Is there a way to do simply print episode info in json based on file name?

Any questions? Need some help?
Post Reply
Rick7C2
Posts: 11
Joined: 22 Nov 2013, 23:04

Is there a way to do simply print episode info in json based on file name?

Post by Rick7C2 » 13 Jan 2018, 22:31

I'm working on a bash script and it would be really helpful to get all info for a specific episode via json

I see that filebot -list --q "TV TITLE" will print all episodes as json. Problem is I need the info for one episode. Not the whole series.

I was messing around and found that running this command gave me the info I need....kinda.

filebot -rename "American Masters - This Is Bob Hope...-3006971453.mp4" --db TheTVDB --q "American Masters" -non-strict --format "{json}" --action test --log all

Produces...

Fetching episode data for [American Masters]
Stripping invalid characters from new path: {"@type":"Episode","seriesName":"American Masters","season":31,"episode":10,"title":"This is Bob Hope","airdate":{"year":2017,"month":11,"day":13},"id":6431579,"seriesInfo":{"database":"TheTVDB","order":"Airdate","language":"en","id":81727,"name":"American Masters","aliasNames":["American Masters (1986)","Historias de Hollywood"],"certification":"TV-PG","startDate":{"year":1986,"month":6,"day":23},"genres":["Documentary","News"],"network":"PBS","rating":8.9,"ratingCount":7,"runtime":90,"status":"Continuing"}}
[TEST] From [/home/rick/American Masters - This Is Bob Hope...-3006971453.mp4] to [/home/rick/{@typeEpisode,seriesNameAmerican Masters,season31,episode10,titleThis is Bob Hope,airdate{year2017,month11,day13},id6431579,seriesInfo{databaseTheTVDB,orderAirdate,languageen,id81727,nameAm.mp4]


I was able to get the info I need by running this...

filebot -rename "American Masters - This Is Bob Hope...-3006971453.mp4" --db TheTVDB --q "American Masters" -non-strict --format "{json}" --action test --log all | grep -oP '(?<=Stripping invalid characters from new path: ).+' | jq .

Which produces...

{
"@type": "Episode",
"seriesName": "American Masters",
"season": 31,
"episode": 10,
"title": "This is Bob Hope",
"airdate": {
"year": 2017,
"month": 11,
"day": 13
},
"id": 6431579,
"seriesInfo": {
"database": "TheTVDB",
"order": "Airdate",
"language": "en",
"id": 81727,
"name": "American Masters",
"aliasNames": [
"American Masters (1986)",
"Historias de Hollywood"
],
"certification": "TV-PG",
"startDate": {
"year": 1986,
"month": 6,
"day": 23
},
"genres": [
"Documentary",
"News"
],
"network": "PBS",
"rating": 8.9,
"ratingCount": 7,
"runtime": 90,
"status": "Continuing"
}
}

Have I overlooked an easier way to do this? If not would you implement this as a feature?

User avatar
rednoah
The Source
Posts: 13530
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is there a way to do simply print episode info in json based on file name?

Post by rednoah » 13 Jan 2018, 23:34

My advice would be to rename files as usual, and then read xattr metadata when further post processing these files.

If files are processed by FileBot then you can read full metadata from the extended file attributes. Note that xattr will not be written in test mode.
My (very excellent) support depends on Windows Store and Mac App Store sales and Patreon support. Paying users, donors and everyone who contributes to FileBot in one way or another will get the very best support.

:idea: Please read the FAQ and How to Request Help.

User avatar
rednoah
The Source
Posts: 13530
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Is there a way to do simply print episode info in json based on file name?

Post by rednoah » 13 Jan 2018, 23:43

If you want to limit the -list command to print only specific episodes, then you can use the --filter option for that.
My (very excellent) support depends on Windows Store and Mac App Store sales and Patreon support. Paying users, donors and everyone who contributes to FileBot in one way or another will get the very best support.

:idea: Please read the FAQ and How to Request Help.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests