TiVo Community
TiVo Community
TiVo Community
Go Back   TiVo Community > Main TiVo Forums > TiVo Home Media Features & TiVoToGo
TiVo Community
Reply
Forum Jump
 
Thread Tools
Old 10-18-2009, 01:50 PM   #1
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
pyTivo auto transfers

I was looking for a way to setup automated "watch" folders with pyTivo similar to how one can setup auto watch folders with Tivo Desktop.
The idea being that you simply drop files into a folder and those files are then automatically pushed to one of your Series 3 TiVos using pyTivo.

EDIT: Since this 1st posting there this program has now evolved from a python script into a Java program with a GUI and ability to run as a service for Windows platforms or as background job for Mac/Linux platforms. The program download, documentation and source code are available from Google project:
http://code.google.com/p/pytivo-auto-push/

----LEGACY PYTHON SCRIPT----
Attached zip file contains current incantation of a python script to do this. Since this is to be used by pyTivo users who already have python installed I figured the best scripting language to use would be python even though I have little to no experience with it.

To summarize what current script does:
* Can be configured to watch multiple folders with ability for each to push to different Tivos (or all same Tivo if you wish)
* Checks configured shares for video files to process and then sleeps for a period of time (10 seconds) before checking again. This happens in infinite loop.
* If it is determined a video file is not changing (modification time & file size not changing) then and a pyTivo push of that file is initiated.
* Processed video files are then "tagged" as processed by having an empty file of same name but with ".processed" suffix. This prevents pushing same files over and over.
NOTE: ffmpeg is used to determine which files are video files, so you need to edit script to specify your ffmpeg binary location.

There are comments at top of script with some instructions on how to set it up properly with pyTivo. Specifically you must ensure that the watchList settings in the script have corresponding pyTivo shares of same name and path in your pyTivo setup.
Included in zip file is a run.bat file for windows users. You may have to edit run.bat to correct path to python executable in your installation.

Obviously still a lot of room for improvement but I figured I'd get the ball rolling if this kind of capability is not already available.
Down the road if there is interest in this then one can worry about details such as running as windows service for windows platforms, etc. For now though just run this script in a console/xterm.

EDIT 1: Change to not bother to test files ending in .txt with ffmpeg
EDIT 2: Script now searches folder hierarchy for video files instead of just top level files in each watch folder.
EDIT 3: Wrap ffmpeg and file in quotes in isVideo function. Don't mark with .processed unsuccessful pushes.
Attached Files
File Type: zip auto_push.zip (2.3 KB, 86 views)
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by moyekj : 10-30-2009 at 12:35 AM.
moyekj is offline   Reply With Quote
Old 10-18-2009, 09:17 PM   #2
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
NOTE: Just added support for full folder hierarchies under watch folders instead of just processing top level watch folder video files.
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
moyekj is offline   Reply With Quote
Old 10-19-2009, 09:39 AM   #3
reneg
Registered User
 
Join Date: Jun 2002
Posts: 457
The script is working pretty good for me. On one occasion it tried to send pytivo a file with a .processed extension which crashed both pytivo and the script. I'll update to the latest version of the script and see if I can make it happen again.
reneg is offline   Reply With Quote
Old 10-19-2009, 09:42 AM   #4
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
Quote:
Originally Posted by reneg View Post
The script is working pretty good for me. On one occasion it tried to send pytivo a file with a .processed extension which crashed both pytivo and the script. I'll update to the latest version of the script and see if I can make it happen again.
I think in EDIT 1 I updated to specifically ignore files ending in .txt or .processed so that should no longer be an issue.
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
moyekj is offline   Reply With Quote
Old 10-19-2009, 01:01 PM   #5
orangeboy
yes, I AM orangeboy!
 
Join Date: Apr 2004
Location: Moline, IL
Posts: 4,075
Bleh. I can't get the latest release to work:

Code:
Traceback (most recent call last):
  File "auto_push.py", line 151, in <module>
    if not os.path.exists(entry_processed) and isVideo(entry):
  File "auto_push.py", line 65, in isVideo
    proc = subprocess.Popen(command, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "c:\Python26\lib\subprocess.py", line 621, in __init__
    errread, errwrite)
  File "c:\Python26\lib\subprocess.py", line 830, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
My edits:
Code:
# *******Adjust these as needed ******
watchList = [
   {"tivo": "TivoS3", "path": "F:\\ToTivo", "share": "DL380-Server"}
]
ffmpeg       = "C:\\Program Files\\kmttg\\ffmpeg"
processedExt = ".processed"
host         = "media-center:9032"
I've tried specifying the paths with both \ and \\ each having the same result. The paths were copied directly from Windows Explorer's address bar because I'm lazy and don't want to mistype.
orangeboy is offline   Reply With Quote
Old 10-19-2009, 01:04 PM   #6
reneg
Registered User
 
Join Date: Jun 2002
Posts: 457
Quote:
Originally Posted by orangeboy View Post
My edits:
Code:
# *******Adjust these as needed ******
watchList = [
   {"tivo": "TivoS3", "path": "F:\\ToTivo", "share": "DL380-Server"}
]
ffmpeg       = "C:\\Program Files\\kmttg\\ffmpeg"
processedExt = ".processed"
host         = "media-center:9032"
I've tried specifying the paths with both \ and \\ each having the same result. The paths were copied directly from Windows Explorer's address bar because I'm lazy and don't want to mistype.
Try adding the .exe to ffmpeg
reneg is offline   Reply With Quote
Old 10-19-2009, 01:12 PM   #7
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
As reneg pointed out the problem is the call to ffmpeg looks like is failing. I think your ffmpeg setting should be:
ffmpeg = "C:\\Program Files\\kmttg\\ffmpeg\\ffmpeg.exe"
I probably should add some exception handling to catch that problem so that it is clearer what is wrong.
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
moyekj is offline   Reply With Quote
Old 10-19-2009, 01:25 PM   #8
orangeboy
yes, I AM orangeboy!
 
Join Date: Apr 2004
Location: Moline, IL
Posts: 4,075
Thanks guys - that was exactly it. I think I had that same problem before, and didn't learn from it.

Upon first run, I got the following:
Code:
watching file: F:\ToTivo\The Outer Limits - Expanding Human-1036_cut.mpg
watching file: F:\ToTivo\processed\702 - Vaya Con Cornholio.avi
watching file: F:\ToTivo\processed\Fringe - Dream Logic-205_cut.mpg
watching file: F:\ToTivo\processed\Jeopardy-5769_cut.mpg
watching file: F:\ToTivo\processed\Jeopardy-5770_cut.mpg
watching file: F:\ToTivo\processed\Jeopardy-_cut.mpg
watching file: F:\ToTivo\processed\Law and Order - Reality Bites-_cut.mpg
watching file: F:\ToTivo\processed\Parks and Recreation - Sister City-_cut.mpg
watching file: F:\ToTivo\processed\Smallville - Echo-_cut.mpg
watching file: F:\ToTivo\processed\Star Trek The Next Generation - Brothers-177_
cut.mpg
watching file: F:\ToTivo\processed\Star Trek The Next Generation - Future Imperf
ect-182_cut.mpg
watching file: F:\ToTivo\processed\TMZ-3035_cut.mpg
checking file: F:\ToTivo\The Outer Limits - Expanding Human-1036_cut.mpg
checking file: F:\ToTivo\processed\702 - Vaya Con Cornholio.avi
pushing file: F:\ToTivo\processed\702 - Vaya Con Cornholio.avi
http://media-center:9032/TiVoConnect?Command=Push&Container=DL380-Server&File=/p
rocessed/702%20-%20Vaya%20Con%20Cornholio.avi&tsn=TivoS3
Traceback (most recent call last):
  File "auto_push.py", line 152, in <module>
    process(tivoName, share, path, entry)
  File "auto_push.py", line 117, in process
    push(tivoName, share, path, file)
  File "auto_push.py", line 91, in push
    result = urllib2.urlopen(url)
  File "c:\Python26\lib\urllib2.py", line 124, in urlopen
    return _opener.open(url, data, timeout)
  File "c:\Python26\lib\urllib2.py", line 389, in open
    response = self._open(req, data)
  File "c:\Python26\lib\urllib2.py", line 407, in _open
    '_open', req)
  File "c:\Python26\lib\urllib2.py", line 367, in _call_chain
    result = func(*args)
  File "c:\Python26\lib\urllib2.py", line 1140, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "c:\Python26\lib\urllib2.py", line 1113, in do_open
    r = h.getresponse()
  File "c:\Python26\lib\httplib.py", line 974, in getresponse
    response.begin()
  File "c:\Python26\lib\httplib.py", line 391, in begin
    version, status, reason = self._read_status()
  File "c:\Python26\lib\httplib.py", line 355, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine
With this from pyTivo:
Code:
2009-10-19 14:15:06,750 ERROR pyTivo: Exception during request from ('192.168.0.60', 1041)
Traceback (most recent call last):
  File "C:\Python26\lib\SocketServer.py", line 558, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python26\lib\SocketServer.py", line 320, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Program Files\pyTivo\httpserver.py", line 56, in __init__
    client_address, server)
  File "C:\Python26\lib\SocketServer.py", line 615, in __init__
    self.handle()
  File "C:\Python26\lib\BaseHTTPServer.py", line 329, in handle
    self.handle_one_request()
  File "C:\Python26\lib\BaseHTTPServer.py", line 323, in handle_one_request
    method()
  File "C:\Program Files\pyTivo\httpserver.py", line 82, in do_GET
    self.handle_query(query, tsn)
  File "C:\Program Files\pyTivo\httpserver.py", line 132, in handle_query
    method(self, query)
  File "C:\Program Files\pyTivo\plugins\video\video.py", line 331, in Push
    file_info['valid'] = transcode.supported_format(file_path)
  File "C:\Program Files\pyTivo\plugins\video\transcode.py", line 840, in supported_format
    if video_info(inFile)['Supported']:
  File "C:\Program Files\pyTivo\plugins\video\transcode.py", line 633, in video_info
    mtime = os.stat(inFile).st_mtime
WindowsError: [Error 3] The system cannot find the path specified: '\\\\dl380-server\\Playground\\ToTivo\\processed\\processed\\702 -
Vaya Con Cornholio.avi'
I take it with the new release, I don't need the "processed" directory (the files moved to root watched directory), and I need to manually add the .processed extension to those files already transferred?
orangeboy is offline   Reply With Quote
Old 10-19-2009, 01:49 PM   #9
orangeboy
yes, I AM orangeboy!
 
Join Date: Apr 2004
Location: Moline, IL
Posts: 4,075
Quote:
Originally Posted by orangeboy View Post
...I don't need the "processed" directory (the files moved to root watched directory), and I need to manually add the .processed extension to those files already transferred?
OK, I did all this, and auto_push is working as expected. Adding the .processed extension to the video files seemed easier than creating 0 byte files in a "quick and dirty" kind of way.
orangeboy is offline   Reply With Quote
Old 10-19-2009, 02:02 PM   #10
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
Quote:
Originally Posted by orangeboy View Post
OK, I did all this, and auto_push is working as expected. Adding the .processed extension to the video files seemed easier than creating 0 byte files in a "quick and dirty" kind of way.
The idea is to not interfere at all with original video files since they could be used for other purposes and you don't want to start changing file extensions. The auto_push script automatically creates the empty .processed files anyway so there is nothing manual to do (other than being annoyed by these empty .processed files I guess ).
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
moyekj is offline   Reply With Quote
Old 10-19-2009, 02:45 PM   #11
orangeboy
yes, I AM orangeboy!
 
Join Date: Apr 2004
Location: Moline, IL
Posts: 4,075
Quote:
Originally Posted by moyekj View Post
The idea is to not interfere at all with original video files since they could be used for other purposes and you don't want to start changing file extensions. The auto_push script automatically creates the empty .processed files anyway so there is nothing manual to do (other than being annoyed by these empty .processed files I guess ).
In actuality, I could have deleted the files that were in the /processed directory, and not messed with .processed files at all! I don't archive or transcode for other devices
orangeboy is offline   Reply With Quote
Old 10-20-2009, 12:50 PM   #12
mathwhiz
Registered User
 
mathwhiz's Avatar
 
Join Date: May 2000
Location: Okemos, MI, USA
Posts: 382
A while ago I had posted (not sure if it was here or in the pyTiVo forums) that I had developed code to do auto-transfers. My current incarnation works only with RSS feeds. It checks the RSS feed, downloads the file, and then pushes it to the TiVo, then deletes the file. If anyone is interested I can cleanup my code and post it here. I've been using this for many months and works reliably most of the time. Once in a while it hangs and I have to restart the service.
__________________
Rich W.
mathwhiz is offline   Reply With Quote
Old 10-20-2009, 03:19 PM   #13
reneg
Registered User
 
Join Date: Jun 2002
Posts: 457
Quote:
Originally Posted by mathwhiz View Post
A while ago I had posted (not sure if it was here or in the pyTiVo forums) that I had developed code to do auto-transfers. My current incarnation works only with RSS feeds. It checks the RSS feed, downloads the file, and then pushes it to the TiVo, then deletes the file. If anyone is interested I can cleanup my code and post it here. I've been using this for many months and works reliably most of the time. Once in a while it hangs and I have to restart the service.
It's posted on the pyTivo forums. From what I can tell, it seems a little bit out of date with current builds. I'd give it a try if it were in sync with current pytivo builds.

My end goal is to have a single program which reads the www.hd-trailers.net RSS feed, downloads new movie trailers in a configured resolution to my PC, clean up trailers older than x days on my PC, and automatically push the downloaded movie trailers to my Tivo. Right now, I'm using one program I found on the net to download/clean up trailers on my PC and this script to push those trailers to my Tivo. I haven't had a lot of time to play around with python lately, so my progress on a single program has been limited.
reneg is offline   Reply With Quote
Old 10-21-2009, 04:59 PM   #14
mathwhiz
Registered User
 
mathwhiz's Avatar
 
Join Date: May 2000
Location: Okemos, MI, USA
Posts: 382
I'll post my latest code sometime soon. I've been keeping my code updated with the latest build, just haven't posted it anywhere because I didn't see much interest in it. The way it works is you give it a list of RSS feeds, it downloads the file in the feed, pushes it to the TiVo, then deletes the file. It keeps track of while files were processed from the feed as well.
__________________
Rich W.
mathwhiz is offline   Reply With Quote
Old 10-23-2009, 12:51 AM   #15
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
I've now got a Java version with a GUI to aid in setup if anyone is interested. You now point it at the pyTivo.conf file and it gets most information needed from there (pyTivo port, ffmpeg location and the video shares available, and also checks if tivo username & password are set). It also uses mdns to poll for available Tivos to push to on your local network. Once setup you can also run as a service in Windows or background process on other OSs. I don't want to put too much more effort into it if I'm going to be the only one using it. If there is some interest I can setup a Google project home for it.
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
moyekj is offline   Reply With Quote
Old 10-23-2009, 03:51 AM   #16
lrhorer
Registered User
 
Join Date: Aug 2003
Location: San Antonio, Texas, USA
Posts: 6,867
I'm interested. Two things which would be really nice, however, are the ability to confirm the transfer succeeded and the ability to run a script of the user's choice against content which transfers successfully. Given the nature of the push, however, I'm not sure this is possible.
lrhorer is offline   Reply With Quote
Old 10-23-2009, 07:07 AM   #17
orangeboy
yes, I AM orangeboy!
 
Join Date: Apr 2004
Location: Moline, IL
Posts: 4,075
Quote:
Originally Posted by moyekj View Post
...I don't want to put too much more effort into it if I'm going to be the only one using it. If there is some interest I can setup a Google project home for it.
I'm using it
orangeboy is offline   Reply With Quote
Old 10-23-2009, 10:03 AM   #18
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
Quote:
Originally Posted by lrhorer View Post
I'm interested. Two things which would be really nice, however, are the ability to confirm the transfer succeeded and the ability to run a script of the user's choice against content which transfers successfully. Given the nature of the push, however, I'm not sure this is possible.
Checking if the pyTivo push call was successful is already in place in the new code - however that just checks that pyTivo was able to initiate the push, not that the full push itself to the Tivo completed successfully. And of course there is no way for a process outside of pyTivo web server itself to know when the push has actually completed.
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
moyekj is offline   Reply With Quote
Old 10-23-2009, 11:14 AM   #19
reneg
Registered User
 
Join Date: Jun 2002
Posts: 457
Quote:
Originally Posted by moyekj View Post
Checking if the pyTivo push call was successful is already in place in the new code - however that just checks that pyTivo was able to initiate the push, not that the full push itself to the Tivo completed successfully. And of course there is no way for a process outside of pyTivo web server itself to know when the push has actually completed.
Isn't it possible to grab the NPL from the Tivo to verify a transfer is in progress or has completed? Tivo could make this easier by providing web access to the todo list and recording history list.

I'm using your script, but don't need any fancy config tools.
reneg is offline   Reply With Quote
Old 10-23-2009, 12:19 PM   #20
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
Quote:
Originally Posted by reneg View Post
Isn't it possible to grab the NPL from the Tivo to verify a transfer is in progress or has completed? Tivo could make this easier by providing web access to the todo list and recording history list.

I'm using your script, but don't need any fancy config tools.
Checking NPL may provide some clues especially if there is an accompanying metadata as part of the push where for example the title & description pulled from TiVo should match that of the metadata file. Note sure if there is a clue in NPL xml for still-transferring pushes vs completed pushes.

Aside from the graphical config and pulling of data from pyTivo.conf the Java version also enables to run as a service for Windows machines which I am familiar with doing based on how I did it with kmttg. I'm not familiar enough with python to figure out how to run python script as a service in Windows. Perhaps using the messy "srvany" helper script but there is likely a more elegant way.

The ultimate place for auto push capability is as part of pyTivo itself since then it is possible to check if a push actually goes through and potentially execute a post-processing step, etc.
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
moyekj is offline   Reply With Quote
Old 10-23-2009, 03:07 PM   #21
reneg
Registered User
 
Join Date: Jun 2002
Posts: 457
Quote:
Originally Posted by moyekj View Post
Checking NPL may provide some clues especially if there is an accompanying metadata as part of the push where for example the title & description pulled from TiVo should match that of the metadata file. Note sure if there is a clue in NPL xml for still-transferring pushes vs completed pushes.

Aside from the graphical config and pulling of data from pyTivo.conf the Java version also enables to run as a service for Windows machines which I am familiar with doing based on how I did it with kmttg. I'm not familiar enough with python to figure out how to run python script as a service in Windows. Perhaps using the messy "srvany" helper script but there is likely a more elegant way.

The ultimate place for auto push capability is as part of pyTivo itself since then it is possible to check if a push actually goes through and potentially execute a post-processing step, etc.
There is a clue for in progress transfers in the NPL xml:
<Details>
...
<InProgress>Yes</InProgress>
...
</Details>

Queued and completed transfer status are more challenging.

As an aside, when I checked the NPL XML, there is what appears to be Tivo generated ids for Program ID & Series ID with a "BS" prefix, example:
<ProgramId>BS15000541</ProgramId>
<SeriesId>BS271055170</SeriesId>
It doesn't help anything, but it was interesting to me.

From what I've seen on the pyTivo side, the push requests are sent to the Tivo as they come in from the script. It's up to the Tivo then to actually initiate the pull of the file. The Tivo is in control.

As far as incorporating this script into pyTivo, one way could be to run the auto_push script as a thread within pyTivo, however I think this script needs more soak time and maturity before introducing it, and unless you want to start a new fork, you'd want wmcbrine on board.
reneg is offline   Reply With Quote
Old 10-23-2009, 03:58 PM   #22
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
Quote:
Originally Posted by reneg View Post
There is a clue for in progress transfers in the NPL xml:
<Details>
...
<InProgress>Yes</InProgress>
...
</Details>

Queued and completed transfer status are more challenging.

As an aside, when I checked the NPL XML, there is what appears to be Tivo generated ids for Program ID & Series ID with a "BS" prefix, example:
<ProgramId>BS15000541</ProgramId>
<SeriesId>BS271055170</SeriesId>
It doesn't help anything, but it was interesting to me.

From what I've seen on the pyTivo side, the push requests are sent to the Tivo as they come in from the script. It's up to the Tivo then to actually initiate the pull of the file. The Tivo is in control.

As far as incorporating this script into pyTivo, one way could be to run the auto_push script as a thread within pyTivo, however I think this script needs more soak time and maturity before introducing it, and unless you want to start a new fork, you'd want wmcbrine on board.
I think building something like this from scratch within pyTivo would be more robust/flexible and I think very easy for someone like wmcbrine to do, however it doesn't seem like there has been enough interest by pyTivo users/and or developers or this probably would have happened shortly after the push capability was implemented. I have no interest in starting another pyTivo fork and trying to implement this in pyTivo itself as there are much better qualified people to do that than me. Perhaps this thread may give a little motivation to the pyTivo developers which I think is mostly wmcbrine these days.
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
moyekj is offline   Reply With Quote
Old 10-23-2009, 07:01 PM   #23
spocko
TiVo HD
 
Join Date: Feb 2009
Posts: 409
Quote:
Originally Posted by moyekj View Post
I think building something like this from scratch within pyTivo would be more robust/flexible and I think very easy for someone like wmcbrine to do
That makes a lot of sense. It might be good to see if there is any interest from the pyTivo devs before you sink much more work into your implementation. Thanks for your effort.
spocko is offline   Reply With Quote
Old 10-23-2009, 09:41 PM   #24
orangeboy
yes, I AM orangeboy!
 
Join Date: Apr 2004
Location: Moline, IL
Posts: 4,075
Quote:
Originally Posted by spocko View Post
...Thanks for your effort.
Same sentiments here: thanks!
orangeboy is offline   Reply With Quote
Old 10-24-2009, 01:30 AM   #25
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
One idea struck me related to auto pushes and tracking. Instead of the clunky way now where all video files under a share are attempted to be pushed unless marked with an empty .processed file, how about instead the program only watches for new video files deposited in the share hierarchy after the auto push program is started?
i.e. The program takes an inventory of files when it first starts and only tries to push new files not in initial inventory? After a successful push a video file is then added to that inventory. If you then shut down the program and start it up again then of course only new files deposited will be pushed.
Of course the down side to that approach is if you add files to the hierarchy while program is not running then of course they won't be pushed, but in some cases that actually might be desirable.
Seems like a cleaner way of handling things to me. Thoughts?
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
moyekj is offline   Reply With Quote
Old 10-24-2009, 09:45 AM   #26
reneg
Registered User
 
Join Date: Jun 2002
Posts: 457
Quote:
Originally Posted by moyekj View Post
One idea struck me related to auto pushes and tracking. Instead of the clunky way now where all video files under a share are attempted to be pushed unless marked with an empty .processed file, how about instead the program only watches for new video files deposited in the share hierarchy after the auto push program is started?
i.e. The program takes an inventory of files when it first starts and only tries to push new files not in initial inventory? After a successful push a video file is then added to that inventory. If you then shut down the program and start it up again then of course only new files deposited will be pushed.
Of course the down side to that approach is if you add files to the hierarchy while program is not running then of course they won't be pushed, but in some cases that actually might be desirable.
Seems like a cleaner way of handling things to me. Thoughts?
The current method is simple and works. I'm used to metadata files so the .processed files don't bother me. It could look cleaner with a .processed directory and keep the .processed files there, like you can do with metadata.

If you do implement a new method, how about only adding files to the inventory after they have been pushed? That would take care of files that were added while the script is not running. The inventory in effect becomes an exclusion list for pushes.

Totally unrelated, but here is some code I added to the main loop to auto-prune files after a some time. Free free to use/change this or not.
Code:
               if not os.path.exists(entry_processed) and isVideo(entry):
                  process(tivoName, share, path, entry)

               # Delete old files
               if os.path.exists(entry)and not os.path.isdir(entry) and not re.search(".txt$",entry) : 
                 ftime = os.path.getmtime(entry)
                 curtime = time.time()
                 difftime = curtime - ftime
                 if difftime > (86400*6):  # 86400 is 1 day in seconds, 604800 is 7 days in seconds
                   log("removing file: " + entry)
                   os.remove(entry)

reneg is offline   Reply With Quote
Old 10-25-2009, 07:47 AM   #27
ggieseke
Registered User
 
Join Date: May 2008
Posts: 2,981
Quote:
Originally Posted by moyekj View Post
One idea struck me related to auto pushes and tracking. Instead of the clunky way now where all video files under a share are attempted to be pushed unless marked with an empty .processed file, how about instead the program only watches for new video files deposited in the share hierarchy after the auto push program is started?
i.e. The program takes an inventory of files when it first starts and only tries to push new files not in initial inventory? After a successful push a video file is then added to that inventory. If you then shut down the program and start it up again then of course only new files deposited will be pushed.
Of course the down side to that approach is if you add files to the hierarchy while program is not running then of course they won't be pushed, but in some cases that actually might be desirable.
Seems like a cleaner way of handling things to me. Thoughts?
If you write one file to each share that contains the date/time stamp of the last file that was pushed successfully I think that would work even better. You could do away with the .processed files and it wouldn't really matter if the program was running or not. Just have it check the time file on startup and push everything (updating as you go of course) with a later date/time.
ggieseke is offline   Reply With Quote
Old 10-25-2009, 11:03 AM   #28
moyekj
Registered User
 
Join Date: Jan 2006
Location: Mission Viejo, CA
Posts: 9,067
Quote:
Originally Posted by ggieseke View Post
If you write one file to each share that contains the date/time stamp of the last file that was pushed successfully I think that would work even better. You could do away with the .processed files and it wouldn't really matter if the program was running or not. Just have it check the time file on startup and push everything (updating as you go of course) with a later date/time.
That is cleaner but makes it harder to purposefully avoid pushing files especially the first time you setup the auto push. Perhaps if there is a utility to go mark all video files in a share as "pushed" initially that would suffice. In any case the syntax of the tracking file should be simple enough to add exclusions manually, so I think perhaps just the full path name of the file should be enough with an optional 2nd column having a push time stamp just for information purposes?
__________________
Roamio Pro, Elite, Premiere
Cox - Motorola CableCards & TAs
Slingbox 350 via TiVo Mini & TiVo Stream for remote viewing

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
moyekj is offline   Reply With Quote
Old 10-25-2009, 11:15 AM   #29
ggieseke
Registered User
 
Join Date: May 2008
Posts: 2,981
I would think that the whole point of setting up an auto-push share is to send everything there to the DVR even if it's being set up for the first time, but that's just how I'd probably use it - YMMV.

Keeping the entire path and a timestamp in a log file would be ideal but it's probably a lot of work to write the code to read it back and make informed decisions on what to push every time the program runs.
ggieseke is offline   Reply With Quote
Old 10-25-2009, 12:34 PM   #30
reneg
Registered User
 
Join Date: Jun 2002
Posts: 457
Quote:
Originally Posted by ggieseke View Post
I would think that the whole point of setting up an auto-push share is to send everything there to the DVR even if it's being set up for the first time, but that's just how I'd probably use it - YMMV.
I concur.
reneg is offline   Reply With Quote
Reply
Forum Jump




Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Advertisements

TiVo Community
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
vBulletin Skins by: Relivo Media

(C) 2013 Magenium Solutions - All Rights Reserved. No information may be posted elsewhere without written permission.
TiVoŽ is a registered trademark of TiVo Inc. This site is not owned or operated by TiVo Inc.
All times are GMT -5. The time now is 09:32 PM.
OUR NETWORK: MyOpenRouter | TechLore | SansaCommunity | RoboCommunity | MediaSmart Home | Explore3DTV | Dijit Community | DVR Playground |