# pyTivo auto pushes



## moyekj

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.


----------



## moyekj

NOTE: Just added support for full folder hierarchies under watch folders instead of just processing top level watch folder video files.


----------



## reneg

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.


----------



## moyekj

reneg said:


> 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.


----------



## orangeboy

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.


----------



## reneg

orangeboy said:


> 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


----------



## moyekj

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.


----------



## orangeboy

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

orangeboy said:


> ...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.


----------



## moyekj

orangeboy said:


> 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  ).


----------



## orangeboy

moyekj said:


> 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


----------



## mathwhiz

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.


----------



## reneg

mathwhiz said:


> 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.


----------



## mathwhiz

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.


----------



## moyekj

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.


----------



## lrhorer

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.


----------



## orangeboy

moyekj said:


> ...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


----------



## moyekj

lrhorer said:


> 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.


----------



## reneg

moyekj said:


> 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.


----------



## moyekj

reneg said:


> 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.


----------



## reneg

moyekj said:


> 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:

...
<InProgress>Yes</InProgress> 
...

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.


----------



## moyekj

reneg said:


> There is a clue for in progress transfers in the NPL xml:
> 
> ...
> <InProgress>Yes</InProgress>
> ...
> 
> 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.


----------



## spocko

moyekj said:


> 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.


----------



## orangeboy

spocko said:


> ...Thanks for your effort.


Same sentiments here: thanks!


----------



## moyekj

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?


----------



## reneg

moyekj said:


> 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)


----------



## ggieseke

moyekj said:


> 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.


----------



## moyekj

ggieseke said:


> 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?


----------



## ggieseke

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.


----------



## reneg

ggieseke said:


> 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.


----------



## moyekj

ggieseke said:


> 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.


 No I think it's pretty easy. Only need to read file once when starting up and then store the entries in memory. Any successful pushes simply append to the file. And I would probably make the file paths relative to the top share directory so in case the top share path changes it won't affect anything. Only problem with this type of approach is if the tracking file gets corrupted in some way due to full disk or similar problem there's a (small) chance all entries are lost and then next time everything gets pushed again, but that is probably pretty rare.

One could get fancier and check entries in the file versus whether they still exist on disk and remove entries whose files no longer exist.


----------



## tlphipps

I haven't had time to set this up just yet, but I fully intend to. I've wanted this functionality for quite some time. So thanks for all the work so far!

But even without using it yet, I have a feature request: Would it be possible to add a pre-processing step to allow for auto-running something like videoredo's quickstreamfix? When I pull videos in from my DVDs I generally have to run the QSF to make everything kosher with the Tivo, so automating that as well would be awesome!


----------



## spocko

ggieseke said:


> 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.


I don't think that would work well. Files with old timestamps could be copied/moved to the auto push folder. I think the tracking method needs to remain per-file, whether that is implemented using .processed files or some other kind of index file. It should be simple and user-editable so the user can easily add/remove exclusions.


----------



## spocko

Here's an idea for what I think would be a useful addition to the auto push tool.

The existing logic can be described as: 
Push all files that are not marked for exclusion.

I think the inverse logic would also be interesting:
Push only files that are marked for inclusion.

This would allow individual files to be explicitly marked for push. In this mode, there would be a list of inclusions rather than a list of exclusions. The mode could potentially be set on a per-share basis, so one share could use an exclusion list, while another could use an inclusion list.

For example, a "mode" could be added to the watchlist definition:



Code:


watchList = [
   {"tivo": "LivingRoom", "path": "c:\\videos\\podcasts", "share": push_all", "mode": "exclude"}
   {"tivo": "LivingRoom", "path": "c:\\videos\\movies", "share": selective_push", "mode": "include"}
]

The script currently uses .processed files to track exclusions, so something similar could be used for inclusions. For example, an empty file with a .push extension could mark an inclusion. After the corresponding file is pushed, the .push file could just be deleted.

The main use that I see for this is with batch processing. Files could selectively be processed and marked for push.

What do you guys think?


----------



## reneg

Fixed a minor bug in the script for Windows in the isVideo routine to enclose the file name in quotes.
changed


Code:


      command = "" + ffmpeg + " -i " + file

to


Code:


      command = "" + ffmpeg + " -i \"" + file + "\""


----------



## moyekj

Probably should wrap ffmpeg in quotes as well in case it has spaces as well...


----------



## reneg

Good point.


----------



## moyekj

Added the above fixes with the extra wrapper quotes for the ffmpeg call. Also added checking of push call so that unsuccessful pushes are not marked with .processed file.


----------



## moyekj

Java version of the program with GUI and ability to run in service mode is now available.

A big change compared to python script is the tracking of pushed files is now done using a tracking file called auto_push.txt at the top of each video share being monitored with entries for files already pushed (as discussed a little earlier in this thread).

Documentation, download and source code are now located in a Google project:
http://code.google.com/p/pytivo-auto-push/


----------



## Zaphod

If I can get this utility to work I think I'll love it!

It won't pick up my pyTivo.conf file. I launch the .jar file, I browse to my pyTivo.conf file and it displays that full path in the appropriate field on the screen (my path is D:\Apps\pyTivo\pyTivo.conf). But I don't see any of the shares show up in the lower half (I have 3 shares defined). I click "save" and don't get any errors, but when I close and reopen the auto-push gui, the path to pyTivo.conf file is missing. When I look at the config.ini file, I see the <pyTivo.conf> section but there's nothing in it. I also notice in the log file after I close and reopen the GUI, I see the following error:

2009_12_07_22:59:57 ERROR: File does not exist:

Any ideas? Oh, this is on Windows Vista, and I do have pyTivo all working for both pulls and manual pushes.

Thank you.


----------



## moyekj

Zaphod, after you browse to the file and it shows the full file path in the text field, you have to press Return to apply it. Then your shares should show up and when you save it will remember the path (and the shares).


----------



## Zaphod

Thanks much! That did it. I see that now on the "Configuring. . ." wiki page. I had read that before but missed that step somehow. Thanks again!


----------



## Hcour

I'm trying out the program for the first time, but I get the msg "tivo_username and/or tivo_password not set in pyTivo config file". What username and password does it mean? Thanks.


----------



## ggieseke

Hcour said:


> I'm trying out the program for the first time, but I get the msg "tivo_username and/or tivo_password not set in pyTivo config file". What username and password does it mean? Thanks.


It's the username & password that you use to access your "My TiVo" account online.


----------



## moyekj

Hcour said:


> I'm trying out the program for the first time, but I get the msg "tivo_username and/or tivo_password not set in pyTivo config file". What username and password does it mean? Thanks.


 In order for pyTivo to be able to do "pushes" it needs your tivo.com login & password information. You can use localhost:9032 to get to pyTivo web configuration. Under Global Server Settings you have to set tivo_username & tivo_password according to your tivo.com login & password.


----------



## Hcour

Sorry, I'm lost. When I click on Global Server Settings and then click "edit section" there is no entry for a username or password. Also, my username when I log into Tivo.com is my email address, is that what I use? Thanks.


----------



## moyekj

Hcour said:


> Sorry, I'm lost. When I click on Global Server Settings and then click "edit section" there is no entry for a username or password. Also, my username when I log into Tivo.com is my email address, is that what I use? Thanks.


 You can edit pyTivo.conf file manually and add the following entries manually under [Server] section:
tivo_username = <username>
tivo_password = <password>

substitute <username> with your tivo.com login (your email)
substitute <password> with your tivo.com password


----------



## lrhorer

moyekj said:


> 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.


Oh, way cool! I'll have to look into this functionality this weekend. Since every once in a while there is some sort of error in files pulled off using TTG that prevents the entire program from trasnferring back to the TiVo, I always do a test push to make sure the file will transfer completely. Automating this will save me a little bit of trouble. Thanks!


----------



## Hcour

Ok, thanks, it's working, but I need to do some more reading to learn more about it, how to setup folders and whatever. So, in the meantime, how do I stop it for now? I clicked on Stop, I unchecked autopush, then I deleted the whole folder and rebooted. It still pushing programs to my Tivo. Thanks.


----------



## moyekj

Hcour said:


> Ok, thanks, it's working, but I need to do some more reading to learn more about it, how to setup folders and whatever. So, in the meantime, how do I stop it for now? I clicked on Stop, I unchecked autopush, then I deleted the whole folder and rebooted. It still pushing programs to my Tivo. Thanks.


 You can run as GUI or service. If you have it running as service then just stop the service. Once you quit GUI and service it will no longer send requests to pyTivo. However, remember that all this program is doing is sending a bunch of push requests to pyTivo, so pyTivo is doing all the actual pushes. So let's say you had 20 videos under a folder. Once the 20 push requests go to pyTivo even if you stop this program then mind.tivo.com & pyTivo will still be working to handle all 20 requests. If you want to physically stop the pushes from happening then you must shut down pyTivo for a while.


----------



## Zaphod

THANK YOU for creating this! It's a God send!!

I seem to have this working now but I wanted to report something odd I saw when first setting this up. I can't seem to recreate it now but I still wanted to mention it.

I have Auto-Push running as a service. The first few times I put a video in the folder that I had configured Auto-Push to monitor, it would push the file TWICE.

On one file, it would keep pushing it over and over and over. After about the5th or 6th time I finally deleted the file to get it to stop pushing.

Again, it seems to be settled down now and only pushing things once, but I wanted to mention it.


----------



## moyekj

Zaphod, the *auto_push.txt* file at top level of pyTivo share folder is what keeps track of what files have already been pushed, so if you encounter that problem that is the file to check, along with the auto_push.log which the service logs to.


----------



## Zaphod

Yep, I knew about the auto_push.txt file. I had checked that and the file name was in there and it still got pushed over and over.

I did not know about the log file but I just checked that and it confirms pushing the same file over and over. I've attached it if you want to take a look (had to add the .txt extension to be able to upload it), but don't feel obligated. But if you do, look on 12/8 and you'll the "Cranky Geeks 2.mov" file being pushed over and over and over. I do see something about connection lost or failed or timed out in between each one, but the full file did get transferred each and every time. Even after stopping and restarting both the auto-push service and pyTivo, it resumed pushing the file again.


----------



## Zaphod

Hey, I have another question. This applies to both auto-push and kmttg.

In Vista, to be able to install, start, and stop the service, doesn't the app have to be run as an Admin? I know there's the BAT files and that's what I've been using, but it'd be nice to be able to use the menu items in the apps.

How does one run these Java apps as an administrator? When I right-click on the .jar file there's no "Run as Administrator" option. Even if I create a shortcut to the .jar file, there's nowhere in the shortcut I can specify to run as an admin.

Thanks again!


----------



## cburbs

I am at trying this one again. I get the stuff to push...blue light on my tivo but when I actually go look the new file is not there. Now if I go to settings in Tivo and go to my AutoPush folder and select transfer the blue light goes on the tivo and the file is actually transferred. 
Any ideas on what might be going on.


----------



## moyekj

cburbs said:


> I am at trying this one again. I get the stuff to push...blue light on my tivo but when I actually go look the new file is not there. Now if I go to settings in Tivo and go to my AutoPush folder and select transfer the blue light goes on the tivo and the file is actually transferred.
> Any ideas on what might be going on.


 You should test pyTivo push outside of this program 1st to make sure everything is working. See configuring_auto_push Wiki and specifically the TEST PYTIVO PUSH SETUP section.


----------



## cburbs

TEST PYTIVO PUSH SETUP - Oh I forgot I did this also. Again blue light comes on but nothing shows up once done. Is there a file I can look at to see what is happening. 
I am using a wireless bridge to my Tivo. Like I mentioned if I transfer the same file within the Tivo it works.


----------



## moyekj

Zaphod said:


> Yep, I knew about the auto_push.txt file. I had checked that and the file name was in there and it still got pushed over and over.
> 
> I did not know about the log file but I just checked that and it confirms pushing the same file over and over. I've attached it if you want to take a look (had to add the .txt extension to be able to upload it), but don't feel obligated. But if you do, look on 12/8 and you'll the "Cranky Geeks 2.mov" file being pushed over and over and over. I do see something about connection lost or failed or timed out in between each one, but the full file did get transferred each and every time. Even after stopping and restarting both the auto-push service and pyTivo, it resumed pushing the file again.


 Yes it's pretty clear from the log file that several responses from pyTivo server to push requests were not the expected "OK". You will notice in the log file that several Cranky Greeks pushes are followed by an ERROR message reply from pyTivo web server. auto-push expects "OK" to be returned by pyTivo and only then assumes the push request went through OK and adds entry to auto_push.txt file so it won't get processed again. If there was an ERROR of some sort returned by pyTivo it assumes push request didn't work. Looks like it sorted itself out after a while.


----------



## moyekj

cburbs said:


> TEST PYTIVO PUSH SETUP - Oh I forgot I did this also. Again blue light comes on but nothing shows up once done. Is there a file I can look at to see what is happening.
> I am using a wireless bridge to my Tivo. Like I mentioned if I transfer the same file within the Tivo it works.


 Try pyTivo in debug mode. Easiest way I know is do the following.
* If you are running pyTivo as a service then stop it
* Edit pyTivo.conf file and under [Server] section set debug=True
* Double-click on pyTivo.py to start pyTivo in a console
* Now go through TEST PYTIVO PUSH SETUP to try and push and examine the pyTivo console for errors.

If it's not obvious what problem is then post the console messages here.

(If I had to guess, the problem is tivo_username and/or tivo_password are not setup properly and hence pyTivo can't properly login to mind.tivo.com to initiate the push).


----------



## cburbs

INFOyTivo:127.0.0.1 [11/Dec/2009 08:10:32] "GET /TiVoConnect?Command=QueryCont
ainer&Container=My%20Videos/Watch HTTP/1.1" 200 -
INFOyTivo:127.0.0.1 [11/Dec/2009 08:10:32] "GET /TiVoConnect?Command=XSL&Conta
iner=My%20Videos/Watch HTTP/1.1" 200 -
INFOyTivo:192.x.x.x [11/Dec/2009 08:10:50] "GET /My%20Videos/Watch/Crimi
nal%20Minds%20-%20S05E01%20-%20Faceless,%20Nameless.avi?Format=video%2Fmpeg HTTP
/1.1" 206 -
FFmpeg version SVN-r15216-rdian06-0.96-win32-x86_32, Copyright (c) 2000-2008 Fab
rice Bellard, et al.
configuration: --enable-memalign-hack --enable-postproc --enable-swscale --ena
ble-gpl --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --
enable-libvorbis --enable-libtheora --enable-libx264 --enable-libxvid --disable-
ffserver --disable-vhook --enable-avisynth --enable-pthreads
libavutil 49.10. 0 / 49.10. 0
libavcodec 51.71. 0 / 51.71. 0
libavformat 52.22. 0 / 52.22. 0
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 6. 1 / 0. 6. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Sep 25 2008 23:08:49, gcc: 4.2.4 [Sherpya]
Input #0, avi, from 'F:\tivo\Watch\Criminal Minds - S05E01 - Faceless, Nameless.
avi':
Duration: 00:43:07.27, start: 0.000000, bitrate: 1134 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 624x352 [PAR 1:1 DAR 39:22], 23.98 tb(r)

Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 128 kb/s
Output #0, vob, to 'pipe:':
Stream #0.0: Video: mpeg2video, yuv420p, 624x352 [PAR 1:1 DAR 39:22], q=2-31
, 16384 kb/s, 23.98 tb(c)
Stream #0.1: Audio: ac3, 48000 Hz, stereo, s16, 448 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 4645 fps= 52 q=2.0 size= 68854kB time=193.69 bitrate=2912.1kbits/s

Then a little later the bottom section after Press [q] -
INFOyTivo:127.0.0.1 [11/Dec/2009 08:19:26] "GET /TiVoConnect?Command=QueryContainer&Container=My%20Videos HTTP/1.
1" 200 -
INFOyTivo:127.0.0.1 [11/Dec/2009 08:19:26] "GET /TiVoConnect?Command=XSL&Container=My%20Videos HTTP/1.1" 200 -
INFOyTivo:127.0.0.1 [11/Dec/2009 08:19:30] "GET /TiVoConnect?Command=QueryContainer&Container=My%20Videos/Watch H
TTP/1.1" 200 -
INFOyTivo:127.0.0.1 [11/Dec/2009 08:19:30] "GET /TiVoConnect?Command=XSL&Container=My%20Videos/Watch HTTP/1.1" 20
0 -
frame=43241 fps= 55 q=2.0 size= 658536kB time=1803.47 bitrate=2991.3kbits/s
==============================================================

Now I checked the Tivo and it is showing the criminal minds show in the "now playing list". It didn't before and I didn't change anything besides turning off the service and running it in debug mode.

Now I am testing another show and it looks like it is going. This time I restarted the pytivo service and then did the push thru pytivo and it seems to be OK. Maybe the service just needed a restart.


----------



## moyekj

cburbs, good to see it's working. Note that you apparently did not enable debug mode (set debug=True in pyTivo.conf) as I don't see any DEBUG messages posted, but it's pretty apparent from the console messages that it's working anyway.


----------



## Zaphod

Zaphod said:


> Hey, I have another question. This applies to both auto-push and kmttg.
> 
> In Vista, to be able to install, start, and stop the service, doesn't the app have to be run as an Admin? I know there's the BAT files and that's what I've been using, but it'd be nice to be able to use the menu items in the apps.
> 
> How does one run these Java apps as an administrator? When I right-click on the .jar file there's no "Run as Administrator" option. Even if I create a shortcut to the .jar file, there's nowhere in the shortcut I can specify to run as an admin.
> 
> Thanks again!


moyekj, can you answer the question in my quote above? Or if you aren't sure, just let me know.

Thanks!


----------



## moyekj

Zaphod said:


> moyekj, can you answer the question in my quote above? Or if you aren't sure, just let me know.
> 
> Thanks!


 I'm running Vista 64 and don't have any issues (don't run as admin), but maybe it's because I have UAC turned off. In any case your questions are covered in service_mode Wiki.


----------



## Zaphod

moyekj said:


> I'm running Vista 64 and don't have any issues (don't run as admin), but maybe it's because I have UAC turned off. In any case your questions are covered in service_mode Wiki.


Yes, you don't have any issues because you have UAC turned off.

That page in the wiki only talks about runing the .BAT files as an Admin in Vista, which I already knew. I don't see anything about how to run the actual Java GUI as an Admin so that we can use the GUI menu items to control the service.

And indeed, I just tried again to stop and star the service from the GUI and get "Access Denied" because the GUI isn't being run as an Admin, and starting and stopping services requires Admin rights.


----------



## moyekj

Zaphod said:


> Yes, you don't have any issues because you have UAC turned off.
> 
> That page in the wiki only talks about runing the .BAT files as an Admin in Vista, which I already knew. I don't see anything about how to run the actual Java GUI as an Admin so that we can use the GUI menu items to control the service.
> 
> And indeed, I just tried again to stop and star the service from the GUI and get "Access Denied" because the GUI isn't being run as an Admin, and starting and stopping services requires Admin rights.


 Just make a .bat file with the following:
java -jar auto_push.jar
Then you can launch that as Admin.


----------



## Zaphod

moyekj said:


> Just make a .bat file with the following:
> java -jar auto_push.jar
> Then you can launch that as Admin.


Awesome! Thank you!

I also now have a feature request. I'd like an option to have the auto-push delete the source video file after a successful push.


----------



## moyekj

Zaphod said:


> Awesome! Thank you!
> 
> I also now have a feature request. I'd like an option to have the auto-push delete the source video file after a successful push.


 Not really feasible. auto-push sends request to pyTivo and checks for response from pyTivo, but from that point on only pyTivo knows if/when push finishes.
(That's why I have stated a few times already this application would be much better suited as integrated into pyTivo itself, but the authors don't seem to have any interest in doing so).


----------



## wmcbrine

Busy... not necessarily disinterested.


----------



## orangeboy

Zaphod said:


> Awesome! Thank you!
> 
> I also now have a feature request. I'd like an option to have the auto-push delete the source video file after a successful push.


Take a look at this hack: pyTivo forum link. It seems like it could be modified to delete the file? Something like:


Code:


os.remove(path)


----------



## ajayabb

I wonder if it is possible to create the following work flow. I would like to be able to transfer a video with Galleon's TTG from my Tivo to my PC, have KMTTG automatically strip commercials and reencode and then have Pytivo Push the video back to my Tivo all without having to go to my PC. Is this possible?


----------



## moyekj

ajayabb said:


> I wonder if it is possible to create the following work flow. I would like to be able to transfer a video with Galleon's TTG from my Tivo to my PC, have KMTTG automatically strip commercials and reencode and then have Pytivo Push the video back to my Tivo all without having to go to my PC. Is this possible?


 You can use kmttg to do all that (including pyTivo push) automatically already. To automate the whole task set you would need to use kmttg for the downloads as well instead of Galleon.


----------



## ajayabb

moyekj said:


> You can use kmttg to do all that (including pyTivo push) automatically already. To automate the whole task set you would need to use kmttg for the downloads as well instead of Galleon.


The reason I wish to incorporate Galleon, is because it has an app which allows you to push a video from Tivo to PC into a designated folder. If KTTG could detect the file in this designated folder and run automatically, that would be great but I am not sure that KTTG can perform that task.


----------



## moyekj

ajayabb said:


> The reason I wish to incorporate Galleon, is because it has an app which allows you to push a video from Tivo to PC into a designated folder. If KTTG could detect the file in this designated folder and run automatically, that would be great but I am not sure that KTTG can perform that task.


 There is some control over folder locations in kmttg. You can specify top level folder where all .TiVo files download to and by using the "[/]" keyword in File Naming you can have sub-folders so that for example series always go to their own sub-folder. But if you mean you want different shows to download to totally different top folders and/or volumes then that is not currently possible in kmttg.


----------



## fdbryant3

Thanks for the this program it seems to be able to fulfill at least one part of the chain I need to get video podcasts on my Tivo.

However I seem to be having the same problem that Zaphod was where it is repeatedly pushing files that have already been pushed.

Also, will this push anything that is not a video file? I ask because I'm having problems finding a decent lightweight podcatcher that can just sit in the background, download RSS feeds, and delete after a day or two (since in theory they will have been moved to the Tivo). I'm probably going to revert to what I use for audio podcasts (MediaMonkey) but that means they will be downloaded to the same folder structure as the audio podcasts.


----------



## orangeboy

fdbryant3 said:


> Thanks for the this program it seems to be able to fulfill at least one part of the chain I need to get video podcasts on my Tivo.
> 
> However I seem to be having the same problem that Zaphod was where it is repeatedly pushing files that have already been pushed.
> 
> Also, will this push anything that is not a video file? I ask because I'm having problems finding a decent lightweight podcatcher that can just sit in the background, download RSS feeds, and delete after a day or two (since in theory they will have been moved to the Tivo). I'm probably going to revert to what I use for audio podcasts (MediaMonkey) but that means they will be downloaded to the same folder structure as the audio podcasts.


Although not supported by the pyTivo developers, you can implement this hack that will log to a text file all video transfers. You could then setup a script to read said log file and delete any of the videos listed. I use Windows commands similar to the following to do the cleanup for me:



Code:


FOR /f "tokens=2* delims= " %%a IN ('FINDSTR "" "C:\Program Files\pyTivo\transfers.txt"') DO (
   IF EXIST   "%%b"     (>NUL DEL "%%b")
)

TYPE NUL> "C:\Program Files\pyTivo\transfers.txt"

The first FOR command looks for any filenames in the "transfers.txt" file, and deletes those files if they are found. The "TYPE NUL" command erases the "transfers.txt" file, so only files transferred after the cleanup are eligible for delete the next time the commands are executed. I hope this helps!


----------



## Hcour

I tried the auto-push a few wks ago and it worked except I didn't have any metadata files and it pushed all my files to a folder on Tivo entitled "Despicable Me", which is the name of one of the movie trailer files I had at the time. So now I'm trying again, this time I've created metadata files in the following format, for example (Rachel Maddow podcast):

title:MSNBC Rachel Maddow
SeriesTitle:MSNBC Rachel Maddow
episodeNumber:1
isEpisode:true
seriesId:SH999901

But when I autopush my files are still all going to a folder "Despicable Me", even though that file no longer exists. Where is that information kept so I can delete the Despicable Me reference? And is my metadata file in the correct format?

Thanks!


----------



## wmcbrine

It's "seriesTitle", not "SeriesTitle". Case is important.

That kind of sounds like the behavior of really old versions of pyTivo, where it would just use the first title pushed as the folder name. Make sure you're up to date.


----------



## Hcour

Oh boy, I'm going backwards. I forgot how I installed pyTivo before. The wiki says there's a Windows installer, but when I download the zip file and double-click it, it just opens the zip folder.

Edit - Never mind. I got the new ver up and running. Thanks.


----------



## Fortynine

I'm having a tough time getting pytivo auto push to work. The GUI comes up and it will say processing... and processing... and processing... but nothing happens. No transfer of files. I have only one file in my 'push' folder yet the processing indication just keeps goiong on and on. Any help would be gratly appreciated. Thanks in advance.


----------



## moyekj

Fortynine said:


> I'm having a tough time getting pytivo auto push to work. The GUI comes up and it will say processing... and processing... and processing... but nothing happens. No transfer of files. I have only one file in my 'push' folder yet the processing indication just keeps goiong on and on. Any help would be gratly appreciated. Thanks in advance.


 Check auto_push.txt file in top level of push folder to see if that 1 entry is already in that file. If it's not in there already then and you are sure the folder setup for auto push contains that 1 file then that means auto_push is not seeing the 1 file as a video file as determined using ffmpeg. Run the following on the file at command line:
"ffmpeg" -i "file"
Replace ffmpeg & file above with full path to ffmpeg binary and video file.


----------



## Fortynine

I have two folders for auto push with a Tivo file in one and an mpg file in the other. Neither folder has an auto_push.txt file. Just to reiterate my problem the auto push GUI will show that it is _processing_ and continue to show _processing_ for as long as the program is left running. Every now and then the following is inserted in the string of _processing_ indicators.

Processing...
java.lang.NullPointerException
at javax.swing.plaf.basic.BasicTextUI$RootView.paint(Unknown Source)
at javax.swing.plaf.basic.BasicTextUI.paintSafely(Unknown Source)
at javax.swing.plaf.basic.BasicTextUI.paint(Unknown Source)
at javax.swing.plaf.basic.BasicTextUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Processing...


----------



## avgjoefriday

moyekj,

I just wanted to say THANK YOU for creating this autopush script. I have been using the python script version for a few weeks and love it. You did us a great service!

I hope one day this makes pyTivo core!


----------



## ebf

Thanks for this! I got it working and all my iTunes video podcasts are transferring now. I am wondering, is it possible to edit the scanning time? It looks like auto_push is checking every 20 seconds or so for new files. I only have iTunes download once an hour. I see in the original .py script you could set the time, but can it be changed for the gui/service?

Thanks again.


----------



## moyekj

ebf said:


> Thanks for this! I got it working and all my iTunes video podcasts are transferring now. I am wondering, is it possible to edit the scanning time? It looks like auto_push is checking every 20 seconds or so for new files. I only have iTunes download once an hour. I see in the original .py script you could set the time, but can it be changed for the gui/service?
> 
> Thanks again.


 Not through GUI. But you can edit config.ini and change the value below the <wait> line. Then re-start auto_push.


----------



## ebf

Yes, that worked. I just stopped and restarted the service and the new time (1800 seconds = 30 min) was set.

Another question, moyekj... Might it be possible to watch a share _sub-folder_ instead of a whole share for auto push? It seems like it should be possible since auto_push seems to be basically building a push URL, which is generally a path to the file. My logic is, I have a share with several folders that works well for manual push and pull (soaps, movies, documentaries, podcasts, etc.). I only want to auto push soaps and podcasts. Right now, I went ahead and made a new share for the podcasts, but it really is otherwise unneeded. What do you think?


----------



## moyekj

It gets messier having to specify sub-folders of pyTivo shares only. The approach you took to create a new pyTivo share with only sub-folder of interest is what I do. There really is no side effect to doing that other than additional shares showing up in NPL is there?

BTW I'm still holding out hope that pyTivo itself will have some kind of implementation for auto pushes as that's really where it belongs. I know William mentioned he's thought about it but just hasn't had time for it yet. I don't really plan on doing anything else with this program at this point.


----------



## ebf

moyekj said:


> ... There really is no side effect to doing that other than additional shares showing up in NPL is there?


Indeed, I could limit which shares show up in each TiVo's NPL, but that's also kind of a pain.

For those that care, add this to your pyTivo.conf file to limit what shares show to a certain box. You will still have access to all shares via push.


Code:


[_tivo_1234TIVOnumber890]
shares = Share1ToShow, Share2ToShow


----------



## dscreen

I have auto push set up. It does see my Tivo box and my video share folder defined by the pyTivo conf file. I can manually push the files using pyTivo but the auto push function fails with "Internal Server Error".

2010_02_03_06:59:43 checking file: C:\Users\Robin\Videos\Tivo Shows\Jeopardy (02_01_2010)_cut.mpg
2010_02_03_06:59:43 pushing file: C:\Users\Robin\Videos\Tivo Shows\Jeopardy (02_01_2010)_cut.mpg
2010_02_03_06:59:43 {http}://localhost:9032/TiVoConnect?Command=Push&Container=My+Videos&File=/Jeopardy+%2802_01_2010%29_cut.mpg&tsn=Don+and+Robin%27s
2010_02_03_06:59:45 ERROR: Received unexpected response for: {http}://localhost:9032/TiVoConnect?Command=Push&Container=My+Videos&File=/Jeopardy+%2802_01_2010%29_cut.mpg&tsn=Don+and+Robin%27s
2010_02_03_06:59:45 ERROR: Internal Server Error 

I added brackets around the http part just for this email. The forum would not let me post http links. 
Don
Allen, Texas


----------



## moyekj

Try executing the push URL spit out in the log file in a browser to see what happens. Seems like response from pyTivo web server is not the expected "OK".


----------



## dscreen

This is what I get when I post it directly in a web browser (Firefox in this case)

notAuthorizedCannot find accountId for TSN Don Traceback (most recent call last): File "C:\Program Files (x86)\pyTivo\plugins\video\video.py", line 493, in Push subtitle = file_info['name']) File "C:\Program Files (x86)\pyTivo\mind.py", line 59, in pushVideo offer_id, content_id = self.__bodyOfferModify(data) File "C:\Program Files (x86)\pyTivo\mind.py", line 163, in __bodyOfferModify raise Exception(ElementTree.tostring(xml)) Exception: notAuthorizedCannot find accountId for TSN Don

My Tivo is called Don and Robin's not just Don
My tivo_username and tivo_password work just fine in a manual pyTivo push.


----------



## moyekj

The URL to enter in the browser is (make sure to include all the way to %27s ):


Code:


http://localhost:9032/TiVoConnect?Command=Push&Container=My+Videos&File=/Jeopardy+%2802_01_2010%29_cut.mpg&tsn=Don+and+Robin%27s

If after using above URL you still are getting an error then it's a pyTivo issue of some sort. Make sure you are running a fairly recent version.


----------



## dscreen

I updated to latest version of pyTivo (5 days old). Even went so far as to rename my Tivo without the spaces and apostrophe. Still get the internal server error. 
Been beating on it for awhile. Everything works except for the auto push.
Tried the URL you posted and got the same error.
Thanks for trying to help fix this.

Don


----------



## reneg

Just a guess, but case is important. Double check the share name in the pytivo.conf & what you have configured in auto_push.


----------



## moyekj

Don't know what else to tell you. auto_push is out of the equation here when you use URL directly in a browser, so the problem is related to pyTivo somehow. From the error you posted earlier it seems like it was trouble converting named tsn to an actual number. Perhaps replace the TiVo name with the actual TSN number in the URL and see if that goes through.
The other thing that may be helpful is turn on debug mode in pyTivo and do the push through pyTivo web interface and pay attention to the URLs spit out by debug and compare to the URL you are using in browser.

NOTE: Other thing you may want to try is bring up auto_push GUI and press return in the pyTivo conf file field which will make auto_push re-parse the pyTivo.conf file. That way if you have changed pyTivo.conf and not updated auto_push then that will sync them up again to make sure the container names & paths are in sync.


----------



## dscreen

Okay..replacing the TSN with the actual number in the URL worked! So what changes to my pyTivo setup should I make?
Thanks!
Don


----------



## moyekj

dscreen said:


> Okay..replacing the TSN with the actual number in the URL worked! So what changes to my pyTivo setup should I make?
> Thanks!
> Don


 You said you changed the TiVo name to remove spaces and special chars now right? I think that should take care of what previously looked like a problem of pyTivo mapping name to actual TSN number.
To make sure everything is in sync, bring up auto_push GUI, hit return in the pyTivo.conf field and make sure it picks up your newly named TiVo and then setup auto push for the "My Videos" share again. Then the URL should have the proper newly named TiVo at the end and hopefully everything will go through.


----------



## dscreen

Still not working. The auto push GUI shows the new Tivo name but I still get the Internal Server Error. pyTivo does not appear to be converting/mapping the Tivo DVR name to the TSN number.
Don


----------



## moyekj

dscreen said:


> Still not working. The auto push GUI shows the new Tivo name but I still get the Internal Server Error. pyTivo does not appear to be converting/mapping the Tivo DVR name to the TSN number.
> Don


 So post the pyTivo stack trace you are getting when you attempt the push with a browser. Maybe that will have some insight on why name->number TSN mapping is failing. Are you running pyTivo as a service or just in console? I would make sure that you stopped and restarted pyTivo since changing TiVo name.


----------



## dscreen

I ran pyTivo in the console and it shows that it is truncating my TSN name to just Don.
I logged into Tivo.com, changed the DVR name, it shows up under settings on the Tivo;however the Tivo box still tags new shows with the old DVR name of Don and Robin's! pyTivo looks like it is grabbing the old DVR name from the Tivo file and then truncating it. I rebooted/power off/power on the Tivo box and yet it persists with the old DVR name when it creates a file! Very frustrating....
Don


----------



## dscreen

Checking to see if pyTivo is already running . . .

Starting pyTivo Server. Use ctrl+Break to exit.

2010-02-04 12:23:38,815 INFO pyTivo: pyTivo is ready.
2010-02-04 12:23:38,963 INFO pyTivo: 192.168.1.5 [04/Feb/2010 12:23:38] "GET /T
iVoConnect?Command=QueryContainer&Container=%2F HTTP/1.0" 200 -
2010-02-04 12:23:55,707 DEBUG root: starting ffmpeg, will wait 10 seconds for it
to complete
2010-02-04 12:23:55,757 DEBUG root: ffmpeg output=FFmpeg version SVN-r15216-rdia
n06-0.96-win32-x86_32, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: --enable-memalign-hack --enable-postproc --enable-swscale --ena
ble-gpl --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --
enable-libvorbis --enable-libtheora --enable-libx264 --enable-libxvid --disable-
ffserver --disable-vhook --enable-avisynth --enable-pthreads
libavutil 49.10. 0 / 49.10. 0
libavcodec 51.71. 0 / 51.71. 0
libavformat 52.22. 0 / 52.22. 0
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 6. 1 / 0. 6. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Sep 25 2008 23:08:49, gcc: 4.2.4 [Sherpya]
Input #0, mpeg, from 'C:\Users\Robin\Videos\Tivo Shows\Leverage - The Future Job
(02_03_2010)_cut.mpg':
Duration: 00:42:52.89, start: 0.200000, bitrate: 3759 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 480x480 [PAR 4:3 DAR 4:3], 3
500 kb/s, 29.97 tb(r)
Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
Must supply at least one output file

2010-02-04 12:23:55,766 DEBUG pyTivo.video.transcode: aFreq=48000; vFps=29.97; c
ontainer=mpeg; kbps=3759; mapAudio=[('0.1', '[0x1c0]')]; vHeight=480; vCodec=mpe
g2video; Supported=True; millisecs=2572890; par=None; aKbps=192; par2=1.33333333
333; par1=4:3; dar2=1.33333333333; mapVideo=0.0; vWidth=480; dar1=4:3; aCodec=mp
2
2010-02-04 12:23:55,766 DEBUG root: CACHE HIT! C:\Users\Robin\Videos\Tivo Shows\
Leverage - The Future Job (02_03_2010)_cut.mpg
2010-02-04 12:23:55,766 DEBUG root: CACHE HIT! C:\Users\Robin\Videos\Tivo Shows\
Leverage - The Future Job (02_03_2010)_cut.mpg
2010-02-04 12:23:55,767 DEBUG pyTivo.video.transcode: TRANSCODE=NO, all compatib
le, C:\Users\Robin\Videos\Tivo Shows\Leverage - The Future Job (02_03_2010)_cut.
mpg
2010-02-04 12:23:55,767 DEBUG root: CACHE HIT! C:\Users\Robin\Videos\Tivo Shows\
Leverage - The Future Job (02_03_2010)_cut.mpg
2010-02-04 12:23:55,767 DEBUG root: CACHE HIT! C:\Users\Robin\Videos\Tivo Shows\
Leverage - The Future Job (02_03_2010)_cut.mpg
2010-02-04 12:23:55,769 DEBUG pyTivo.video.transcode: TRANSCODE=NO, all compatib
le, C:\Users\Robin\Videos\Tivo Shows\Leverage - The Future Job (02_03_2010)_cut.
mpg
2010-02-04 12:23:56,664 DEBUG pyTivo.mind: __login
{'cams_security_domain': 'tivocom', 'cams_login_config': 'http', 'cams_cb_passwo
rd': 'deleted my password for this post', 'cams_original_url': '/mind/mind7?type=infoGet', 'cams_cb_usern
ame': '[email protected]'}
2010-02-04 12:23:57,167 DEBUG pyTivo.mind: pcBodySearch
{}

<pcBodyList><isBottom>true</isBottom><isTop>true</isTop><pcBody><bucketNumber>49
6</bucketNumber><levelOfDetail>low</levelOfDetail><name>pyTivo</name><pcBodyId>t
ivoc.1000995791</pcBodyId><type>pcBody</type></pcBody></pcBodyList>g
2010-02-04 12:23:57,661 DEBUG pyTivo.mind: pcBodySearch
{}

<pcBodyList><isBottom>true</isBottom><isTop>true</isTop><pcBody><bucketNumber>49
6</bucketNumber><levelOfDetail>low</levelOfDetail><name>pyTivo</name><pcBodyId>t
ivoc.1000995791</pcBodyId><type>pcBody</type></pcBody></pcBodyList>g
2010-02-04 12:23:58,170 DEBUG pyTivo.mind: bodyOfferModify&bodyId=tsnon and Ro
bin's
{'subtitle': 'The Future Job', 'description': 'A con man masquerades as a psychi
c medium in order to steal money from his clients.', 'pcBodyId': 'tivoc.100099
5791', 'publishDate': '2010-02-04 18:2357', 'partnerId': 'tivot.3187', 'durati
on': 2572, 'size': 1209118720, 'title': 'Leverage', 'url': 'http://192.168.1.2:9
032/My%20Videos/Leverage%20-%20The%20Future%20Job%20%2802_03_2010%29_cut.mpg', '
bodyId': "tsnon and Robin's", 'source': 'SH01087016', 'state': 'complete', 'en
codingType': 'mpeg2ProgramStream'}

<error>


Code:


notAuthorized

<text>Cannot find accountId for TSN Don</text><
/error>g
2010-02-04 12:23:58,171 INFO pyTivo: 127.0.0.1 [04/Feb/2010 12:23:58] "GET /TiV
oConnect?Command=Push&Container=My+Videos&File=/Leverage+-+The+Future+Job+%2802_
03_2010%29_cut.mpg&tsn=Don+and+Robin%27s HTTP/1.1" 500 -
2010-02-04 12:23:58,173 ERROR pyTivo: Exception during request from ('127.0.0.1'
, 50065)
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 61, 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 94, in do_GET
self.handle_query(query)
File "C:\Program Files\pyTivo\httpserver.py", line 126, in handle_query
method(self, query)
File "C:\Program Files\pyTivo\plugins\video\video.py", line 351, in Push
mime = mime)
File "C:\Program Files\pyTivo\mind.py", line 77, in pushVideo
offer_id, content_id = self.__bodyOfferModify(data)
File "C:\Program Files\pyTivo\mind.py", line 189, in __bodyOfferModify
raise Exception(ElementTree.tostring(xml))
Exception: <error>


Code:


notAuthorized

<text>Cannot find accountId for TSN
Don</text></error>
Terminate batch job (Y/N)?


----------



## ebf

dscreen said:


> I ran pyTivo in the console and it shows that it is truncating my TSN name to just Don.
> I logged into Tivo.com, changed the DVR name, it shows up under settings on the Tivo;however the Tivo box still tags new shows with the old DVR name of Don and Robin's! ...


Have you forced a connection on the TiVo box? The box needs to get its new name from the TiVo servers before pyTiVo will see it. You may need to manually (or via the Web Config) update your list of TiVo boxes in the pyTiVo config file.


----------



## dscreen

Actually, I did force a connection a couple of times. I started over and reinstalled the latest copy of pyTivo and created a new pytivo.conf file from the sample dist file.
It just introduced a new problem on top of my Tivo box not letting go of the old TSN name when it tags a file. Now it also says no video plugin found even though I have ffmpeg.exe in both the pyTivo\bin directory and pyTivo\plugins\video directory. My conf file points to the first one.

Checking to see if pyTivo is already running . . .

Starting pyTivo Server. Use ctrl+Break to exit.

INFOyTivo.beacon:Announcing shares...
Error no video plugin exists. Check the type setting for your share.
INFOyTivo.beacon:Scanning for TiVos...
INFOyTivoyTivo is ready.
Error no video plugin exists. Check the type setting for your share.
INFOyTivo:192.168.1.5 [04/Feb/2010 14:47:11] "GET /TiVoConnect?Command=QueryCo
ntainer&Container=%2F HTTP/1.0" 200 -
INFOyTivo:127.0.0.1 [04/Feb/2010 14:47:19] "GET /TiVoConnect?Command=Push&Cont
ainer=My+Videos&File=/Jeopardy+%2802_04_2010%29_cut.mpg&tsn=Don+and+Robin%27s HT
TP/1.1" 404 -
Traceback (most recent call last):
File "C:\Program Files\pyTivo\Zeroconf.py", line 860, in run
self.readers[socket].handle_read()
File "C:\Program Files\pyTivo\Zeroconf.py", line 914, in handle_read
msg = DNSIncoming(data)
File "C:\Program Files\pyTivo\Zeroconf.py", line 467, in __init__
self.readHeader()
File "C:\Program Files\pyTivo\Zeroconf.py", line 474, in readHeader
length = struct.calcsize(format)
AttributeError: 'module' object has no attribute 'calcsize'
INFOyTivo.beacon:Unregistering:
Terminate batch job (Y/N)? ^A

Here is my conf file:

[_tivo_SD]

[MyTelevison]
type=video
path = c:\Users\Robin\Videos\Tivo Shows

[_tivo_HD]

[Server]
port = 9032

ffmpeg = c:\Program Files\pyTivo\bin\ffmpeg.exe
[email protected]
tivo_password=***** hidden for posting purposes


----------



## wmcbrine

So, dscreen, your problem with the space in the TiVo name isn't a pyTivo issue per se, but rather an issue with the Mind server. I could probably work around it in pyTivo, by forcing the numeric TSN to be used. Or moyekj could do that in his program.

Your new issue is bizarre. The bit about not finding calcsize in the struct module suggests that your installation of Python is broken. The error about no video plugin, then, is probably due to an import failure within video.py (for the same reason -- having a broken Python), which is being obscured by the way pyTivo tries to load its plugins.


----------



## dscreen

Thanks guys! I finally got it working. My pyTivo install was definitely the problem. My fault for not running pyTivo.py before copying the newest files over top of the March 2009 auto installer files. Once I did that everything worked! 
I really appreciate your efforts on KMTTG and pyTivo!!! What fantastic software!
Don
Allen, TX


----------



## wmcbrine

dscreen said:


> My fault for not running pyTivo.py before copying the newest files over top of the March 2009 auto installer files.


No, that isn't necessary, nor suggested. I can't see how it would make a difference. It's probably only a coincidence.


----------



## dscreen

How about this one...KMTTG runs perfectly in GUI mode, including auto pushes. When I run it as a service I get this error:

---DONE--- job=decrypt output=C:\kmttg\Jeopardy (02_05_2010).mpg
2010_02_05_13:36:02 >> Running adscan on C:\kmttg\Jeopardy (02_05_2010).mpg ...
2010_02_05_13:36:02 C:\Windows\system32\cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\AdScan.vbs" "C:\kmttg\Jeopardy (02_05_2010).mpg" "C:\kmttg\Jeopardy (02_05_2010).VPrj" /q 
2010_02_05_13:38:04 ERROR: adscan failed (exit code: 0 ) - check command: C:\Windows\system32\cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\AdScan.vbs" "C:\kmttg\Jeopardy (02_05_2010).mpg" "C:\kmttg\Jeopardy (02_05_2010).VPrj" /q 
2010_02_05_13:38:04 ERROR: C:\Program Files (x86)\VideoReDoTVSuite\AdScan.vbs(41, 2) WScript.CreateObject: Could not create object named "VideoReDo.VideoReDoSilent".
2010_02_05_13:38:06 ERROR: vprj file not found: C:\kmttg\Jeopardy (02_05_2010).VPrj

When I cut and paste the AdScan command into a DOS window it runs fine...just not in KMTTG as a service mode.

Don


----------



## moyekj

dscreen said:


> How about this one...KMTTG runs perfectly in GUI mode, including auto pushes. When I run it as a service I get this error:
> 
> ---DONE--- job=decrypt output=C:\kmttg\Jeopardy (02_05_2010).mpg
> 2010_02_05_13:36:02 >> Running adscan on C:\kmttg\Jeopardy (02_05_2010).mpg ...
> 2010_02_05_13:36:02 C:\Windows\system32\cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\AdScan.vbs" "C:\kmttg\Jeopardy (02_05_2010).mpg" "C:\kmttg\Jeopardy (02_05_2010).VPrj" /q
> 2010_02_05_13:38:04 ERROR: adscan failed (exit code: 0 ) - check command: C:\Windows\system32\cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\AdScan.vbs" "C:\kmttg\Jeopardy (02_05_2010).mpg" "C:\kmttg\Jeopardy (02_05_2010).VPrj" /q
> 2010_02_05_13:38:04 ERROR: C:\Program Files (x86)\VideoReDoTVSuite\AdScan.vbs(41, 2) WScript.CreateObject: Could not create object named "VideoReDo.VideoReDoSilent".
> 2010_02_05_13:38:06 ERROR: vprj file not found: C:\kmttg\Jeopardy (02_05_2010).VPrj
> 
> When I cut and paste the AdScan command into a DOS window it runs fine...just not in KMTTG as a service mode.
> 
> Don


Consult the VideoRedo_configuration Wiki. You should setup the kmttg service to run using same login account you are running GUI with (by default Windows services run as a non-user account).


----------



## stern_howie

Hi

I'm trying to use this but having some difficulty, 

I point to my pytivo.conf file, shares are read and show in the Java GUI however, when I start the service it says RUNNING but if I check the status it says STOPPED.

The path to my share is D:\_video

Also, my networked Tivo never shows in the drop down.

I have wmcbrides latest pytivo running with no problems can (manual) push and pull files from my tivo.

Any ideas?

cool program.


----------



## moyekj

This program uses Bonjour (MDNS) to detect TiVos on your network, which apparently is not working for you. Until your TiVo is detected and you specify a TiVo to push to for 1 or more of your shares there is nothing for service to do so it will stop. To manually configure things you can edit config.ini file as follows:


Code:


<tivos>
tivoName
<watchList>
shareName,sharePath,tivoName

Obviously replace tivoName, shareName, sharePath with appropriate entries, just make sure they match your pyTivo config.
(Under watchList section you can have additional lines if there are other shares to auto push).


----------



## stern_howie

Thank you moyekj your help..errr helped 

Weird really since I do have the bonjour service running but anywho your tip seemed to have worked. I see seemed since I don't have time to run a complete test but it is 'processing' and watching my share....

I will create a new share just for a particular folder (new share) to watch. looking good though!


----------



## 9300170

I had to manually edit the config file to make it see my TiVo's name. I have an apostrophe in the name of my TiVo. I think this was the issue.

Other than that I am soooo happy to see this program! Thank you! I've been looking for a way to seamlessly update my shows!!!


----------



## ebf

I upgraded from wmcbrine's branch from around 12/30/2009 to the 2/10/2010 snapshot last night. I came home to find all of today's podcast downloads on my TiVo between 15 and 45 (!) times*. It looks like the auto_push.txt file has not been updated with auto_push transfers in the past day-- I assume since I upgraded my pyTiVo snapshot.

*I am probably lucky I have auto_push set to only check every 30 minutes!

The auto_push log does have references to the files in question. It actually looks like it started last night. These check/push/error entries repeat every 30 min. Unfortunately, I don't have the pyTiVo debug setting turned to see those logs.

Anyone have any ideas how to fix this?

Thanks.



Code:


2010_02_11_04:07:05 checking file: H:\iTunes\Podcasts\GeekBrief.TV _ Video Podcast (iPod)\GBTV #705 (small) _ Google Buzz, Tun.mp4
2010_02_11_04:07:05 pushing file: H:\iTunes\Podcasts\GeekBrief.TV _ Video Podcast (iPod)\GBTV #705 (small) _ Google Buzz, Tun.mp4
2010_02_11_04:07:05 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/GeekBrief.TV+_+Video+Podcast+%28iPod%29/GBTV+%23705+%28small%29+_+Google+Buzz%2C+Tun.mp4&tsn=EBF+DT-TiVo
2010_02_11_04:07:08 ERROR: Received unexpected response for: http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/GeekBrief.TV+_+Video+Podcast+%28iPod%29/GBTV+%23705+%28small%29+_+Google+Buzz%2C+Tun.mp4&tsn=EBF+DT-TiVo
2010_02_11_04:07:08 ERROR: Not Found
2010_02_11_04:07:08 checking file: H:\iTunes\Podcasts\Latest Movie Trailers\Shutter Island - Featurette.m4v
2010_02_11_04:07:08 pushing file: H:\iTunes\Podcasts\Latest Movie Trailers\Shutter Island - Featurette.m4v
2010_02_11_04:07:08 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Latest+Movie+Trailers/Shutter+Island+-+Featurette.m4v&tsn=EBF+DT-TiVo
2010_02_11_04:07:11 ERROR: Received unexpected response for: http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Latest+Movie+Trailers/Shutter+Island+-+Featurette.m4v&tsn=EBF+DT-TiVo
2010_02_11_04:07:11 ERROR: Not Found
2010_02_11_04:07:12 checking file: H:\iTunes\Podcasts\Scam School (Quicktime Large)\The Birthday Scam and our 100th Epis.mp4
2010_02_11_04:07:12 pushing file: H:\iTunes\Podcasts\Scam School (Quicktime Large)\The Birthday Scam and our 100th Epis.mp4
2010_02_11_04:07:12 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Scam+School+%28Quicktime+Large%29/The+Birthday+Scam+and+our+100th+Epis.mp4&tsn=EBF+DT-TiVo
2010_02_11_04:07:15 ERROR: Received unexpected response for: http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Scam+School+%28Quicktime+Large%29/The+Birthday+Scam+and+our+100th+Epis.mp4&tsn=EBF+DT-TiVo
2010_02_11_04:07:15 ERROR: Not Found
2010_02_11_04:37:27 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i H:\iTunes\Podcasts\auto_push.log.lnk 
2010_02_11_04:37:42 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\GeekBrief.TV _ Video Podcast (iPod)\GBTV #705 (small) _ Google Buzz, Tun.mp4" 
2010_02_11_04:37:53 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\Latest Movie Trailers\Shutter Island - Featurette.m4v" 
2010_02_11_04:38:04 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\Scam School (Quicktime Large)\The Birthday Scam and our 100th Epis.mp4" 
2010_02_11_05:08:17 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i H:\iTunes\Podcasts\auto_push.log.lnk 
2010_02_11_05:08:42 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\GeekBrief.TV _ Video Podcast (iPod)\GBTV #705 (small) _ Google Buzz, Tun.mp4" 
2010_02_11_05:08:53 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\Latest Movie Trailers\Shutter Island - Featurette.m4v" 
2010_02_11_05:09:04 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\Scam School (Quicktime Large)\The Birthday Scam and our 100th Epis.mp4" 
2010_02_11_05:39:16 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i H:\iTunes\Podcasts\auto_push.log.lnk 
2010_02_11_05:39:27 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\GeekBrief.TV _ Video Podcast (iPod)\GBTV #705 (small) _ Google Buzz, Tun.mp4" 
2010_02_11_05:39:38 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\Latest Movie Trailers\Shutter Island - Featurette.m4v" 
2010_02_11_05:39:53 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\Scam School (Quicktime Large)\The Birthday Scam and our 100th Epis.mp4" 
2010_02_11_06:10:04 checking file: H:\iTunes\Podcasts\GeekBrief.TV _ Video Podcast (iPod)\GBTV #705 (small) _ Google Buzz, Tun.mp4
2010_02_11_06:10:04 pushing file: H:\iTunes\Podcasts\GeekBrief.TV _ Video Podcast (iPod)\GBTV #705 (small) _ Google Buzz, Tun.mp4
2010_02_11_06:10:04 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/GeekBrief.TV+_+Video+Podcast+%28iPod%29/GBTV+%23705+%28small%29+_+Google+Buzz%2C+Tun.mp4&tsn=EBF+DT-TiVo
2010_02_11_06:10:07 ERROR: Received unexpected response for: http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/GeekBrief.TV+_+Video+Podcast+%28iPod%29/GBTV+%23705+%28small%29+_+Google+Buzz%2C+Tun.mp4&tsn=EBF+DT-TiVo
2010_02_11_06:10:07 ERROR: Not Found
2010_02_11_06:10:19 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\Latest Movie Trailers\Shutter Island - Featurette.m4v" 
2010_02_11_06:10:31 ERROR: Timing out command that was taking too long: "C:\Program Files\TiVo\pyTivo\plugins\video\ffmpeg.exe" -i "H:\iTunes\Podcasts\Scam School (Quicktime Large)\The Birthday Scam and our 100th Epis.mp4" 
2010_02_11_06:40:34 checking file: H:\iTunes\Podcasts\GeekBrief.TV _ Video Podcast (iPod)\GBTV #705 (small) _ Google Buzz, Tun.mp4
2010_02_11_06:40:34 pushing file: H:\iTunes\Podcasts\GeekBrief.TV _ Video Podcast (iPod)\GBTV #705 (small) _ Google Buzz, Tun.mp4
2010_02_11_06:40:34 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/GeekBrief.TV+_+Video+Podcast+%28iPod%29/GBTV+%23705+%28small%29+_+Google+Buzz%2C+Tun.mp4&tsn=EBF+DT-TiVo
2010_02_11_06:40:37 ERROR: Received unexpected response for: http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/GeekBrief.TV+_+Video+Podcast+%28iPod%29/GBTV+%23705+%28small%29+_+Google+Buzz%2C+Tun.mp4&tsn=EBF+DT-TiVo
2010_02_11_06:40:37 ERROR: Not Found
2010_02_11_06:40:37 checking file: H:\iTunes\Podcasts\Latest Movie Trailers\Shutter Island - Featurette.m4v
2010_02_11_06:40:37 pushing file: H:\iTunes\Podcasts\Latest Movie Trailers\Shutter Island - Featurette.m4v
2010_02_11_06:40:37 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Latest+Movie+Trailers/Shutter+Island+-+Featurette.m4v&tsn=EBF+DT-TiVo
2010_02_11_06:40:40 ERROR: Received unexpected response for: http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Latest+Movie+Trailers/Shutter+Island+-+Featurette.m4v&tsn=EBF+DT-TiVo
2010_02_11_06:40:40 ERROR: Not Found
2010_02_11_06:40:40 checking file: H:\iTunes\Podcasts\Scam School (Quicktime Large)\The Birthday Scam and our 100th Epis.mp4
2010_02_11_06:40:40 pushing file: H:\iTunes\Podcasts\Scam School (Quicktime Large)\The Birthday Scam and our 100th Epis.mp4
2010_02_11_06:40:40 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Scam+School+%28Quicktime+Large%29/The+Birthday+Scam+and+our+100th+Epis.mp4&tsn=EBF+DT-TiVo
2010_02_11_06:40:43 ERROR: Received unexpected response for: http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Scam+School+%28Quicktime+Large%29/The+Birthday+Scam+and+our+100th+Epis.mp4&tsn=EBF+DT-TiVo
2010_02_11_06:40:43 ERROR: Not Found


----------



## moyekj

It looks to me like the response from pyTivo server for a file push is "Not Found" instead of the expected "OK", but the pushes are going through anyway. Since auto_push is not getting the expected "OK" response it assumes the push request failed and thus does not update the auto_push.txt file. Then of course that loop repeats every 30 mins.
i.e. If you enter the following in a web browser the response will likely be "Not Found":


Code:


http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Scam+School+&#37;28Quicktime+Large%29/The+Birthday+Scam+and+our+100th+Epis.mp4&tsn=EBF+DT-TiVo

So that is the mystery that needs to be solved. When you updated pyTivo did you modify the pyTivo.conf at all?


----------



## ebf

moyekj said:


> ...If you enter the following in a web browser the response will likely be "Not Found"...





Code:


Error response
Error code 404.
Message: Not Found.
Error code explanation: 404 = Nothing matches the given URI.

I did not change the config file, but every upgrade I do make changes to video.py and TvBus.tmpl to return changed episodeTitle functionality. Pushing and Pulling both work fine.


----------



## moyekj

Can you also confirm that despite the error message the browser spit out that the push actually does go through?

I think this goes back to problem of TiVo name has spaces in it like a recent user posted in this thread. The TiVo name you have assigned is currently:
"EBF DT-TiVo"
right? As with previous user if you substitute tsn=EBF+DT-TiVo with tsn=# in the URL (where # is your TiVo TSN #) then it probably works fine and browser returns OK.


----------



## ebf

Yes, it goes through when the same url is entered the the browser (and returns an error). I'll try the TSN.


----------



## ebf

When I replace my TiVo name with the TSN (minus the dashes?) I get the same error and no transfer happens. (Not my real TSN.)



Code:


http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Latest+Movie+Trailers/Leaves+of+Grass+-+Trailer.m4v&tsn=6491234567890A1

Correction, the transfer does happen. I must have gotten the number wrong.


----------



## moyekj

Well I think you can stop auto_push service, manually edit the config.ini and under watchList section change TiVo name to your tsn #, then restart service and I think that will then bypass the problem. i.e.:


Code:


<watchList>
shareName,sharePath,tsn


----------



## ebf

Well, that didn't work either. Still seeing no new entries in auto_push.txt, the log still looks the same and manually entering the push url gives the same error.



Code:


2010_02_11_22:37:06 checking file: H:\iTunes\Podcasts\Rocketboom\Brangelina Split_.mov
2010_02_11_22:37:06 pushing file: H:\iTunes\Podcasts\Rocketboom\Brangelina Split_.mov
2010_02_11_22:37:06 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Rocketboom/Brangelina+Split_.mov&tsn=6491234567890A1
2010_02_11_22:37:10 ERROR: Received unexpected response for: http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/Rocketboom/Brangelina+Split_.mov&tsn=6491234567890A1
2010_02_11_22:37:10 ERROR: Not Found


----------



## ebf

BTW, what format should the auto_push.txt be in? I cleared mine out now want to manually add some entries while troubleshooting, but it seems to be ignoring this:



Code:


CNET TV_ Buzz Report\The Buzz Report_ The Google Buzz Rep.m4v
Democracy Now! Video\Democracy Now! 2010-02-11 Thursday.mp4


----------



## moyekj

ebf said:


> BTW, what format should the auto_push.txt be in? I cleared mine out now want to manually add some entries while troubleshooting, but it seems to be ignoring this:
> 
> 
> 
> Code:
> 
> 
> CNET TV_ Buzz Report\The Buzz Report_ The Google Buzz Rep.m4v
> Democracy Now! Video\Democracy Now! 2010-02-11 Thursday.mp4


 It's path to file relative to the top share folder. So, for example if my top share path is defined as *c:\home\dvd* and the file I want to prevent from being pushed is c:\home\dvd\just testing\test1.mpg then the entry that goes in the c:home\dvd\auto_push.txt file is (taking out c:\home\dvd from full path):
just testing\test1.mpg

For your other problem you probably need to enable debug mode in pyTivo and then examine/post the messages it spits out.


----------



## stern_howie

Hi

I seem to auto pushing the same files over and over 
I have 2 shares

e.g.

D:\_Video
D:\_Video\_push

files I want to push are in _Push. Only _Push is set to auto push, everything in that share just keeps being sent.

set to check every 30 mins.



Are nested shares a problem?

thanks


----------



## ebf

stern_howie said:


> I seem to auto pushing the same files over and over.....


Are you using a recent version of pyTiVo? Check further up this thread.



> ...files I want to push are in _Push. Only _Push is set to auto push, everything in that share just keeps being sent. ...


Are they TWO shares are one share with sub-folders? Check even further up...


----------



## stern_howie

Hi ebf

Yes a recent version of pytivo (not at that pc right now to check) maybe 2 weeks old.

Yeah

d:\_video (is a share)
d:\_video\_push (is a share inside of the above)

I am only pushing what is inside of d:\_video\_push

I'll try moving the _push share and see what happens.

thanks


----------



## ebf

stern_howie said:


> Hi ebf
> 
> Yes a recent version of pytivo (not at that pc right now to check) maybe 2 weeks old.


My snapshot from around 2009-12-30 still works fine. Not sure what happened along the way, but going back to the 12-30 version made auto_push behave again for me.


----------



## Sparty99

I'm going to post a new thread here as well, because this doesn't seem to be an issue with the Auto Push file, but I figured I'd post it here as well.

When I enter my username and password in my pyTiVo config file, I don't see anything listing "Push from video shares". Quite frankly, I don't even know where to look. Can someone provide some assistance?


----------



## moyekj

ebf said:


> My snapshot from around 2009-12-30 still works fine. Not sure what happened along the way, but going back to the 12-30 version made auto_push behave again for me.


 I just switched to latest wmcbrine git version of today and now I see that every time I issue a push request the response back from pyTivo is always error code 404: "Not Found". However the pushes go through anyway. Needless to say this breaks auto_push which assumes push request failed unless "OK" message is returned to push request.


----------



## ebf

moyekj said:


> I just switched to latest wmcbrine git version of today and now I see that every time I issue a push request the response back from pyTivo is always error code 404: "Not Found". However the pushes go through anyway. Needless to say this breaks auto_push which assumes push request failed unless "OK" message is returned to push request.


Yes. Do you know what version you had been using? Does this mean wmcbrine's branch of pyTiVo has a flaw or has something changed at the TiVo mothership?


----------



## moyekj

ebf said:


> Yes. Do you know what version you had been using? Does this mean wmcbrine's branch of pyTiVo has a flaw or has something changed at the TiVo mothership?


 Don't know if it's a "flaw", but something certainly changed. I didn't narrow down exactly which release something changed but for example the 2010/01/28 version from not too long ago behaves as expected (returns OK message for push requests) whereas the most recent git versions always return 404 - Not Found. I've contacted wmcbrine about it to see if perhaps he can share some insight and correct it if it is a bug.


----------



## wmcbrine

Indeed, it's not a flaw, because this whole thing is kind of an off-label usage of Push, as it were.  The intended usage -- from pyTivo's web page -- was not broken. But anyway...

This is what happens at the end of a Push command:



Code:


        referer = handler.headers.getheader('Referer')
        handler.send_response(302)
        handler.send_header('Location', referer)
        handler.end_headers()

It redirects to the referring page (to redisplay the list). So when there is no referrer, as with a wget from the command line, you get this:



Code:


INFO:pyTivo:127.0.0.1 [14/Feb/2010 17:31:33] "GET /TiVoConnect?Command=Push&Container=Videos&File=/pluto.mp4&tsn=Little&#37;20Tivo HTTP/1.0" 302 -
INFO:pyTivo:127.0.0.1 [14/Feb/2010 17:31:33] code 404, message Not Found
INFO:pyTivo:127.0.0.1 [14/Feb/2010 17:31:33] "GET /None HTTP/1.0" 404 -

getheader('Referer') returns "None", and this is passed back to the redirector, which unsurprisingly fails. You can work around this by faking the referer -- "/" will do:



Code:


wget "http://localhost:9032/TiVoConnect?Command=Push&Container=Videos&File=/pluto.mp4&tsn=Little%20Tivo" --*********/
--18:12:42--  http://localhost:9032/TiVoConnect?Command=Push&Container=Videos&File=/pluto.mp4&tsn=Little%20Tivo
           => `TiVoConnect?Command=Push&Container=Videos&File=%2Fpluto.mp4&tsn=Little Tivo'
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:9032... connected.
HTTP request sent, awaiting response... 302 Found
Location: / [following]
--18:12:46--  http://localhost:9032/
           => `index.html'
Connecting to localhost|127.0.0.1|:9032... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]

    [ <=>                                 ] 845           --.--K/s             

18:12:46 (18.82 MB/s) - `index.html' saved [845]

After realizing this, the surprising thing is that it didn't return 404 before. But that was because, prior to recent changes, pyTivo would serve up the info page for any request that didn't start with either "TiVoConnect" or the name of a share. Now, as part of gaining the ability to serve arbitrary content, it's a lot more picky -- only "/" will fetch the info page.

Edit: Well, this is silly -- TCF auto-censored my wget referer option. "Dash dash referer equals slash" is what it's supposed to say.


----------



## moyekj

wmcbrine said:


> Code:
> 
> 
> getheader('Referer') returns "None", and this is passed back to the redirector, which unsurprisingly fails. You can work around this by faking the referer -- "/" will do:
> [/QUOTE] OK thanks. Adding "REFERER" property to http request as "/" does indeed work around the problem. I'll put that change in kmttg and auto_push.


----------



## moyekj

OK, new version available with fix to above issue related to "Not Found" return messages:
http://pytivo-auto-push.googlecode.com/files/auto_push_v0.1b.zip


----------



## wmcbrine

I decided to fix this on my end as well -- to make it return 200 OK if no referer. Not in my repo yet, will push the commit later tonight.


----------



## moyekj

wmcbrine said:


> I decided to fix this on my end as well -- to make it return 200 OK if no referer. Not in my repo yet, will push the commit later tonight.


 OK great, thanks.


----------



## ebf

Updated both pyTiVo and auto_push and things seem to be working. Thanks guys.


----------



## kpdillon

I am new to using KMTTG, I've been using PyTIVO but recently upgraded everything to get an end to end process working to download a show, trim the commercials and send it back to the Tivo. Everything is working great for me but I am struggling with the push back to the Tivo at the very end. Here is what I am seeing on the PyTivo console.... What could I possibly be doing wrong here?

My Error:
Received unexpected response for: http://localhost:9032/TiVoConnect?C...Clues+-+Bugs+(02_15_2010)2_cut.mpg&tsn=TivoHD
Internal Server Error

INFOyTivo:192.168.1.20 [17/Feb/2010 11:54:08] "GET /TiVoConnect?Command=QueryC
ontainer&Container=%2F HTTP/1.0" 200 -
INFOyTivo:127.0.0.1 [17/Feb/2010 11:54:41] "GET /TiVoConnect?Command=Push&Cont
ainer=Media&File=/Blues+Clues+-+Bugs+%2802_15_2010%292_cut.mpg&tsn=TivoHD HTTP/1
.1" 500 -
ERRORyTivo:Exception during request from ('127.0.0.1', 51863)
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 57, 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 83, in do_GET
self.handle_query(query, tsn)
File "C:\Program Files\pyTivo\httpserver.py", line 127, in handle_query
method(self, query)
File "C:\Program Files\pyTivo\plugins\video\video.py", line 390, in Push
tvrating = file_info['tvRating'])
File "C:\Program Files\pyTivo\mind.py", line 84, in pushVideo
offer_id, content_id = self.__bodyOfferModify(data)
File "C:\Program Files\pyTivo\mind.py", line 200, in __bodyOfferModify
content_id = offer_id.replace('of','ct')
AttributeError: 'NoneType' object has no attribute 'replace'


----------



## ebf

Are you using the "auto_push" add on or the web Push feature?


----------



## kpdillon

I believe I am using whatever Pytivo comes with. Is that the web verison? Should I install and be using auto_push instead? I was able to get one show autopushed yesterday but it doesn't seem to be working anymore so I am not sure where the problem is.


----------



## moyekj

kpdillon said:


> I believe I am using whatever Pytivo comes with. Is that the web verison? Should I install and be using auto_push instead? I was able to get one show autopushed yesterday but it doesn't seem to be working anymore so I am not sure where the problem is.


 You need to focus on getting pushes working from pyTivo web page first (i.e. connect with web browser to http://localhost:9032 and do push from there) before expecting them to work from kmttg or auto_push. It's not obvious to me from your pyTivo log what the problem is but probably posting in pyTivo forums may get you some quicker answers.


----------



## kpdillon

I just successfully pushed a file with PyTivo via the web interface, so I think everything in PyTivo is configured properly.


----------



## kpdillon

If I manually put this in my browser, I get a 500 error.

http://localhost:9032/TiVoConnect?C...llywood+round+(02_16_2010)_cut.mpg&tsn=TivoHD

So, since Push works in PyTivo, what could be the problem?

If I turn of friendly HTTP error messages in the broswer, I see this:

'NoneType' object has no attribute 'replace' Traceback (most recent call last): File "C:\Program Files\pyTivo\plugins\video\video.py", line 390, in Push tvrating = file_info['tvRating']) File "C:\Program Files\pyTivo\mind.py", line 84, in pushVideo offer_id, content_id = self.__bodyOfferModify(data) File "C:\Program Files\pyTivo\mind.py", line 200, in __bodyOfferModify content_id = offer_id.replace('of','ct') AttributeError: 'NoneType' object has no attribute 'replace'


----------



## kpdillon

I am using Python 2.6. Should I be using a later version perhaps?


----------



## kpdillon

ok, I rebooted my PC and it seems I can now manually push files via kmttg. I am hoping this was just a fluke but also concerned that this is some kind of memory error/leak and that push will fail again. I'll keep my fingers crossed.


----------



## moyekj

kpdillon said:


> I am using Python 2.6. Should I be using a later version perhaps?


 No. I believe pyTivo needs 2.4 to 2.6 Python so you should not try to use later version. Besides, pyTivo web push is working. What you should do if you have not is update to latest wmcbrine version of pyTivo from here if you have not already. (Grab zip file of latest version and just unzip it over your current installation to update). There was a fix for pushes external to pyTivo that wmcbrine put in a couple of days ago. I don't think that's your issue but it would be good to make sure you are using latest pyTivo version before trying to debug further.


----------



## kpdillon

Thanks for the quick response, I am using the latest pyTivo build from yesterday's GIT. Push seems to manually be working again after the reboot so I'm trying the end to end process once more. I should know in about 5 hours (since it's transfering a 10GB file over wireless) if I am successful in copying American Idol over to the PC, ripping out commercials and copying it back to the Tivo so that I can watch it commercial free tonight. This will be so cool if it works.


----------



## reneg

kpdillon said:


> Thanks for the quick response, I am using the latest pyTivo build from yesterday's GIT. Push seems to manually be working again after the reboot so I'm trying the end to end process once more. I should know in about 5 hours (since it's transfering a 10GB file over wireless) if I am successful in copying American Idol over to the PC, ripping out commercials and copying it back to the Tivo so that I can watch it commercial free tonight. This will be so cool if it works.


If for some reason, you are still seeing an issue, can you post your pyTivo.conf file (removing the tivo mak/username/password)?


----------



## kpdillon

Here it is, I hope my issue is resolved but I'll certainly post back if it breaks again needing to be fixed by a reboot. Here is a copy of my PyTivo.conf file:

BTW, when I had the issue and it was not working with kmmtg it was still working with Pytivo web pushes. So it seems to me that the reboot cleared up an issue for kmmtg not PyTivo.

[Media]
type = video
path = e:\Movies

[_tivo_SD]

[_tivo_HD]

[Server]
tivo_username = ******@*********.com
tivo_password = supersecretpassword
tivo_mak = 1234567891
ffmpeg = /usr/bin/ffmpeg
tivodecode = c:\program files\pytivo\bin\tivodecode
tdcat = c:\program files\pytivo\bin\tdcat
beacon = 192.168.1.20 192.168.1.141
port = 9032


----------



## moyekj

NOTE: Your ffmpeg setting is not correct, so if pyTivo needs to do transcoding for anything you will run into trouble. You can set ffmpeg to full path to ffmpeg.exe in kmttg installation to fix that.


----------



## kpdillon

Yes, I noticed that as well - I did hardcode the path but somehow that reverted back. I'll fix it - if pytivo is not transcoding properly. I am using a separate copy of ffmpeg (the one that came with kmtgg) for kmtgg. 

American Idol has copied down 6GB, 4 more GB to go, then decrypt, ad scan and comskip, then hopefully a successful push back to the the Tivo in time for me to watch it commercial free tonight! Is adscan and comskip pretty accurate for the most part? I have no desire to do any manual adjustments.


----------



## LoREvanescence

Does anyone know what might be causing this error?

checking file: C:\Users\Public\Videos\Paramore\Use Somebody.mp4
pushing file: C:\Users\Public\Videos\Paramore\Use Somebody.mp4
http://localhost:9032/TiVoConnect?Command=Push&Container=Paramore&File=/Use+Somebody.mp4&tsn=Tivo
Connection failed: http://localhost:9032/TiVoConnect?Command=Push&Container=Paramore&File=/Use+Somebody.mp4&tsn=Tivo
java.net.SocketTimeoutException: Read timed out

When I try going to the local host link listed in the error, it takes forever, then gives me this error:

<error>


Code:


badArgument

<text>unsupported encodingType for this body: avcL41MP4</text></error>

Traceback (most recent call last):
File "C:\Program Files\pyTivo\plugins\video\video.py", line 351, in Push
mime = mime)
File "C:\Program Files\pyTivo\mind.py", line 77, in pushVideo
offer_id, content_id = self.__bodyOfferModify(data)
File "C:\Program Files\pyTivo\mind.py", line 189, in __bodyOfferModify
raise Exception(ElementTree.tostring(xml))

Exception: <error>


Code:


badArgument

<text>unsupported encodingType for this body: avcL41MP4</text></error>

The video's I am trying to push, are youtube mp4 files saved directly from youtube through keepvid.com, so they should be valid.


----------



## kpdillon

Arggh, something went south. Is it best to not launch the automated gui when copying a file? That somehow seemed to start the next queued task (decrypt) and it hadn't finished copied so now I am back to starting everything over... :-(


----------



## kpdillon

Quick question on something that confuses me with kmttg. Can you push a encoded mp4 instead of an mpeg automatically after kmttg processes everything or is the only option to push an mpeg back to the Tivo?

thanks


----------



## moyekj

kpdillon said:


> Quick question on something that confuses me with kmttg. Can you push a encoded mp4 instead of an mpeg automatically after kmttg processes everything or is the only option to push an mpeg back to the Tivo?
> 
> thanks


 Under kmttg configuration in pyTivo tab there is a setting called *Files to push* which controls which files you want kmttg to push. You can specify which file type specifically you want to push or "all" or "last" (which means the last output file of your task set whatever it is). Setting it to "last" usually works best since that is usually the target file you want to push following a task set.


----------



## kpdillon

Makes sense. Are you the author of kmmtg? If so, let me publicly tell you, this software rocks!!!!!!!!!!! I have only been using it for two days but WOW, it is implented so nicely.. It is the best thing out there!


----------



## moyekj

kpdillon said:


> Makes sense. Are you the author of kmmtg? If so, let me publicly tell you, this software rocks!!!!!!!!!!! I have only been using it for two days but WOW, it is implented so nicely.. It is the best thing out there!


 Yes, I'm the kmttg author.


----------



## kpdillon

Very cool. I never heard of Streambaby but just noticed it in your signature and I am excited to try it out and see what it does.


----------



## ebf

moyekj, I've noticed a couple of times lately auto_push is not respecting the auto_push.txt file. I am not sure under what circumstances it happens, maybe after a brief network outage, but auto_push will re-push some of my podcasts-- even though the file is already in the auto_push.txt file. Checking the auto_push.log, it looks like the service is starting up again and rescanning for files to push. The double-pushed files even show up in the auto_push.txt file multiple times.



Code:


2010_02_24_18:20:23 watching file: H:\iTunes\Podcasts\CNET TV_ News Videos\News_ Bloom Energy unveils the Bloom.m4v
2010_02_24_18:50:23 checking file: H:\iTunes\Podcasts\CNET TV_ News Videos\News_ Bloom Energy unveils the Bloom.m4v
2010_02_24_18:50:23 pushing file: H:\iTunes\Podcasts\CNET TV_ News Videos\News_ Bloom Energy unveils the Bloom.m4v
2010_02_24_18:50:23 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/CNET+TV_+News+Videos/News_+Bloom+Energy+unveils+the+Bloom.m4v&tsn=EBF+DT-TiVo
2010_02_24_20:20:21 STARTING UP
2010_02_24_20:20:21 AUTO WATCH STARTED FOR SHARES:
2010_02_24_20:20:21 share=PC Podcasts path=H:\iTunes\Podcasts tivo=EBF DT-TiVo
...
2010_02_24_20:20:24 watching file: H:\iTunes\Podcasts\CNET TV_ News Videos\News_ Bloom Energy unveils the Bloom.m4v
2010_02_24_20:20:31 watching file: H:\iTunes\Podcasts\Science and Environment (Video)\Uncharted Waters, Fragile Hopes.mp4
2010_02_24_20:50:44 checking file: H:\iTunes\Podcasts\CNET TV_ CNET Top 5\CNET Top 5_ Google search terms.m4v
2010_02_24_20:50:44 pushing file: H:\iTunes\Podcasts\CNET TV_ CNET Top 5\CNET Top 5_ Google search terms.m4v
2010_02_24_20:50:44 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/CNET+TV_+CNET+Top+5/CNET+Top+5_+Google+search+terms.m4v&tsn=EBF+DT-TiVo
...
2010_02_24_20:51:15 checking file: H:\iTunes\Podcasts\CNET TV_ News Videos\News_ Bloom Energy unveils the Bloom.m4v
2010_02_24_20:51:15 pushing file: H:\iTunes\Podcasts\CNET TV_ News Videos\News_ Bloom Energy unveils the Bloom.m4v
2010_02_24_20:51:15 http://localhost:9034/TiVoConnect?Command=Push&Container=PC+Podcasts&File=/CNET+TV_+News+Videos/News_+Bloom+Energy+unveils+the+Bloom.m4v&tsn=EBF+DT-TiVo

Any ideas?


----------



## moyekj

Yes I've seen that before as well and looked into it but didn't see anything obvious as to why it would happen. The old style of marking pushed files with an accompanying file was a lot more reliable though messy. To be honest I don't have a lot of motivation to look into it since it's not obvious to me what the problem is. If someone using this program wants to look through the source and figure it out please do so. I keep a list of push files in memory after parsing the push file and perhaps due to multi-threading it's not always working right. Probably one fix would be to just re-parse push file every time when evaluating a file to push which would be more overhead but more reliable.

I'm still hoping wmcbrine will develop some kind of auto transfers built directly into pyTivo where it really belongs.


----------



## ebf

moyekj said:


> ...I keep a list of push files in memory after parsing the push file and perhaps due to multi-threading it's not always working right. Probably one fix would be to just re-parse push file every time when evaluating a file to push which would be more overhead but more reliable.


Ah, I assumed it always compared the .txt file each time. If you made the change, would it rescan every ten seconds (the default config watch time)? If that contributes to the overhead, could the default watch time be increased to something more reasonable, like the 30 min I set mine to?



> ... I'm still hoping wmcbrine will develop some kind of auto transfers built directly into pyTivo where it really belongs.


Yes, yes! :up:


----------



## kpdillon

Just curious, KMTTG has been working great for me but I still am not successful in getting the encoded final show automatically pushed back to the Tivo. Should I be installing and configuring pytivo-auto-push or should I be looking into pytivo some more to troubleshoot why this is not working well?


----------



## moyekj

kpdillon said:


> Just curious, KMTTG has been working great for me but I still am not successful in getting the encoded final show automatically pushed back to the Tivo. Should I be installing and configuring pytivo-auto-push or should I be looking into pytivo some more to troubleshoot why this is not working well?


 You don't need auto-push for that. If you are getting error messages when the pushes are attempted what are they? If you are not getting error messages then you have to look at pyTivo side to find out what the problem is.


----------



## kpdillon

Well, I have an LCD 52" Sony TV and I'm trying to find the sweet spot between disk space and decent quality so I've been encoding to HB_AppleTV mp4 format. I guess this is what I am having trouble sending back to the Tivo via push and I can't figure out why. The mp4 is getting put in a pytivo media shared directory.


----------



## kpdillon

kpdillon said:


> Well, I have an LCD 52" Sony TV and I'm trying to find the sweet spot between disk space and decent quality so I've been encoding to HB_AppleTV mp4 format. I guess this is what I am having trouble sending back to the Tivo via push and I can't figure out why. The mp4 is getting put in a pytivo media shared directory.


Correction in the above post, the file format is m4v, not mp4. Not sure that makes a difference.


----------



## txporter

kpdillon said:


> Correction in the above post, the file format is m4v, not mp4. Not sure that makes a difference.


It does matter, but you can simply rename the file to .mp4. Should be fine for push then.


----------



## kpdillon

Ok, how do you rename an m4v extension to an mp4 and keep the process completely automated? If there a better encoding format to use to convert a tivo mpeg to for a highdef TV and still get pretty decent quality and have it automatically push back to the Tivo?


----------



## txporter

kpdillon said:


> Ok, how do you rename an m4v extension to an mp4 and keep the process completely automated? If there a better encoding format to use to convert a tivo mpeg to for a highdef TV and still get pretty decent quality and have it automatically push back to the Tivo?


Handbrake does it automatically. Try using moyekj's ffmpeg profile instead.


----------



## ebf

moyekj said:


> ...I keep a list of push files in memory after parsing the push file and perhaps due to multi-threading it's not always working right. Probably one fix would be to just re-parse push file every time when evaluating a file to push which would be more overhead but more reliable...


This is still a problem. After a restart auto_push does not seem to be parsing the auto_push.txt file. I just had pyTiVo queue up a bunch of files already listed in the auto_push.txt file. Shouldn't auto_push exclude the existing entries on restart? Thanks.


----------



## moyekj

ebf said:


> This is still a problem. After a restart auto_push does not seem to be parsing the auto_push.txt file. I just had pyTiVo queue up a bunch of files already listed in the auto_push.txt file. Shouldn't auto_push exclude the existing entries on restart? Thanks.


I haven't looked at this project for a while now. I made a change so that auto push will re-parse list of pushed files before deciding on what to push every time, so hopefully that should take care of issues you were seeing:
http://pytivo-auto-push.googlecode.com/files/auto_push_v0.1c.zip


----------



## ebf

Thanks, moyekj. I'll try it out later and let you know!


----------



## ebf

Sorry for the delayed reply. Well, that seems worst. I am getting duplicate pushes when there is no error in the auto_push log file. What's even weirder, each of the pushes are appearing in the auto_push.txt file. Theoretically, once in the .txt file, there should be no further attempt to push the file, right?


----------



## moyekj

OK, spent some more time really digging into the problem. Turns out there was a parser error with files with spaces in their name when parsing .processed files. This version fixes that problem and likely the duplicated pushes you were seeing:
http://pytivo-auto-push.googlecode.com/files/auto_push_v0.1d.zip


----------



## moyekj

FYI. There is also recently an issue with pyTivo pushes (actually a change to mind.tivo.com server which doesn't always give correct responses) that prevents pyTivo pushes from working. I gave wmcbrine a fix to mind.py that worked for me so hopefully there will be a newer version of pyTivo released with the workaround soon.


----------



## ThAbtO

I'm puzzled as how I can configure PyTivo to push at all.

The log says ....

STARTING UP
ERROR: There are currently no shares setup for auto push
SHUTTING DOWN


----------



## moyekj

ThAbtO said:


> I'm puzzled as how I can configure PyTivo to push at all.
> 
> The log says ....
> 
> STARTING UP
> ERROR: There are currently no shares setup for auto push
> SHUTTING DOWN


 Instructions are here:
http://code.google.com/p/pytivo-auto-push/wiki/configuring_auto_push


----------



## ebf

moyekj said:


> OK, spent some more time really digging into the problem. Turns out there was a parser error with files with spaces in their name when parsing .processed files. This version fixes that problem and likely the duplicated pushes you were seeing:
> http://pytivo-auto-push.googlecode.com/files/auto_push_v0.1d.zip


So far, so good. I haven't yet tried disconnecting the internet, something that seemed to trigger the original duplication problem. I'll try that today.


----------



## ThAbtO

Now I get this error from pytivo.



Code:


list index out of range

Traceback (most recent call last):
  File "e:\pyTivo\plugins\video\video.py", line 351, in Push
    mime = mime)
  File "e:\pyTivo\mind.py", line 46, in pushVideo
    pc_body_id = self.__pcBodySearch()[0]
IndexError: list index out of range


----------



## moyekj

ThAbtO said:


> Now I get this error from pytivo.
> 
> 
> 
> Code:
> 
> 
> list index out of range
> 
> Traceback (most recent call last):
> File "e:\pyTivo\plugins\video\video.py", line 351, in Push
> mime = mime)
> File "e:\pyTivo\mind.py", line 46, in pushVideo
> pc_body_id = self.__pcBodySearch()[0]
> IndexError: list index out of range


 Yes that's the pyTivo issue I was talking about in post 172. If you upgrade to latest pyTivo version it has a fix for that issue (it's actually a problem with mind.tivo.com that pyTivo is now working around).


----------



## ebf

Things do seem to be working. Several days and one router restart without a duplicate push! Thanks much.


----------



## ThAbtO

I just updated the PyTivo and noticed that the 'ToGo' option is missing.

Edit: It was missing my MAK under the Global Settings; Now I see my individual Tivos instead of just the 'ToGo' option.

Edit #2: I just did a push to the THD and the file was copy-protected against being transferred again. File was previously transferred from a S2 with kmttg and decoded to .MPG.



> This show is copy protected - cannot process


----------



## moyekj

ThAbtO said:


> Edit #2: I just did a push to the THD and the file was copy-protected against being transferred again. File was previously transferred from a S2 with kmttg and decoded to .MPG.


 That's normal. All files pushed to TiVos are marked as copy protected. TiVo Desktop's Auto Transfers does it too. You have to pull to TiVo (initiate transfer from TiVo) to avoid that, but then you can only pull mpeg2/TiVo files without transcoding.


----------



## caddyroger

never mind I tried taking the pytivo.conf from the end and it started to work.


----------



## tjtv

Hi,

I was wondering if it would be possible to modify this program, such that it only pushes certain file types. I pre-process all of my mkv files, by extracting the audio/video streams and remuxing to mp4. After the processing is done, I'm left with a valid mp4 file, and the mkv file is deleted. I'd like to be able to have the mp4 auto-pushed, but I don't want the mkv to be pushed.

Any hints you can give me to where I should start looking to made this modification?


----------



## ebf

Can't you just have your mkv file outside of the push location and setup your processing app to put the resulting file in the push location?


----------



## tjtv

ebf said:


> Can't you just have your mkv file outside of the push location and setup your processing app to put the resulting file in the push location?


Thanks. I've changed my processing script to move the file to the push location. Can't believe I didnt' think of that!

One other question. I have two tivos. I have a folder that I want to be auto-pushed to BOTH tivos. Is there any easy way to accomplish this?


----------



## Phantom Gremlin

tjtv said:


> One other question. I have two tivos. I have a folder that I want to be auto-pushed to BOTH tivos. Is there any easy way to accomplish this?


I don't know the answer to your question, because I don't auto-push. But I wanted to highlight your question as being *exactly* the type of thing that TiVo should be making very easy to do. TiVo can easily differentiate themselves from the "cheaper" cable company DVR by doing stuff like this; all kinds of stuff like this. Everybody should be raving about how flexible and how powerful the TiVo boxes are. But, alas, accomplishing anything that's even slightly out of the ordinary is left to third party programs and third party forums.


----------



## tjtv

After spending a few hours learning how to use svn to checkout the source, learning a bit about java, and how to compile build.xml with ant I think I found a solution that works for me. It's a piece of code that I hardcoded, since I don't have the time/skill to understand the source code to determine how the gui works and how the config file is read.

*The original piece of code in the auto_push.java file is:*
if (watching.get(videoFile).get("mtime").equals(mtime) && watching.get(videoFile).get("size").equals(size)) {
// File is not changing so push it and mark it as processed
log.print("pushing file: " + videoFile);
if( push(tivoName, share, path, videoFile) ) {
watching.get(videoFile).put("status", "pushed");
config.appendTrackingFile(share, path, file.basename(videoFile));
}
}

*I modified it to be:*
if (watching.get(videoFile).get("mtime").equals(mtime) && watching.get(videoFile).get("size").equals(size)) {
// File is not changing so push it and mark it as processed
log.print("pushing file: " + videoFile);
if( push(tivoName, share, path, videoFile) ) {
watching.get(videoFile).put("status", "pushed");
config.appendTrackingFile(share, path, file.basename(videoFile));
}
log.print("pushing file: " + videoFile);
if( push(*"Bedroom"*, share, path, videoFile) ) {
watching.get(videoFile).put("status", "pushed");
config.appendTrackingFile(share, path, file.basename(videoFile));
}
}

It's ugly, and I'm not really sure what the watching.get.... line and config.appendTrackingFile.... line really do and if I should have duplicated them, but it seems to work for me so far.

Thanks again for writing this great program, and for providing the source so that I could modify it for my needs.


----------



## robbroy

I use pytivo, streambaby and autopush on my Tivo HD.

Recently, videos in my ubuntubox autopush push folder stopped transcoding in realtime and I am rewarded with checkback in x hours box if I move to play the transcoding file. If I do a pytivo or streambaby pull from the Tivo box on the same material from the same location, however, realtime transcoding is not a problem. 

Any clues on what's going on?


----------



## Chew

Is there anyway to automatically grab metadata before auto-pushing? 

It's the only thing missing from the perfect "hands-free" pytivo set-up.


----------



## robbroy

I am trying to get the python script to work on my Debian install.

I have a low power Debian pyTivo server installed on a pogoplug and everything works fine. I can push to the tivo from my desktop and pull onto the tivo from the Debian box. I am trying to configure the auto_push.py script to work with my install. I am not using the java script because of the overhead of java.

When I run python auto_push.py, I get essentially the message quoted below by an earlier poster, so I figure I share his config problem:



orangeboy said:


> 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"


Since I am using Debian, my edits are as follows:



> # *******Adjust these as needed ******
> watchList = [
> {"tivo": "DVR 3402", "path": "//media//usb0//TV", "share": "DeBoxTV"}
> ]
> *ffmpeg = "//usr//bin//ffmpeg"*
> processedExt = ".processed"
> host = "localhost:9032"


I think I have the same problem in that the pointer to ffmpeg is incorrect. Just a different operating system.

I have tried the variations of "//" versus "/" in the path statement to point to ffmpeg at /usr/bin to no avail. I just can't get the syntax right. Can someone help?

Any help would be appreciated.


----------



## orangeboy

Are file extensions not used in Debian? That was my issue: I didn't specify ffmpeg*.exe*. How do you know what files are executable programs and what are data?


----------



## robbroy

Are file extensions not used in Debian? That was my issue: I didn't specify ffmpeg.exe. How do you know what files are executable programs and what are data?

The Debian executable is /usr/bin/ffmpeg with no .exe or any other extension. In windows I would use <path to>ffmpeg.exe

On my setup, my pyTivo.config points to /usr/bin/ffmpeg and transcodes fine.

I think my problem involves nesting "/" in the pointer to ffmpeg.


----------



## wmcbrine

File extensions are not used for executables in Debian (or Linux generally), no; and double slashes are not used for paths. The only reason backslashes are doubled is that the single backslash is the escape character; the forward slash doesn't have that problem.


----------



## orangeboy

Interesting. I've only had very limited unix exposure with IBM's z/OS Unix System Services. The folks where I worked didn't embrace the exploitation offered, so mostly I dealt with configuration stuff, such as setting up the tcpip stack, ftp daemon, and resolver parms.

Edit: I wish I still worked on a 'frame. I see this port: python-MVS. Would've been fun to play with


----------



## robbroy

When I remove all coding to the isVideo file check, autopush works for a while but then crashes out probably because of my removing the file check.

So the problem is definitely related to why auto_push.py is not reading:

ffmpeg = "/usr/bin/ffmpeg"

as the path to ffmpeg (which should be the correct syntax for the auto_push script in Debian).

Could I have a permission or ffmpeg version issue. I'm running both pytivo and auto_push.py as root on a version of ffmpeg which pytivo transcodes.


----------



## moyekj

What's the python stack trace look like exactly? i.e. post it here. If you can execute /usr/bin/ffmpeg on the command line as root and it works then I don't see any reason why python system call should fail.
Note that the isVideo check is to guard against trying to push non-video files (such as accompanying metadata files).


----------



## robbroy

Here's some more info:

When I run python auto_push.py, I get:



> [email protected]:~/autopush# python auto_push.py
> Traceback (most recent call last):
> File "auto_push.py", line 152, 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 "/usr/lib/python2.6/subprocess.py", line 623, in __init__
> errread, errwrite)
> File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
> raise child_exception
> OSError: [Errno 2] No such file or directory


My edits to auto_push.py in bold:



> EXAMPLE PYTIVO SETUP
> * In this sample script my pyTivo.conf has the video share setup to match my watchList setup:
> *[DeBoxTV]
> type=video
> path=/media/usb0/TV*
> 
> RUNNING THIS SCRIPT
> * After everything is setup make sure pyTivo is running with proper config,
> then run this script with python, such as:
> c:\Python25\python.exe auto_push.py
> """
> 
> import os
> import sys
> import urllib2
> import time
> import subprocess
> import re
> 
> # *******Adjust these as needed ******
> watchList = [
> * {"tivo": "DVR 3402", "path": "/media/usb0/TV", "share": "DeBoxTV"}
> ]
> ffmpeg = "/usr/bin/ffmpeg"*
> processedExt = ".processed"
> host = "localhost:9032"
> # Wait time in seconds for file check loop (don't set this too low!!)
> wait = 10


when I call ffmpeg, I get



> [email protected]:~/autopush# ffmpeg
> FFmpeg version SVN-r0.5.2-4:0.5.2-6, Copyright (c) 2000-2009 Fabrice Bellard, et al.
> configuration: --extra-version=4:0.5.2-6 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --extra-cflags=-marm -fPIC -DPIC --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdc1394 --enable-shared --disable-static
> libavutil 49.15. 0 / 49.15. 0
> libavcodec 52.20. 1 / 52.20. 1
> libavformat 52.31. 0 / 52.31. 0
> libavdevice 52. 1. 0 / 52. 1. 0
> libavfilter 0. 4. 0 / 0. 4. 0
> libswscale 0. 7. 1 / 0. 7. 1
> libpostproc 51. 2. 0 / 51. 2. 0
> built on Oct 5 2010 15:12:47, gcc: 4.4.5


Whereis ffmpeg results in:



> [email protected]:~/autopush# whereis ffmpeg
> ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz


I hope this helps.


----------



## robbroy

I never solved the problem with auto_push.py finding /usr/bin/ffmpeg.

I even set up a test rig, reinstalled everything from sources and reproduced the problem.

In the end I modified the script replacing the ffmpeg video check with a check for a video variable before passing the file to pyTivo:



> extList = [".avi", ".mkv"]
> 
> if not os.path.exists(entry_processed) and os.path.splitext(entry)[1] in extList:


So far it works but chokes on illegal characters which I gather is more a pyTivo issue than an auto_push issue.

I also had to rename DVR 3402 to DVR_3402 to fight off a host of other errors.


----------



## caddyroger

What entries can deleted for this to work ok.

[Admin]
tivo_mak = xxxxxxx
type = admin
togo_path = G:\FROM THE TIVO

[handlers]
keys = console,rotfile

[Server]
tivo_password = xxxxxxx
tivo_mak = xxxxxxxxxxx
ffmpeg = C:\Program Files\pyTivo\bin\ffmpeg.exe
temp = C:\Users\Public\Documents\pyTivo
tivodecode = C:\Program Files\pyTivo\bin\TIVODECODE
tdcat = C:\Program Files\pyTivo\bin\tdcat
beacon = xxxxxxxxxxxx
togo_path = G:\FROM THE TIVO
tivo_username = xxxxxxxxxxxxxxxxxxxxx
port =9032

[formatter_basicform]
format = %(asctime)s %(levelname)-5s %(name)s: %(message)s

[handler_rotfile]
formatter = basicform
class = handlers.RotatingFileHandler
args = ('C:\Users\Public\Documents\pyTivo\debug.log', 'a', 10485760, 5)

[_tivo_HD]
def ishdtivo(tsn) = # tsn's of High Definition Tivo's
return bool(tsn and tsn[:3] in ['648', '652', '658', '663', '748', '746'])

[logger_root]
handlers = console,rotfile
level = DEBUG

[formatters]
keys = basicform


----------



## johnjay829

i'm getting double entries in the auto push txt file sending the video twice to my tivo. in the folder i'm saving the video file and a metadata file with the same name with.txt. example is:

Movie.avi
Movie.avi.txt

update: tried just saving only an .avi file in the autopush folder still getting double entries in the txt file and on the tivo


----------



## jcncamsdad

I have two Tivos and I am running Pytivo and Kmttg with no problems. I am trying to setup Auto Push, but it will not show my Tivos in the Tivo window. I can push through the web page and kmttg. What have I done wrong?


----------



## johnjay829

jcncamsdad said:


> I have two Tivos and I am running Pytivo and Kmttg with no problems. I am trying to setup Auto Push, but it will not show my Tivos in the Tivo window. I can push through the web page and kmttg. What have I done wrong?


Do you have the pytivo conf file mapped correctly in the autopush.jar


----------



## jcncamsdad

Probably not. The .jar file sees the shares, but I did not touch the pytivo.conf file.


----------



## caddyroger

jcncamsdad said:


> I have two Tivos and I am running Pytivo and Kmttg with no problems. I am trying to setup Auto Push, but it will not show my Tivos in the Tivo window. I can push through the web page and kmttg. What have I done wrong?


Restart your Tvos. Usually that what I have to do


----------



## jcncamsdad

caddyroger said:


> Restart your Tvos. Usually that what I have to do


Nope, that didn't work.


----------



## dcrowell77

I noticed that I haven't gotten any new trailers in awhile so I tried adjusting the feedURL like below and things seem to be chugging along again.

#feedURL = "http://www.hd-trailers.net/blog/feed/"
feedURL = "http://feeds.hd-trailers.net/hd-trailers"

Anyone know what changed?


----------



## Chuppa

Hi Guys,

How can I 'easily' get auto-push to run at login on a Mac in the background?

I keep running into issues with the command "auto_push -b &"


----------



## alton987

tjtv said:


> After spending a few hours learning how to use svn to checkout the source, learning a bit about java, and how to compile build.xml with ant I think I found a solution that works for me. It's a piece of code that I hardcoded, since I don't have the time/skill to understand the source code to determine how the gui works and how the config file is read.
> 
> *The original piece of code in the auto_push.java file is:*
> if (watching.get(videoFile).get("mtime").equals(mtime) && watching.get(videoFile).get("size").equals(size)) {
> // File is not changing so push it and mark it as processed
> log.print("pushing file: " + videoFile);
> if( push(tivoName, share, path, videoFile) ) {
> watching.get(videoFile).put("status", "pushed");
> config.appendTrackingFile(share, path, file.basename(videoFile));
> }
> }
> 
> *I modified it to be:*
> if (watching.get(videoFile).get("mtime").equals(mtime) && watching.get(videoFile).get("size").equals(size)) {
> // File is not changing so push it and mark it as processed
> log.print("pushing file: " + videoFile);
> if( push(tivoName, share, path, videoFile) ) {
> watching.get(videoFile).put("status", "pushed");
> config.appendTrackingFile(share, path, file.basename(videoFile));
> }
> log.print("pushing file: " + videoFile);
> if( push(*"Bedroom"*, share, path, videoFile) ) {
> watching.get(videoFile).put("status", "pushed");
> config.appendTrackingFile(share, path, file.basename(videoFile));
> }
> }
> 
> It's ugly, and I'm not really sure what the watching.get.... line and config.appendTrackingFile.... line really do and if I should have duplicated them, but it seems to work for me so far.
> 
> Thanks again for writing this great program, and for providing the source so that I could modify it for my needs.


Could someone help me understand how to do this? Ialso want autopush on 2 tivos


----------



## innocentfreak

Is there anyway with autopush to monitor a specific folder in the shares? I don't want the whole share monitored but just a few specific folders.


----------



## ebf

Make a new share for sub-folder and hide it from all the TiVos to avoid on-TV confusion.


----------



## Bobot

For the last week or so, autopush via pyTivo has been pushing every podcast to my Tivo twice. The autopush log shows it checking each video, and then shows it pushing each video multiple times. It is not respecting the auto_push.txt file.

I have rebooted the Tivo several times, rebooted the machine running the autopush service, checked the parameters, deleted the auto_push.txt file, etc all in attempts to fix this.

What else do I need to investigate to stop this behavior? Is there a better method I should be using to monitor a folder of videos and push them automatically to the Tivo?


----------



## Shelbrain

PyTivo is working properly and I am trying to set up the auto push function. I have downloaded the autopush program and it is placed in C:\Program Files\autopush. I open the program, find my pytivo.conf file, choose my shares and when I go to save the autopush conf file, I get this:

Problem writing to config file: C:\Program Files\autopush\config.ini
java.io.FileNotFoundException: C:\Program Files\autopush\config.ini (Access is denied)

Any ideas? Thanks in advance!
Does any one think I could edit the .conf program directly and avoid the GUI? 
Could someone post their sample autopush conf file for me to examine?


----------



## lrhorer

Shelbrain said:


> I open the program, find my pytivo.conf file, choose my shares and when I go to save the autopush conf file, I get this:
> 
> Problem writing to config file: C:\Program Files\autopush\config.ini
> java.io.FileNotFoundException: C:\Program Files\autopush\config.ini (Access is denied)


'Sounds like you are running Windows, in particular Windows 7.



Shelbrain said:


> Any ideas?


Yeah. Don't run Windows, especially not Windows 7. Alternately, you could put pyTivo, or at least its config file, somewhere besides Program Files.



Shelbrain said:


> Does any one think I could edit the .conf program directly and avoid the GUI?


Yes, running as Admin, I think, may work. Certainly there is no requirement that the web utility do the work.


----------



## Aero 1

installed autopush v01.d, browsed the pytivo.conf file, it saw my shares, but it wont autopush. getting the following error:



> Processing...
> Cannot run program "/usr/bin/ffmpeg": CreateProcess error=2, The system cannot find the file specified


help! any ideas? thanks.

standalone pytivo push works fine, kmttg pytivo push works also, just not auto push.

p.s. this is under windows 7 x64.


----------



## RJV

I'm having the same symptoms, in the same environment and circumstances, as Aero 1 in the previous post. Any ideas?

edit: I fibbed...I am not using kmttg.


----------



## plpmke

Sorry if this sounds like a noob question, but how do I get auto_push to run as a background job on OS X at login? I can get auto_push to run perfectly fine as graphical job at boot via adding it to my Login Items, and a couple of years ago I was able to get it to run as a background job when I was doing some testing (didnt suit my purposes at the time so I disabled it). For the life of me, I cannot get it to run as a background job for me on my new media server, no matter what I do! Im pretty sure I used the -b & command from Terminal previously (as stated on the Code wiki)...Thinking about it, I may have created an Application via Automator to run the Terminal commands via a shell script. Does it seem like I am on the right track here? Any specifics or suggestions? Thanks.


----------



## mystic1muse

Is Pytivo Auto Push still functional? I set everything up and it appears to be working from the display I see "Watching" and the file that I just put in the directory where transfers should occur; then it says "pushing" that file; and the right address of my Tivo where it is suppose to be pushing to. BUT

... no transfers are made to the Tivo.

No error messages.


----------

