Release group folder vs file

All your suggestions, requests and ideas for future development
Post Reply
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Release group folder vs file

Post by devster »

I recently found something regarding release groups when processing a folder.
Here the example:

Code: Select all

$ ls -l Luther.S04.720p.HDTV.DD2.0.x264-BTN/
Luther.S04E01.720p.HDTV.x264-ORGANiC.mkv -> Luther - S04E01 - Episode 1 [720p x264 - 2.0 AC3 Eng - HDTV]-BTN.mkv
luther.4x02.720p_hdtv_x264-fov.mkv -> Luther - S04E02 - Episode 2 [720p x264 - 2.0 AC3 - HDTV]-BTN.mkv
It seems FileBot is defaulting to the folder group instead of the group from the file.
This happens both when processing the folder and when processing the files individually. In the specific case it was the effect of a post-processing script from transmission.
Is it possible to prioritize file group instead of the folder group?
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Release group folder vs file

Post by rednoah »

Unfortunately, no. Not sure if one way is better than the other. I might change the current behaviour if it comes up as an issue here in the forums more often.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Release group folder vs file

Post by devster »

Instead of changing the behaviour might it be possible to add 2 additional bindings like:

Code: Select all

{folderReleaseGroup}
{fileReleaseGroup}
without touching the current {group} binding and let a custom naming format do the work?
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Release group folder vs file

Post by rednoah »

Sorry, but I don't want to add unnecessary stuff that's only used by one person and/or needs to be documented. If a file has two different release groups, then something just doesn't make sense.


Why does the folder say it's RG fov but the file says it's RG BTN?


:idea: In this case, BTN takes precedence because it's an exact match. "fov" is not exactly the same as "FoV" so it has less priority. If the file were to use "FoV" instead of "fov" then the file match would be the first match.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Release group folder vs file

Post by devster »

rednoah wrote: 11 Nov 2017, 01:10 Sorry, but I don't want to add unnecessary stuff that's only used by one person and/or needs to be documented.
Makes sense.
rednoah wrote: 11 Nov 2017, 01:10 If a file has two different release groups, then something just doesn't make sense.

Why does the folder say it's RG fov but the file says it's RG BTN?
The file has a single release group, it's just that the folder contains an entire season which can be released by different groups.
rednoah wrote: 11 Nov 2017, 01:10 :idea: In this case, BTN takes precedence because it's an exact match. "fov" is not exactly the same as "FoV" so it has less priority. If the file were to use "FoV" instead of "fov" then the file match would be the first match.
This might be the behaviour for FoV but in the case of ORGANiC this didn't seem to work, the match was exact and it still didn't give priority to the file. Also I tried this with other FoV releases and it didn't match the file despite being the correct capitalization.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Release group folder vs file

Post by rednoah »

I did find a bug though that caused the name to be ignored completely if matching files with themselves (instead of Episode / Movie objects) via generic file mode.

r5237 might work slightly better for you now, but a case-sensitive match in the folder will still trump a case-insensitive match in the filename.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Release group folder vs file

Post by devster »

Confirmed:

Code: Select all

[TEST] from [The.Strain.S01.HDTV.x264-BTN/The.Strain.S01E03.HDTV.x264-KILLERS.mp4] to [/Media/TV Shows/The Strain (2014)/Season 1/The Strain - S01E03 - Gone Smooth [480p x264 - 2.0 AAC - HDTV]-KILLERS.mp4]
[TEST] from [The.Strain.S01.HDTV.x264-BTN/The.Strain.S01E04.HDTV.x264-ASAP.mp4] to [/Media/TV Shows/The Strain (2014)/Season 1/The Strain - S01E04 - It's Not for Everyone [480p x264 - 2.0 AAC - HDTV]-ASAP.mp4]
but:

Code: Select all

[TEST] from [The.Strain.S01.HDTV.x264-BTN/the.strain.s01e05.proper.hdtv.x264-2hd.mp4] to [/Media/TV Shows/The Strain (2014)/Season 1/The Strain - S01E05 - Runaways [480p x264 - 2.0 AAC - HDTV].PROPER-BTN.mp4]
The above with:

Code: Select all

FileBot 4.7.14 (r5240)
JRE: Java(TM) SE Runtime Environment 1.8.0_65
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Release group folder vs file

Post by rednoah »

Since BTN and HD2 are on the list, BTN beats hd2. That's how it currently works. It doesn't always make sense, but it does help to avoid false positives.

@see https://github.com/filebot/data/blob/ma ... ps.txt#L20
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Release group folder vs file

Post by devster »

Is there a command to post-process files in place just giving them the correct extended attributes in order to override the folder group?
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Release group folder vs file

Post by rednoah »

Not sure what happens if you use {fn} as format. It might work, renaming files to what they are already named, and then adding xattr. But files might just be ignored because the operation is pointless. Not sure which.

You could write your own script to just set that attribute to the current filename:
viewtopic.php?f=3&t=324

You can use FileBot or standard Linux tools to set xattr.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Release group folder vs file

Post by devster »

I'll try both, see what happens,
For the custom script is there a documented structure of how FileBot stores the metadata?
Or can I just set the basic attributes like
  • @type
  • year
  • id
  • name
for movies and an additional:
  • season
  • episode
for TV shows letting FileBot fill in the rest at post-processing time?
Or maybe there's a xattr.setXattr function I can use in groovy?
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Release group folder vs file

Post by rednoah »

You can set raw xattr like so:

Code: Select all

def f = '/path/to/file.txt'
f.xattr.'net.filebot.filename' = 'file.txt'
You can set the metadata xattr like so:

Code: Select all

def m = new Movie(...)
f.metadata = m
For the latter you'd have too look into the code a little bit to see what properties the Movie and Episode classes have. But as long as you serialize the JSON correctly, you can also set the metadata value via xattr directly.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Release group folder vs file

Post by devster »

Thanks for the tips.
Using {fn} can't do it in place since copying the files conflicts with the existing one apparently; so for tagging I'm using some lines from your artwork scripts to detect the series and tag the number when incorrect.

Now the last issue is that I still get a lot of season packs with several release groups and I keep getting clashes between folder and files.
Is there a patch or small edits I could make only on my own version that gives full priority to the release group in the filename instead of the folder?
I'm guessing it's somewhere here or here but I can't understand it well enough.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Release group folder vs file

Post by rednoah »

It's probably best to match them from the file or folder name yourself. Presumably, they already follow a certain pattern and are given for each file and folder.

e.g.
rednoah wrote:If your files already follow scene naming standards (e.g. "avatar-group.avi") you can try this expression which doesn't rely on a list of known release group names and just matches text patterns:

Code: Select all

{fn.match(/(?<=[-])\w+$/)}
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Release group folder vs file

Post by devster »

rednoah wrote: 02 Dec 2017, 11:15 It's probably best to match them from the file or folder name yourself. Presumably, they already follow a certain pattern and are given for each file and folder.

e.g.
rednoah wrote:If your files already follow scene naming standards (e.g. "avatar-group.avi") you can try this expression which doesn't rely on a list of known release group names and just matches text patterns:

Code: Select all

{fn.match(/(?<=[-])\w+$/)}
They usually do, and naming is usually very reliable.
Can I also match whatever pattern was found against the list you have online?
Because the issue is not that the release group is missing, it's just that BTN overrides 2hd because of the insensitive case matching, but 2HD should be the correct group.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Release group folder vs file

Post by rednoah »

You could do this in your format:

Code: Select all

net.filebot.media.MediaDetection.releaseInfo.getReleaseGroup(fn)
:!: This is not public API. It may or may not work in the future.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Release group folder vs file

Post by kim »

You need to modify it, but you can use my code:

Code: Select all

{
def dn = call{(file.parentFile.name).match(/(?:\-\w+(?=\[\w+\])|\-\w+$)/)};
def nn = call{fn.match(/(?:(?=(?:19|20)\d{2})\w.+$)/)};
def g = call{(file.parentFile.name+'.'+fn).find(/\-/) ? call{group.replaceAll(/\bDK\b|\bFS\b/,'')} : null};
def gg = '-'+g;
def gb = call{fn.match(/(?:^\w{3,}(?=[-]))/)};
def fm = call{fn.match(/(?:(?:\-(?!\bDL\b|\bRip\b|\bES\b|\bHD\b)\w+$)|(?:\-(?!\bDL\b|\bRip\b|\bES\b|\bHD\b)\w+[\.\_]\w+[\-]\w+$)|(?:\-\w+(?=\.cd[0-9]|\-trailer|\.part[0-9]|\.dan|\.eng))|(?:\-(?!\bDL\b|\bRip\b|\bES\b|\bHD\b)\w+[\-\.\_](?!\b720p\b|\b1080p\b)\w+$)|(?:\-\w+[\.]+\w+(?=\.cd[0-9]))|(?:\-(?!\bDL\b|\bRip\b|\bES\b|\bHD\b)\w+(?=\[\w+\]$)))/)};
if(g!=null && dn!=null && gg.equalsIgnoreCase(dn)) return '-'+g;
if(g!=null && dn!=null) return dn;
if(nn==null && dn!=null) return dn;
if(g!=null && (fm!=null||gb!=null) && (gg.equalsIgnoreCase(fm) || g.equalsIgnoreCase(gb))) return '-'+g;
if(g!=null && g!= '' && (fm!=null && gb!=null)) return '-'+g;
if(g==null && fm!=null && nn!=null) return ''+fm;
if(gb!=null && fm!=null && nn!=null) return '-'+gb;
if(g==null && gb!=null && fm==null && dn==null && nn==null) return '-'+gb;
if(g!=null && fm!=null && g!=fm) return fm;
if(g==null && fm==null && gb!=null && dn==null && nn==null) return '-'+gb;
if(g==null && fm!=null && gb!=null && dn==null && nn==null) return '-'+gb;
if(fm!=null) return fm}
master7mine
Posts: 2
Joined: 22 Feb 2017, 05:36

Re: Release group folder vs file

Post by master7mine »

rednoah wrote: 02 Dec 2017, 17:16 You could do this in your format:

Code: Select all

net.filebot.media.MediaDetection.releaseInfo.getReleaseGroup(fn)
:!: This is not public API. It may or may not work in the future.
Thank you.

I have been looking for a way to look for the group from MediaTitle for quite awhile and this worked perfectly. Please don't hide it or provide a way to look for group when it already got deleted from fn or folder.name.

I guess if it does disappear I will probably have corrected all my files by than.
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Release group folder vs file

Post by rednoah »

FileBot will always check the original filename xattr value if {group} is used. Using {mediatitle} is a good idea though in case xattr metadata is missing.
:idea: Please read the FAQ and How to Request Help.
Post Reply