Is there a way to do simply print episode info in json based on file name?
Posted: 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?
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?