API/interface to pull recorded show listings, metadata, and files off of the Tablo

@jskenney - Good point, hadn’t thought about the multiple Tablo’s


I was also thinking about changing the FFMPEG call to have it called multiple times, if the number of segments exceed a certain number, as on different OS’s it appears to have trouble being evoked if the command string is too long.  It is also every dependent on the temp path, etc.

@ericgus - "it would be nice if a required command line option is missing its stated in the output when the script is envoked… might want to tweak that … "

Yeah, good idea - I added that to the original script and probably should have added a warning :slight_smile:

@ericgus  I figured out the issue.. seems -temp is required in the new version

now I am getting this error

            Traceback (most recent call last):

  File “./TabloToGo.v1.py”, line 433, in

    DB, found_count, add_count, del_count, proc_count = db_update(TABLOS, DB)

  File “./TabloToGo.v1.py”, line 228, in db_update

    DB[IP][ID] = get_meta(IP, ID)

  File “./TabloToGo.v1.py”, line 88, in get_meta

    metadata = eval(metadata)

  File “”, line 1

   

    ^

That is caused by Tablo not having a meta data to be retrieved for live shows being displayed.


Working on a fix for that now…

Thanks … I am not entirely sure what was going on with the tablo last night but I figured I should post the results of my tinkering for you guys in the event it might provide some value…


I also noticed I did a test of a sporting event and the script failed to find it so you might want to check to ensure you aren’t accidentally excluding any catagories…

Tried adding the -handbrake option, and got a ton of audio sync issues.  Found that if you take the .mp4 file, run a qsfix in Videoredo on it, then use the same settings you’ve got hard coded into your script, it works without the silence padding & desyncing.  You may want to look at incorporating that into your script at some point, or at least make the deletion of the .mp4 file optional, in case of audio problems.


On my system, my plan is to use this to extract the videos from tablo, process them in videoredo to fix any stream errors, pass them through comskip and create a videoredo cut file, then process it again in videoredo to remove commercials (didn’t see where this type of discussion was verboten here, hopefully comskip isn’t taboo), then shuffle them off to my unraid box to be picked up by my Plex server.  

Is this for linux only? Or will this work on Windows?

@mtuckman when will you fix the meta.txt issue? I tried to run this today, but of course I had watched live TV



My stream issues were signal level problems on a specific recording, but I’m going to see about adding the qsfix myself, just in case I have issues with it in the future (I do have signal level glitches occasionally).



Got a new and differerent error today (TabloToGo.v1.py)


Note: tablo2go.py works fine.

Traceback (most recent call last):
  File “./TabloToGo.v1.py”, line 516, in
    get_video(item[0], item[1], NDIR, TEMPDIR, FFMPEG, item[2], DEBUG, TESTING)
  File “./TabloToGo.v1.py”, line 122, in get_video
    subprocess.call(cmd)
  File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 524, in call
    return Popen(*popenargs, **kwargs).wait()
  File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 711, in init
    errread, errwrite)
  File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 1308, in _execute_child
    raise child_exception
OSError: [Errno 63] File name too long
Let me begin with I never used python or anything like that. This is what I did

1) Installed python 3.4
2) installed the ffmpeg

and then tried the above command and it keeps failing with the following error

C:\\Python34>python ./tablo.py -db:tablo2go.db -tablo:192.168.1.8 -ffmpeg:ffmpeg
-output:"F:/TVShows" -temp:"F"/TabloTemp"
  File "./tablo.py", line 110
    if DEBUG: print '   - Retrieving '+cmd+ ' ('+str(int(float(counter)/float(fi
nal_int)*100.0))+'%)'
                                     ^
SyntaxError: invalid syntax

What am I doing wrong? and do i need to install anything else?

This is actually written in Python 2.7 - Python did a rewrite of print statements in version 3 and changed some of their designs which broke backward compatibility.  You will need to install the python 2 software.

Awesome work guys!  I can’t wait to try it this weekend.  Does anyone have a Synology NAS?  It would be interesting to see if this would work on the NAS.  I haven’t looked for ffmpeg for Synology though.

Unless you have a high end NAS ($$$$) don’t expect low end processors found on most NAS units to be very effective at doing ffmpeg (speaking about transcoding).  So usually you’d need a proxy host that does that part and then copies the result to the NAS… but again, maybe if just doing a pure concatenate, you’d be fine, just often times you’ll want to transcode as well.  YMMV.

@cjcox - I agree on the transcoding on a NAS.  However, Tablo has already done the transcoding to H.264 and down to the resolution we’ve set in the Settings page so the NAS would not need to transcode, only capture.  Unless I’m mistaken, ffmpeg is being used only to capture the stream.  I’ve played with ffmpeg to capture the stream from my HDHomeRun.

@ericgus  I figured out the issue.. seems -temp is required in the new version now I am getting this error Traceback (most recent call last):   File "./TabloToGo.v1.py", line 433, in     DB, found_count, add_count, del_count, proc_count = db_update(TABLOS, DB)   File "./TabloToGo.v1.py", line 228, in db_update     DB[IP][ID] = get_meta(IP, ID)   File "./TabloToGo.v1.py", line 88, in get_meta     metadata = eval(metadata)   File "", line 1         ^
That is caused by Tablo not having a meta data to be retrieved for live shows being displayed.

Working on a fix for that now…

@mtuckman if you use urllib2 instead of urllib,  you can catch the meta.txt not existing.  For example:


def get_meta(IPADDR, VIDEOID):
    try:
        resp = urllib2.urlopen(‘http://’+IPADDR+’:18080/pvr/’+str(VIDEOID)+’/meta.txt’).read()
    except:
        resp= []
    metadata = ‘’
    for i in range(len(resp)):
        metadata = metadata + resp[i]
    print metadata
    metadata = eval(metadata)
    print metadata
    return metadata


I can push the changes to your github later if you want.  I’ve been using tablo2go-0.23.py instead and haven’t really looked into if urllib2 would break anywhere for your version.


@ericgus  I figured out the issue.. seems -temp is required in the new version now I am getting this error Traceback (most recent call last):   File "./TabloToGo.v1.py", line 433, in     DB, found_count, add_count, del_count, proc_count = db_update(TABLOS, DB)   File "./TabloToGo.v1.py", line 228, in db_update     DB[IP][ID] = get_meta(IP, ID)   File "./TabloToGo.v1.py", line 88, in get_meta     metadata = eval(metadata)   File "", line 1         ^ That is caused by Tablo not having a meta data to be retrieved for live shows being displayed. Working on a fix for that now...
@</blockquote><p>

@shivmevawala

I tried the process for pulling the files for the first time this evening. Initially it copied all 400 .ts files to the temp drive then it gave an error. I think it was ffmpeg path related.

Now I am getting the error as you mention above (plus the “syntax error” on the final line). I’ve rebooted the Tablo as well with no luck. I think the issues began when I started using the “-testing” switch so I would not have to copy over all 400 files again.

I’m not sure if it matters but I’m using the 4 tuner model.

My command line on Windows 8.1 x64 is:
TabloToGo.v1.py -db:tablo2go.db -Tablo:192.168.1.118 -ffmpeg:“c:\ffmpeg\bin\ffmpeg” -output:“c:\tablotv” -temp:“c:\TabloTemp” -a -sleep:900



So I quit messing with it last night and even left the CMD prompt up on my server. This morning, I hit the up arrow key to bring back the last command that was typed and viola! It's working just as expected.

I have three shows (recorded in 1080p) that are now in MP4 format that were pulled from the Tablo in about 5 minutes.

Probably the issue where if you had watched live TV it has a dir that has no meta.txt file and this causes an error which has yet to be fixed

@Jestep

That issue should have been fixed by this morning.  Just run a git pull again

OSError: [Errno 63] File name too long  :(

I assume this is the concatenation of the files for ffmpeg



Possibly… I find it’s better to dump them into a concat file (temp file) and convert using that.