I’m trying to rewrite the tivo channel to remove the dependencies on OSX specific code. I’d like to make it cross platform (since my PMS is windows based) before I make any other tweaks. the current plugin uses OSX binaries for tivo discovery and browsing. I decided to use pybonjour instead (http://code.google.com/p/pybonjour/).
I've also included the pybonjour.py file in Contents/Libraries/Shared/. But I get the following error in the tivo plugin log:
2012-01-12 17:00:12,671 (1788) : CRITICAL (core:315) - Exception starting plug-in (most recent call last):<br />
File "C:\Users\Matt\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\core.py", line 441, in start<br />
self.host.execute(self.init_code)<br />
File "C:\Users\Matt\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\code.py", line 652, in execute<br />
exec(code) in self.environment<br />
File "C:\Users\Matt\AppData\Local\Plex Media Server\Plug-ins\TiVo.bundle\Contents\Code\__init__.py", line 12, in <module><br />
import pybonjour<br />
File "C:\Users\Matt\AppData\Local\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\code.py", line 712, in __import__<br />
raise e<br />
IOError: [Errno 9] Bad file descriptor
I can't figure out what I am missing. The weird thing is that I could swear this code was working before. I originally started working on this last year, but got side tracked by other projects. I could swear I had the pybonjour code working, but now I can't figure out why it isn't working. Any help/insight would be appreciated.
I don’t know what happened, but it started working. I had to restart Plex for another reason and after that the pybonjour file seems to load fine. I’m in the process of ironing out a few minor things and hopefully I will post a beta soon.
On the topic of getting it to work remotely, I’ve been looking into this. I don’t think the issue is only that the plugin creates its own web proxy service to pipe the content through tivodecode. I think the issue is that when viewed remotely Plex seems to want to transcode the video and the transcoder bails when it can’t figure out the duration of the mpeg2 pipe. If I manually download the file and transcode it then ffmpeg can figure out the duration. However, if I replicate the curl → tivodecode → ffmpeg command line as the plugin constructs it then ffmpeg fails to figure out the duration.
When played locally the file does not seem to be transcoded.
I’m trying to find more information on what options Plex is handing to ffmpeg during transcode and why it is so dependent on the duration.
I’m happy to test your beta on a Mac when you are ready.
While it does give an error when it tries to determine file size, I don't think that error is causing the issue. I think the issue is that it requests file twice, once to determine size, and once to actually transcode. The problem is that by requesting the url, it kicks off the fetch from the tivo and tivodecode processes. Those processes aren't killed immediately after the first request, so they are still running when the 2nd request comes along. Since the Tivo will only allow one file transferring at a time, this causes a problem with the 2nd request.
Note that those observations are based on my updated code that uses python for fetching (instead of curl) and uses the updated Plex Framework for threading. So it is possible that the symptoms I am seeing are due to my changes. I'm looking into finding out how to better kill the fetching and processing threads.
If that’s the case then it seems like the correct solution would be to tee the pipe after the tivodecode and write it to a file as well. The 2nd request can be fed from the file instead of requesting it from the TiVo again.
Though, I seem to recall replacing the fetch from the TiVo with just a local file and having it not work as well. I’ll test that again to make sure.
Update: I tested this again. I downloaded a .tivo file from the TiVo and converted it to a .mpeg using tivodecode. Then I modified the plugin to open the local file instead of constructing the full pipeline. This test fails in exactly the same way as the regular version.