please is there any way to use TheMovieDb for series?

Support for Windows users
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: 54
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: 22976
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: 54
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: 54
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: 54
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: 54
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: 22976
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: 54
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: 22976
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: 54
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: 22976
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: 54
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: 54
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: 54
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: 54
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: 54
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!
Post Reply