SurLaTablo.py - Python program to query and convert Tablo recordings


#341

Thanks, that seems to have cleared them out.


#342

New problem. Getting this error on a couple different shows:

Working on: [./TV Shows/Hogan’s Heroes/Season 5/Hogan’s Heroes - s05e22 - Six Lessons From Madame LaGrange]
Can not get http://192.168.111.205:18080/pvr/48247/segs. Bad id?

It’s been deleted from the Tablo already. Is there a way to get SurLaTablo to ignore this entry? Or force the Tablo to clear whatever is caching the info?


#343

Normally a run of surlatablo.py (no options or without -n anyhow) will sync the cache, eliminating shows no longer there. If this isn’t working, it means that the Tablo thinks the show exists, yet it is gone (the device data is out of sync, which I’ll say is unlikely).

So… does this happen when surlatablo is running and deletions are happening while surlatablo is doing things? Surlatablo (if the -n option isn’t present) does its whole sync thing first… syncing it’s cache db with what’s on your Tablo. It only does this when surlatablo starts, if it’s running it won’t know that deletions were made while it working on a query to transcode items (for example).


#344

Oh, and it’s safe to destroy the cache data for surlatablo and force it to rebuild it all (though it may take a bit to rebuild the cache).


#345

I think I’m going to have to blame this on some sort of corruption of SurLaTablo’s cache. When I did a query for a specific show (no convert), it reported 4 episodes, but there’s only two on the Tablo. I deleted the cache, and it no longer reports the deleted shows.

I do delete shows when SurLaTablo is running, but I don’t use the -n option, so I would think it would figure it out next time it runs. And I run it hourly via a cron script that has it extract and convert certain shows. If it happens again I may just delete the cache regularly.


#346

Surlatablo computes the difference by querying the rec_ids list from the Tablo. It compares the rec_ids received from the Tablo with the rec_ids from the last time surlatablo was run to compute additions and deletions… ideally it should simply “work”…


Wait for ATV Tablo app or goto TiVo Roamio w/Lifetime subscription
#347

I agree. I’ve written code that does similar things. I have no idea why those were hanging around. If it happens again I’ll save the cache files for you.


#348

Six pack, heck I’ll chip in for a case if you get delete working. :wink:

Running this on my FreeNAS in a jail and dumping into my Plex media server directory. So far working great! Awesome utility. Might just keep my Tablo now that i got this working!

Question though, any way to combine query for mulitple series? Say I wanted to query for Mom and Dateline in a single query?

Thanks and keep up the awesome work!


#349

Unfortunately the delete thing isn’t going to happen. Would involve taking the whole project and making it “closed” somehow (binary only). Not my choice.

As for the query, try:

surlatablo.py -q '"series": "(Mom|Dateline)'

That would search for a series name beginning with Mom or Dateline.


#350

Thanks for the fast reply. Wishful thinking for the delete option I know but can’t hurt to ask and hope.

I was close. I see what I was doing wrong with my query now.

Also, got a little bug for your. When I try to pull the show “20/20” from my Tablo and dump it into a directory i get a directory called 20 with a directory called 20 under it with a Season directory under that and then finally the show. I figure it’s the / in the name that is causing it but not sure how to get around it.

Thanks again for the script!


#351

I’ll try to work on a fix for that tonight. I have some other updates/feature to push out anyhow (bringing back channel data… requires some config work on the user’s end).


#352

In case anyone is interested, below is my wrapper script that I wrote for this. This way I can use the SurLaTablo.py script to extract the info from my Tablo and then I call the URL for my Plex Media Server to perform a refresh. I am running this in a dedicated jail on my FreeNAS system to which I have passed in my directory containing my TV media. Enjoy and feel free to ask any questions.

For your first run it will take time if you have a large library on your Tablo. After that you can run it every 15 mins or so to extract new shows and refresh your Plex server.

Wrapper Script:
#!/usr/local/bin/bash
BASE="/media/surlatablo"
#echo ${BASE}
DATE=/bin/date +%Y%m%d
#echo ${DATE}
TIME=/bin/date +%H%M%S
#echo ${TIME}
LOGBASE="${BASE}/logs/${DATE}"
#echo ${LOGBASE}
LOG="${LOGBASE}/surlatablo-${TIME}.log"
#echo ${LOG}
WGETOPTS="–append-output=${LOG} --output-document=/dev/null"
PLEXIP=“Insert your Plex IP address here”
PLEXTOKEN=“Insert your Plex Token here if part of Plex Home”
# get your library id to refresh, see plex web site for info
PLEXTVID=“2”
DEBUG=""
if [ ! -d ${LOGBASE} ]
then
mkdir -p ${LOGBASE}
fi
for ARG in “$@”
do
case ${ARG} in
–debug)
echo “Warning: debug mode set, nothing will be pulled from Tablo”
DEBUG="–debug"
;;
*)
echo “Usage: $0 [–debug]”
exit 1
;;
esac
done
/usr/local/bin/surlatablo.py ${DEBUG} --convert --query “.” > ${LOG} 2>&1
# If using Plex Home use this one
#wget ${WGETOPTS} http://${PLEXIP}:32400/library/sections/${PLEXTVID}/refresh?X-Plex-Token=${PLEXTOKEN}
# If not using Plex Home use this one
wget ${WGETOPTS} http://${PLEXIP}:32400/library/sections/${PLEXTVID}/refresh
exit 0


#353

SurLaTablo 1.7 Released (return of channels sort of…)

1.7 - (channels return… sort of)

  1. You can add back channel handling by creating your own mapping of Tablo meta_channel ids to channel_num data. You can add the mapping to your surlatablo.conf. The meta_channel is now a piece of metadata you can query which might help you in creating the mapping like so (you’d have to watch/record shows to get the meta_channel numbers).
    The meta_channel is called recChannel in the original Tablo metadata:
    channel_map = {
    110247: { ‘channel_num’: ‘27.1’ },
    173111: { ‘channel_num’: ‘13.1’ },
    26697: { ‘channel_num’: ‘33.1’ },
    39153: { ‘channel_num’: ‘5.1’ },
    39243: { ‘channel_num’: ‘11.1’ },
    46752: { ‘channel_num’: ‘4.1’ },
    50615: { ‘channel_num’: ‘68.1’ },
    630311: { ‘channel_num’: ‘8.1’ }
    }
  2. Escape forward slashes for when a show/series title has slashes in it (to prevent inadvertent folder creations).

#354

Silly question… how do you name news shows that air 2-3 times a day? Right now it does one & thinks the the rest are duplicates. Like this show below that for what ever reason is broken into 2 shows in the mornings. Worse is the local news that I record 3 times a day so I can pick what ever one is latest to watch.

Example:
TV Series/Program 7722
Good Morning New Orleans - s05e09 - Episode 2016-05-09 <-- 5am
TV Series/Program 7725
Good Morning New Orleans - s05e09 - Episode 2016-05-09 <-- 6am

Working on: [/pool/Tablo/TV/Good Morning New Orleans/Season 5/Good Morning New Orleans - s05e09 - Episode 2016-05-09]
Retrieving Tablo Data (7725): [####################] 100% Elapsed seconds 264.0
Searching for commercials: [####################] 100% Elapsed seconds 389.0
Removing commercials (z1): [####################] 100% Elapsed seconds 74.0
Transcoding (Mp4, .mp4): [####################] 100% Elapsed seconds 18.0

File exists (try --clobber), /pool/Tablo/TV/Good Morning New Orleans/Season 5/Good Morning New Orleans - s05e09 - Episode 2016-05-09.mp4
Warning: No zap compatible transcoder provided. Transcode may have audio/video sync issues.


#355

You could try adding a time stamp to your file save configuration for these shows.

If you run “surlatablo.py --help” and look at the meta keys there are options for time stamps. That would set each one up as a different file when it saves.

air_date = UTC date and time of recording (YYYY-MM-DDTHH:MMZ)
air_date_year = UTC year of recording (YYYY)
air_date_month = UTC month of recording (MM)
air_date_day = UTC day of recording (DD)
air_date_hour = UTC hour of recording (HH)
air_date_minute = UTC minute of recording (MM)
lair_date = Local timezone date and time of recording
(YYYY-MM-DDTHH:MM+TZOFFSET)
(note: stored with the cached metadata db, this is the
local timezone value at the time of the cache entry)
lair_date_year = Local timezone year of recording (YYYY)
lair_date_month = Local timezone month of recording (MM)
lair_date_day = Local timezone day of recording (DD)
lair_date_hour = Local timezone hour of recording (HH)
lair_date_minute = Local timezone minute of recording (MM)
lair_date_tz = Local timezone

FILENAME_PATS={‘Default’:’${Etitle}’,
‘TV’:’${Eseries} - s${plex_season_number}e${plex_episode_number}-${air_date} - ${Etitle}’,

or something like that…


#356

@Spunky03 THAT’S what I was looking for earlier! Couldn’t find it for anything for some reason. LOL

Not sure where to add this info tho. I’ll try your suggestion first. Not sure if doing that will mess with Plex’s lookup on the other shows or what. I’m guessing it’s going to think it’s episode spanning doing this.

Is there a query for: all but show 1 show 2? Could just set 2 jobs that way one for dailies & one for the rest.

Try this first:
‘TV’:’${Eseries} - s${plex_season_number}e${plex_episode_number}-${air_date} - ${Etitle}’,

Trying this 2nd:
NOZEROTV = FALSE


#357

NOPE!

Naming them that way, Plex thinks they’re versions of the same episode. No go! Also using the air_date puts a : in the name & windows can’t see that file then. Stupid windows.

NOZEROTV didn’t seem to do anything… maybe I’m reading the description of that wrong.

Back to clueless on how to name these. :frowning:


#358

You can use the individual elements… ${air_date_year}${air_date_month}… etc to avoid the colons.

You can override things in your surlatablo.conf. You can also do this sort of thing as a one time override from the command line, but might be a bit too frustrating.

I’m a Linux user… so sometimes I don’t consider all the nasty Window-isms out there.


#359

@cjcox Yeah I did the individual elements, but no place to put that data in the name I can think of that won’t confuse the hell out of Plex.

Is there a query like “all shows except show 1 & show 2”
Like I could do -q “title”:“Episode 2016” to get the dailies but how would I do the reverse to get all the other shows? All shows that don’t have Episode 2016 in the title.


#360

Back to the show name question, you can try using -S to set the season number and -E to set the episode number, on -E it’s the “start”, it will increment for multiple matches (both -S and -E are expected to be numbers and are not drawn out of metadata, but fixed on the command line). If your news show sets a season as part of the metadata that is acceptable to you, then you can just use -E and set it to the value where you want the episode numbering to start.

The search is a regular expression search done across all SurLaTablo metadata per recording (i.e. all metadata for the recording on one line).

Multiple matches like -q 'series~=(?:Show 1|Show 2)' which means search series named ‘Show 1’ or ‘Show 2’ works.

I had problems with doing a singular negation string search, like (?!Show 1) which means not having Show 1.