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


#441

Thanks chuckc. Jeffrey was right that Samba is renaming the file, but no amount of reconfiguring Samba will allow you to use a colon in a filename in Windows (just try creating a new text file with a colon in it on your Windows box). The only solution is to add it to BAD_CHARS (which I have done). Waiting for the next airing of The Exorcist to confirm that it works as desired.


#442

I have to believe that nobody else is having a problem with 3.33 ?
I must have goofed up the modifications needed to conform to my local paths.
3.31 is working OK for me, but has that issue with S00E00.
I’ll try to edit 3.33 again tonight and see if it works.


#443

I ended up working on a different project this past weekend, so I will try to get an update out in the next few days. Pending changes:

  1. A third naming pattern (like what is already their for series and movies) for series without season, episode data.
  2. Enter IP addresses via the command line
  3. @kkoceski and @chuckc issues with python 2 and the bytes-like object

#444

Hi Jeffery - I am still using 3.31, with 3.33 still not working for me.
I am using python3, so I don’t think that’s the problem.
The only thing I don’t like about 3.31 is that it doesn’t handle S00E00 very well.
Thanks again for all your work !


#445

I am using version 3.35, but I found I needed to make these three four many changes to make it work for me. It can probably be made cleaner:

  1. In get_video (twice):

     for line in resp.iter_lines():
         lined=line.decode("utf-8") 
    

    (then use “lined” everywhere you have “line” in that block)

  2. At the top level program, in the loop “# Go through queued items”, just before “if USE_FFMPEG:”, check to ensure there is something to do, first, or print error message if there isn’t:

             if (QUEUE[TABLO_IP][airing_num]['m3u8']):
                 if USE_FFMPEG:
    
                 :    
                 :
    
             else:
                 print(TABLO_IP+' - Download Failed - '+QUEUE[TABLO_IP][airing_num]['build']+'.ts')
    
  3. In the top-level program, in the loop “# Download Metadata from found tablos” where you are determining what do to based on airing_type, add:

         elif airing_type == 'sports':
             disp_build = squish(fillin(NAME_SPORTS, QUEUE[TABLO_IP][airing_num]))
             if disp_id == '' or disp_id.find('SH') == 0:
                 disp_id = clean(disp_build, {' ':'.'})
    
  4. In “# Go through queued items” add, where similar post_api are happening:

     elif QUEUE[TABLO_IP][airing_num]['type'] == 'sports':
         playlist = post_api(TABLO_IP, '8885', '/recordings/sports/events/'+str(airing_num)+'/watch', COMMENT='Retrieve sport playlist')
    
  5. Add next to NAME_UNKNOWN

     NAME_SPORTS  = "... your information here.../Sports/{disp_event} {date_only}"
    
  6. In “# Download Metadata from found tablos”, where you are processing the airings, insert:

     disp_event = rDict(METADATA[TABLO_IP]['airing'][airing_num], '', 'event', 'title')
    
  7. Just a little bit after the above, where you are inserting into queue, insert

          'disp_event':disp_event,
    

(I think those are all the changes)

I suspect there’s more to be done for manual recordings, but I haven’t tried that yet. And I’m pretty sure Windows machines won’t like the Sports names with colons in them. I don’t use Windows (and neither should anyone else).


#446

Hi qajxujeza,
Would it be possible for you post your complete python file, please ?
Thanks, Kurt


#447

@kkoceski I will post mine later today to my github account and provide a link here.

I incorporated @qajxujeza (thanks for the finds) finds, added a fix for episodes without season/episode numbers and added logging into mine. I have been unable to test the Sports show changes at this point because I don’t have any recorded. Was waiting until this weekend to test that additional functionality.


#448

@kkoceski Script is up and available here:

https://bitbucket.org/mjarends/tablo-scripts/raw/23759f8a7ee2b3cf6d232c383202003057636955/tablo2go-3.35-with-fixes.py

Script includes changes from @qajxujeza, fix for episodes with no season/episode numbers, and includes two new options:
-name_sports “value”
-log_file “log_file_path”

I have not been able to test the -name_sports option yet because I don’t have any sports shows recorded yet. If you have issues let me know.

@jskenney thanks for providing the initial script. Feel free to use any/all/none of the changes in my uploaded version


#449

Thanks ! I’ll try to give this a shot tonight - Kurt


#450

I actually got to it at lunch time. It is working !
However, the “title” portion is not getting embedded into the file-name.
Version, 3.31 ( which didn’t handle S00E00 well ) works OK.


#451

What type of show is failing? Is it a show without season/episode data? Can you post your file formats below? Thanks.


#452

With 3.31, I get :
The Tonight Show Starring Jimmy Fallon - S04E69 - Michael Keaton; Nina Dobrev; The xx.ts

With this modified 3.35, I get :
The Tonight Show Starring Jimmy Fallon - S04E69.ts


#453

Sorry for not being on the forums much lately, I am working to combine tvdb queries with my tablo2go software so I get consistent naming of files from both my TiVo and Tablo software. My TiVo work is done, and then I plan to port this into my tablo2go software, I probably won’t add any new updates until this merger is complete. Thanks to everyone who is still working on making this better, I’ll work to port any of these changes into the code.


#454

@kkoceski Can you post what your file formats look like. Are you specifying them on the command line? I will look to see if there was a difference between 3.31 and 3.35 that may have caused the different names to be generated.


#455

I only made minimal changes:

'# Note that any metadata apearing can be added manually to the code below, but
'# these are available by default.
NAME_SERIES = “./TV/{series}/{series} - S{season}E{episode} - {title}”
NAME_UNKNOWN = “./Fail/{series}/{series} - {title} ({date_only})”
NAME_MOVIES = “./Movies/{title} ({year})”
NAME_SPORTS = “./Sports/{title} - {date_only}”

USE_FFMPEG = False

'# Set metadata and history files
FILE_TABLO_METADATA = ‘./tablo3.mtd’
FILE_TABLO_HISTORY = ‘./tablo3.history’
FILE_TIVO_HISTORY = ‘./auto.history’

This is what I enter at the command line:
python3 tablo2go-3.35-with-fixes_KK.py -ip 192.168.0.101

In addition, it considers “Saturday Night Live” an unknown show instead of a TV show.

“The Tonight Show” ( the one with Johnny Carson ) isn’t getting detected. 2.0.62_FIX ( yes, the old one - I have 2 tablos, and have NOT updated the other one ) gets it as:
The Tonight Show - 2017-01-04.ts


#457

Script available here:
https://bitbucket.org/mjarends/tablo-scripts/raw/de864b2d7f2cdc9fe61cf40fe9973f7fad5e5d6d/tablo2go-3.35-with-fixes.py

Changes:
Fixed episode title formatting

Added two new formatting options for series:

  • series_date: series original air date - format: YYYY-MM-DD
  • series_year: series original air year - format: YYYY

Example use: TV Shows/{series} ({series_year}) - S{season}E{episode} - {title}


#458

Looks Good !!! It now embeds title information into the file-name :smile:. It also found Johnny Carson’s The Tonight Show and embedded the recording-date into the file-name. I’ll keep monitoring things, but it is great so far. Thanks again ! :smile:


#459

More fixes:
https://bitbucket.org/mjarends/tablo-scripts/raw/1201040535d01011dc200114113e93b1c7862a17/tablo2go-3.35-with-fixes.py

Changes:

  • Fixed issue with file names on Windows that contains special characters

This weekend I will validate the Sports functionality after I am able to record some sports shows


#460

Latest version:
https://bitbucket.org/mjarends/tablo-scripts/raw/2babe87b6e5fca044d9186ac55c27dbeba8b3f2a/tablo2go-3.35-with-fixes.py

Changes:

  • Implemented sports show support. The following tags are supported for sports shows:
    {series} - outputs the sports league name (ex: NFL)
    {date_only} - outputs the date the sporting event aired
    {title} - outputs the title of the sporing event (ex: New York Giants vs Dallas Cowboys)

#461

Problem with cron job. Can you share you cron job? I amenable to get this to run as a cron job or from the launchd without it clobbering the metadata file to zero bytes. Thus whenever the job runs it re-reads the metadata and it make the script run for a lot longer.

If I run the script from the command line the metadata file is built and never clobbered. Very strange behavior. I am running this on a Mac OS Sierra machine. I use the following command:

/usr/local/bin/python3 /Users/user/scripts/Tablo2Go/tablo2go-3.35.py -quiet true -list_only true -debug true

Here is some more information from the debug. When I run it as cron or launchd is appears to be choking on METADATA and thus causing a re-read of the file. But same code work just fine from command line. Anyways here is the error from stderr:

    Traceback (most recent call last):
  File "/Users/user/scripts/Tablo2Go/tablo2go-3.35.py", line 465, in <module>
    METADATA[TABLO_IP]['series'][series_num] = get_api(TABLO_IP, '8885', series, COMMENT='Retrieve series information')
  File "/Users/user/scripts/Tablo2Go/tablo2go-3.35.py", line 296, in get_api
    pDict(results)
  File "/Users/user/scripts/Tablo2Go/tablo2go-3.35.py", line 238, in pDict
    pDict(_dict[item], loc+1, dpath+"'"+item+"', ")
  File "/Users/user/scripts/Tablo2Go/tablo2go-3.35.py", line 238, in pDict
    pDict(_dict[item], loc+1, dpath+"'"+item+"', ")
  File "/Users/user/scripts/Tablo2Go/tablo2go-3.35.py", line 235, in pDict
    print(_dict)
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 424: ordinal not in range(128)