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

Hmmm, any chance your movies have odd characters in the titles? I hadn’t considered non-standard characters, but it shouldn’t be to hard to support unicode.

probably i have a bunch of movies.

I’m using 3.04, and getting the same error:

Traceback (most recent call last): File "Desktop/tablo2go-3.04.py", line 279, in <module> disp_build = squish(fillin(NAME_SERIES, QUEUE[TABLO_IP][airing_num])) File "Desktop/tablo2go-3.04.py", line 120, in fillin _string = _string.replace('{'+str(key)+'}', str(_dict[key])) UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in position 111: ordinal not in range(128)

It’s not handling unicode characters in the show descriptions. Unfortunately, that seems to be happening more often, especially u’\u2014’ which is a dash character.

I’ll see if I can add a general unicode safeguard into the script this weekend. Since I don’t have any files that are causing this, if you could provide the name of the offending movie/tv show that would help a bit for testing.

I put in a debug statement to dump the info for an airing when it gets the error. These two show episodes are currently throwing an exception:

Error building display name for {'date': u'2016-10-08T13:30Z', 'type': u'series', 'episode': '02', 'description': u'Jeff arrives in the salmon capital of the world, where he embarks on a mission to catch the king of all salmon \u2014 the Chinook; Jeff learns the art of totem pole carving through the Native American heritage of Ketchikan.', 'season': '01', 'duration': 2120, 'series': u'Ocean Treks With Jeff Corwin', 'title': u'Ketchikan: The Alaskan Wild', 'year': '', 'height': 720}

Error building display name for {'date': u'2016-10-02T01:00Z', 'type': u'series', 'episode': '03', 'description': u'Chidi starts giving Eleanor formal lessons in ethics \u2014 the first lesson is to be kind to your neighbor; Michael and Janet assist Chidi in finding a new hobby.', 'season': '01', 'duration': 2120, 'series': u'The Good Place', 'title': u'Tahani Al Jamil', 'year': '', 'height': 1080}

One other change I made. I think you must be using Python3. I don’t have P3 installed on my server box. I had to add the following:

import errno

def mkdir_p(path):
    try:
        os.makedirs(path)
except OSError as exc:  # Python >2.5
    if exc.errno == errno.EEXIST and os.path.isdir(path):
        pass
    else:
        raise

And then change this:

#                os.makedirs(os.path.dirname(QUEUE[TABLO_IP][airing_num]['build']), exist_ok=True)
                mkdir_p(os.path.dirname(QUEUE[TABLO_IP][airing_num]['build']))

Perfect, that is exactly what I needed, I’ll update the script this weekend.

Version 3.05 uploaded, I think it will now successfully convert the utf-8 strings to ascii.

New version available at https://sites.google.com/a/moboard.com/tablo/

Looks like you uploaded a version that’s hardcoded for the IP address of your Tablo. I restored the two lines you commented out, and commented out the hardcoded address line, and it appears to be working fine.

I’d like to request that you please change the os.makedirs call. The exist_ok parameter is Python 3.5 or later only. It doesn’t work in Python2.

Thanks for the note, 3.06 has been updated that removes the settings that were specific to my house… I also changed the api call that gets info about your tablo’s to https as it appears that this functionality has changed. I’ll see what I can do to update how I make directories.

Updated with a new 3.06, this should handle directory creation in both python 2/3

Great. I’ll give it a try.

Seems to work pretty good. I had to change this line to stop a bunch of errors from ffmpeg:

FFMPEG_CMD = ' -headers "User-Agent: bar"$"\r\n" -i "{m3u8}" -c copy -bsf:a aac_adtstoasc "{build}.mp4"'

That might be fixed in later versions of ffmpeg. My system has ffmpeg version 2.8.6 installed.

What’s the correct syntax for the SEARCH definition for multiple series? And are you planning on adding command line arguments to specify the series to be downloaded?

Thanks!

I try to stay up to date with ffmpeg, so I am using their current 3.1.5.

The existing search criteria can only be used to filter on one item, I added that code mostly as a placeholder for a future change to regular expressions.

My old version 2 had all of this functionality, including command line parameters, I just haven’t had time to move them into the new version, and I use this script via a cronjob that runs once a day to download everything that the tivo didn’t record.

Version 3.07 posted (I just removed one str() function so that python2 would be a bit happier, 3.08 was added to support all available metadata found for TV shows.

My goal was to keep version 3 very clean and compact, so that it could serve as the foundation for a much more option-rich version 4 (which would use v3 as a library of sorts)

TableTV Firmware update 2.2.12 seems to have broken the tablo2go-2.0.63.py. Worked with 2.2.10 and tonight after the upgrade when I tried to run I get:

[Nov 2 00:20:20 2016] - Starting TabloToGo Version 2.0.63
[Nov 2 00:20:21 2016] - Loading download history
[Nov 2 00:20:21 2016] - 556 shows and movies have already been downloaded
[Nov 2 00:20:21 2016] [xxx.xxx.xxx.xxx] - Found Tablo named TabloTV
[Nov 2 00:20:21 2016] [xxx.xxx.xxx.xxx] - Loading meta-data for 0 recordings
[Nov 2 00:20:21 2016] [xxx.xxx.xxx.xxx] - No videos have been queued

Appears to be failing at:
def get_list(IPADDR): function

Thanks arejay. I’ll stick with 2.2.10 for a while.

I am actually using tablo2go-2.0.62_FIX, which is tablo2go-2.0.62, but with the mod from mjarends ( on Jan 2 ).

I didn’t try version 3 because I didn’t see how to NOT convert to .mp4.

My typical download consists of table2go-2.0.62_FIX.py, but just to .ts files.
Then I use Handbrake to compress it with subtitles.
I wrote a simple .c program to make it easier, and to eliminate typos.

Once I’ve got the .ts files downloaded, I do a “ls *.ts > list.txt”
Then I use my program : “makeListC list.txt list.do”
Then is just “source list.do”

Thanks, Kurt

With the new API you will need to move onto the new 3.x version of Tablo2go when you upgrade. It doesn’t have all of the options as 2.x did, but has everything need to automate the pulling and placing of videos. I planned 3.x to be a very light weight interface so later on I can use it as the framework for a more feature rich 4.x set.

OK, so I tried version 3, but I’m not smart enough to get it to work.
I did modify my paths for :
FFMPEG = ‘/usr/bin/ffmpeg’
and
FILE_TABLO_METADATA = ‘./tablo3.mtd’
FILE_TABLO_HISTORY = ‘./tablo3.history’
FILE_TIVO_HISTORY = ‘./auto.history’

but I get :

[kkoceski@E4300_XFCE TabloTV_500GB]$ python ./tablo2go-3.08.py
Traceback (most recent call last):
File “./tablo2go-3.08.py”, line 209, in
found_tablos = get_api(‘api.tablotv.com’,‘443’,’/assocserver/getipinfo/’, HTTPS=True)
File “./tablo2go-3.08.py”, line 138, in get_api
import requests
ImportError: No module named ‘requests’
[kkoceski@E4300_XFCE TabloTV_500GB]$

Thanks, Kurt

The new version uses the requests library to handle the api calls, so run

pip3 install requests

or

pip install requests

If attempting to use with python2. (Python3 is what I am testing and using)

I noticed this behavior with version 3:

  1. Run tablo2go-3.08.py while a show is actively being recorded
  2. The show’s metadata will be loaded (I see it in the tablo3.mtd file)
  3. When show has completed recording (or stopped early), run tablo2go-3.08.py again
  4. The script cannot see (or download) the show that was actively being recorded, but is now done

Is this how the script is supposed to work currently? I tried version 2 and it works fine and circles back to download any shows that were recording during the previous run.

Oh, I forgot to mention that my Tablo is still on the 2.2.10 firmware. Does tablo2go 3.x work like tablo2go 2.x (where it will go back and download shows that are done, but where actively being recorded when it saw them the first time) on 2.2.12 with the new API?

Thanks for the work on this script, I appreciate it.