amc/htpc downloading same info multiple times

All your suggestions, requests and ideas for future development
Post Reply
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

amc/htpc downloading same info multiple times

Post by kim »

from amc:
this part:
def dest = rename(file: files, format: movieFormat, db: 'TheMovieDB')
makes this happen:
Fetch resource: api.themoviedb.org/3/movie/ID?language=da-DK (*movieFormat, I guess)
Fetch resource: api.themoviedb.org/3/movie/ID?language=en-US (*movieFormat, I guess)
Fetch resource: api.themoviedb.org/3/movie/ID?append_to_response=alternative_titles%2Creleases%2Ccasts%2Ctrailers&language=en (why no -US)
[MOVE] from *** to ***
Fetch resource: api.themoviedb.org/3/movie/ID?language=en(why no -US and why again?)
from htpc
this part:
def movieInfo = TheMovieDB.getMovieInfo(movie, locale, true)
makes this happen:
Fetch resource: https://api.themoviedb.org/3/movie/ID?a ... uage=en-US[/b] (why same again?)

In my movieFormat I use:

Code: Select all

localize.dan, info.name, info.spokenLanguages
btw: is there a way I can make my own api call with alternative_titles%2Creleases%2Ccasts%2Ctrailers (maybe more) ?
because I'm forced to make 1 more api call to TheMovieDB.getAlternativeTitles(i.id) that AMC and htpc downloaded before, but filebot filters out stuff
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: amc/htpc downloading same info multiple times

Post by rednoah »

1.
Nice catch. I'll look into that. In some cases, fr and fr-CA will not yield the same results though, but for English / US English I think I can add a special case because that's what 99% of users use.


2.
You can make your own HTTP requests. See Groovy manual for that.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: amc/htpc downloading same info multiple times

Post by kim »

https://developers.themoviedb.org/3/get ... /languages

1. themoviedb has NO other en-XX ONLY en-US, so best to use en-US for all English requests ( as default)

2. All other languages behave like this, so again better to use ONLY the full xx-XX for all to themoviedb
calling only de is really the same as calling de-DE
3.
fr and fr-CA will not yield the same results though
you can test with e.g. https://www.themoviedb.org/movie/166426
there most always be a county code in request otherwise e.g. fr will always only show fr-FR and never fr-CA

Conclusion: Always use xx-XX style to themoviedb
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: amc/htpc downloading same info multiple times

Post by kim »

As to the "extended information" part I think all requests should be with TRUE because otherwise htpc will need to download the same data + the "extended information" again

maybe you make it so:
if artwork = true get "extended information"
else get without "extended information"
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: amc/htpc downloading same info multiple times

Post by kim »

More testing:
1. did a Clear cache
2. use test file "***.Og.***.1960.FS.SD.XViD.MP3.avi"
3. set include_adult=true
4. run modified (more log info) AMC script
5. result from log:
Query Movie => [*** og *** 1960 fs, *** og *** 1960]
Fetch resource: api.themoviedb.org/3/search/movie?query=***+og+***+1960+fs&include_adult=true&language=en
(problem 1, year in search like this will fail / problem 2, fs need to be blacklisted / possible solution, all 19xx and 20xx most be excluded in search, when better words can be used, at least on 1st run)

Fetch resource: api.themoviedb.org/3/search/movie?query=***+og+***&year=1960&include_adult=true&language=en
(OK, but no US in &language=en)

Rank [*** Og *** 1960, *** Og *** 1960 FS] => [*** and *** (1960)]
FROM amc Group: [mov:*** and *** 1960] => [*** .Og.***.1960.FS.SD.XViD.MP3.avi]

FROM amc Movie Mode - before rename
Rename movies using [TheMovieDB]
Auto-detect movie from context: [***\***.Og.***.1960.FS.SD.XViD.MP3.avi]
Query Movie => [*** og *** 1960 fs, *** og *** 1960]
(WHY do this again! ???)

Fetch resource: api.themoviedb.org/3/search/movie?query=***+og+***+1960+fs&include_adult=true&language=en-US
(same as before, but now with &language=en-US)

Fetch resource: api.themoviedb.org/3/search/movie?query=***+og+***&year=1960&include_adult=true&language=en-US
(same as before, but now with &language=en-US)

Rank [*** Og *** 1960, *** Og *** 1960 FS] => [*** and *** (1960)]

Fetch resource: api.themoviedb.org/3/movie/54600?language=en-US
(don't know why or what it needs from this?)

Fetch resource: api.themoviedb.org/3/movie/54600?append_to_response=alternative_titles%2Creleases%2Ccasts%2Ctrailers&language=da-DK (*my format)
Fetch resource: api.themoviedb.org/3/movie/54600?append_to_response=alternative_titles%2Creleases%2Ccasts%2Ctrailers&language=en-US (*my format)

[MOVE] from [***] to [***]
Fetch resource: api.themoviedb.org/3/movie/54600?language=en
(same as before, but now with &language=en-US and don't know why or what it needs from this?)

FROM amc Movie Mode - after rename
also why is "&include_adult=true" not part of every search ?
Last edited by kim on 18 Jun 2017, 16:49, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: amc/htpc downloading same info multiple times

Post by rednoah »

Fixed some of that with r5149. I can't really answer Why? questions without spending many hours checking the source code.

The adult thing is pretty much untested, but as far as I know it's only necessary for search, but not for lookup-by-id.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: amc/htpc downloading same info multiple times

Post by kim »

testet:
now down to 5 from 8 api requests :)
i think when FS blacklist is active down to 4
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: amc/htpc downloading same info multiple times

Post by kim »

Is there a good reason why you use "Locale.ENGLISH" over "Locale.US",
when looking up "alternative_titles" ?

it looks like it's getting the data 2x times and makes 2x cache files "en" and "en-us" ?

so please change all "Locale.ENGLISH" to "Locale.US" on themoviedb.
1. "en" and "en-us" is ALWAYS the same data (after some time), because there is no other EN-xx
2. "Locale.US" gets updated faster then "Locale.ENGLISH" on the API

https://developers.themoviedb.org/3/get ... /languages
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: amc/htpc downloading same info multiple times

Post by rednoah »

Got catch. Missed one previously. Fixed.
:idea: Please read the FAQ and How to Request Help.
Post Reply