Multi-Episode not being picked up

All about user-defined episode / movie / file name format expressions
Post Reply
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Multi-Episode not being picked up

Post by mihawk90 »

I have a little issue with a (granted rare) occurence of a multi-episode file, and I'm not sure if it can even be solved, so here goes.

First the 2 filenames:

Code: Select all

[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4
[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4
I'm using the Absolute Ordering setting in the GUI after having a brainlag when it didn't work in seasonal (obviously, duh)
The first one is being picked up fine now, but the second is just being seen as Episode 290, not even 295 (as in it would only contain 290 and 295 and not the ones in between, which would be wrong too, but understandable).

The file is a custom cut made by that group to contain a 6 episode filler arc that's completely independant of the actual series (but surprisingly well done for a filler), contains... well, episodes 290 up to 295 as you probably guessed.
Is there a way to make it pick up and write all the episode numbers into the file? I want to process them to SxE later on too.

Of course I can just rename them manually, and more then 2 episodes in a file is probably pretty rare, but I was wondering if it could be solved with Filebot alone :)

/Edit #1
Just tried this:

Code: Select all

[Taka]_Naruto_Shippuuden_Chikara_290-291-292-293-294-295_[720p][210318B3]
and as expected, all 6 episode are being picked up, because the numbers are in succession I guess.

When leaving out any episode in between however it goes back to just picking up the 290. Now I haven't seen this (ever), but theoretically if there was really just for example 290, 291, 292, 294 and 295 in the file (for whatever reason, maybe a filler in 293), this wouldn't work. Wondering if it could work at all.

/Edit #2
I just tried renaming using your formats from the abs2sxe script, and the episodes get lost completely.

Your stage1 format:

Code: Select all

{n} - {[e.pad(5)]} - {t} - {[d]}
yields this as a result:

Code: Select all

Naruto Shippuden - [00290] - Power - Episode 1 & Power - Episode 2 & Power - Episode 3 & Power - Episode 4 & Power - Episode 5 & Power - Episode 6 - [2012-11-22] [210318B3].mp4
Naruto Shippuden - [00290] - Power - Episode 1 - [2012-11-22] [210318B3].mp4
Naruto Shippuden - [00286] - Things You Can't Get Back & One Worth Betting On - [2012-11-01] [B48E507C].mp4
Is the result of the first rename (stage 1 in the abs2sxe script). Further renaming doesn't know there are more episodes then just 290 in there.

I then tried using this to get all episode numbers back into the file:

Code: Select all

{n} - {[episodes*.absolute*.pad(3).join(']-[')]} - {t} - {[d]}
and this worked. However, using Airdate order again (abs2sxe stage2), it still wouldn't pick up more then the first episode (even for the 2-episode file). Is this because of the date maybe? I couldn't get all dates in there though.

So I tried it without the date, and the result was this:

Code: Select all

Naruto Shippuden - [290]-[291]-[292]-[293]-[294]-[295] - Power - Episode 1 & Power - Episode 2 & Power - Episode 3 & Power - Episode 4 & Power - Episode 5 & Power - Episode 6.mp4
Naruto Shippuden - [290] - Power - Episode 1.mp4
Naruto Shippuden - [286]-[287] - Things You Can't Get Back & One Worth Betting On.mp4
Looks good, right? Doesn't work, not all episodes are being picked up. But now comes the strange part...
Image

What is happening? Now I'm really confused.

For stage2 I have to use opportunistic matching by the way, strict just won't match at all and the new name list remains empty... is this supposed to happen? :)
Last edited by mihawk90 on 03 Jan 2017, 09:58, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Multi-Episode not being picked

Post by rednoah »

1.
Fixed with r4671. Maybe. Kinda. Might break other things.


2.
The abs2sxe script doesn't work for multi-episode objects at all. It's a hack that uses the airdate as unique identifier that is the same regardless of episode order. However, the {d} binding doesn't give you multiple airdates and FileBot doesn't support multi-episode-by-multi-airdate kinda patterns, so this trick only works for single episodes.
:idea: Please read the FAQ and How to Request Help.
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Re: Multi-Episode not being picked

Post by mihawk90 »

rednoah wrote:1.
Fixed with r4671. Maybe. Kinda. Might break other things.
Thanks! I'll try it out when I get the time (probably not today) :)
rednoah wrote:2.
The abs2sxe script doesn't work for multi-episode objects at all. It's a hack that uses the airdate as unique identifier that is the same regardless of episode order. However, the {d} binding doesn't give you multiple airdates and FileBot doesn't support multi-episode-by-multi-airdate kinda patterns, so this trick only works for single episodes.
Suspected that :) That also explains why all my multi-episodes were single episode... Never really noticed cause it's kinda rare. Thanks for clarifying :D

Happy new year!
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Re: Multi-Episode not being picked

Post by mihawk90 »

Hey there again :)

So, just tested it and Stage1 is working fine with the fix, thanks!

In Stage2 however the additional episodes are still lost (I didn't rename the third file to test something out):
Image

Or is it just not possible to match multiple absolute episode numbers to multiple season/episodes?

Also (this might be related, somewhat), I know that it's hard to programatically figure out if say 290 is supposed to be absolute number 290 oder season 2, episode 90. But couldn't we just tell Filebot when in doubt? I mean, yeah, defining Absolute and Airdate order is a thing, but the downside is that input and output are somewhat bound to each other in that case (seasons not in absolute order etc). Letting the user choose in certain cases (just like when Filebot isn't sure about the series) would really help in those edge-cases. Or is TVDB just not returning Season/Episode data when querying for absolute numbers (never looked into the API docs tbh)? Would kinda suck, but eh... worth a shot :)
/edit
Just looked into the API again (that thing is godaweful but w/e), It's not actually querying anything other then the series ID, so the info is there in either case as I understand, no?
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Multi-Episode not being picked

Post by rednoah »

Alright, so you wanna convert multi-episode-absolute-number files to multi-episode-SxE-numbers? You're out of luck. I can't think of a way of using FileBot that would allow you to do this.

If you were to write a dedicated script that makes a lot of assumptions and does only that exact thing then it's fairly easy of course. In the grander scheme of FileBot that particular use case is not feasible though.


EDIT:

Upsies. I forgot about the new {order} dynamic binding. It's pretty much the same as the {localize} binding, in that it'll allow you to reload the data with different fetch parameters.

e.g. Use Absolute Order for matching, and then translate to Airdate Order after matching in your format:

Code: Select all

{n} - {order.airdate.s00e00} - {localize.german.title}
:idea: Please read the FAQ and How to Request Help.
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Re: Multi-Episode not being picked

Post by mihawk90 »

Oh my god this is beautiful :)

At first I was confused because it wouldn't match anything after I already applied stage1, reverted that and just used the original files. Works like a charm! Thank you again :)

Appears that that abs2sxe script is outdated now :)


Really wondering though, this shouldn't be happening, right (that's with r4671 from above)?
Image

I mean, I wouldn't do that (converting 3 to 6 back to 3), but it should still pick up all episodes, no?


Also, does that binding work in AMC? This is the log:

Code: Select all

Run script [fn:amc] at [Mon Jan 02 23:14:44 CET 2017]
Parameter: music = n
Parameter: artwork = n
Parameter: ut_label = tv_old
Parameter: ut_kind = multi
Parameter: ut_dir = C:\Users\tarulia\Videos\filebot_test
Parameter: seriesFormat = {any{order.airdate.sxe [{defines.ut_title.contains('[Hi10') ? 'Hi10 via '+{group} : {group}}] *.absolute*.pad(3).join('-') [crc32]}{fn}}
Input: C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4
Input: C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4
xattr: [[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4] => [Naruto Shippuden - 290 - Power - Episode 1]
Group: [tvs:naruto shippuuden] => [[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4]
Group: [tvs:naruto shippuden] => [[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4]
Rename episodes using [TheTVDB]
Auto-detected query: [Naruto Shippuuden]
Fetching episode data for [Naruto Shippuden]
Apply Filter: {if (label == /tv_old/) return true; age < 30 || !model.any{ it.age < 30 }}
Include [Naruto Shippuden - 1x01 - Homecoming]
[...]
Include [Naruto Shippuden - 19xSpecial 14 - OVA: The Day Naruto Became Hokage]
[TEST] Rename [C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4] to [C:\Users\tarulia\Downloads\BitTorrent\_organized\[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4]
Processed 1 files
Rename episodes using [TheTVDB]
Auto-detected query: [Naruto Shippuden]
Fetching episode data for [Naruto Shippuden]
Apply Filter: {if (label == /tv_old/) return true; age < 30 || !model.any{ it.age < 30 }}
Include [Naruto Shippuden - 1x01 - Homecoming]
[...]
Include [Naruto Shippuden - 19xSpecial 14 - OVA: The Day Naruto Became Hokage]
[TEST] Rename [C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4] to [C:\Users\tarulia\Downloads\BitTorrent\_organized\[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
So apparently it's not doing anything. This is not r4671 though, because when I replace the jar file I get a load of xattr-related errors and it just fails:

Code: Select all

Run script [fn:amc] at [Mon Jan 02 23:13:52 CET 2017]
Parameter: music = n
Parameter: artwork = n
Parameter: ut_label = tv_old
Parameter: ut_kind = multi
Parameter: ut_dir = C:\Users\tarulia\Videos\filebot_test
Parameter: seriesFormat = {any{order.airdate.sxe [{defines.ut_title.contains('[Hi10') ? 'Hi10 via '+{group} : {group}}] *.absolute*.pad(3).join('-') [crc32]}{fn}}
Failed to read xattr: java.lang.IllegalArgumentException
Input: C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4
Input: C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Group: [tvs:naruto shippuuden] => [[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4, [Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4]
Rename episodes using [TheTVDB]
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Auto-detected query: [Naruto Shippuuden]
Fetching episode data for [Naruto Shippuden]
Apply Filter: {if (label == /tv_old/) return true; age < 30 || !model.any{ it.age < 30 }}
Include [Naruto Shippuden - 1x01 - Homecoming]
[...]
Include [Naruto Shippuden - 19xSpecial 14 - OVA: The Day Naruto Became Hokage]
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
[TEST] Rename [C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4] to [C:\Users\tarulia\Downloads\BitTorrent\_organized\[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4]
[TEST] Rename [C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4] to [C:\Users\tarulia\Downloads\BitTorrent\_organized\[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4]
Processed 2 files
Finished without processing any files
Failure (°_°)
/edit
Well... that it doesn't rename seems to be partly due to the expression I used (falling back on {fn} if not everything is defined, but looking at this log:

Code: Select all

Run script [fn:amc] at [Mon Jan 02 23:27:28 CET 2017]
Parameter: music = n
Parameter: artwork = n
Parameter: ut_label = tv_old
Parameter: ut_kind = multi
Parameter: ut_dir = C:\Users\tarulia\Videos\filebot_test
Parameter: seriesFormat = {order.airdate.sxe} [{group}] {episodes*.absolute*.pad(3).join('-')} [{crc32}]
Input: C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4
Input: C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4
xattr: [[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4] => [Naruto Shippuden - 290 - Power - Episode 1]
Group: [tvs:naruto shippuuden] => [[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4]
Group: [tvs:naruto shippuden] => [[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4]
Rename episodes using [TheTVDB]
Auto-detected query: [Naruto Shippuuden]
Fetching episode data for [Naruto Shippuden]
Apply Filter: {if (label == /tv_old/) return true; age < 30 || !model.any{ it.age < 30 }}
Include [Naruto Shippuden - 1x01 - Homecoming]
[...]
Include [Naruto Shippuden - 19xSpecial 14 - OVA: The Day Naruto Became Hokage]
[TEST] Rename [C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_286-287_[720p][B48E507C].mp4] to [C:\Users\tarulia\Downloads\BitTorrent\_organized\13x27 [Taka] 287 [B48E507C].mp4]
Processed 1 files
Rename episodes using [TheTVDB]
Auto-detected query: [Naruto Shippuden]
Fetching episode data for [Naruto Shippuden]
Apply Filter: {if (label == /tv_old/) return true; age < 30 || !model.any{ it.age < 30 }}
Include [Naruto Shippuden - 1x01 - Homecoming]
[...]
Include [Naruto Shippuden - 19xSpecial 14 - OVA: The Day Naruto Became Hokage]
[TEST] Rename [C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4] to [C:\Users\tarulia\Downloads\BitTorrent\_organized\13x30 [Taka] 290 [210318B3].mp4]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
Everything seems to be defined, so why is it falling back to {fn} ?
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Multi-Episode not being picked

Post by rednoah »

1.
{order} was introduced fairly recently. You may need the latest revision for that.


2.
If you're using AniDB (i.e. Anime mode in the amc script) then {order.airdate} will still give you Absolute Order episode data because that's the only thing AniDB has. Absolute to SxE conversion is not possible with AniDB data.

Absolute to SxE conversion for multi-episodes with TheTVDB requires Absolute Order episode data. The amc script is using Airdate episode data, so you won't be able to integrate this feature into the amc script.


3.
The abs2sxe script uses {e.pad(5)} precisely because FileBot won't interpret 00001 as Episode 1 so that FileBot is forced to use {t} or {d} instead to match the file.


4.
Please run xattr script with with the latest revision on a view files and send me the logs:

Code: Select all

filebot -script fn:xattr /path/to/files

5.
Please use the Format Editor for prototyping format expressions:
Image

Not using the Format Editor can adversely affect your mental health. :lol:
:idea: Please read the FAQ and How to Request Help.
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Re: Multi-Episode not being picked

Post by mihawk90 »

1.
That's what I thought and why I replaced the jar file ;)

2.
Ah well, suspected that, but was worth a shot :)

3.
makes sense, so in the end there's probably no way to actually do Multi-Episode Absolute to Multi-Episode Airdate order (at least not at download time, with AMC). But then again, it's so rare these days that it doesn't really matter.

4.
Sure, here you go.

Before replacing the jar:

Code: Select all

PS C:\Users\tarulia> filebot -script fn:xattr "C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_Chikara_290
-295_[720p][210318B3].mp4"
C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4
        net.filebot.metadata: {"@type":"Episode","seriesName":"Naruto Shippuden","episode":290,"title":"Power - Episode
1","absolute":290,"airdate":{"year":2012,"month":11,"day":22},"id":4429067,"seriesInfo":{"database":"TheTVDB","order":"A
bsolute","language":"en","id":79824,"name":"Naruto Shippuden","aliasNames":["Naruto Shipp?den","Naruto Shippuuden","Naru
to Shippuden (2007)","Naruto: Shipp¹den","??????: ????????? ???????","?????? ??????","NARUTO????? ???","????????","???"]
,"certification":"TV-14","startDate":{"year":2007,"month":2,"day":15},"genres":["Action","Adventure","Animation"],"netwo
rk":"TV Tokyo","rating":8.1,"ratingCount":888,"runtime":25,"status":"Continuing"}}
Done ?(?????)?
After replacing the jar:

Code: Select all

PS C:\Users\tarulia> filebot -script fn:xattr "C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_Chikara_290
-295_[720p][210318B3].mp4"
C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4
        net.filebot.metadata: {"@type":"Episode","seriesName":"Naruto Shippuden","episode":290,"title":"Power - Episode
1","absolute":290,"airdate":{"year":2012,"month":11,"day":22},"id":4429067,"seriesInfo":{"database":"TheTVDB","order":"A
bsolute","language":"en","id":79824,"name":"Naruto Shippuden","aliasNames":["Naruto Shipp?den","Naruto Shippuuden","Naru
to Shippuden (2007)","Naruto: Shipp¹den","??????: ????????? ???????","?????? ??????","NARUTO????? ???","????????","???"]
,"certification":"TV-14","startDate":{"year":2007,"month":2,"day":15},"genres":["Action","Adventure","Animation"],"netwo
rk":"TV Tokyo","rating":8.1,"ratingCount":888,"runtime":25,"status":"Continuing"}}
Done ?(?????)?
Looks the same to me:/

The second file doesn't give anything in either case:

Code: Select all

PS C:\Users\tarulia> filebot -script fn:xattr "C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_286-287_[72
0p][B48E507C].mp4"
Done ?(?????)?
PS C:\Users\tarulia> filebot -script fn:xattr "C:\Users\tarulia\Videos\filebot_test\[Taka]_Naruto_Shippuuden_286-287_[72
0p][B48E507C].mp4"
Done ?(?????)?
5.
I did that and it worked in the format editor, but not in the script. Upon trying around a little more it seems that it is an issue with the any closure and/or the unwind-on-undefined behaviour.

Not working (Expression yields empty result):

Code: Select all

{order.airdate.sxe [{group}] episodes*.absolute*.pad(3).join('-') [crc32]}
{any{order.airdate.sxe [{group}] episodes*.absolute*.pad(3).join('-') [crc32]}}
{any{order.airdate.sxe [{group}] episodes*.absolute*.pad(3).join('-') [crc32]}{fn}} (this is technically working, but yields {fn}
Working:

Code: Select all

{order.airdate.sxe} [{group}] {episodes*.absolute*.pad(3).join('-')} [{crc32}]
To me they look like (basically) the same expression. In both cases it tells me airdate is undefined, but I suspect that this is only resolved when actually creating the filename?

As a sidenote, why do I have to enclose group in an additional curly bracket? If I don't, it appears to be taking the value of group as a binding...? Shouldn't group just be resolved into Taka as a string? It's working with crc32 obviously.
Image
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Multi-Episode not being picked

Post by rednoah »

3.
I'll look into adding some extra {sxe} binding magic when AniDB is used. It's a bit tricky so it has to wait for the next release.


4.
No idea where those xattr IllegalArgumentException came from then... let me know if it happens again. Maybe the new version can't read certain kinds of xattr metadata that were written by older versions of FileBot, or the old version can't read newer ones. Let me know if you keep seeing this with the new version.


5.
The outermost {...} define the expression, but everything inside is Groovy code, and {...} is also valid in Groovy and either refers to code blocks or closures.

e.g. in the expression {any{...}{...}} the red and blue {...} have a completely different meaning.

i.e. this Groovy code makes no sense at all, even though it's syntactically valid:

Code: Select all

order.airdate.sxe [{group}] episodes*.absolute*.pad(3).join('-')[crc32]
This is more or less what you meant:

Code: Select all

"$order.airdate.sxe [$group] ${episodes*.absolute*.pad(3).join('-')}[$crc32]"
This is pure Groovy code. The outermost {...} that delimit Groovy code have been omitted for the sake of clarity.

@see http://groovy-lang.org/syntax.html#_str ... erpolation
:idea: Please read the FAQ and How to Request Help.
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Re: Multi-Episode not being picked

Post by mihawk90 »

3.
No hurry, single episode files work perfectly fine for the time being, and as mentioned, multi-episode is somewhat rare these days, I can just rename them by hand.

4.
I'll try again when the new version is out, if I don't forget :)

5.
Well, that explains something... I always though the curly brackets were just for replacing, I was wondering why it would suddenly replace multiple values too... so using $ is probably the better way to go :)
/e just tried that (without quotes, but with curlys around of course), tells me Binding "$order": undefined (when I take that dollar sign away, it goes on with group, etc)
/e2 nevermind, actually have to use the quotes... kinda confusing :P But I guess, the whole format string gets a toString() called on it and that's what it all gets replaced...
Last edited by mihawk90 on 03 Jan 2017, 11:37, edited 2 times in total.
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Multi-Episode not being picked up

Post by rednoah »

"$order" is the same as "${order}" is the same as order.toString() is the same as ''+order and so on.

Binding "$order": undefined makes no sense and I have no idea how one would even produce that error. What's the format expression for that? :lol:


/e yes, whatever the result of your expression may be, FileBot is taking the String value, so {order} is the same as {order as String} and so on.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Multi-Episode not being picked up

Post by rednoah »

{s00e00} and {sxe} use the range syntax as per Plex standard. So S01E01-05 means Episode 1 through 5.

Unfortunately, there is no alternative binding that would just give you what you want, so it's gonna be a bit ugly:

Code: Select all

'S'+order.airdate.s+'E'+order.airdate.es.join('-E')
:idea: Please read the FAQ and How to Request Help.
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Re: Multi-Episode not being picked up

Post by mihawk90 »

You're too fast for me :P

It's all a little confusing not knowing exactly where what is processed, takes a little time :) I'll get around to it some day :)


One thing that's missing though...
That format string returns this:

Code: Select all

13x30-35 [Taka] 290-291-292-293-294-295 [210318B3].mp4
So, the absolute numbers are all in there, but the sxe binding is only returning the 2 episodes that were in the original filename [Taka]_Naruto_Shippuuden_Chikara_290-295_[720p][210318B3].mp4. which won't be picked up by kodi (will only recognize those 2 episodes).

I tried a two-step rename again, didn't use the sxe binding in step one to not confuse filebot in the second step, but only episode 290 is picked up from the filename again... Didn't this work earlier :D

Image


/e
Mh, so the solution is basically similar to the format you gave me way back, which I also wrote here :)
/e2
Finished it like this, works with Single and Multi (yay!). I used the SxE style rather then s00e00 for cleanness sake (all my other episodes are SxE already), but it's basically the same :) :

Code: Select all

{"${order.airdate.s}x${order.airdate.es.join('-')} [$group] ${episodes*.absolute*.pad(3).join('-')} [$crc32]"}
Last edited by mihawk90 on 03 Jan 2017, 11:50, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Multi-Episode not being picked up

Post by rednoah »

1.
13x30-35 means Season 13 Episode 30, 31, 32, 33, 34 and 35 to FileBot and Plex.

@see Multi-Episode Files


2.
It's quite simple actually:

List of files ➔ Magic matcher ➔ File/Episode pairs ➔ Apply format expression on each pair ➔ Destination path for each input file

That's why custom formats can't fix bad matches. ;)
:idea: Please read the FAQ and How to Request Help.
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Re: Multi-Episode not being picked up

Post by mihawk90 »

1. Yeah, Plex uses range, but Kodi only uses those episodes that are actually in the filename. 13x30-35 is S13 Episode 30 and 35 for Kodi
Note: Only the episodes in the file name will be added, e.g. name.s01e01-03.ext will not include episode 2.
So custom format has to do :)

2.
It's simple once one got his head around it, yeah :)
Though, I still wonder why it still won't pick up all episodes in [Taka] 290-291-292-293-294-295 [210318B3].mp4. It's an odd format for sure (and I don't think I actually have any of those files, it's just from trying the 2-step thing earlier), but I wonder why it only picks 290. For [Taka] 286-287 [B48E507C].mp4 it works perfectly fine. Guess it's only looking for ranges, and more then 2 values wouldn't be a range anymore (obvioulsy)?
It would be picked up by Kodi (and Plex doesn't do absolute order at all I think?).
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Multi-Episode not being picked up

Post by rednoah »

Works for me:

Code: Select all

$ filebot -rename "[Taka] 290-291-292-293-294-295 [210318B3].mp4" --q "Naruto Shippuuden" --db TheTVDB --order Absolute -non-strict --action Test
[TEST] Rename [[Taka] 290-291-292-293-294-295 [210318B3].mp4] to [Naruto Shippuden - 290 & 291 & 292 & 293 & 294 & 295 - Power - Episode 1 & Power - Episode 2 & Power - Episode 3 & Power - Episode 4 & Power - Episode 5 & Power - Episode 6.mp4]

Code: Select all

$ filebot -version
FileBot 4.7.6 (r4674) / Java(TM) SE Runtime Environment 1.8.0_112 / Mac OS X 10.12.2 (x86_64)
:idea: Please read the FAQ and How to Request Help.
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Re: Multi-Episode not being picked up

Post by mihawk90 »

Now that's weird... I updated to the same rev, dragged the file into the GUI, same result...

Ran the 2 console commands, works, and now GUI works too .. what? :D

This time the GUI was asking me for the series though (it cought "filebot_test" in the path, won't work obviously). Could it be that it just got confused with some old xattr values?

Code: Select all

PS C:\Users\tarulia> filebot -version
FileBot 4.7.6 (r4674) / Java(TM) SE Runtime Environment 1.8.0_111 / Windows 8.1 6.3 (amd64)
PS C:\Users\tarulia> filebot -rename "C:\Users\tarulia\Videos\filebot_test\[Taka] 290-291-292-293-294-295 [210318B3].mp4
" --q "Naruto Shippuuden" --db TheTVDB --order Absolute -non-strict --action Test
Rename episodes using [TheTVDB]
Failed to read xattr: java.lang.IllegalArgumentException
Fetching episode data for [Naruto Shippuden]
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
Failed to read xattr: java.lang.IllegalArgumentException
[TEST] Rename [C:\Users\tarulia\Videos\filebot_test\[Taka] 290-291-292-293-294-295 [210318B3].mp4] to [C:\Users\tarulia\
Videos\filebot_test\Naruto Shippuden - 290 & 291 & 292 & 293 & 294 & 295 - Power - Episode 1 & Power - Episode 2 & Power
 - Episode 3 & Power - Episode 4 & Power - Episode 5 & Power - Episode 6.mp4]
Processed 1 files
PS C:\Users\tarulia> filebot -script fn:xattr "C:\Users\tarulia\Videos\filebot_test\[Taka] 290-291-292-293-294-295 [2103
18B3].mp4"
C:\Users\tarulia\Videos\filebot_test\[Taka] 290-291-292-293-294-295 [210318B3].mp4
        net.filebot.metadata: {"@type":"Episode","seriesName":"Naruto Shippuden","episode":290,"title":"Power - Episode
1","absolute":290,"airdate":{"year":2012,"month":11,"day":22},"id":4429067,"seriesInfo":{"database":"TheTVDB","order":"A
bsolute","language":"en","id":79824,"name":"Naruto Shippuden","aliasNames":["Naruto Shipp?den","Naruto Shippuuden","Naru
to Shippuden (2007)","Naruto: Shipp¹den","??????: ????????? ???????","?????? ??????","NARUTO????? ???","????????","???"]
,"certification":"TV-14","startDate":{"year":2007,"month":2,"day":15},"genres":["Action","Adventure","Animation"],"netwo
rk":"TV Tokyo","rating":8.1,"ratingCount":888,"runtime":25,"status":"Continuing"}}
Done ?(?????)?
A lot of xattr failures again.
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Multi-Episode not being picked up

Post by rednoah »

Uploading 4.7.7 as we speak... :shock:

@see viewtopic.php?f=13&p=25514#p25514
:idea: Please read the FAQ and How to Request Help.
User avatar
mihawk90
Power User
Posts: 51
Joined: 18 Mar 2014, 00:41

Re: Multi-Episode not being picked up

Post by mihawk90 »

So, after I've been quiet for a while I fiddled around a little more today, tried getting this format to work in the AMC.

I actually got it to work (without asking, yay!) like this as an AMC parameter:

Code: Select all

"seriesFormat={any{order.airdate.s+'x'+order.airdate.es.join('-')+' ['+group+'] '+ episodes*.absolute*.pad(3).join('-')+' ['+crc32+']'}{fn}}"
This works and get me this (though it says Failure...?):

Code: Select all

PS C:\Users\tarulia> filebot -script fn:amc --log-file "C:\Users\tarulia\Downloads\BitTorrent\_organized\amc.log" --acti
on test --conflict override -non-strict --filter "if (label == /TV_old/) return true; age < 30 || !model.any{ it.age < 3
0 }" --def music=n artwork=n "ut_label=TV_old" "ut_state=5" "ut_title=Code Geass- Lelouch of the Rebellion [Hi10]" "ut_k
ind=single" "ut_file=(Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv" "ut_dir=C:\Users\tarulia
\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion" "seriesFormat={any{order.airdate.s+'x'+order.aird
ate.es.join('-')+' ['+group+'] '+ episodes*.absolute*.pad(3).join('-')+' ['+crc32+']'}{fn}}"
Locking C:\Users\tarulia\Downloads\BitTorrent\_organized\amc.log
Run script [fn:amc] at [Tue Jan 24 00:26:16 CET 2017]
Parameter: music = n
Parameter: artwork = n
Parameter: ut_label = TV_old
Parameter: ut_state = 5
Parameter: ut_title = Code Geass- Lelouch of the Rebellion [Hi10]
Parameter: ut_kind = single
Parameter: ut_file = (Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv
Parameter: ut_dir = C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion
Parameter: seriesFormat = {any{order.airdate.s+'x'+order.airdate.es.join('-')+' ['+group+'] '+ episodes*.absolute*.pad(3
).join('-')+' ['+crc32+']'}{fn}}
Input: C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion\(Coalgirls)_Code_Geass_-_01
_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv
Group: [tvs:code geass lelouch of the rebellion] => [(Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7
A).mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [Code Geass Lelouch of the Rebellion]
Fetching episode data for [Code Geass: Lelouch of the Rebellion]
Apply Filter: {if (label == /TV_old/) return true; age < 30 || !model.any{ it.age < 30 }}
Include [Code Geass: Lelouch of the Rebellion - 1x01 - The Day a New Demon was Born]
...
Include [Code Geass: Lelouch of the Rebellion - 1xSpecial 31 - Picture Drama - Stage 3.25]
[TEST] Rename [C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion\(Coalgirls)_Code_Ge
ass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv] to [C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass-
 Lelouch of the Rebellion\1x1 [Coalgirls] 001 [DC1BBB7A].mkv]
Processed 1 files
Finished without processing any files
Failure (┬░_┬░)
But, using pad() on season and episode gets me this:

Code: Select all

PS C:\Users\tarulia> filebot -script fn:amc --log-file "C:\Users\tarulia\Downloads\BitTorrent\_organized\amc.log" --acti
on test --conflict override -non-strict --filter "if (label == /TV_old/) return true; age < 30 || !model.any{ it.age < 3
0 }" --def music=n artwork=n "ut_label=TV_old" "ut_state=5" "ut_title=Code Geass- Lelouch of the Rebellion [Hi10]" "ut_k
ind=single" "ut_file=(Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv" "ut_dir=C:\Users\tarulia
\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion" "seriesFormat={any{order.airdate.s.pad(2)+'x'+ord
er.airdate.es.pad(2).join('-')+' ['+group+'] '+ episodes*.absolute*.pad(3).join('-')+' ['+crc32+']'}{fn}}"
Locking C:\Users\tarulia\Downloads\BitTorrent\_organized\amc.log
Run script [fn:amc] at [Tue Jan 24 00:28:06 CET 2017]
Parameter: music = n
Parameter: artwork = n
Parameter: ut_label = TV_old
Parameter: ut_state = 5
Parameter: ut_title = Code Geass- Lelouch of the Rebellion [Hi10]
Parameter: ut_kind = single
Parameter: ut_file = (Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv
Parameter: ut_dir = C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion
Parameter: seriesFormat = {any{order.airdate.s.pad(2)+'x'+order.airdate.es.pad(2).join('-')+' ['+group+'] '+ episodes*.a
bsolute*.pad(3).join('-')+' ['+crc32+']'}{fn}}
Input: C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion\(Coalgirls)_Code_Geass_-_01
_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv
Group: [tvs:code geass lelouch of the rebellion] => [(Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7
A).mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [Code Geass Lelouch of the Rebellion]
Fetching episode data for [Code Geass: Lelouch of the Rebellion]
Apply Filter: {if (label == /TV_old/) return true; age < 30 || !model.any{ it.age < 30 }}
Include [Code Geass: Lelouch of the Rebellion - 1x01 - The Day a New Demon was Born]
...
Include [Code Geass: Lelouch of the Rebellion - 1xSpecial 31 - Picture Drama - Stage 3.25]
Skipped [C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass- Lelouch of the Rebellion\(Coalgirls)_Code_Geass_-_
01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv] because [C:\Users\tarulia\Downloads\BitTorrent\_organized\Code Geass-
Lelouch of the Rebellion\(Coalgirls)_Code_Geass_-_01_(BD_1080p)_(Hi10)_(Dual_Audio)_(DC1BBB7A).mkv] already exists
Processed 0 files
Finished without processing any files
Failure (┬░_┬░)
Not using {fn} there at least gives me
Expression yields empty value: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.any() is applicable for argument types: (Script2$_run_closure1) values: [Script2$_run_closure1@38234a38] Possible solutions: any(), any(groovy.lang.Closure), wait(), find(), wait(long), get(java.lang.String)
But, that doesn't help be because I still don't know what's happening (or rather, not happening). In the GUI airdate isn't defined so I can't test it there :(

I'm just wondering, isn't there an easier way to write this string? All the concatenation gets on my eyes :) I couldn't just copy and paste because I already needed quotation around the whole parameter, then using a quotation for the first "any" closure, then another for the string delimiter inside the brackets.

--- Slightly Off-Topic ---

I guess my real problem is not so much groovy in itself, but rather that I don't really understand how/where the arguments and their values are passed on and replaced. When I use the string in the above post in the GUI it works perfectly fine, but using it in the commandline directly gets me Parameter: seriesFormat = {any{x [] []}{fn}}.

a)
As I understand the value is directly passed into the string there, and since the episodes aren't actually being processed yet the variables aren't instanced yet, hence being null/empty?

b)
I suppose in the GUI it works because the format string is being passed through another function where the variables are being replaced by their values (using the $). The curly brackets inside the double-quotation serve as a means to "define" a nameless variable which is "accessed" by the $? The GUI didn't give me any syntax error when not using the $, and neither did not using the curly braces. Which is weird, because this:

Code: Select all

order.airdate.sxorder.airdate.es.join('-')
Shouldn't be anywhere near this:

Code: Select all

${order.airdate.s}x${order.airdate.es.join('-')}
because the first one would access a property of airdate named sxorder which.... probably doesn't exist, so I'm confused there.

c)
When using the above string in the AMC they are treated as variable names and only replaced on each loop for each file to process?
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Multi-Episode not being picked up

Post by rednoah »

1.
I highly recommend passing arguments and format expressions via external text files:
viewtopic.php?f=3&t=3244


2.
order.airdate makes no sense here, because the amc script will always fetch airdate episode data, i.e. order.airdate.s always equals s.


3.
The GUI and the CLI are exactly the same. There is nothing that cannot be tested in the GUI.


4.
Groovy Documentation regarding String Interpolation (i.e. doing "1 + 1 = ${1+1}")
http://groovy-lang.org/syntax.html#_str ... erpolation

String Interpolation is useful if String concatenation gets on your eyes. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply