(AMC) If folder name contains "norwegian" search with norwegian as language

Any questions? Need some help?
Post Reply
znerken
Posts: 30
Joined: 15 Feb 2018, 23:26

(AMC) If folder name contains "norwegian" search with norwegian as language

Post by znerken »

Is it possible to achieve this? If Norwegian is in folder name(or file name, just what's easiest), search the tvDB with Norwegian as language?


Most important, does Filebot ever search TheTVDB with Norwegian language, if it's not specified? For example when using the Python AMC script.




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

Re: (AMC) If folder name contains "norwegian" search with norwegian as language

Post by rednoah »

I'd modify the python script to check the input folder name, and then either pass --lang English or --lang Norwegian to FileBot depending on the situation. By default, it'll always use English.
:idea: Please read the FAQ and How to Request Help.
znerken
Posts: 30
Joined: 15 Feb 2018, 23:26

Re: (AMC) If folder name contains "norwegian" search with norwegian as language

Post by znerken »

rednoah wrote: 19 Apr 2018, 11:52 I'd modify the python script to check the input folder name, and then either pass --lang English or --lang Norwegian to FileBot depending on the situation. By default, it'll always use English.

That sounds like a good solution. Care to help me along the road?
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: (AMC) If folder name contains "norwegian" search with norwegian as language

Post by rednoah »

Sorry, you might need to learn a bit of Python for that one. It shouldn't be more than a simple if-then-else though.
:idea: Please read the FAQ and How to Request Help.
znerken
Posts: 30
Joined: 15 Feb 2018, 23:26

Re: (AMC) If folder name contains "norwegian" search with norwegian as language

Post by znerken »

rednoah wrote: 19 Apr 2018, 12:02 Sorry, you might need to learn a bit of Python for that one. It shouldn't be more than a simple if-then-else though.

Ah, so basically in pseudo:

Code: Select all

command{
	'filebot', '-script', 'fn:amc',
	'--output', output,
	'--action', 'copy',
	'--conflict', 'skip',
	'-non-strict',
if(filename.contains("NORWEGIAN")
--language =norwegian)
}
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: (AMC) If folder name contains "norwegian" search with norwegian as language

Post by rednoah »

Yeah, just pass in --lang as well like this:

Code: Select all

'--lang', directory.contains('NORWEGIAN') ? 'NO' : 'EN',
I rarely write Python, but if it's anything like C based languages, then it might just work out of the box.
:idea: Please read the FAQ and How to Request Help.
znerken
Posts: 30
Joined: 15 Feb 2018, 23:26

Re: (AMC) If folder name contains "norwegian" search with norwegian as language

Post by znerken »

So I got it to work, but it doesn't look like it cares about the language?

Parameter: unsorted = y
Parameter: movieFormat = {plex.dir}/{fn}
Parameter: seriesFormat = {plex.dir}/{fn}
Parameter: animeFormat = {plex}
Parameter: musicFormat = {plex}
Parameter: ut_label =
Parameter: ut_state =
Parameter: ut_title = Huskestue.S04E05.NORWEGiAN.720p.HDTV.x264-ALTiTV.mkv
Parameter: ut_kind = multi
Parameter: ut_file =
Parameter: ut_dir = D:\SORTED\TV Shows\Huskestue\Season 4\Huskestue.S04E05.NORWEGiAN.720p.HDTV.x264-ALTiTV.mkv
Parameter: lang = NO
Parameter: plex = *****
Parameter: clean = y
Input: D:\SORTED\TV Shows\Huskestue\Season 4\Huskestue.S04E05.NORWEGiAN.720p.HDTV.x264-ALTiTV.mkv
Group: [tvs:huskestue] => [Huskestue.S04E05.NORWEGiAN.720p.HDTV.x264-ALTiTV.mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [huskestue]
Resource not found: https://api.thetvdb.com/search/series?name=huskestue
Failed to fetch episode data: [huskestue]
This tv show does exist in norwegian at tvdb.

Have you implemented the language in the post?

Code: Select all

{
  "data": [
    {
      "abbreviation": "string",
      "englishName": "string",
      "id": 0,
      "name": "string"
    }
  ]
}
https://api.thetvdb.com/swagger#/Languages
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: (AMC) If folder name contains "norwegian" search with norwegian as language

Post by rednoah »

YES:

Code: Select all

--lang NO
NO:

Code: Select all

--def lang=NO
Log looks like you're doing the latter.
:idea: Please read the FAQ and How to Request Help.
znerken
Posts: 30
Joined: 15 Feb 2018, 23:26

Re: (AMC) If folder name contains "norwegian" search with norwegian as language

Post by znerken »

rednoah wrote: 19 Apr 2018, 17:17 YES:

Code: Select all

--lang NO
NO:

Code: Select all

--def lang=NO
Log looks like you're doing the latter.

That worked! GREAT!
Post Reply