TiVo Community Forum banner
1 - 5 of 5 Posts

· Registered
Joined
·
82 Posts
Discussion Starter · #1 ·
I've been using kmttg for a long time and love it but there's some tasks I do by hand that I wanted to automate. I wanted the automation to be scripts rather then compiled so I wrote a little node client for tivo rpc. I've made two scripts that build on top the library I wrote. Feel free to make requests for more scripts or open a PR with scripts.

The first script reboot.js will reboot the tivo so you could run it every week/night/etc.

The second script autoDelete.js is to prune deleted items. I have tivo suggestions disabled and I like keeping some of my deleted shows around as long as I can but others I don't care about (I have over 700 deleted episodes). This script will permanently delete shows based on the title. The script can also delete duplicate shows (same tite, season, episode, subtitle).

  1. To run the scripts you'll need node.js. I was coding with 12 but 14 should work and I would not be shocked if 10 works as well.
  2. download and extract the zip https://github.com/lart2150/tivo-scripts/releases/download/0.1.0/node-scripts.zip
  3. you'll need to edit config.js and update the ip and media access key (mak)
  4. run "node reboot.js"
 

· Registered
Joined
·
82 Posts
Discussion Starter · #2 ·
I've uploaded a new version of my scripts that includes the ability to make a ffmpeg metadata file that includes chapters based on the skip mode information! It requires a cookie from online.tivo.com. I plan on adding support for getting the cookie automatically but for now you'll need to pull it from a browser.

https://github.com/lart2150/tivo-scripts/releases/download/0.2.0/tivo-scripts.0.2.0.zip

Code:
node getRecordingSkip.js tivo:rc.12345678
this will get the recording metadata, skip metadata, and skip data offset. It will write the data to a file like "title SxE subtitle.txt"

you can then add the data to a recording you have downloaded using ffmpeg.
Code:
ffmpeg -i "Title - 1x01 - sub title.ts" -i "Title - 1x01 - sub title.txt" -map_metadata 1 -c copy "Title - 1x01 - sub title.mkv"
the output will look something like
Code:
;FFMETADATA1
AirDate=2021-08-20 00:59:58
Date=2021-08-19
RecordingTimestamp=2021-08-20 00:59:58
show=Making It
season_number=3
comment=With everyone spending so much time at home lately, Nick and Amy task the Makers with making another Mega Craft; an outdoor space that would be the perfect hangout for the entire family.
title=Making It

[CHAPTER]
TIMEBASE=1/1000
START=0
END=12825
title=Skip 1

[CHAPTER]
TIMEBASE=1/1000
START=12825
END=487652
title=Content 1

[CHAPTER]
TIMEBASE=1/1000
START=487652
END=697432
title=Skip 2

[CHAPTER]
TIMEBASE=1/1000
START=697432
END=1292649
title=Content 2

[CHAPTER]
TIMEBASE=1/1000
START=1292649
END=1496432
title=Skip 3

[CHAPTER]
TIMEBASE=1/1000
START=1496432
END=1820578
title=Content 3

[CHAPTER]
TIMEBASE=1/1000
START=1820578
END=2015708
title=Skip 4

[CHAPTER]
TIMEBASE=1/1000
START=2015708
END=2390562
title=Content 4

[CHAPTER]
TIMEBASE=1/1000
START=2390562
END=2605394
title=Skip 5

[CHAPTER]
TIMEBASE=1/1000
START=2605394
END=2985577
title=Content 5

[CHAPTER]
TIMEBASE=1/1000
START=2985577
END=3180377
title=Skip 6

[CHAPTER]
TIMEBASE=1/1000
START=3180377
END=3631687
title=Content 6
 

· Cranky old novice
Joined
·
9,553 Posts
So here's my experiences with the 0.2.0 package:

I installed node.js version 14.17.6 LTS 64 bit on my Win10 PC.

I edited config.js to as follows:
Code:
export const config = {
    ip: '192.168.0.123',
    mak: '<my MAK>',
    deleteTitles: [
        'Meet the Press',
    ],
    deleteScanAll: false,//false it will only check the 50 most recently deleted recordings.  false is way faster if you have a lot of deleted recordings
    deleteDuplicats: false, //setting this to true will flip deleteScanAll to true.
    tivoDecodePath: "C:\\tivodecode\\tivodecode.exe",//I strongly recommend tivodecode-ng

    //used for tivo online
    username: '<my email>',
    password: '<my password>',
    domainToken: '5we3g7MQ5Qq_v9FMB8urEOlpSS_GFXykhbaD55g_cmG2EQ.onZLfteo5REbcZZASriNgUWoLAVA6TNpnZcxqd5YL4GdAIZcFqNpoIsyECWDsin49Js_HRWZm3okyauiJCglwsip7YKF5MxLDU1g4yZUvlPlhjgAVygUkT_7z8I3bpDdpRi_odvdY3b9bOt8aTOAdAT8QogcIp.o9RM6kWFFBx1ntJlWx',//you need to pull this cookie from online.tivo.com.  at some point I'm going to write this to take a username/password and get the cookie.  but for now this is here.
    tsn: '<my TSN>',//after I get loggin working I'll pull the first tsn from http://online.tivo.com/body/global/selectors
};
To get the domainToken I logged into online.tivo.com then pulled the domainToken for tivo.com-->online.tivo.com from my edge browser.

autoDelete.js worked fine.

getAllRecordings.js threw an error as follows:
Code:
(node:1480) UnhandledPromiseRejectionWarning: TypeError: collectionRecordings.recording is not iterable (cannot read property undefined)
    at Tivo.getAllRecordings (file:///C:/Programs/NodeJS/lart/lib/tivo.js:280:31)
The offending JS code line (280) is:
allRecordings.push(...collectionRecordings.recording);
and I determined the error was because an instance of collectionRecordings.recording was undefined. I fixed this by checking with: if (collectionRecordings.recording) before the push statement. Then I was able to get a listing of my recordings from which I could pull recordingId's (tivo:rc.#######) for use when running getRecordingSkip.js .

getRecordingSkip.js throws the following error:
Code:
(node:4124) UnhandledPromiseRejectionWarning: Error: {"code": "middlemindError", "text": "middlemindError", "type": "error", "cause": {"code": "routeNotAuthorized", "type": "middlemindErrorCause", "text": "unauthorized bodyId(84600119058A668) in request(recordingSearch)"}}
    at TivoWs.sendRequest (file:///C:/Programs/NodeJS/lart/lib/tivo-ws.js:115:19)
I noted that this program uses the websocket version (lib/tivo-ws.js) for talking to middlemind while the other two do not. The error return seems to indicate my TiVo TSN is not authorized although just prior to the error, the code logged to the console that the connection succeeded, which seems to imply the domainToken credential was accepted (??).

So I'm stuck at this point on the getRecordingSkip.js failure.
 

· Cranky old novice
Joined
·
9,553 Posts
Update on my getRecordingSkip.js experience:

My previous failure was due to operator error -- I neglected to prepend my TSN value in config.js with "tsn:"

So I picked a recordingId for a program that I know (and verified) has operating commercial skip on my TiVo and ran getRecordingSkip.js with that argument. I get the following error:
Code:
Error: {
"code": "featureNotEnabled",
 "debug": "",
 "text": "HttpdInMyWorld and TranscodeRecordingLocalmind features required",
 "type": "error"}
I'm wondering what the "HttpdInMyWorld" and "TranscodeRecordingLocalmind" features are and have no idea how to "enable" them. My TiVo is a Roamio Base model running experience 3. Is it possible these features are only enabled in Experience 4?

At least there is good news here: The middlemind login using a domainToken is working and a meaningful response is coming back from the server
 
1 - 5 of 5 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top