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

@jskenney


Here is what I found, prior to b37 I was getting the following summary…
Loading meta-data for 276 recordings
245 new TV shows and 9 new movies
With b37…
Loading meta-data for 276 recordings
260 new TV, 9 movies, and 0 sports   --I have a total of 15 sporting events recorded (being added to TV shows total here)

When I do a search, they are listed if the search word is present in the episode title.  For example, if I search for ‘championship’, it will return 3 sporting events.  I think genre is important here, because currently if I search for NBA or even basketball, I get no results because the actual title is something similar to ‘Cleveland Cavaliers at Miami Heat’.  The actual genre in this case is ‘Basketball’; whereas in the other example it was ‘Gymnastics’.  The world of sports is a crazy one, lol.

When I do a -list -sports, all 15 events do show up.  Sorting by genre here first for sports would be great, too.

But now when I try to download any show (sports or tv), I get the following error…
Traceback (most recent call last):
  File “tablo2go-2.0b37.py”, line 855, in
    debug(‘Downloading "’+filename+’"’, ipaddr)
TypeError: cannot concatenate ‘str’ and ‘NoneType’ objects

Thanks again


@krissy, thanks for the catch, b41 posted and the old version deleted.


Can you post the output of the -sports -list (with no sports to test, I need a bit of help)

@jskenny,


Glad to help… I added the corresponding genre in yellow…

Loading meta-data for 277 recordings
246 new TV, 9 movies, and 15 sports
15 matching videos have been queued
EP000076050701 2014 World Championships (2014-10-11T1800Z) Gymnastics
EP000076050706 2014 World Championships (2014-10-12T1900Z) Gymnastics
SP003032660000 Cleveland Cavaliers at Miami Heat (2014-12-25T2200Z) Basketball
EP000095271704 IAAF Diamond League Brussels (2014-09-21T1800Z) Track & Field
EP000079212457 ISU Grand Prix Cup of China (2014-11-09T2100Z) Figure Skating
EP000079212487 ISU Grand Prix Final (2014-12-21T2100Z) Figure Skating
EP000079212462 ISU Grand Prix NHK Trophy (2014-11-30T2100Z) Figure Skating
EP000079212460 ISU Grand Prix Rostelecom Cup (2014-11-16T2100Z) Figure Skating
EP000079212455 ISU Grand Prix Skate America (2014-10-26T2000Z) Figure Skating
EP000079212456 ISU Grand Prix Skate Canada (2014-11-02T1800Z) Figure Skating
EP018608690009 Mens Final (2014-09-08T2100Z) Tennis
EP018608690006 Mixed Doubles Final and Womens Semifinals (2014-09-05T1630Z) Tennis
SP003032650000 Oklahoma City Thunder at San Antonio Spurs (2014-12-25T1930Z) Basketball
EP000076050699 P+G Championships Womens Final Day (2014-08-24T0000Z) Gymnastics
EP018608690008 Womens Final (2014-09-07T2030Z) Tennis





@krissy - b42 has been uploaded can you provide -sports -list again

- it should now count sports shows correctly
- genre’s are searchable for selection criteria (but I am only using the first genre listed - the primary one for everything)
- it should download them to sportsdir

b43 has been uploaded

- I added the ability to have a cache db if you want it (so that it will not reload the metadata over again on restart) this comes with to command line arguments
-db:path_to_db_file
-dbtime:time_an_entry_is_Valid_for_in_seconds

example:
python tablo2go.py -db:cache.odb -dbtime:86400

will wait a day before redownloading the metadata, it will always redownload if the video was not finished during the last load, or if the metadata was invalid.

this is different than the old database format in version 1:
- optional
- only stores the metadata from the tablo.

Thanks to everyone for testing this, I will finish up in a few days, and work on version 3 during a future holiday.  If I am missing anything or if something is broken, please tell me now.

@jskenney


I tested b42…
love the sorting by genre 
love the searching by genre

Everything looks good to me with the changes. 

Thanks for adding my suggestions.

here is the listing…
Loading meta-data for 277 recordings
246 new TV, 9 movies, and 15 sports
15 matching videos have been queued
SP003032660000 Basketball - Cleveland Cavaliers at Miami Heat (2014-12-25)
SP003032650000 Basketball - Oklahoma City Thunder at San Antonio Spurs (2014-12-25)
EP000079212457 Figure skating - ISU Grand Prix Cup of China (2014-11-09)
EP000079212487 Figure skating - ISU Grand Prix Final (2014-12-21)
EP000079212462 Figure skating - ISU Grand Prix NHK Trophy (2014-11-30)
EP000079212460 Figure skating - ISU Grand Prix Rostelecom Cup (2014-11-16)
EP000079212455 Figure skating - ISU Grand Prix Skate America (2014-10-26)
EP000079212456 Figure skating - ISU Grand Prix Skate Canada (2014-11-02)
EP000076050701 Gymnastics - 2014 World Championships (2014-10-11)
EP000076050706 Gymnastics - 2014 World Championships (2014-10-12)
EP000076050699 Gymnastics - P+G Championships Womens Final Day (2014-08-24)
EP018608690009 Tennis - Mens Final (2014-09-08)
EP018608690006 Tennis - Mixed Doubles Final and Womens Semifinals (2014-09-05)
EP018608690008 Tennis - Womens Final (2014-09-07)
EP000095271704 Track field - IAAF Diamond League Brussels (2014-09-21)

Wow - This is awesome !! I just started reading this thread last night and in a matter of minutes I was successfully downloading shows from my Tablo.


@jskenney Thanks for all your hard work on this script.  Since my wife uses PLEX this was the final piece of the puzzle.


@jskenney -   thank you for your work.  Would it be possible to run a script with comskip to process the recording?

@7up - I was thinking about trying for comskip in the following version of the script, a bit more than I am willing to take on over this holiday.  Personally I have never cared for it, as sometimes it guesses horribly, and your file is broken by it.  If you are comfortable scripting, another script to be run on the output of this one until that gets built in.

@jskenney -  I agree, Compskip isn’t perfect but I think its still worth trying to figure out how to integrate into Tablo.   Thanks for considering in the future.    

I am using MCEBuddy with Comskip and it’s not perfect but it is acceptable.  You might want to try that out.

@jskenney One other suggestion on the logging side of things. Would it be possible to use Python’s logging module for the logging to a file functionality? It supports file size and log file rollover which would make the automatic cleanup of the logging file easier. If you can’t get to it I can modify and send you the changes.

@mjarends - I doubt I will have time to get to it at this point, I am happy to take code though, please forward it along.

b45 has been uploaded with significant updates in file naming support (please check, this is one of those things that needs testing) 


NOTE: you can test filenames by just using the -list command (that list command has been showing EPISODEID FILENAME for a while now)

a few new options
-mce will save the tv episodes in SERIES_YYYYMMDD to satisfy mcebuddy

-custom will allow for custom file naming, it is a bit more complicated to use, so here are some examples  (note -custom will rename all shows/movies/sports in this format, use -customtv, -custommovie, -customsports to be more specific)

Example 1: - default tv format = The Simpsons - S01E01 - Pilot
-custom:"{series} - {tvse} - {title}“

Example 2: - dating things a bit = The Simpsons - Pilot - 1989-12-17
-custom:”{series} - {title} - {airdate}“

All metadata fields that are seen with -list -long are available for use, but since I know there will be some of you who want alot more control, all metadata fields provided by the tablo are supported in my format (try the -list -reallylong options ) which is level0.level1.level2 (etc)

so something like below = The Simpsons - S01E01 - Pilot - 480
-custom:”{series} - {tvse} - {title} - {recMovieAiring.jsonForClient.video.height}"

Ok, nearly done.  Uploaded 2.0pre1, please test.  I plan to upload the final version tomorrow and consider this version done, and I’ll look into tackling more during the next holiday (summer).


I just finished the last feature I wanted to add, subtitles can now be embedded by telling it were ccextractor is

-ccextract:ccextractorwin.exe

and enabling closed captions via the

-cc

flag.

@jskenney


The closed captions worked great for this mac user!  I tried viewing the closed captions in quicktime, iTunes, VLC, and the AppleTV.  You are really knocking things off the version 3 list todo list :slight_smile:

I’m having a little trouble with the custom file rename. 
I would like to save movies with ‘{title} ({recMovie.jsonForClient.releaseYear})’.  Do I need to add a line under configurable options for custommovies?
-Edit:  custommovies work fine, but I get an error with customsports – 

I added the following under the configurable options (in yellow)…
‘custom’: [’’, ‘SEARCH’, ‘Custom File Naming’],
‘custommovie’: [’{title} ({recMovie.jsonForClient.releaseYear})’, ‘SEARCH’, ‘Custom File Naming’],
‘customsports’:   [’{series} - {title} - {airdate}’,    ‘SEARCH’, ‘Custom File Naming’],
‘log’:   …

and I get the following errors…
Traceback (most recent call last):
File “tablo2go-2.0pre1.py”, line 936, in
show_proc = proc_meta(show_info, OPTIONS)
File “tablo2go-2.0pre1.py”, line 669, in proc_meta
PROC[‘name’] = custom(OPTIONS[‘customsports’][0], PROC, convert(metadata))
File “tablo2go-2.0pre1.py”, line 240, in convert
results[k] = OPTIONS[k][0]
KeyError: 0

Thanks again for working on this.  I’m planning on trying out mutagen today for the metadata.

@krissy - Uploaded pre3 - looks like I made a few mistakes last night on the custom file naming, try it now.

@jskenney  pre3 works great, thanks.

I did see a couple of things that would be nice to implement…

-when using custommovie, customsports, and customtv the sort changes in the list command
I would love to still get the sort of custom (it makes the most logical sense in terms of displaying information), and still get the filenames generated from custommovie, customsports, and customtv.

-sometimes the episode {title} is too long, can you drop the tail end after so many characters, this may cause an error trying to save the file
example from -tv -list:
EP008473331540 Rachael Ray - Rachaels Fellow Members of the Presidents Council on Fitness Sports and Nutrition Dr. Iam Smith Olympian Michelle Kwan (2014-12-23)


@krissy - The -list sort is always alphabetical by filename, if you use the -custom commands it should just be changing the filenames and still sorting them all (they will be sorted together), are you seeing something else?


Cutting the files if the title is to long can cause a few complications, because you would want this to be configurable by metadata item, a bit to much for this go.

@jskenney


I found when I only use {title} {airdate} for customtv in -list -tv, it’s no longer grouped by show, all the episodes are just listed in alphabetical order by title.  This isn’t a big deal, I can just comment out the customsorts and -list to get the original sorting.

Don’t worry about the file names, turns out it wasn’t a big deal.  I was able to download the episode, just fine.  I thought it may throw an error due to file name length.

I did discover something totally unexpected, but very nice.  I messed up the location for the ccextractor in the script, so the show downloaded, then failed.  After I updated and reran script with the correct path, it didn’t prompt me to overwrite the existing file.  It was smart enough to not download again and just process the subtitles.  :)  I’m sure you have probably mentioned it before, but seeing it in action is great!!

Right now I’m trying to download some shows via cTivo and the process is failing on conversion, and then it re-downloads the shows again.  Urrghh

Thanks again