 |
pyTivo Discussion Forum Answers and the development of pyTivo a TiVo transcoding server
|
|
| Author |
Message |
dlfl
Joined: 05 Jan 2008 Posts: 337 Location: Near Dayton, Ohio
|
Posted: Thu May 24, 2012 6:47 pm Post subject: |
|
|
42 min transfer still failed with the same error message in To Do/History. The pyTivo command window messages for start and finish of the transfer were:
| Code: | INFO:pyTivo:192.168.0.100 [24/May/2012 13:51:25] "GET /Internet%20Tv%20-%20Playo
n/id%3Dprojectfreetv.lua-195/1-projectfreetv.lua-195.mpg HTTP/1.1" 302 -
redirecting tohttp://192.168.0.224:63478/projectfreetv.lua-195/1-projectfreetv.l
ua-195.mpg
INFO:pyTivo:192.168.0.100 [24/May/2012 14:33:00] "GET /Internet%20Tv%20-%20Playo
n/id%3Dprojectfreetv.lua-195/1-projectfreetv.lua-195.mpg HTTP/1.1" 302 -
redirecting tohttp://192.168.0.224:63478/projectfreetv.lua-195/1-projectfreetv.l
ua-195.mpg |
My next hunch is the problem is the duration estimate is too large, so TiVo thinks the transfer was truncated and is asking pyTivo for more. Thus I'm going to try trimming the duration estimate down a little instead of bumping it up.
EDIT: Well that hunch was wrong. Same failure -- same message in To Do/History and same two INFO messages in pyTivo command window. _________________ TiVo HD, Win 7 64bit, Wired Ethernet
Try metagenerator 3 and pyTivoMetaGen
VideoReDo users: try VAP |
|
| Back to top |
|
 |
wmcbrine

Joined: 04 Jan 2008 Posts: 2008 Location: Maryland
|
Posted: Thu May 24, 2012 8:22 pm Post subject: |
|
|
The TiVo expects either a "Content-Length:" header or "Transfer-Encoding: chunked". When it doesn't get either of these, that's when it makes a double request. (The second request has a "Range" header that says to start where the file left off in the first transfer -- i.e. after the end.) _________________ My pyTivo fork . My page |
|
| Back to top |
|
 |
dlfl
Joined: 05 Jan 2008 Posts: 337 Location: Near Dayton, Ohio
|
Posted: Thu May 24, 2012 10:44 pm Post subject: |
|
|
It appears the PlayOn plugin just redirects the Tivo request to the Playon Server with the following code:
| Code: | def send_file(self, handler, container, name):
# The playon server sends tivo compatible files, so just redirect there
path = unquote(container)
path = path.replace('\\','/')
path = path.replace('http:/','http://')
path = path.replace('id=','')
path = path.replace('localhost',socket.gethostbyname(socket.gethostname()))
path = path.replace(':54479',':63478')
handler.send_response(302)
handler.send_header('Location',path)
print "redirecting to" + path
handler.end_headers()
return |
I'm assuming that preventing the second Tivo request isn't going to be as simple as just inserting:
handler.send_header('Transfer-Encoding', 'chunked')
in the above code sequence. Correct? Obviously the required header isn't sent by the PlayOn server with the video data. Could the second request from the Tivo be intercepted by detecting "Range" in the header and the TiVo sent back some kind of response that would tell it the file is done transferring so be happy? _________________ TiVo HD, Win 7 64bit, Wired Ethernet
Try metagenerator 3 and pyTivoMetaGen
VideoReDo users: try VAP |
|
| Back to top |
|
 |
HeatherABC
Joined: 25 May 2012 Posts: 10
|
Posted: Fri May 25, 2012 12:34 am Post subject: |
|
|
Hi everyone! I'm new here and new to pyTiVo. I'm having an issue and hope you can help.
I installed this version of pyTiVo tonight and was able to get playon working perfectly. However, I am running into problems with transfering movies from my Win7 PC to the TiVo Premiere. I get a minute or three and then the blue light goes out and the transfer stops. Does anyone have any advice? I'd like to keep this installation because of the playon plugin but will go install another installation of pyTiVo if I must.
Thanks!
EDIT:
When I try to push a movie to my TiVo I get this error log:
<urlopen error (-1, 'SSL handshake exception')>
Traceback (most recent call last):
File "C:\Users\Familyroom\AppData\Roaming\pyTivo\plugins\video\video.py", line 448, in Push
m.pushVideo(
File "C:\Users\Familyroom\AppData\Roaming\pyTivo\pytivo.jar\Lib\mind.py", line 46, in pushVideo
pc_body_id = self.__pcBodySearch()
File "C:\Users\Familyroom\AppData\Roaming\pyTivo\pytivo.jar\Lib\mind.py", line 217, in _Mind__pcBodySearch
xml = self.__dict_request({}, 'pcBodySearch')
File "C:\Users\Familyroom\AppData\Roaming\pyTivo\pytivo.jar\Lib\mind.py", line 174, in _Mind__dict_request
result = self.__opener.open(r)
File "C:\Users\Familyroom\AppData\Roaming\pyTivo\pytivo.jar\Lib\urllib2.py", line 381, in open
response = self._open(req, data)
File "C:\Users\Familyroom\AppData\Roaming\pyTivo\pytivo.jar\Lib\urllib2.py", line 398, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "C:\Users\Familyroom\AppData\Roaming\pyTivo\pytivo.jar\Lib\urllib2.py", line 360, in _call_chain
result = func(*args)
File "C:\Users\Familyroom\AppData\Roaming\pyTivo\pytivo.jar\Lib\urllib2.py", line 1115, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "C:\Users\Familyroom\AppData\Roaming\pyTivo\pytivo.jar\Lib\urllib2.py", line 1082, in do_open
raise URLError(err)
URLError: <urlopen error (-1, 'SSL handshake exception')>
It's all Greek to me, but maybe it can help someone help me figure out what's wrong with my setup.
EDIT: I was successfully able to pull a video from the TiVo. Not sure if that plays into this in any way but thought I'd put it out there.  |
|
| Back to top |
|
 |
jkasyan
Joined: 25 Nov 2010 Posts: 26
|
Posted: Fri May 25, 2012 5:00 am Post subject: |
|
|
Interesting stuff going on!
I've asked my wife about this, and she says that if she's not watching them immediately, that they've never saved on the tivo! She says it's no biggie for her, but it would annoy the heck out of me.
I just added a line:
handler.send_header('Transfer-Encoding','chunked')
after the line
handler.send_header('Location',path)
and quickly tried downloading a few things from hulu. They all stuck around... don't know if that's going to be 100%, but it's promising.
The version of ffmpeg will have zero effect on the playon plugin. As you've seen, it just redirects to playon. I'm surprised that the headers before redirect are even honored.
As far as your urlerror HeatherABC, i'm not sure what to tell you yet. I remember encountering the problem and putting some code in togo.py to work around it. Are you using just my install? Can you look into your togo.py file to confirm there's a line saying "def trust_all_certificates(f):" Your problem is with java wanting to verify a certificate, but python not caring... or something. Never quite understood what the deal was there myself. If you tried to merge my install with other, more updated plugins, then that would be a problem.
I found the code that i copied into togo.py from http://tech.pedersen-live.com/2010/10/trusting-all-certificates-in-jython/ I'm documenting here for my own benefit, as I kept notes on none of this.
I'm going to set up togo again, and see if i have the same issue. Haven't tried pushing in ages. I'll let you know in a day or so. |
|
| Back to top |
|
 |
HeatherABC
Joined: 25 May 2012 Posts: 10
|
Posted: Fri May 25, 2012 12:39 pm Post subject: |
|
|
jkasyan
Thanks for getting back to me. Here's what's in my togo.py
| Code: | import cookielib
import logging
import os
import subprocess
import thread
import time
import sys
import urllib2
import urlparse
from urllib import quote, unquote
from xml.dom import minidom
from xml.sax.saxutils import escape
from Cheetah.Template import Template
import config
import metadata
from plugin import EncodeUnicode, Plugin
logger = logging.getLogger('pyTivo.togo')
tag_data = metadata.tag_data
SCRIPTDIR = os.path.dirname(__file__)
CLASS_NAME = 'ToGo'
# Some error/status message templates
MISSING = """<h3>Missing Data</h3> <p>You must set both "tivo_mak" and
"togo_path" before using this function.</p>"""
TRANS_QUEUE = """<h3>Queued for Transfer</h3> <p>%s</p> <p>queued for
transfer to:</p> <p>%s</p>"""
TRANS_STOP = """<h3>Transfer Stopped</h3> <p>Your transfer of:</p>
<p>%s</p> <p>has been stopped.</p>"""
UNQUEUE = """<h3>Removed from Queue</h3> <p>%s</p> <p>has been removed
from the queue.</p>"""
UNABLE = """<h3>Unable to Connect to TiVo</h3> <p>pyTivo was unable to
connect to the TiVo at %s.</p> <p>This is most likely caused by an
incorrect Media Access Key. Please return to the Web Configuration page
and double check your <b>tivo_mak</b> setting.</p>"""
# Preload the templates
tnname = os.path.join(SCRIPTDIR, 'templates', 'npl.tmpl')
NPL_TEMPLATE = file(tnname, 'rb').read()
status = {} # Global variable to control download threads
tivo_cache = {} # Cache of TiVo NPL
queue = {} # Recordings to download -- list per TiVo
basic_meta = {} # Data from NPL, parsed, indexed by progam URL
auth_handler = urllib2.HTTPDigestAuthHandler()
cj = cookielib.LWPCookieJar()
tivo_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj),
auth_handler)
# Check if running in Jython
if 'java' in sys.platform:
from javax.net.ssl import TrustManager, X509TrustManager
from jarray import array
from javax.net.ssl import SSLContext
class TrustAllX509TrustManager(X509TrustManager):
def checkClientTrusted(self, chain, auth):
pass
def checkServerTrusted(self, chain, auth):
pass
def getAcceptedIssuers(self):
return None
# Create a static reference to an SSLContext which will use
# our custom TrustManager
trust_managers = array([TrustAllX509TrustManager()], TrustManager)
TRUST_ALL_CONTEXT = SSLContext.getInstance("SSL")
TRUST_ALL_CONTEXT.init(None, trust_managers, None)
# Keep a static reference to the JVM's default SSLContext for restoring
# at a later time
DEFAULT_CONTEXT = SSLContext.getDefault()
def trust_all_certificates(f):
'''Decorator function that will make it so the context of the decorated method
will run with our TrustManager that accepts all certificates'''
def wrapped(*args, **kwargs):
# Only do this if running under Jython
if 'java' in sys.platform:
from javax.net.ssl import SSLContext
SSLContext.setDefault(TRUST_ALL_CONTEXT)
try:
res = f(*args, **kwargs)
return res
finally:
SSLContext.setDefault(DEFAULT_CONTEXT)
else:
return f(*args, **kwargs)
return wrapped
class ToGo(Plugin):
CONTENT_TYPE = 'text/html'
def tivo_open(self, url):
# Loop just in case we get a server busy message
while True:
try:
# Open the URL using our authentication/cookie opener
return tivo_opener.open(url)
# Do a retry if the TiVo responds that the server is busy
except urllib2.HTTPError, e:
if e.code == 503:
time.sleep(5)
continue
# Throw the error otherwise
raise
@trust_all_certificates
def NPL(self, handler, query):
global basic_meta
shows_per_page = 50 # Change this to alter the number of shows returned
cname = query['Container'][0].split('/')[0]
folder = ''
tivo_mak = config.get_server('tivo_mak')
has_tivodecode = bool(config.get_bin('tivodecode'))
if 'TiVo' in query:
tivoIP = query['TiVo'][0]
tivos_by_ip = dict([(value, key)
for key, value in config.tivos.items()])
tivo_name = config.tivo_names[tivos_by_ip[tivoIP]]
theurl = ('https://' + tivoIP +
'/TiVoConnect?Command=QueryContainer&ItemCount=' +
str(shows_per_page) + '&Container=/NowPlaying')
if 'Folder' in query:
folder += query['Folder'][0]
theurl += '/' + folder
if 'AnchorItem' in query:
theurl += '&AnchorItem=' + quote(query['AnchorItem'][0])
if 'AnchorOffset' in query:
theurl += '&AnchorOffset=' + query['AnchorOffset'][0]
if (theurl not in tivo_cache or
(time.time() - tivo_cache[theurl]['thepage_time']) >= 60):
# if page is not cached or old then retreive it
auth_handler.add_password('TiVo DVR', tivoIP, 'tivo', tivo_mak)
try:
page = self.tivo_open(theurl)
except IOError, e:
print 'could not retrieve ' + theurl
print e.reason
handler.redir(UNABLE % tivoIP, 10)
return
tivo_cache[theurl] = {'thepage': minidom.parse(page),
'thepage_time': time.time()}
page.close()
xmldoc = tivo_cache[theurl]['thepage']
items = xmldoc.getElementsByTagName('Item')
TotalItems = tag_data(xmldoc, 'Details/TotalItems')
ItemStart = tag_data(xmldoc, 'ItemStart')
ItemCount = tag_data(xmldoc, 'ItemCount')
FirstAnchor = tag_data(items[0], 'Links/Content/Url')
data = []
for item in items:
entry = {}
entry['ContentType'] = tag_data(item, 'ContentType')
for tag in ('CopyProtected', 'UniqueId'):
value = tag_data(item, tag)
if value:
entry[tag] = value
if entry['ContentType'] == 'x-tivo-container/folder':
entry['Title'] = tag_data(item, 'Title')
entry['TotalItems'] = tag_data(item, 'TotalItems')
lc = tag_data(item, 'LastCaptureDate')
if not lc:
lc = tag_data(item, 'LastChangeDate')
entry['LastChangeDate'] = time.strftime('%b %d, %Y',
time.localtime(int(lc, 16)))
else:
keys = {'Icon': 'Links/CustomIcon/Url',
'Url': 'Links/Content/Url',
'SourceSize': 'Details/SourceSize',
'Duration': 'Details/Duration',
'CaptureDate': 'Details/CaptureDate'}
for key in keys:
value = tag_data(item, keys[key])
if value:
entry[key] = value
entry['SourceSize'] = ( '%.3f GB' %
(float(entry['SourceSize']) / (1024 ** 3)) )
dur = int(entry['Duration']) / 1000
entry['Duration'] = ( '%02d:%02d:%02d' %
(dur / 3600, (dur % 3600) / 60, dur % 60) )
entry['CaptureDate'] = time.strftime('%b %d, %Y',
time.localtime(int(entry['CaptureDate'], 16)))
url = entry['Url']
if url in basic_meta:
entry.update(basic_meta[url])
else:
basic_data = metadata.from_container(item)
entry.update(basic_data)
basic_meta[url] = basic_data
data.append(entry)
else:
data = []
tivoIP = ''
TotalItems = 0
ItemStart = 0
ItemCount = 0
FirstAnchor = ''
cname = query['Container'][0].split('/')[0]
t = Template(NPL_TEMPLATE, filter=EncodeUnicode)
t.escape = escape
t.quote = quote
t.folder = folder
t.status = status
if tivoIP in queue:
t.queue = queue[tivoIP]
t.has_tivodecode = has_tivodecode
t.tname = tivo_name
t.tivoIP = tivoIP
t.container = cname
t.data = data
t.len = len
t.TotalItems = int(TotalItems)
t.ItemStart = int(ItemStart)
t.ItemCount = int(ItemCount)
t.FirstAnchor = quote(FirstAnchor)
t.shows_per_page = shows_per_page
handler.send_response(200)
handler.send_header('Content-Type', 'text/html; charset=utf-8')
handler.send_header('Refresh', '300')
handler.send_header('Expires', '0')
handler.end_headers()
handler.wfile.write(t)
def get_tivo_file(self, tivoIP, url, mak, togo_path):
# global status
status[url].update({'running': True, 'queued': False})
parse_url = urlparse.urlparse(url)
name = unquote(parse_url[2])[10:].split('.')
id = unquote(parse_url[4]).split('id=')[1]
name.insert(-1, ' - ' + id + '.')
if status[url]['decode']:
name[-1] = 'mpg'
outfile = os.path.join(togo_path, ''.join(name))
if status[url]['save']:
meta = basic_meta[url]
details_url = 'https://%s/TiVoVideoDetails?id=%s' % (tivoIP, id)
try:
handle = self.tivo_open(details_url)
meta.update(metadata.from_details(handle))
handle.close()
except:
pass
metafile = open(outfile + '.txt', 'w')
metadata.dump(metafile, meta)
metafile.close()
auth_handler.add_password('TiVo DVR', parse_url[1], 'tivo', mak)
try:
handle = self.tivo_open(url)
except IOError, e:
status[url]['running'] = False
status[url]['error'] = e.code
return
tivos_by_ip = dict([(value, key)
for key, value in config.tivos.items()])
tivo_name = config.tivo_names[tivos_by_ip[tivoIP]]
logger.info('[%s] Start getting "%s" from %s' %
(time.strftime('%d/%b/%Y %H:%M:%S'), outfile, tivo_name))
if status[url]['decode']:
tivodecode_path = config.get_bin('tivodecode')
tcmd = [tivodecode_path, '-m', mak, '-o', outfile, '-']
tivodecode = subprocess.Popen(tcmd, stdin=subprocess.PIPE,
bufsize=(512 * 1024))
f = tivodecode.stdin
else:
f = open(outfile, 'wb')
length = 0
start_time = time.time()
last_interval = start_time
try:
while status[url]['running']:
output = handle.read(1024000)
if not output:
break
length += len(output)
f.write(output)
now = time.time()
elapsed = now - last_interval
if elapsed >= 5:
status[url]['rate'] = '%.2f Mb/s' % (length * 8.0 /
(elapsed * 1024 * 1024))
status[url]['size'] += length
length = 0
last_interval = now
if status[url]['running']:
status[url]['finished'] = True
except Exception, msg:
logger.info(msg)
handle.close()
f.close()
status[url]['size'] += length
if status[url]['running']:
mega_elapsed = (now - start_time) * 1024 * 1024
if mega_elapsed < 1:
mega_elapsed = 1
size = status[url]['size']
rate = size * 8.0 / mega_elapsed
logger.info('[%s] Done getting "%s" from %s, %d bytes, %.2f Mb/s' %
(time.strftime('%d/%b/%Y %H:%M:%S'), outfile,
tivo_name, size, rate))
status[url]['running'] = False
else:
os.remove(outfile)
if status[url]['save']:
os.remove(outfile + '.txt')
logger.info('[%s] Transfer of "%s" from %s aborted' %
(time.strftime('%d/%b/%Y %H:%M:%S'), outfile,
tivo_name))
del status[url]
def process_queue(self, tivoIP, mak, togo_path):
while queue[tivoIP]:
time.sleep(5)
url = queue[tivoIP][0]
self.get_tivo_file(tivoIP, url, mak, togo_path)
queue[tivoIP].pop(0)
del queue[tivoIP]
def ToGo(self, handler, query):
tivo_mak = config.get_server('tivo_mak')
togo_path = config.get_server('togo_path')
for name, data in config.getShares():
if togo_path == name:
togo_path = data.get('path')
if tivo_mak and togo_path:
tivoIP = query['TiVo'][0]
urls = query.get('Url', [])
decode = 'decode' in query
save = 'save' in query
for theurl in urls:
status[theurl] = {'running': False, 'error': '', 'rate': '',
'queued': True, 'size': 0, 'finished': False,
'decode': decode, 'save': save}
if tivoIP in queue:
queue[tivoIP].append(theurl)
else:
queue[tivoIP] = [theurl]
thread.start_new_thread(ToGo.process_queue,
(self, tivoIP, tivo_mak, togo_path))
logger.info('[%s] Queued "%s" for transfer to %s' %
(time.strftime('%d/%b/%Y %H:%M:%S'),
unquote(theurl), togo_path))
urlstring = '<br>'.join([unquote(x) for x in urls])
message = TRANS_QUEUE % (urlstring, togo_path)
else:
message = MISSING
handler.redir(message, 5)
def ToGoStop(self, handler, query):
theurl = query['Url'][0]
status[theurl]['running'] = False
handler.redir(TRANS_STOP % unquote(theurl))
def Unqueue(self, handler, query):
theurl = query['Url'][0]
tivoIP = query['TiVo'][0]
del status[theurl]
queue[tivoIP].remove(theurl)
logger.info('[%s] Removed "%s" from queue' %
(time.strftime('%d/%b/%Y %H:%M:%S'),
unquote(theurl)))
handler.redir(UNQUEUE % unquote(theurl))
|
The line you are looking for is in there. Do you have any other thoughts? I have only your install installed. I'll wait to hear from you before I mess around because I know enough to install, not enough to understand the code.
BTW do you think the problem with trying to send video to my TiVo from the PC is the same issue causing my TiVo not being able to complete a transfer of video from the PC when initiated on the TiVo? Or is this two issues I'm dealing with?
Thanks for your help. I really appreciate it. |
|
| Back to top |
|
 |
jkasyan
Joined: 25 Nov 2010 Posts: 26
|
Posted: Fri May 25, 2012 4:33 pm Post subject: |
|
|
| I've uploaded a new version to the googlecode page. Try uninstalling the older version first, and try the new one out. Please let me know how it goes. |
|
| Back to top |
|
 |
dlfl
Joined: 05 Jan 2008 Posts: 337 Location: Near Dayton, Ohio
|
Posted: Fri May 25, 2012 7:26 pm Post subject: |
|
|
| jkasyan wrote: | I've uploaded a new version to the googlecode page. Try uninstalling the older version first, and try the new one out. Please let me know how it goes. |
OK:
The push pages show up fine in the web interface and appear to go through the normal steps when a push is attempted. However I haven't been able to successfully push a video.
When a PlayOn video push is attempted the TiVo todo/history says the download failed because "the download type was not supported".
For normal videos shares (files on the PC) it says "because there was an error in the download'. I tried .mp4, .m4v and .mpg files, all of which I know will push in other versions of pyTiVo.
As a sanity check, since it's been a long time since I did any "pushing", I tried pushing the same files with the latest W. McBrine pyTivo. The files pushed OK. The result for a PlayOn video was the same as with your distribution (unsupported download type). (I have added your PlayOn plugin to my W. McBrine pyTivo).
I don't know if your intent is to be able to push PlayOn videos, but since they show up on the push menu I tried them.
Am I correct that this latest installer is not based on the trunk code in your Google code repository? The latest revision I see is r12 dated 10 months ago. _________________ TiVo HD, Win 7 64bit, Wired Ethernet
Try metagenerator 3 and pyTivoMetaGen
VideoReDo users: try VAP |
|
| Back to top |
|
 |
HeatherABC
Joined: 25 May 2012 Posts: 10
|
Posted: Fri May 25, 2012 7:53 pm Post subject: |
|
|
| jkasyan wrote: | I've uploaded a new version to the googlecode page. Try uninstalling the older version first, and try the new one out. Please let me know how it goes. |
Thanks! That works better. I don't get an error now however, I now have the same situation as I do when trying to bring a movie from my PC to the TiVo via the TiVo. I get the blue light for a few minutes, it goes off and when I choose the movie from the menu it says it's been removed. I have also only managed to get this far one time... the first time I tried. All additional times I get this far:
Queued for Push to Main Room
\80's & Classics\Strange Brew [1983].mpg
The page will reload in 5 seconds.
And nothing further happens.
Thanks again for all your help. If I can get away from having to use Media Center or GTV in my main viewing room I will be a happy girl!
-Heather |
|
| Back to top |
|
 |
jkasyan
Joined: 25 Nov 2010 Posts: 26
|
Posted: Fri May 25, 2012 8:09 pm Post subject: |
|
|
Very odd. I can push both local files and playon files with my install. I've sent to a series 2 and series 3 without issue. I only had the windows sample file sitting around, but there were galloping horses transfered over.
Maybe it's time to rebuild this from scratch, as all of the tools have evolved substantially in the past year and a half. I don't want to be diagnosing issues wmcbrine fixed ages ago. |
|
| Back to top |
|
 |
HeatherABC
Joined: 25 May 2012 Posts: 10
|
|
| Back to top |
|
 |
jkasyan
Joined: 25 Nov 2010 Posts: 26
|
Posted: Fri May 25, 2012 11:23 pm Post subject: |
|
|
Well, i'd been interested in one particular change in wmcbrine's fork (NFO files), so i'm updating it for me too now.
I've uploaded a NEW new version which i've taken the latest wmcbrine fork and ffmpeg and added my bits to it.
I did some light testing by pushing a local video (wmv) and a playon video. Please uninstall and try again. If it still fails, post your error logs. |
|
| Back to top |
|
 |
dlfl
Joined: 05 Jan 2008 Posts: 337 Location: Near Dayton, Ohio
|
Posted: Fri May 25, 2012 11:33 pm Post subject: |
|
|
| jkasyan wrote: | ...........
I just added a line:
handler.send_header('Transfer-Encoding','chunked')
after the line
handler.send_header('Location',path)
and quickly tried downloading a few things from hulu. They all stuck around... don't know if that's going to be 100%, but it's promising.
.............. |
I've made that change also and have been testing the effects of changing the bitrate used to estimate size, e.g., this line in playon.py
video['size'] = int(video['duration']) * 546720
Muliplying by 8 bits/Byte, that constant corresponds to 4.37 Mbps. I don't know how you chose that number but it looks like a good one. I've calculated the overall bitrates for several videos of different sizes transferred from PlayOn (using the duration and disk space displayed by TiVo) and it always comes out just under that number.
I've tried making that number much larger (smaller), so the size estimate given to Tivo is much too large (small) compared to the actual size. When the number was too small the transfer failed and the error reported was that the file size was too large. When the number was way too large there was no apparent ill effect. However I believe this size estimate is used by TiVo to delete files on the drive to make room for the new file, and obviously if you overestimate size by huge amounts you force excessive deletions of existing recordings.
My preference is to increase that number by about 2% to provide a little safety margin without any significant penalty in deletion of existing recordings, e.g.:
546720 --> 557654
I've also noticed that occasionally the duration reported by PlayOn is way off. Probably not much one can do about that except take notice of the run time displayed just before you click to start the transfer. If it's obviously way off, and there are other sites available for the video you're after, you can select another site.
As I indicated in an earlier post, I'm pleasantly surprised that just adding that header item is enough to solve the failed transfer problem. In fact I had already developed another solution that involved detecting the queries with non-zero Range values in the header and replying (without redirecting) with a 206 response -- which works very well. This is done in Video.py and the concept is discussed by K.R. Keegan in a blog here:
http://www.krkeegan.com/pytivo-end-transfer/
However, so far at least, it looks like adding just the one header item and avoiding grossly underestimating size does the trick. _________________ TiVo HD, Win 7 64bit, Wired Ethernet
Try metagenerator 3 and pyTivoMetaGen
VideoReDo users: try VAP |
|
| Back to top |
|
 |
dlfl
Joined: 05 Jan 2008 Posts: 337 Location: Near Dayton, Ohio
|
Posted: Fri May 25, 2012 11:35 pm Post subject: |
|
|
| jkasyan wrote: | Well, i'd been interested in one particular change in wmcbrine's fork (NFO files), so i'm updating it for me too now.
I've uploaded a NEW new version which i've taken the latest wmcbrine fork and ffmpeg and added my bits to it.
I did some light testing by pushing a local video (wmv) and a playon video. Please uninstall and try again. If it still fails, post your error logs. |
Where are the error logs found? Does it take a line in pytivo.conf to turn them on?
Also: did you include the additional header item in this build?
(handler.send_header('Transfer-Encoding','chunked')) _________________ TiVo HD, Win 7 64bit, Wired Ethernet
Try metagenerator 3 and pyTivoMetaGen
VideoReDo users: try VAP |
|
| Back to top |
|
 |
HeatherABC
Joined: 25 May 2012 Posts: 10
|
Posted: Fri May 25, 2012 11:43 pm Post subject: |
|
|
| jkasyan wrote: | Well, i'd been interested in one particular change in wmcbrine's fork (NFO files), so i'm updating it for me too now.
I've uploaded a NEW new version which i've taken the latest wmcbrine fork and ffmpeg and added my bits to it.
I did some light testing by pushing a local video (wmv) and a playon video. Please uninstall and try again. If it still fails, post your error logs. |
I just uninstalled and re-installed and immediately have an issue. The playon plugin is not showing up on my configuration screen. Also the global settings config screen is completely blank.
EDIT:
I think I remembered how the config file was set up for the global settings so I plugged everything in and I'm still hitting a wall when it comes to transferring to the TiVo regardless if the TiVo requests the file or I try to push it. I am not sure where an error file would be generated. If you could point me to it I will be happy to send it over. It's not in the pyTiVo folder anywhere. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|