please is there any way to use TheMovieDb for series?

Support for Windows users
Post Reply
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

please is there any way to use TheMovieDb for series?

Post by cafevincent »

I don't like how TheTVDb works. they currently have their voting feature disabled so many of their show ratings are 10.0, for example. the ratings are generally way off due to low vote counts. in fact they are so way off they are not listing ratings at their site at all ATM.

another thing is that even though they do list the imdb tag, they don't actually come through filebot. I like to include the imdb tag in the filename because that way I can open the imdb page with two clicks using my lookup script in the context menu.

so I am in dire need of getting my series data from somewhere else. is it in any way possible to fetch series data via TheMovieDb? I mean they do have series and better data accuracy so why not? or at least tell me why imdb tag via TheTVDb is not delivered, they are not answering my emails.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I am assuming imdb tags are not coming through for anybody. if it's just me then let me know and I'll post them logs and everything.
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

Yes, you can click the TheMovieDB button instead of the TheTVDB button (Episode Mode section) if you prefer to match files with TheMovieDB episode data.

If you're using TheTVDB, then you may be able to use the {omdb} (omdb info for given movie / series if available) binding in your format expression to get the ratings / ids you want.

e.g. series imdb id via omdb query:

Code: Select all

{omdb.imdbId}
e.g. series rating via omdb query:

Code: Select all

{omdb.rating}

:!: Note that {imdbid} only works for Movie Mode / Movie Objects and does not work for Episode Objects regardless of selected database.
:idea: Please read the FAQ and How to Request Help.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

rednoah wrote: 14 Sep 2018, 14:51 Yes, you can click the TheMovieDB button instead of the TheTVDB button (Episode Mode section) if you prefer to match files with TheMovieDB episode data.
how about command line? how do I signal TheMovieDb that I want series results?

rednoah wrote: 14 Sep 2018, 14:51If you're using TheTVDB, then you may be able to use the {omdb} (omdb info for given movie / series if available) binding in your format expression to get the ratings / ids you want.

e.g. series imdb id via omdb query:

Code: Select all

{omdb.imdbId}
e.g. series rating via omdb query:

Code: Select all

{omdb.rating}

:!: Note that {imdbid} only works for Movie Mode / Movie Objects and does not work for Episode Objects regardless of selected database.
I can't get this to work. it said something about "." being unexpected while I was typing it in, and now returning to the screen it says "binding omdb: server returned http response code 401"

I actually thought the OMDb had been out of use for years now. it has not worked for me at least.

anyway this is how I wrote it

Code: Select all

{n} {s00e00} {t} {genres} {certification} r{omdb.rating} {vf} {vc} {ac}-{omdb.imdbId}
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

how about command line? how do I signal TheMovieDb that I want series results?
you can if you use my custom AMC script:
viewtopic.php?f=4&t=5451&p=31192#p31191

Code: Select all

To get TV from themoviedb:
--def tmdbTV=y (default is use thetvdb)
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

kim wrote: 19 Sep 2018, 15:21 well it sounds like you don't want my script

so why not just use this

Code: Select all

filebot -rename -non-strict --db TheMovieDB PATH_HERE --format "{n} {s00e00} {t} {genres} {certification} r{omdb.rating} {vf} {vc} {ac}-{omdb.imdbId}"
btw: {t} will F up your movie files, better use 2 formats ;)
better continue here to stay on topic. i'm testing it now but I get this mishap. can I force tv mode in tmdb:

Code: Select all

Auto-detect movie from context: [E:\TEMP\Who Is America S01E04.mkv]
how about command line? how do I signal TheMovieDb that I want series results?
bringing me back to this earlier question.
Last edited by cafevincent on 19 Sep 2018, 15:47, edited 1 time in total.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

I forgot that part

Code: Select all

--db TheMovieDB::TV
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I'm not sure if that was supposed to be ::TV or :TV but either way is no good. with single : I get error

Code: Select all

Fetch failed: Try again in 5 seconds (2 more) => java.io.IOException: Server returned HTTP response code: 401 for URL: http://www.omdbapi.com/?i=tt8679236&tomatoes=false
with double :: I get no certification, no rating and no imdb tag for series. I checked themoviedb if my sample series has these in the listing and it does.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

Code: Select all

--db TheMovieDB::TV
is correct

Why not working... ?... This is for rednoah ;)
Binding "omdb": net.filebot.web.SeriesInfo cannot be cast to net.filebot.web.TheTVDBSeriesInfo
but omdb have TV info so ?


viewtopic.php?t=5098#p28631
rednoah wrote: 08 Jun 2017, 05:57 1.
{imdbid} is only available for (most but not all) Movie objects, but not for Episode objects. I recommend using TheMovieDB ID for movies and TheTVDB ID for TV shows. Both of these can be accessed via the {id} binding.
Price atm for using TheMovieDB::TV
{certification} and omdb stuff is not supported aka ask rednoah ;)

workaround... use info from TheMovieDB
replace {omdb.rating}

Code: Select all

{rating}
replace {omdb.imdbId}

Code: Select all

{def eAddOns = ["append_to_response":"external_ids"]; net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${s}/episode/${e}", eAddOns, Locale.ENGLISH).external_ids.imdb_id}
All in new format

Code: Select all

{n} {s00e00} {t} {genres} r{rating} {vf} {vc} {ac}-{def eAddOns = ["append_to_response":"external_ids"]; net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${s}/episode/${e}", eAddOns, Locale.ENGLISH).external_ids.imdb_id}
Last edited by kim on 19 Sep 2018, 21:33, edited 2 times in total.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I'm not sure what I'm looking at in this workaround. am I to use that last code box as-is where the formatting goes?

btw, don't tell me this is a VPN issue? I can't be turning that off. I'll check.
Last edited by cafevincent on 20 Sep 2018, 12:24, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

1.
Are you using the latest release? The OMDb API has changed and requires the latest release. FileBot 4.7.9 and older won't work.


2.
--db TheMovieDB::TV is indeed correct, since --mode forced BOTH database and series / movie mode, and internally there are two completely separate implementations for TheMovieDB that handle each mode separately.

e.g. retrieve episode list via TheMovieDB:

Code: Select all

filebot -list --q firefly --db TheMovieDB::TV

3.
TheTVDB is the primary database. Some bindings, especially the more intricate ones, might not be supported if you use TheMovieDB. In this case, the {omdb} only works for TheTVDB (but not AniDB / TheMovieDB) since IMDb ID is required for lookup and (at the time) only TheTVDB included that ID in the series record. I'll have a look if TheMovieDB API provides IMDb ID as well now, then maybe this can be supported in a future release.

Top-level bindings such as {genres} {certification} {rating} etc work for TheMovieDB::TV but with data supplied by TheMovieDB and not IMDb / OMDb:

Code: Select all

$ filebot -list --q firefly --db TheMovieDB::TV --format "{n} {s00e00} {genres} {certification} {rating}"
Firefly S01E01 [Western, Drama, Action & Adventure, Sci-Fi & Fantasy]  8.2
...
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

It does not look like {certification} works atm ?
https://www.themoviedb.org/tv/1437-firefly
Certificering = TV-14
I think because "Certificering" is only on the series level and not on the episode level (API)
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

Yes, all of {genres} {certification} {rating} etc is series level and not episode level. {certification} indeed seems to be broken or unsupported for TheMovieDB::TV right now. I'll have a look.


EDIT:

Support for {certification} would require an additional HTTP request upfront that would be a waste unless {certification} is used in the format later on, and it isn't for most users most of the time, so {certification} will not be supported for TheMovieDB::TV for performances reasons and to not put unnecessary load on TheMovieDB services:
https://developers.themoviedb.org/3/tv/ ... nt-ratings
:idea: Please read the FAQ and How to Request Help.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

there is no need for all the info to be episode level accurate (although ep specific rating would be super), can't I just jut get all the info (incl. cert, rating, imdbId) for the series level instead? and if there is any problems on how its delivered I'll make it work in the script and construct the name if I have to, even if I only get the name of the series (with this info) without episode or title I can make it work. if this can be achieved I'll have my reason for the expensive lifetime license. this all started from a missing imdbId and inaccurate rating for series.. it would be equally bad to have a missing certification.
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

1.
The series {rating} works out of the box.


2.
IMDB ID is not part of the series record, but there might be a way to somehow look up the IMDB ID via the TMDB Series ID via the API somehow:
https://developers.themoviedb.org/3/tv/get-tv-details


3.
For the certification, you could make your own TheMovieDB API request in your custom format. You can build the request URL by using your own API key and {id} and parse the result with Groovy JsonSlurper. It's a simple one liner. The same could be done for episode specific (you have episode.id too) ratings. The same could be done for IMDB lookup.


e.g

Code: Select all

{
	def url = new URL('https://www.filebot.net/reviews.json')
	def json = new groovy.json.JsonSlurper().parse(url)
	return json[0].text
}
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

Here you go... all from my script ;)

Code: Select all

{def eAddOns = ["append_to_response":"external_ids"]; 
def sAddOns = ["append_to_response":"external_ids,content_ratings"];
def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${s}/episode/${e}", eAddOns, Locale.US);
def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US);
def epRating = episodeInfo.vote_average;
def epImdbId = episodeInfo.external_ids.imdb_id;
def mpaaCountryLIST = ['US']
def mpaaRating = seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{"$it.rating"}.join();
(allOf{n}{s00e00}{t}{genres}{mpaaRating}{'r'+epRating}{vf}{vc}{ac}{'-'+epImdbId}).join(' ')
}
EDIT:
change this if you want imdb id for the series not episode
def epImdbId = episodeInfo.external_ids.imdb_id; and {epImdbId}
to
def sImdbId = seriesInfo.external_ids.imdb_id; and {sImdbId}

like {omdb.imdbId} does
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I'm still wondering how to use all this code from the command line, in the meanwhile I have been trying the latest version of filebot and the omdb rating, imdbId seems to work. except when the imdbId starts with a 0, then it gets left out, rendering the id invalid. I'm not sure who to ask for a fix.
Last edited by cafevincent on 06 Nov 2018, 12:32, edited 1 time in total.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

like so (ALL in 1 line):

Code: Select all

filebot -list --q firefly --db TheMovieDB::TV --format "{def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${s}/episode/${e}\", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def mpaaCountryLIST = ['US']; def mpaaRating = seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{\"$it.rating\"}.join(); (allOf{n}{s00e00}{t}{genres}{mpaaRating}{'r'+epRating}{vf}{vc}{ac}{'-'+epImdbId}).join(' ')}"
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

kim wrote: 23 Sep 2018, 19:38 like so (ALL in 1 line):

Code: Select all

filebot -list --q firefly --db TheMovieDB::TV --format "{def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${s}/episode/${e}\", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def mpaaCountryLIST = ['US']; def mpaaRating = seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{\"$it.rating\"}.join(); (allOf{n}{s00e00}{t}{genres}{mpaaRating}{'r'+epRating}{vf}{vc}{ac}{'-'+epImdbId}).join(' ')}"
I tried a recent episode of tosh.0 and I get no certification, rating 0.0 and `null`instead of imdb tag. I tried an episode of GoT and got good results! I wanna build a script that puts in series level info when episode level info is not available. the only thing I would change is get the genres from somewhere else (I don't like the combined `action & adventure` and `scifi & fantasy` genres).
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

"tosh.0 and I get no certification" = make themoviedb account and add the info

All else DONE (I think) ;)

Code: Select all

filebot -list --q firefly --db TheMovieDB::TV --def ut_label=TV --format "{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${season}/episode/${episode}\", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def mpaaCountryLIST = ['CA', 'DE', 'GB', 'US']; def mpaaRating = seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{\"$it.rating\"}.last(); def newGenre = genres*.split(' & ').flatten().each{it}; (allOf{n}{s00e00}{t}{newGenre}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{'-'+any{epImdbId}{sImdbId}}).join(' ')}" --action test
Output:
Firefly S01E01 The Train Job [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.4 -tt0579539
Firefly S01E02 Bushwhacked [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.5 -tt0579528
Firefly S01E03 Our Mrs. Reynolds [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.4 -tt0579532
Firefly S01E04 Jaynestown [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.4 -tt0579530
Firefly S01E05 Out of Gas [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r9.1 -tt0579533
Firefly S01E06 Shindig [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r7.9 -tt0579537
Firefly S01E07 Safe [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.0 -tt0579534
Firefly S01E08 Ariel [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.5 -tt0579527
Firefly S01E09 War Stories [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.1 -tt0579541
Firefly S01E10 Objects in Space [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r9.0 -tt0579531
Firefly S01E11 Serenity [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r7.8 -tt0579535
Firefly S01E12 Heart of Gold [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.1 -tt0579529
Firefly S01E13 Trash [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.2 -tt0579540
Firefly S01E14 The Message [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r7.9 -tt0579538
Firefly S00E01 Serenity [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r10.0 -tt0379786
Firefly S00E02 Here?s How It Was: The Making of ?Firefly? [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.2 -tt0303461
Firefly S00E03 Done the Impossible [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.2 -tt0303461
Firefly S00E04 Browncoats Unite [Western, Drama, Action, Adventure, Sci-Fi, Fantasy] TV-14 r8.2 -tt0303461
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

man it is so cool using this! renaming everything now.

but just to split action & adventure and Sci-Fi & Fantasy is silly. Firefly is not fantasy, Game of Thrones is not sci-fi etc. I don't know why they decided to merge those genres since they've now stopped serving their purpose. they don't use the combos for movies. I take it this means it's not possible (in a single fetch) to also get genres from like tvdb?

I'm starting to learn this language a little bit. is this java?

where are these episode specific ratings coming from? I don't see a per episode voter in themoviedb, and there doesn't seem to be a lot of votes either.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

With TVDB genres (Warning: this is not so fast anymore AND it's possible to find wrong show/info):

Code: Select all

filebot -list --q firefly --db TheMovieDB::TV --def ut_label=TV --format "{def tvdbId = net.filebot.WebServices.TheTVDB.search(series.name, Locale.US).id.join().toInteger(); def tvdbInfo = net.filebot.WebServices.TheTVDB.getSeriesInfo(tvdbId, Locale.US); def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${season}/episode/${episode}\", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def mpaaCountryLIST = ['CA', 'DE', 'GB', 'US']; def mpaaRating = seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{\"$it.rating\"}.last(); def newGenre = genres*.split(' & ').flatten().each{it}; (allOf{n}{s00e00}{t}{any{tvdbInfo.genres}{newGenre}}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{'-'+any{epImdbId}{sImdbId}}).join(' ')}" --action test
it's Groovy/Java

ratings.... you see it now (8.4) ?
https://www.themoviedb.org/tv/1437-fire ... /episode/1
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

problem. can you see the error here?

Code: Select all

d:\SOURCE\Mom.S06E01.1080p.HDTV.x264-PLUTONiUM[TGx]>if "show" == "show" set "form={def tvdbId = net.filebot.WebServices.TheTVDB.search(series.name, Locale.US).id.join().toInteger(); def tvdbInfo = net.filebot.WebServices.TheTVDB.getSeriesInfo(tvdbId, Locale.US); def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${season}/episode/${episode}\", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def mpaaCountryLIST = ['CA', 'DE', 'GB', 'US']; def mpaaRating = seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{\"$it.rating\"}.last(); def newGenre = genres*.split(' & ').flatten().each{it}; (allOf{n}{s00e00}{t}{any{tvdbInfo.genres}{newGenre}}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}"

d:\SOURCE\Mom.S06E01.1080p.HDTV.x264-PLUTONiUM[TGx]>if "show" == "show" filebot -rename -non-strict --db TheMovieDB::TV "E:\TEMP\vren2809181415553\Mom S06E01 1080p HDTV x264-PLUTONiUM.mkv" --q "MOM " --format "{def tvdbId = net.filebot.WebServices.TheTVDB.search(series.name, Locale.US).id.join().toInteger(); def tvdbInfo = net.filebot.WebServices.TheTVDB.getSeriesInfo(tvdbId, Locale.US); def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${season}/episode/${episode}\", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def mpaaCountryLIST = ['CA', 'DE', 'GB', 'US']; def mpaaRating = seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{\"$it.rating\"}.last(); def newGenre = genres*.split(' & ').flatten().each{it}; (allOf{n}{s00e00}{t}{any{tvdbInfo.genres}{newGenre}}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}"  1>nul
Expression yields empty value: For input string: "266967767912643572998843474592763733213542745601485612973853349931248212738302962792931933458242950152211412718163216347536028535229541629421531923032503826993526357932461635219729114129906134862227219613393126787730453591931342728272850342726311211317414737213362373147472742217275815783128195032955880337341049328708336480"
net.filebot.format.SuppressedThrowables: Expression yields empty value: For input string: "266967767912643572998843474592763733213542745601485612973853349931248212738302962792931933458242950152211412718163216347536028535229541629421531923032503826993526357932461635219729114129906134862227219613393126787730453591931342728272850342726311211317414737213362373147472742217275815783128195032955880337341049328708336480"
        at net.filebot.format.ExpressionFormat.format(ExpressionFormat.java:163)
        at net.filebot.format.ExpressionFormat.format(ExpressionFormat.java:129)
        at net.filebot.cli.CmdlineOperations.formatMatches(CmdlineOperations.java:570)
        at net.filebot.cli.CmdlineOperations.renameSeries(CmdlineOperations.java:250)
        at net.filebot.cli.CmdlineOperations.rename(CmdlineOperations.java:96)
        at net.filebot.cli.ArgumentProcessor.runCommand(ArgumentProcessor.java:115)
        at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:32)
        at net.filebot.Main.main(Main.java:131)
Caused by: java.lang.NumberFormatException: For input string: "266967767912643572998843474592763733213542745601485612973853349931248212738302962792931933458242950152211412718163216347536028535229541629421531923032503826993526357932461635219729114129906134862227219613393126787730453591931342728272850342726311211317414737213362373147472742217275815783128195032955880337341049328708336480"
        at Script1.run(Script1.groovy:1)
        at net.filebot.format.SecureCompiledScript$1.run(SecureCompiledScript.java:87)
        at net.filebot.format.SecureCompiledScript.eval(SecureCompiledScript.java:83)
        at net.filebot.format.ExpressionFormat.format(ExpressionFormat.java:147)
        ... 7 more
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

What is this ?

Code: Select all

d:\SOURCE\Mom.S06E01.1080p.HDTV.x264-PLUTONiUM[TGx]>if "show" == "show" set "form={CUSTOM FORMAT}"

d:\SOURCE\Mom.S06E01.1080p.HDTV.x264-PLUTONiUM[TGx]>if "show" == "show" filebot -rename -non-strict --db TheMovieDB::TV "E:\TEMP\vren2809181415553\Mom S06E01 1080p HDTV x264-PLUTONiUM.mkv" --q "MOM " --format "{CUSTOM FORMAT}"  1>nul

Expression yields empty value: For input string: "266967767912643572998843474592763733213542745601485612973853349931248212738302962792931933458242950152211412718163216347536028535229541629421531923032503826993526357932461635219729114129906134862227219613393126787730453591931342728272850342726311211317414737213362373147472742217275815783128195032955880337341049328708336480"
net.filebot.format.SuppressedThrowables: Expression yields empty value: For input string: "266967767912643572998843474592763733213542745601485612973853349931248212738302962792931933458242950152211412718163216347536028535229541629421531923032503826993526357932461635219729114129906134862227219613393126787730453591931342728272850342726311211317414737213362373147472742217275815783128195032955880337341049328708336480"
        at net.filebot.format.ExpressionFormat.format(ExpressionFormat.java:163)
        at net.filebot.format.ExpressionFormat.format(ExpressionFormat.java:129)
        at net.filebot.cli.CmdlineOperations.formatMatches(CmdlineOperations.java:570)
        at net.filebot.cli.CmdlineOperations.renameSeries(CmdlineOperations.java:250)
        at net.filebot.cli.CmdlineOperations.rename(CmdlineOperations.java:96)
        at net.filebot.cli.ArgumentProcessor.runCommand(ArgumentProcessor.java:115)
        at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:32)
        at net.filebot.Main.main(Main.java:131)
Caused by: java.lang.NumberFormatException: For input string: "266967767912643572998843474592763733213542745601485612973853349931248212738302962792931933458242950152211412718163216347536028535229541629421531923032503826993526357932461635219729114129906134862227219613393126787730453591931342728272850342726311211317414737213362373147472742217275815783128195032955880337341049328708336480"
        at Script1.run(Script1.groovy:1)
        at net.filebot.format.SecureCompiledScript$1.run(SecureCompiledScript.java:87)
        at net.filebot.format.SecureCompiledScript.eval(SecureCompiledScript.java:83)
        at net.filebot.format.ExpressionFormat.format(ExpressionFormat.java:147)
        ... 7 more
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

This makes no sense:

Code: Select all

net.filebot.WebServices.TheTVDB.search(series.name, Locale.US).id.join().toInteger()
You're using the series name value to do another search, and then you take the id of ALL results, and concatenate them, yielding a really long string of numbers, and then creating a int value which overflows. It might work if you only get 1 result, but it probably never works if you get more than one.

Why not just use {id} then? The series id is already a given when you select TheTVDB to match files.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

LOL, I only tested with A show with 1 search result...

anyhoo
Format Version 3.0
This will (I think) with any show with a tvdb id, if no id ADD IT ;)

Code: Select all

{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${season}/episode/${episode}\", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def sTvdbId = any{seriesInfo.external_ids.tvdb_id.toInteger()}{null}; def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; def mpaaCountryLIST = ['CA', 'DE', 'GB', 'US']; def mpaaRating = seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{\"$it.rating\"}.last(); def newGenre = genres*.split(' & ').flatten().each{it}; (allOf{n}{s00e00}{t}{any{tvdbInfo.genres}{newGenre}}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{'-'+any{epImdbId}{sImdbId}}).join(' ')}
output
Mom S06E01 Pre-Washed Lettuce and a Mime [Comedy, Drama] TV-14 r6.3 -tt8355548
the new code

Code: Select all

def sTvdbId = any{seriesInfo.external_ids.tvdb_id.toInteger()}{null};
def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; 
btw: No more "wrong show" Warning, now only "not so fast" ;)
With TVDB genres (Warning: this is not so fast anymore AND it's possible to find wrong show/info)
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

perfect! many thanks!! I'm not sure what to think about the episode specific ratings since they are very rare but when there are ratings its very interesting. I think I'll stick with this one for now, thanks again!

also, how do I use this format in the GUI mode?
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

You can click Edit Format and then copy & paste your format.

:idea: If you're prototyping a new format, you probably should do it in the GUI in the first place for instant feedback. :lol:
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

copy/paste in GUI and you will see
SyntaxError: unexpected char: '\'
Why:
because the need to escape characters in the CLI
viewtopic.php?t=1899

Fix:
replace

Code: Select all

\"
with

Code: Select all

"
aka remove ALL the

Code: Select all

\
btw: I think you can download an TMDB mobil app, where you can ez add your votes (not sure)
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

some files still give me an error, this one (for example the show "united states of bacon")...

Code: Select all

Expression yields empty value: Cannot access last() element from an empty List
net.filebot.format.SuppressedThrowables: Expression yields empty value: Cannot access last() element from an empty List
        at net.filebot.format.ExpressionFormat.format(ExpressionFormat.java:163)
        at net.filebot.format.ExpressionFormat.format(ExpressionFormat.java:129)
        at net.filebot.cli.CmdlineOperations.formatMatches(CmdlineOperations.java:570)
        at net.filebot.cli.CmdlineOperations.renameSeries(CmdlineOperations.java:250)
        at net.filebot.cli.CmdlineOperations.rename(CmdlineOperations.java:96)
        at net.filebot.cli.ArgumentProcessor.runCommand(ArgumentProcessor.java:115)
        at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:32)
        at net.filebot.Main.main(Main.java:131)
Caused by: java.util.NoSuchElementException: Cannot access last() element from an empty List
        at Script1.run(Script1.groovy:1)
        at net.filebot.format.SecureCompiledScript$1.run(SecureCompiledScript.java:87)
        at net.filebot.format.SecureCompiledScript.eval(SecureCompiledScript.java:83)
        at net.filebot.format.ExpressionFormat.format(ExpressionFormat.java:147)
        ... 7 more
using this command

Code: Select all

filebot -rename -non-strict --db TheMovieDB::TV "%full%" --q "united states of bacon " --format "%format%"
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

replace

Code: Select all

def mpaaRating = seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{"$it.rating"}.last();
with

Code: Select all

def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{"$it.rating"}.last()}{'No Certification'};
and/or add
"Content Rating" to https://www.themoviedb.org/tv/64954-uni ... nt_ratings
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

so are you saying this error appears when a show has no certification listed? and this new code allows it being missing?

if I'm understanding this correctly, now that it isn't using themoviedb genres I can change

Code: Select all

def newGenre = genres*.split(' & ').flatten().each{it}; (allOf{n}{s00e00}{t}{any{tvdbInfo.genres}{newGenre}}
into

Code: Select all

(allOf{n}{s00e00}{t}{tvdbInfo.genres}
is this correct?
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

correct, if you don't want the "backup"

or
remove

Code: Select all

def newGenre = genres*.split(' & ').flatten().each{it}; 
and change to

Code: Select all

{any{tvdbInfo.genres}{genres}}
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I can't get this to work. it now always comes up with "no certification". without that little code change it gave tv-14 nicely. plus can you make it so it puts nothing in the filename when no certification is found?

note that there are other changes. I reconstructed it but still it gives me "no certification" always.

Code: Select all

filebot -rename -non-strict --db TheMovieDB::TV "friends s01e03.mkv" --q "friends" --format "{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${season}/episode/${episode}\", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def sTvdbId = any{seriesInfo.external_ids.tvdb_id.toInteger()}{null}; def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; def mpaaCountryLIST = ['CA', 'DE', 'GB', 'US']; def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{"$it.rating"}.last()}{'No Certification'}; (allOf{n}{s00e00}{t}{tvdbInfo.genres}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}"
also, I was looking at the `mpaaCountryLIST` and I wonder if the first or the last one is picked when the info is found on all of them? should I assume the last is used if you put US last?
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

you forgot the escape part
viewtopic.php?f=10&p=36169#p36099

Code: Select all

\"$it.rating\"
or just

Code: Select all

{it.rating}

Use the GUI and play round with the format


ONLY US cert

Code: Select all

{
def season = (any{special ? 0 : s} {s}); 
def episode = (any{special ? special : e} {e}); 
def eAddOns = ['append_to_response':'external_ids']; 
def sAddOns = ['append_to_response':'external_ids,content_ratings']; 
def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); 
def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); 
def epRating = episodeInfo.vote_average; 
def epImdbId = episodeInfo.external_ids.imdb_id; 
def sImdbId = seriesInfo.external_ids.imdb_id; 
def sTvdbId = any{seriesInfo.external_ids.tvdb_id.toInteger()}{null}; 
def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; 
def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> r.any{r.iso_3166_1 == 'US'}}.collect{it.rating}[0]}{'No Certification'};
(allOf{n}{s00e00}{t}{tvdbInfo.genres}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')
}
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

can this code chunk be loaded from an external file? it's a bit messy handling this in the script.
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

If you're using the CLI, then I highly recommend loading complex arguments from external text files:
viewtopic.php?f=4&t=3244

That way you can just copy & paste your format from the GUI into a text file, and use it as is without having to worry about command-line escaping anything.
:idea: Please read the FAQ and How to Request Help.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I'm trying to find examples of how to use an external file that only includes the formatting. didn't find any matching my situation so I tried my own. this is the content of my args.txt file:

Code: Select all

{
def season = (any{special ? 0 : s} {s}); 
def episode = (any{special ? special : e} {e}); 
def eAddOns = ['append_to_response':'external_ids']; 
def sAddOns = ['append_to_response':'external_ids,content_ratings']; 
def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${season}/episode/${episode}\", eAddOns, Locale.US); 
def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); 
def epRating = episodeInfo.vote_average; 
def epImdbId = episodeInfo.external_ids.imdb_id; 
def sImdbId = seriesInfo.external_ids.imdb_id; 
def sTvdbId = any{seriesInfo.external_ids.tvdb_id.toInteger()}{null}; 
def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; 
def mpaaCountryLIST = ['FI', 'US', 'CA', 'GB']; 
def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''}; 
(allOf{n}{s00e00}{t}{tvdbInfo.genres}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')
}
and this is how I tried to run it, with the results

Code: Select all

filebot -script --db TheMovieDB::TV "friends s01e03.mkv" --q "friends" --format "@args.txt"
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <:> at index 10: TheMovieDB::TV (TheMovieDB::TV)
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <?> at index 26: def season = (any{special ? 0 : s} {s});  (def season = (any{special ? 0 : s} {s}); )
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <?> at index 27: def episode = (any{special ? special : e} {e});  (def episode = (any{special ? special : e} {e}); )
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <:> at index 35: def eAddOns = ['append_to_response':'external_ids'];  (def eAddOns = ['append_to_response':'external_ids']; )
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <:> at index 35: def sAddOns = ['append_to_response':'external_ids,content_ratings'];  (def sAddOns = ['append_to_response':'external_ids,content_ratings']; )
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <"> at index 62: def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv\${id}\season\${season}\episode\${episode}\", eAddOns, Locale.US);  (def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv\${id}\season\${season}\episode\${episode}\", eAddOns, Locale.US); )
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <"> at index 61: def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv\${id}\", sAddOns, Locale.US);  (def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv\${id}\", sAddOns, Locale.US); )
Illegal Argument: java.nio.file.InvalidPathException: Trailing char < > at index 40: def epRating = episodeInfo.vote_average;  (def epRating = episodeInfo.vote_average; )
Illegal Argument: java.nio.file.InvalidPathException: Trailing char < > at index 48: def epImdbId = episodeInfo.external_ids.imdb_id;  (def epImdbId = episodeInfo.external_ids.imdb_id; )
Illegal Argument: java.nio.file.InvalidPathException: Trailing char < > at index 46: def sImdbId = seriesInfo.external_ids.imdb_id;  (def sImdbId = seriesInfo.external_ids.imdb_id; )
Illegal Argument: java.nio.file.InvalidPathException: Trailing char < > at index 69: def sTvdbId = any{seriesInfo.external_ids.tvdb_id.toInteger()}{null};  (def sTvdbId = any{seriesInfo.external_ids.tvdb_id.toInteger()}{null}; )
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <?> at index 33: def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null;  (def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; )
Illegal Argument: java.nio.file.InvalidPathException: Trailing char < > at index 47: def mpaaCountryLIST = ['FI', 'US', 'CA', 'GB'];  (def mpaaCountryLIST = ['FI', 'US', 'CA', 'GB']; )
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <>> at index 67: def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''};  (def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''}; )
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <?> at index 87: (allOf{n}{s00e00}{t}{tvdbInfo.genres}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ') ((allOf{n}{s00e00}{t}{tvdbInfo.genres}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' '))
Illegal Argument: java.nio.file.NoSuchFileException: C:\Users\Administrator\} (})
Bad script source: --db
Failure (°_°)
I also tried launching with this: and with --format added to the beginning of the args.txt file

Code: Select all

filebot -script fn:rename --db TheMovieDB::TV "friends s01e03.mkv" --q "friends" --def "@args.txt"
resulting in error "script not found: rename". if I run this as a script doesn't it need more than just the format?
Last edited by cafevincent on 05 Oct 2018, 11:25, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

That's indeed tricky. If you were using the amc script then you could use --def seriesFormat=@/path/to/series.format.groovy and just pass in a multi-line format via that file, since the amc script uses multiple --def parameters instead of the --format option for custom formats.

However, if you're using simple filebot -rename calls, then you can only do filebot @args.txt which allows you to pass all arguments line by line which means your format has to be a single line as well. Not ideal for complex formats, but that's how it works.

e.g.

Code: Select all

-rename
--format
{n} {sxe} {t}
:arrow: Writing anything in a single line is not a problem however, since you can always use ; instead of a newline if necessary.



:idea: There is no rename script. There is a renall script, but that doesn't help you in the slightest in this particular case. The fn:renall script is just a wrapper that calls filebot -rename for each folder, and thus just uses the --format argument, and not multiple --def name=value options for multiple formats per category like the amc script does.
:idea: Please read the FAQ and How to Request Help.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

so in simple -rename use I can put all the static arguments into the args.txt (without @ in filename) file like this?

Code: Select all

-rename
--db TheMovieDB::TV
--format "{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${season}/episode/${episode}\", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def sTvdbId = any{seriesInfo.external_ids.tvdb_id.toInteger()}{null}; def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; def mpaaCountryLIST = ['FI', 'US', 'CA', 'GB']; def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''}; (allOf{n}{s00e00}{t}{tvdbInfo.genres}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}"
...and then call it something like this?

Code: Select all

filebot "friends s01e03.mkv" --q "friends" --def @args.txt
there must be an error somewhere because I get error:

Code: Select all

SyntaxError: unexpected token: }
javax.script.ScriptException: SyntaxError: unexpected token: }
        at net.filebot.format.ExpressionFormat.compile(ExpressionFormat.java:106)
        at net.filebot.format.ExpressionFormat.<init>(ExpressionFormat.java:43)
        at net.filebot.format.ExpressionFileFormat.<init>(ExpressionFileFormat.java:13)
        at net.filebot.cli.ArgumentBean.getExpressionFileFormat(ArgumentBean.java:252)
        at net.filebot.cli.ArgumentProcessor.runCommand(ArgumentProcessor.java:115)
        at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:32)
        at net.filebot.Main.main(Main.java:131)

Failure (°_°)
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

1.
No, because 1 argument per 1 line. The entire point of doing this is so that you don't need to quote or escape arguments, because you're using lines to separate arguments, and not spaces. ;)

NO:

Code: Select all

-rename
--db TheMovieDB::TV
:idea: This would be equivalent to "-rename" "--db TheMovieDB::TV" which doesn't make sense.

YES:

Code: Select all

-rename
--db
TheMovieDB::TV


2.
Forget about --def. It's confusing you. If you're using filebot -rename then --def does not exist as far as you need to know. --def name=value are used to pass arbitrary key=value pairs into custom scripts which is not relevant for this particular use case.

NO:

Code: Select all

filebot "friends s01e03.mkv" --q "friends" --def @args.txt
YES:

Code: Select all

filebot @args.txt "friends s01e03.mkv" --q "friends"
YES:

Code: Select all

filebot "friends s01e03.mkv" --q "friends" @args.txt
:idea: Please read the FAQ and How to Request Help.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

got it! works now. thanks, this really helps with the script a whole lot. sorry for the redundant noobism.

still, I'm interested in the order of the mpaaCountryLIST, not to focus on US certifications but to customize the list. if I want 'FI' and 'US' but I prefer 'FI' then do I place it first or last?
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

If you try to remove the ".last()" and play around with the "mpaaCountryLIST" you will answer your question ;)

Very few (if any) has 'FI' rating... but anyhoo this is what you want

if 'FI' use... else if 'US' use... else null aka blank

Code: Select all

def mpaaRating = any{seriesInfo.content_ratings.results.findAll{it.iso_3166_1 == 'FI' ? it : it.iso_3166_1 == 'US' ? it : null}.find{it}.rating}{''};
replaces

Code: Select all

def mpaaCountryLIST = ['FI', 'US', 'CA', 'GB']; 
def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''};
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I am trying to add `(year)` in but the way I'm using the parenthesis with the year is wrong, I get error warning: illegal. I'm not sure how to escape them...

Code: Select all

-rename
--db
TheMovieDB::TV
--format
"{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def sTvdbId = any{seriesInfo.external_ids.tvdb_id.toInteger()}{null}; def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; def mpaaCountryLIST = ['FI', 'US']; def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''}; (allOf{n}({y}){s00e00}{t}{tvdbInfo.genres}{mpaaRating}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}"
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

cant you just use ?

Code: Select all

{'('+y+')'}
or

Code: Select all

{ny}
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

:o :D thx!
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I edited it to replace both 0.0 and 10.0 rating with the series rating, not only 0.0

Code: Select all

{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def sTvdbId = any{seriesInfo.external_ids.tvdb_id.toInteger()}{null}; def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; def mpaaCountryLIST = ['FI', 'US']; def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''}; (allOf{ny}{s00e00}{t}{tvdbInfo.genres}{any{mpaaRating}{'NR'}}{'r'+any{epRating.toString() != '0.0' ? epRating.round(1) : null}{epRating.toString() != '10.0' ? epRating.round(1) : null}{rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}
it doesn't seem to work. renaming an ep of brickleberry produces 0.0. the show has no episode votes but does have series rating.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

Code: Select all

{'r'+any{epRating.toString() != '0.0' && epRating.toString() != '10.0' ? epRating.round(1) : null}{rating}}
when I tested before I'm could not get it to work without the "toString()" BUT it look like it works now , weird...

Code: Select all

{'r'+any{epRating != 0.0 && epRating != 10.0 ? epRating.round(1) : null}{rating}}
or

Code: Select all

{'r'+any{epRating > 0.0 && epRating < 10.0 ? epRating.round(1) : null}{'rating'}}
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

or better

Code: Select all

{'r'+any{episodeInfo.vote_count > 1 || epRating > 0.0 && epRating < 10.0 ? epRating.round(1) : null}{rating}}
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

wait, you can access vote count?? that makes this much better! no need to avoid 0.0 or 10.0, simply only require 5 votes or else use series rating. actually, require 5 votes for series rating too. finally no more wild ratings because of too few voters! perfect!

would you please send me your bitcoin address, I would like to send you a few "beers" as thanks!
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

cafevincent wrote: 19 Oct 2018, 21:11 would you please send me your bitcoin address, I would like to send you a few "beers" as thanks!
Noice! w00t w00t for kim! :ugeek:
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

Well if you like that, this will blow your mind :P

Now with TV (series and episode) OMDB (IMDB) support :D

CLI version:

Code: Select all

{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}/season/${season}/episode/${episode}\", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\"tv/${id}\", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; def OMDbSeriesInfo = (sImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':sImdbId]) : null; def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; def sOMDbVotes = any{OMDbSeriesInfo.imdbVotes.replaceAll(/\D/) as int}{null}; def sTvdbId = any{seriesInfo.external_ids.tvdb_id as int}{null}; def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; def mpaaCountryLIST = ['FI', 'US']; def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''}; (allOf{ny}{s00e00}{t}{any{tvdbInfo.genres}{OMDbEpisodeInfo.Genre.split(',')}}{any{mpaaRating}{OMDbSeriesInfo.Rated}{'NR'}}{'r'+any{epOMDbVotes >= 5 ? OMDbEpisodeInfo.imdbRating : null}{sOMDbVotes >= 5 ? OMDbSeriesInfo.imdbRating : null}{(episodeInfo.vote_count as int) >= 5 ? epRating.round(1) : null}{' '}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}
GUI version:

Code: Select all

{def season = (any{special ? 0 : s} {s}); 
def episode = (any{special ? special : e} {e}); 
def eAddOns = ['append_to_response':'external_ids']; 
def sAddOns = ['append_to_response':'external_ids,content_ratings']; 
def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); 
def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); 
def epRating = episodeInfo.vote_average; 
def epImdbId = episodeInfo.external_ids.imdb_id; 
def sImdbId = seriesInfo.external_ids.imdb_id; 
def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; 
def OMDbSeriesInfo = (sImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':sImdbId]) : null; 
def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; 
def sOMDbVotes = any{OMDbSeriesInfo.imdbVotes.replaceAll(/\D/) as int}{null}; 
def sTvdbId = any{seriesInfo.external_ids.tvdb_id as int}{null}; 
def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; 
def mpaaCountryLIST = ['FI', 'US']; 
def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''}; 
(allOf{ny}{s00e00}{t}{any{tvdbInfo.genres}{OMDbEpisodeInfo.Genre.split(',')}}{any{mpaaRating}{OMDbSeriesInfo.Rated}{'NR'}}{'r'+any{epOMDbVotes >= 5 ? OMDbEpisodeInfo.imdbRating : null}{sOMDbVotes >= 5 ? OMDbSeriesInfo.imdbRating : null}{(episodeInfo.vote_count as int) >= 5 ? epRating.round(1) : null}{' '}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}

TVDB alternative:

Code: Select all

{(allOf{ny}{s00e00}{t}{genres}{any{certification}{omdb.Certification}{'NR'}}{'r'+any{omdb.votes >= 5 ? omdb.rating : null}{votes >= 5 ? rating : null}{' '}}{vf}{vc}{ac}{any{'tt'+(omdb.ImdbId).pad(7)}{''}}).join(' ')}
I do not have a bitcoin wallet, but you can give it to charity of your choice ;)
Last edited by kim on 04 Nov 2018, 17:34, edited 1 time in total.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

TVDB alternative version 2:

CLI version:

Code: Select all

{import net.filebot.Cache; def epId = net.filebot.WebServices.TheTVDB.getEpisodeList(id, null, Locale.US).find{it =~ sxe || it =~ it.special}.id; def epTVDbInfo = (epId != null) ? net.filebot.WebServices.TheTVDB.requestJson(\"episodes/${epId}\", Locale.US, Cache.ONE_WEEK).data : null; def epImdbId = epTVDbInfo.imdbId; def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; (allOf{ny}{s00e00}{t}{genres}{any{certification}{omdb.Certification.replaceAll(/N\/A/)}{'NR'}}{'r'+any{epOMDbVotes >= 5 ? OMDbEpisodeInfo.imdbRating : null}{omdb.votes >= 5 ? omdb.rating : null}{votes >= 5 ? rating : null}{' '}}{vf}{vc}{ac}{any{epImdbId}{OMDbEpisodeInfo.imdbID}{'tt'+(omdb.ImdbId).pad(7)}{''}}).join(' ')}
GUI version:

Code: Select all

{import net.filebot.Cache; 
def epId = net.filebot.WebServices.TheTVDB.getEpisodeList(id, null, Locale.US).find{it =~ sxe || it =~ it.special}.id; 
def epTVDbInfo = (epId != null) ? net.filebot.WebServices.TheTVDB.requestJson("episodes/${epId}", Locale.US, Cache.ONE_WEEK).data : null; 
def epImdbId = epTVDbInfo.imdbId; 
def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; 
def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; 
(allOf{ny}{s00e00}{t}{genres}{any{certification}{omdb.Certification.replaceAll(/N\/A/)}{'NR'}}{'r'+any{epOMDbVotes >= 5 ? OMDbEpisodeInfo.imdbRating : null}{omdb.votes >= 5 ? omdb.rating : null}{votes >= 5 ? rating : null}{' '}}{vf}{vc}{ac}{any{epImdbId}{OMDbEpisodeInfo.imdbID}{'tt'+(omdb.ImdbId).pad(7)}{''}}).join(' ')}
sample result:
Firefly (2002) S01E01 The Train Job [Drama Science-Fiction] TV-14 r8.5 tt0579539
Firefly (2002) S01E02 Bushwhacked [Drama Science-Fiction] TV-14 r8.6 tt0579528
Firefly (2002) S01E03 Our Mrs. Reynolds [Drama Science-Fiction] TV-14 r9.1 tt0579532
Firefly (2002) S01E04 Jaynestown [Drama Science-Fiction] TV-14 r8.8 tt0579530
Firefly (2002) S01E05 Out of Gas [Drama Science-Fiction] TV-14 r9.4 tt0579533
Firefly (2002) S01E06 Shindig [Drama Science-Fiction] TV-14 r8.5 tt0579537
Firefly (2002) S01E07 Safe [Drama Science-Fiction] TV-14 r8.3 tt0579534
Firefly (2002) S01E08 Ariel [Drama Science-Fiction] TV-14 r9.1 tt0579527
Firefly (2002) S01E09 War Stories [Drama Science-Fiction] TV-14 r8.9 tt0579541
Firefly (2002) S01E10 Objects in Space [Drama Science-Fiction] TV-14 r9.3 tt0579531
Firefly (2002) S01E11 Serenity [Drama Science-Fiction] TV-14 r8.7 tt0579535
Firefly (2002) S01E12 Heart of Gold [Drama Science-Fiction] TV-14 r8.4 tt0579529
Firefly (2002) S01E13 Trash [Drama Science-Fiction] TV-14 r8.9 tt0579540
Firefly (2002) S01E14 The Message [Drama Science-Fiction] TV-14 r8.5 tt0579538
Firefly (2002) S00E01 Serenity [Drama Science-Fiction] TV-14 r9.0 tt0303461
Firefly (2002) S00E03 Done the Impossible [Drama Science-Fiction] TV-14 r9.0 tt0303461
Firefly (2002) S00E02 Here's How It Was: The Making of "Firefly" [Drama Science-Fiction] TV-14 r9.0 tt0303461
Firefly (2002) S00E04 Browncoats Unite [Drama Science-Fiction] TV-14 r9.0 tt0303461
Last edited by kim on 04 Nov 2018, 17:29, edited 4 times in total.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

so.. OMDb has the same exact ratings as IMDb because they have been copied over when IMDb used to have an API? then how come they have the same rating for modern shows? and if the ratings are simply copied (no site votes) then how can you set it to 5 votes minimum? would that mean we are requiring the original IMDb rating + 4 OMDb site votes from the days it was possible to vote on the site? unless when they copied the info from IMDb they also included the amount of votes there? also, shouldn't some of the votes be slightly different if there has been OMDb site votes on top of the IMDb ones? ANY information about the benefits of these new ones would be greatly appreciated!

none of that matters, really, since it seems to work nicely (only worried if the 5 vote minimum is needed with OMDb), and I much more appreciate the IMDb ratings. this is truly amazing, really. my eyes nearly bolted out of my head when I saw the results!
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

OMDb gets new info from IMDB, both old and new Movies / TV shows (series and episodes)

How often ?
Don't know, but my guess is 1 x week and older stuff 1 x month/year ?

If they use an API or scrap the info, I don't know.... but it works ;)
maybe they use https://www.imdb.com/interfaces/

Test it out here:
http://www.omdbapi.com/
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

for some series this produces a `N/A` certification, which divides the first half of the resulting filename into a directory name and and the second half to the filename.

plus could you please build one that renames movies via omdb?
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

cafevincent wrote: 04 Nov 2018, 12:26 for some series this produces a `N/A` certification, which divides the first half of the resulting filename into a directory name and and the second half to the filename.
I need a sample ?

renames movies via omdb
why is there a need for this ?
sample ?

you can just use:

Code: Select all

{omdb.genres}

Code: Select all

{omdb.rating}

Code: Select all

{omdb.votes}
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

try fetching `Psychoville (2009) - S01E01 - Black Mail.mkv` to get the `N/A` to appear.

for movies I am hoping for the possibility to get the certification from omdb, they have wider range of countries for the country list. I am currently using the simple omdb.certification but it has the same `N/A` problem for some files.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

Code: Select all

{OMDbSeriesInfo.Rated.replaceAll(/N\/A/)}
if you need to escape it then

Code: Select all

{OMDbSeriesInfo.Rated.replaceAll(/N\\/A/)} 
Sound like you want this:

Code: Select all

def certifications = net.filebot.WebServices.TheMovieDB.getMovieInfo(movie, Locale.US, true).certifications
e.g.

Code: Select all

{certifications.FI}
sample from Avatar:
K-13
all available from:

Code: Select all

{certifications}
GB=12A, DE=12, ES=7, NZ=M, AU=M, KR=12, GR=Κ-13, ZA=13M-LV, DK=15, KZ=Б14, NL=12, HU=16, BR=10, CA=PG, CH=12, SE=11, CZ=U, RU=16+, IT=T, BG=PG-13, FI=K-13, PT=M/6, BE=12-KT, US=PG-13, FR=10
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

psychoville now works, but I only now started to wonder... why is OMDb giving no cert or rating for this show (not even for one episode) when IMDb does have all the info, including episode level id, ratings?

I'm still trying to figure out what you mean by the `def certification` customization...
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

from http://www.omdbapi.com/

Code: Select all

{"Title":"Blackmail","Year":"2009","Rated":"N/A","Released":"18 Jun 2009","Season":"N/A","Episode":"N/A","Runtime":"N/A","Genre":"Comedy, Horror, Mystery","Director":"Matt Lipsey","Writer":"Steve Pemberton, Reece Shearsmith","Actors":"Sally Sanders, Reece Shearsmith, Dawn French, Freddie Fruitcake","Plot":"One by one, people in different English counties receive the same grim, succinct, chilling note 'I know what you did'. They seem to have nothing in common, usually doing badly. A blind ...","Language":"N/A","Country":"N/A","Awards":"N/A","Poster":"http://ia.media-imdb.com/images/M/MV5BMTEyNzg5MzQxNjReQTJeQWpwZ15BbWU3MDY1Njg3ODM@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"7.2/10"}],"Metascore":"N/A","imdbRating":"7.2","imdbVotes":"83","imdbID":"tt1443130","seriesID":"N/A","Type":"episode","Response":"True"}
maybe rednoah can answer why missing info and outdated e.g. imdbVotes (current = 152) ?
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

OMDb ≠ IMDb

It's not the same. Presumably, OMDb regularly scrapes IMDb web pages to collect data, but probably not too regularly as to avoid getting sued by whoever owns IMDb.
:idea: Please read the FAQ and How to Request Help.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

well this particular show is a (2009) show
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

There's a good chance that the last time this particular show was scraped, something went wrong, and hence the bad data.
:idea: Please read the FAQ and How to Request Help.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

rednoah wrote: 05 Nov 2018, 15:47 OMDb ≠ IMDb

It's not the same. Presumably, OMDb regularly scrapes IMDb web pages to collect data, but probably not too regularly as to avoid getting sued by whoever owns IMDb.
that would be Amazon.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

this is what I gathered you meant with your certification for movies

Code: Select all

-rename
--db
TheMovieDb
--format
"{def certifications = net.filebot.WebServices.TheMovieDB.getMovieInfo(movie, Locale.US, true).certifications; (allOf{ny}{director}{omdb.genres}{any{OMDb.certifications.FI.replaceAll(/N\\/A/)}{OMDb.certifications.US.replaceAll(/N\\/A/)}{'NR'}}{'r'+any{omdb.rating}{' '}}{vf}{vc}{ac}{imdbid}).join(' ')}"
seems to work nicely, but can we do this with omdb instead? I assume they have the whole imdb certifications list. I tried replacing the .themoviedb. bit with .omdb. but it stopped working.

instead of my FI, US only thing I was thinking it would be more accurate and informative (not to mention universal) to have the certifications data...
GB=12A, DE=12, ES=7, NZ=M, AU=M, KR=12, GR=Κ-13, ZA=13M-LV, DK=15, KZ=Б14, NL=12, HU=16, BR=10, CA=PG, CH=12, SE=11, CZ=U, RU=16+, IT=T, BG=PG-13, FI=K-13, PT=M/6, BE=12-KT, US=PG-13, FR=10
...be stripped down to numerals and calculated into an average value, rounded to the closest full number. the few alphabetical-only certifications being ignored. these here 20 (numeral) certifications would average to 12.1 = k12. unless it's too complex?
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

OMDb does NOT have other then US "Rated":

Code: Select all

{"Title":"Avatar","Year":"2009","Rated":"PG-13","Released":"18 Dec 2009","Runtime":"162 min","Genre":"Action, Adventure, Fantasy","Director":"James Cameron","Writer":"James Cameron","Actors":"Sam Worthington, Zoe Saldana, Sigourney Weaver, Stephen Lang","Plot":"A paraplegic marine dispatched to the moon Pandora on a unique mission becomes torn between following his orders and protecting the world he feels is his home.","Language":"English, Spanish","Country":"UK, USA","Awards":"Won 3 Oscars. Another 85 wins & 128 nominations.","Poster":"https://m.media-amazon.com/images/M/MV5BMTYwOTEwNjAzMl5BMl5BanBnXkFtZTcwODc5MTUwMw@@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"7.8/10"},{"Source":"Rotten Tomatoes","Value":"82%"},{"Source":"Metacritic","Value":"83/100"}],"Metascore":"83","imdbRating":"7.8","imdbVotes":"1,003,716","imdbID":"tt0499549","Type":"movie","DVD":"22 Apr 2010","BoxOffice":"$749,700,000","Production":"20th Century Fox","Website":"http://www.avatarmovie.com/","Response":"True"}
TheMovieDB is WAY better:

Code: Select all

{def certifications = net.filebot.WebServices.TheMovieDB.getMovieInfo(movie, Locale.US, true).certifications; 
def cleanNum = certifications.findResults{key, value -> value.replaceAll(/\D/)}.findAll{it}*.toInteger();
def int avg = (cleanNum.sum() / cleanNum.size()).toDouble().round();
(allOf{ny}{director}{any{omdb.genres}{genres}}{any{'K-'+avg}{certifications.FI}{certifications.US}{'NR'}}{'r'+any{omdb.rating}{rating}{' '}}{vf}{vc}{ac}{imdbid}).join(' ')}
sample (fake file):
Avatar (2009) James Cameron [Action, Adventure, Fantasy] K-12 r7.8 tt0499549
PS: I don't think it will work well with e.g. "For all ages" cert.
e.g. Cinderella 1950 = K-3
https://en.wikipedia.org/wiki/Finnish_B ... sification

so maybe use

Code: Select all

{avg > 5 ? 'K-'+avg : null}
or

Code: Select all

{avg == 0 ? 'S' : 'K-'+avg}
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I get error:

Code: Select all

Illegal Argument: java.nio.file.InvalidPathException: Illegal char <>> at index 54: def cleanNum = certifications.findResults{key, value -> value.replaceAll(\D\)}.findAll{it}*.toInteger(); (def cleanNum = certifications.findResults{key, value -> value.replaceAll(\D\)}.findAll{it}*.toInteger();)
Illegal Argument: java.nio.file.InvalidPathException: Trailing char < > at index 29: def int avg = (cleanNum.sum() \ cleanNum.size()).toDouble().round(); (def int avg = (cleanNum.sum() \ cleanNum.size()).toDouble().round();)
Illegal Argument: java.nio.file.InvalidPathException: Illegal char <"> at index 171: (allOf{ny}{director}{any{omdb.genres}{genres}}{any{'c'+avg}{certifications.FI}{certifications.US}{'NR'}}{'r'+any{omdb.rating}{rating}{' '}}{vf}{vc}{ac}{imdbid}).join(' ')}" ((allOf{ny}{director}{any{omdb.genres}{genres}}{any{'c'+avg}{certifications.FI}{certifications.US}{'NR'}}{'r'+any{omdb.rating}{rating}{' '}}{vf}{vc}{ac}{imdbid}).join(' ')}")
SyntaxError: missing token: }
javax.script.ScriptException: SyntaxError: missing token: }
        at net.filebot.format.ExpressionFormat.compile(ExpressionFormat.java:112)
        at net.filebot.format.ExpressionFormat.<init>(ExpressionFormat.java:43)
        at net.filebot.format.ExpressionFileFormat.<init>(ExpressionFileFormat.java:13)
        at net.filebot.cli.ArgumentBean.getExpressionFileFormat(ArgumentBean.java:252)
        at net.filebot.cli.ArgumentProcessor.runCommand(ArgumentProcessor.java:115)
        at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:32)
        at net.filebot.Main.main(Main.java:131)
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

Looks like a command-line issue:
viewtopic.php?f=4&t=1899


:idea: Use the @file syntax for reading command-line arguments from external text files.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

I post in GUI format, you need to remember (learn) to escape stuff before use in CLI
SyntaxError: missing token: }
javax.script.ScriptException: SyntaxError: missing token: }

Code: Select all

{def certifications = net.filebot.WebServices.TheMovieDB.getMovieInfo(movie, Locale.US, true).certifications; def cleanNum = certifications.findResults{key, value -> value.replaceAll('\\D')}.findAll{it}*.toInteger(); def int avg = any{(cleanNum.sum() / cleanNum.size()).toDouble().round()}{}; (allOf{ny}{director}{any{omdb.genres}{genres}}{any{avg == 0 ? 'S' : avg >= 5 ? 'K-'+avg : null}{certifications.FI}{certifications.US}{'NR'}}{'r'+any{omdb.Rating}{rating}{' '}}{vf}{vc}{ac}{imdbid}).join(' ')}
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

well now I get this error

Code: Select all

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedConstructor$1 (file:/C:/Program%20Files/FileBot/jar/groovy.jar) to constructor java.math.BigDecimal(java.math.BigInteger,long,int,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedConstructor$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
even though the file gets renamed correctly, seemingly.
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

You can ignore these Groovy / Java 9+ warning messages.
:idea: Please read the FAQ and How to Request Help.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

testing on a massive scale now. at least one interesting popped up:

https://www.themoviedb.org/movie/11324- ... uage=en-US

this movie gets a certification of 99, meaning it probably counts the 16/14 from Switzerland as 1614, not a separate number.

btw this average certification is awesome, finally a definitive indicator!
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

simple fix

Code: Select all

def cleanNum = certifications.findResults{key, value -> value.replaceAll('\\D')}.findAll{it}*.toInteger().findAll{it < 22}; 
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

the series version did a weird thing today. it renamed the whole season 2 of "F is for Family" so that there were no brackets around the genres. weird right?

this is the one I'm currently using

Code: Select all

-rename
--db
TheMovieDB::TV
--format
"{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; def OMDbSeriesInfo = (sImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':sImdbId]) : null; def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; def sOMDbVotes = any{OMDbSeriesInfo.imdbVotes.replaceAll(/D/) as int}{null}; def sTvdbId = any{seriesInfo.external_ids.tvdb_id as int}{null}; def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; def mpaaCountryLIST = ['FI', 'US']; def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''}; (allOf{ny}{s00e00}{t}{any{OMDbEpisodeInfo.Genre}{tvdbInfo.genres}}{any{mpaaRating}{OMDbSeriesInfo.Rated.replaceAll(/N\\/A/)}{'NR'}}{'r'+any{epOMDbVotes >= 5 ? OMDbEpisodeInfo.imdbRating : null}{sOMDbVotes >= 5 ? OMDbSeriesInfo.imdbRating : null}{(episodeInfo.vote_count as int) >= 5 ? epRating.round(1) : null}{' '}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}"
edit: it's doing it for everything now. this should probably be simplified. I trust omdb to provide accurate information so no need for the check for 5 votes, among other things, only these:

{ny}{s00e00}{t}{genres}{any{avg.episode.certification}{avg.series.certification}{NR}}{any{episode.rating}{series.rating}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

is this close? it says "The current scope already contains a variable of the name eavg"

Code: Select all

-rename
--db
TheMovieDB::TV
--format
"{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; def OMDbSeriesInfo = (sImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':sImdbId]) : null; def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; def sOMDbVotes = any{OMDbSeriesInfo.imdbVotes.replaceAll(/D/) as int}{null}; def sTvdbId = any{seriesInfo.external_ids.tvdb_id as int}{null}; def tvdbInfo = (sTvdbId != null) ? net.filebot.WebServices.TheTVDB.getSeriesInfo(sTvdbId, Locale.US) : null; def mpaaCountryLIST = ['FI', 'US']; def mpaaRating = any{seriesInfo.content_ratings.results.findAll{r -> mpaaCountryLIST.any{r.iso_3166_1.contains(it)}}.sort().collect{it.rating}.last()}{''}; def ecertifications = net.filebot.WebServices.TheMovieDB.getEpisodeInfo(eAddOns, Locale.US, true).ecertifications; def ecleanNum = ecertifications.findResults{key, value -> value.replaceAll('\\D')}.findAll{it}*.toInteger().findAll{it < 22}; def int eavg = (ecleanNum.sum() / ecleanNum.size()).toDouble().round(); def scertifications = net.filebot.WebServices.TheMovieDB.getSeriesInfo(sAddOns, Locale.US, true).scertifications; def scleanNum = scertifications.findResults{key, value -> value.replaceAll('\\D')}.findAll{it}*.toInteger().findAll{it < 22}; def int eavg = (scleanNum.sum() / scleanNum.size()).toDouble().round(); (allOf{ny}{s00e00}{t}{OMDbEpisodeInfo.Genre}{'c'+any{eavg}{savg}{'NR'}}{'r'+any{OMDbSeriesInfo.imdbRating}{epRating.round(1)}{' '}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}"
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

cafevincent wrote: 11 Nov 2018, 12:56 is this close? it says "The current scope already contains a variable of the name eavg"
1. in short = no

2. can you have more then 1 variable named "eavg" on same "level" ?

3. do you see "content ratings (certifications)" on episode level ?
https://developers.themoviedb.org/3/tv- ... de-details

4. why do you change my code and not confirming your changes works in the GUI piece by piece ?
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

kim wrote: 12 Nov 2018, 19:13 1. in short = no

2. can you have more then 1 variable named "eavg" on same "level" ?

3. do you see "content ratings (certifications)" on episode level ?
https://developers.themoviedb.org/3/tv- ... de-details
just got to realizing both those things just before noticing this post, believe it or not.. you gave me just enough time for self-reflection. sorry :oops:, here is my new streamlined one I'm trying to debug. it looks a lot better but it's also broken, saying "unexpected token: key". I don't know what to do about it.

Code: Select all

-rename
--db
TheMovieDB::TV
--format
"def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); def epRating = episodeInfo.vote_average; def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); def certifications = net.filebot.WebServices.TheMovieDB.getSeriesInfo(series, Locale.US, true).certifications; def cleanNum = certifications.findResults{key, value -> value.replaceAll('\\D')}.findAll{it}*.toInteger().findAll{it < 22}; def int avg = (cleanNum.sum() / cleanNum.size()).toDouble().round(); def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; def epImdbId = episodeInfo.external_ids.imdb_id; (allOf{ny}{s00e00}{t}{OMDbEpisodeInfo.Genre}{'c'{avg}}{'r'{OMDbEpisodeInfo.imdbRating}}{vf}{vc}{ac}{epImdbId}).join(' ')}"
kim wrote: 12 Nov 2018, 19:13 4. why do you change my code and not confirming your changes works in the GUI piece by piece ?
thanks for the tip.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

Code: Select all

{
def sAddOns = ['append_to_response':'external_ids,content_ratings']; 
def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\u0022tv/${id}\u0022, sAddOns, Locale.US); 
def scleanNum = seriesInfo.content_ratings.results*.findResults{key, value -> value.replaceAll('\\D')}.flatten().findAll{it}*.toInteger().findAll{it < 22}; 
int savg = (scleanNum.sum().div(scleanNum.size())).toDouble().round(); 
}
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

still "unexpected token: key". it looks like the "{key, value -> " bit divides each cert entry into alphabetical markings (key, unused) and numerals (value), yet is somehow is not recognized as valid word to use here? god I wish I knew some java right now.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

where is the { ?

Code: Select all

--format
"def season

Code: Select all

--format
"{def season
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I'm sorry but adding the missing { did not help much, it now produces an empty filename with extension only.

Code: Select all

Rename episodes using [TheMovieDB]
Fetching episode data for [StartUp]
Stripping invalid characters from new path: ""
[MOVE] from [E:\TEMP\vr1507079\StartUp 2016 S03E01 Rebranding 1080p.mkv] to [E:\TEMP\vr1507079\.mkv]
Processed 1 files
I don't know how to test this "piece by piece" either or what else to do anymore. I don't have a near complete working code with these features I could try adjusting in tiny increments, I'm just struggling to gather a simple enough code correctly from all we've talked about. my script cluster development has been in limbo ever since, sorry. I'm desperate, is there nobody I could hire to do this because I'm not getting any smarter...

Code: Select all

-rename
--db
TheMovieDB::TV
--format
"{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); def epRating = episodeInfo.vote_average; def seriesInfo = net.filebot.WebServices.TheMovieDB.request(\u0022tv/${id}\u0022, sAddOns, Locale.US); def certifications = net.filebot.WebServices.TheMovieDB.getSeriesInfo(series, Locale.US, true).certifications; def cleanNum = seriesInfo.content_ratings.results*.findResults{key, value -> value.replaceAll('\\D')}.flatten().findAll{it}*.toInteger().findAll{it < 22}; def int avg = (cleanNum.sum().div(cleanNum.size())).toDouble().round(); def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; def epImdbId = episodeInfo.external_ids.imdb_id; (allOf{ny}{s00e00}{t}{OMDbEpisodeInfo.Genre}{'c'{avg}}{'r'{OMDbEpisodeInfo.imdbRating}}{vf}{vc}{ac}{epImdbId}).join(' ')}"
please modify the code presented above. also I would love to have the year be taken from the omdb air date.
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

1.
This is weird:

Code: Select all

\u0022tv/${id}\u0022

2.
It also seems net.filebot.WebServices.TheTVDB has been find-and-replaced with net.filebot.WebServices.TheMovieDB which is completely incompatible. net.filebot.WebServices.TheMovieDB_TV on the other hand might implement the EpisodeListProvider interface just as net.filebot.WebServices.TheTVDB does. It's complicated, and really more about writing FileBot code, than writing format code.

:idea: But since this is more and more about internal APIs I must stress that internal APIs are subject to change, and writing format code highly dependant on internal APIs is strongly discouraged, since it's not documented and will likely break with future releases.

:idea: It seems as if you're testing this on the command-line, without making sure it's working at all in the GUI Format Editor first. This approach will result in misery. Using the GUI Format Editor for prototyping first is highly recommended.

:idea: You're probably dealing with multiple issues at the same time, format fundamentally not working, but also command-line messing up the format value, so it's best to prototype in the GUI Format Editor so you can make sure that format itself is working, and then you can use the multi-line literal to pass it in as is. Step by Step.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

Let's find out how to figure things out step by step.

Step 1:

Code: Select all

{
	def season = (any{special ? 0 : s} {s})
}

Code: Select all

1
Step 2:

Code: Select all

{
	def season = (any{special ? 0 : s} {s})
	def episode = (any{special ? special : e} {e})
}

Code: Select all

1
Step 3:

Code: Select all

{
	def season = (any{special ? 0 : s} {s})
	def episode = (any{special ? special : e} {e})
	def eAddOns = ['append_to_response':'external_ids']
	def sAddOns = ['append_to_response':'external_ids,content_ratings']
	def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US)
}

Code: Select all

{air_date=2016-09-06, crew=[Ljava.lang.Object;@7c167ad1, episode_number=1, guest_stars=[Ljava.lang.Object;@41577f51, name=Seed Money, overview=When Miami tech visionary Izzy Morales fails to attract funding for her new cryptocurrency GenCoin, financier Nick Talman funnels dirty money from his embezzling father. Meanwhile, gangster Ronald Dacey finds his money is missing, while cynical FBI agent Phil Rask hunts for Nick’s father., id=1216012, production_code=null, season_number=1, still_path=/tT50TbFpYqwsNqJX1ZmjG5eprCm.jpg, vote_average=5.5, vote_count=2, external_ids={imdb_id=tt5653618, freebase_mid=null, freebase_id=null, tvdb_id=5645387, tvrage_id=null}}
Step 4:

Code: Select all

{
	def season = (any{special ? 0 : s} {s})
	def episode = (any{special ? special : e} {e})
	def eAddOns = ['append_to_response':'external_ids']
	def sAddOns = ['append_to_response':'external_ids,content_ratings']
	def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US)
	def epRating = episodeInfo.vote_average
	def seriesInfo = net.filebot.WebServices.TheMovieDB.request("${id}", sAddOns, Locale.US)
}

Code: Select all

Expression yields empty value: Resource is empty: {} => https://api.themoviedb.org/3/66310?append_to_response=external_ids%2Ccontent_ratings&language=en-US
:arrow: We see that the last line causes an error. Maybe it generally doesn't work. Maybe it only specifically doesn't work for this particular show. If the code is wrong, we have to change the code. If it just doesn't work for some shows, then we need to catch errors, and use default values instead. This usually accomplished via any{...}{...}. Kinda depends on what you guys want the code to do.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

Code: Select all

{
def season = (any{special ? 0 : s} {s}); 
def episode = (any{special ? special : e} {e}); 
def eAddOns = ['append_to_response':'external_ids']; 
def sAddOns = ['append_to_response':'external_ids,content_ratings']; 
def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); 
def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); 
def epRating = episodeInfo.vote_average; 
def epImdbId = episodeInfo.external_ids.imdb_id; 
def sImdbId = seriesInfo.external_ids.imdb_id; 
def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; 
def OMDbSeriesInfo = (sImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':sImdbId]) : null; 
def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; 
def sOMDbVotes = any{OMDbSeriesInfo.imdbVotes.replaceAll('\\D') as int}{null}; 
def scleanNum = seriesInfo.content_ratings.results*.findResults{key, value -> value.replaceAll('\\D')}.flatten().findAll{it}*.toInteger().findAll{it < 22}; 
int savg = (scleanNum.sum().div(scleanNum.size())).toDouble().round(); 
def eOMDbYear = OMDbEpisodeInfo.Released.match(/(?:19|20)\d{2}/); 
def sOMDbYear = OMDbSeriesInfo.Released.match(/(?:19|20)\d{2}/); 
(allOf{ny}{s00e00}{t}{OMDbEpisodeInfo.Genre.split(',')}{'c'+any{savg}{'NR'}}{'r'+any{OMDbEpisodeInfo.imdbRating.replaceAll(/N\/A/)}{epRating.round(1)}{' '}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')
}
sample
Firefly (2002) S01E01 The Train Job [Adventure, Drama, Sci-Fi] c14 r8.5 tt0579539
I think it's bad. but use eOMDbYear and/or sOMDbYear how you want.
the year be taken from the omdb air date.
btw:
\u0022
= "
I was thinking it was better to use in the 1 line CLI, with the escaping stuff ?
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

Just use PowerShell so you can use @''@ multi-line literal so you don't have to worry about escaping at all:

e.g.

Code: Select all

--format @'
{n}
 - 
{s00e00}
 - 
{t}
'@
:idea: Please read the FAQ and How to Request Help.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

seems perfect. I even got the year wrapped in brackets. thank you so much for the both of you!

Code: Select all

-rename
--db
TheMovieDB::TV
--format
"{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; def OMDbSeriesInfo = (sImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':sImdbId]) : null; def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; def sOMDbVotes = any{OMDbSeriesInfo.imdbVotes.replaceAll('\\D') as int}{null}; def scleanNum = seriesInfo.content_ratings.results*.findResults{key, value -> value.replaceAll('\\D')}.flatten().findAll{it}*.toInteger().findAll{it < 22}; int savg = (scleanNum.sum().div(scleanNum.size())).toDouble().round(); def eOMDbYear = OMDbEpisodeInfo.Released.match(/(?:19|20)\d{2}/); def sOMDbYear = OMDbSeriesInfo.Released.match(/(?:19|20)\d{2}/); (allOf{n}{any{'('+eOMDbYear+')'}{'('+sOMDbYear+')'}}{s00e00}{t}{OMDbEpisodeInfo.Genre.split(',')}{'c'+any{savg}{'NR'}}{'r'+any{OMDbEpisodeInfo.imdbRating.replaceAll(/N\/A/)}{epRating.round(1)}{' '}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')}"
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I just discovered that some shows still get a blank filename, for example the show called "gary and his demons (2018)". this show only has the single alphabetical "tv-ma" for certification, I suspect this is the reason for the failure.

instead of nullifying in a situation like this, maybe it would be ideal to display the only (non-numeral) rating as-is? I have the retype script that can change those to whatever is needed. I tried doing this like

Code: Select all

{'c'+any{savg}{certification}{'NR'}}
but it's no good, filename still blank. I should find another one that doesn't work and look for connections just in case.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

Code: Select all

certification
is broken (undefined) on TheMovieDB::TV

Code: Select all

{
def season = (any{special ? 0 : s} {s}); 
def episode = (any{special ? special : e} {e}); 
def eAddOns = ['append_to_response':'external_ids']; 
def sAddOns = ['append_to_response':'external_ids,content_ratings']; 
def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); 
def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); 
def epRating = episodeInfo.vote_average; 
def epImdbId = episodeInfo.external_ids.imdb_id; 
def sImdbId = seriesInfo.external_ids.imdb_id; 
def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; 
def OMDbSeriesInfo = (sImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':sImdbId]) : null; 
def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; 
def sOMDbVotes = any{OMDbSeriesInfo.imdbVotes.replaceAll('\\D') as int}{null}; 
def scleanNum = any{seriesInfo.content_ratings.results*.findResults{key, value -> value.replaceAll('\\D')}.flatten().findAll{it}*.toInteger().findAll{it < 22}}{null}; 
int savg = any{(scleanNum.sum().div(scleanNum.size())).toDouble().round()}{null}; 
def eOMDbYear = any{OMDbEpisodeInfo.Released.match(/(?:19|20)\d{2}/)}{null}; 
def sOMDbYear = any{OMDbSeriesInfo.Released.match(/(?:19|20)\d{2}/)}{null}; 
(allOf{n}{'('+any{eOMDbYear}{sOMDbYear}+')'}{s00e00}{t}{OMDbEpisodeInfo.Genre.split(',')}{'c'+any{savg}{seriesInfo.content_ratings.results.rating[0]}{'NR'}}{'r'+any{OMDbEpisodeInfo.imdbRating.replaceAll(/N\/A/)}{epRating.round(1).toString().replaceAll(/0.0/)}{rating}{' '}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')
}
Gary and His Demons (2018) S01E01 Still The One cTV-MA r9.0 tt8421152

better... replaced eOMDbYear/sOMDbYear with epYear/y

Code: Select all

{
def season = (any{special ? 0 : s} {s}); 
def episode = (any{special ? special : e} {e}); 
def eAddOns = ['append_to_response':'external_ids']; 
def sAddOns = ['append_to_response':'external_ids,content_ratings']; 
def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); 
def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); 
def epRating = episodeInfo.vote_average; 
def epImdbId = episodeInfo.external_ids.imdb_id; 
def sImdbId = seriesInfo.external_ids.imdb_id; 
def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; 
def OMDbSeriesInfo = (sImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':sImdbId]) : null; 
def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; 
def sOMDbVotes = any{OMDbSeriesInfo.imdbVotes.replaceAll('\\D') as int}{null}; 
def scleanNum = any{seriesInfo.content_ratings.results*.findResults{key, value -> value.replaceAll('\\D')}.flatten().findAll{it}*.toInteger().findAll{it < 22}}{null}; 
def savg = any{(scleanNum.sum().div(scleanNum.size())).toDouble().round() as int }{seriesInfo.content_ratings.results.rating[0]}{null}; 
def epYear = any{episodeInfo.air_date.match(/(?:19|20)\d{2}/)}{null}; 
(allOf{n}{'('+any{epYear}{y}+')'}{s00e00}{t}{OMDbEpisodeInfo.Genre.split(',')}{'c'+any{savg}{}{'NR'}}{'r'+any{OMDbEpisodeInfo.imdbRating.replaceAll(/N\/A/)}{epRating.round(1).toString().replaceAll(/0.0/)}{rating}{' '}}{vf}{vc}{ac}{any{epImdbId}{sImdbId}}).join(' ')
}
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

in the middle of rewriting all south park episodes I got 3 episodes in a row (s18e07-s018e09) that were renamed differently:

-there was no genres, only the brackets
-they all had different rating than imdb
-they all had the series imdb id

I was guessing there was a momentary lapse of connection to omdb, but I'm getting massive amounts of files named like this for lesser known shows. this also started happening to "gary and his demons" after your last adjustment. I will investigate more and report back another day.
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I am getting an error "Unexpected token: A" even though there definitely is no runaway A characters.

Code: Select all

-rename
--db
TheMovieDB::TV
--format
"{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; def OMDbSeriesInfo = (sImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':sImdbId]) : null; def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; def sOMDbVotes = any{OMDbSeriesInfo.imdbVotes.replaceAll('D') as int}{null}; def scleanNum = any{seriesInfo.content_ratings.results*.findResults{key, value -> value.replaceAll('D')}.flatten().findAll{it}*.toInteger().findAll{it < 22}}{null}; def savg = any{(scleanNum.sum().div(scleanNum.size())).toDouble().round() as int }{seriesInfo.content_ratings.results.rating[0]}{null}; def epYear = any{episodeInfo.air_date.match(/(?:19|20)d{2}/)}{null}; (allOf{n}{'('+{epYear}+')'}{s00e00}{t}{'['+{OMDbEpisodeInfo.Genre}+']'}{'c'+any{savg}{}{'NR'}}{'r'+any{OMDbEpisodeInfo.imdbRating.replaceAll(/N/A/)}{epRating.round(1).toString().replaceAll(/0.0/)}{rating}{' '}}{vf}{vc}{ac}{epImdbId}).join(' ')}"
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

Best to use the Format Editor GUI to debug custom formats.

If the format works fine in the GUI, then it's a command line issues, things getting interpreted by your shell in unexpected ways. In this case, using PowerShell and multi-line literals @""@ should do the trick.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

how do you remove/replace e.g. this ?
N/A
does the year work ?

also is this the same ?

Code: Select all

replaceAll('\\D')
and

Code: Select all

replaceAll('D')
again, you change code without testing in GUI ?

btw it's better to use

Code: Select all

OMDbSeriesInfo.Genre
then

Code: Select all

OMDbEpisodeInfo.Genre
because OMDb is so unreliable, mostly with new shows
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I figured out the '/N/A/' to '/N\/A/' thing. now the only problem seems to be that currently epYear produces an empty value

Code: Select all

{def season = (any{special ? 0 : s} {s}); def episode = (any{special ? special : e} {e}); def eAddOns = ['append_to_response':'external_ids']; def sAddOns = ['append_to_response':'external_ids,content_ratings']; def episodeInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}/season/${season}/episode/${episode}", eAddOns, Locale.US); def seriesInfo = net.filebot.WebServices.TheMovieDB.request("tv/${id}", sAddOns, Locale.US); def epRating = episodeInfo.vote_average; def epImdbId = episodeInfo.external_ids.imdb_id; def sImdbId = seriesInfo.external_ids.imdb_id; def OMDbEpisodeInfo = (epImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':epImdbId]) : null; def OMDbSeriesInfo = (sImdbId != null) ? net.filebot.WebServices.OMDb.request(['i':sImdbId]) : null; def epOMDbVotes = any{OMDbEpisodeInfo.imdbVotes as int}{null}; def sOMDbVotes = any{OMDbSeriesInfo.imdbVotes.replaceAll('D') as int}{null}; def scleanNum = any{seriesInfo.content_ratings.results*.findResults{key, value -> value.replaceAll('D')}.flatten().findAll{it}*.toInteger().findAll{it < 22}}{null}; def savg = any{(scleanNum.sum().div(scleanNum.size())).toDouble().round() as int }{seriesInfo.content_ratings.results.rating[0]}{null}; def epYear = any{episodeInfo.air_date.match(/(?:19|20)d{2}/)}{null}; (allOf{n}{'('+{epYear}+')'}{s00e00}{t}{'['+{OMDbEpisodeInfo.Genre}+']'}{'c'+any{savg}{}{'NR'}}{'r'+any{OMDbEpisodeInfo.imdbRating.replaceAll(/N\/A/)}{epRating.round(1).toString().replaceAll(/0.0/)}{rating}{' '}}{vf}{vc}{ac}{epImdbId}).join(' ')}
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: please is there any way to use TheMovieDb for series?

Post by kim »

Code: Select all

def epYear = any{episodeInfo.air_date.match(/(?:19|20)d{2}/)}{null};

Code: Select all

{episodeInfo.air_date.match(/(?:19|20)d{2}/)}
= ?

Code: Select all

{episodeInfo.air_date.match(/(?:19|20)/)}
= ?

Code: Select all

{episodeInfo.air_date}
= ?

try and you find problem ;)

btw: Gui will only show output of last line, so best to test with is remove the "(allOf..." line
cafevincent
Posts: 66
Joined: 22 Jun 2017, 10:08

Re: please is there any way to use TheMovieDb for series?

Post by cafevincent »

I'm trying this in the GUI with the default Firefly example selected.

Code: Select all

{episodeInfo.air_date.match(/(?:19|20)d{2}/)}

Code: Select all

Expression yields empty value: Patter not found: 2018-04-13
It looks like this code is trying to fetch a 4-digit value starting with 19 or 20 but somehow fails to match the 2018.

Code: Select all

{episodeInfo.air_date.match(/(?:19|20)/)}

Code: Select all

20
It finds the 19/20 bit just fine, there must be something wrong with the d{2} bit of the code. Not sure how that works but it looks like d stands for digits and {2} should allow for any two numbers. I must be getting this wrong.

Code: Select all

{episodeInfo.air_date}

Code: Select all

2018-04-13
This is not the original air date for Firefly S01E01, there must be something horribly wrong.
User avatar
rednoah
The Source
Posts: 24693
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: please is there any way to use TheMovieDb for series?

Post by rednoah »

Best to read up on how regular expressions work for a bit first.

\d means single digit, d just means a single d.

In this case, you could just match \d+ to match the first number sequence.
:idea: Please read the FAQ and How to Request Help.
Post Reply