sortOrder not working in scripts?

All your suggestions, requests and ideas for future development
Post Reply
cowmix
Power User
Posts: 30
Joined: 09 Jan 2015, 11:03

sortOrder not working in scripts?

Post by cowmix »

I'm trying to add some detection for tv series to switch to dvd order if dvd or bluray tags exists but the sortOrder parameter doesn't seem to work.

For example:

Code: Select all

dest = rename(file: files, format: config.format, db: 'TheTVDB', sortOrder: 'dvd')
still seems to use the airdate order

but adding the order outside the script:

Code: Select all

filebot -script "/home/filebot/amc.groovy" --order "dvd" etc...
works correctly and uses the correct dvd order

I'm not sure if this is a bug or if I'm passing something incorrectly?

I'm on linux, filebot version 4.5.3

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

Re: sortOrder not working in scripts?

Post by rednoah »

Since sort-order isn't defined one way or the other in the Groovy rename(...) call it'll default to your cmdline argument.

If you want to override sort-order in the script call you have to specify order and not sortOrder.

If you come up with some patterns that work reliably this could be added to the amc script. ;)
:idea: Please read the FAQ and How to Request Help.
cowmix
Power User
Posts: 30
Joined: 09 Jan 2015, 11:03

Re: sortOrder not working in scripts?

Post by cowmix »

Do you mean like this?

Code: Select all

dest = rename(file: files, format: config.format, db: 'TheTVDB', order: 'dvd')
that doesn't seem to work and it looks like the parameter is sortOrder in the source code?

I was just going to simply check the filepath for dvd, bluray or bdrip:

Code: Select all

f.dir.listPath().any{ it.name ==~ /(?i:dvd|bluray|bdrip)/ } 
but I haven't messed with that much yet because I'm having problems with passing order to rename

I've hacked up the amc script pretty good with a bunch of other little features that I'll be happy to share but I'm not sure if you'll want all to be merged into amc:
  • sonarr api to force a series disk refresh if adding t series to same file path
  • couchpotato api to force a disk refresh for movies
  • Lookup anime in anidb and map it to tvdb for episode listing
  • Use moviedb for anime movies
  • skip subtitle download when embedded subs are found
also I'm bug fixing as I use it so the stability of some of the more advanced features aren't 100% tested but it seems to work well for me so far
User avatar
rednoah
The Source
Posts: 23926
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: sortOrder not working in scripts?

Post by rednoah »

I guess you could at least make a Gist so people can have a look. :D I might add some features to the official script if there's demand for that.

I'll have a look at sort order...

EDIT:

Works fine for me. See ScriptShellBaseClass.java line 311 for on how script functions map to internal calls.

Code: Select all

rename(file:args, db:'thetvdb', order:'dvd')
:idea: Please read the FAQ and How to Request Help.
cowmix
Power User
Posts: 30
Joined: 09 Jan 2015, 11:03

Re: sortOrder not working in scripts?

Post by cowmix »

actually your right it does work, sorry about that, it seems that tvdb had a strange dvd listing with marking episodes as special and switching to tvrage fixed the issue
http://www.tvrage.com/Archer_2009/episode_list/3
http://thetvdb.com/index.php?tab=season ... &order=dvd

its not really a bug just a a weird case where its marked as special for airdate order but it also has a dvd episode number for dvd order

filebot marks it as special and ignores its episode number for dvd order

I'll post the source code of my modified amc file in the script boards
User avatar
rednoah
The Source
Posts: 23926
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: sortOrder not working in scripts?

Post by rednoah »

1.
TVRage only has one sort order, so DVD order default to Airdate and Absolute order is generated from Airdate data.

2.
Fixed the DVD order numbering for specials turned normal episode on DVD.
:idea: Please read the FAQ and How to Request Help.
cowmix
Power User
Posts: 30
Joined: 09 Jan 2015, 11:03

Re: sortOrder not working in scripts?

Post by cowmix »

Thanks, looking forward to it in the next build :)
Post Reply