How do I do this? (tags after show name/episode)

How-to guides, frequently asked questions, not-so-obvious features, etc
Post Reply
User avatar
Wolfie
Posts: 102
Joined: 27 Oct 2015, 02:59

How do I do this? (tags after show name/episode)

Post by Wolfie » 11 Oct 2018, 11:40

Hoping this simple question makes sense.

Is there a value that would be essentially the same as {fn} but without the name of the series, without the episode (SxE) or airdate, and without the extension, leaving everything else after the episode/airdate?

examples:
gooberville.s01e01.720p.HEVC.x265-groupName.mkv => 720p.HEVC.x265-groupName

gooberville.s01e01.PROPER.720p.HEVC.x265-anotherGroupName.mkv => PROPER.720p.HEVC.x265-anotherGroupName

I've tried filtering it on my own to remove the name of the show and the episode information, but sometimes that fails because of unusual issues. So I'm hoping that there is a value that contains everything after the episode/airdate (except for the extension).

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

Re: How do I do this? (tags after show name/episode)

Post by rednoah » 11 Oct 2018, 12:03

If you specifically check for s01e01 patterns, then it's quite simple:

Code: Select all

{fn.after(/s\d+e\d+/)}
Unfortunately, there's not built-in binding.


EDIT:

{fn.stripReleaseInfo()} not what you want, but it kinda is the exact opposite of what you want, so maybe you can do some kinda substring / regex replace operation based on that value?
:idea: Please read the FAQ and How to Request Help.

User avatar
Wolfie
Posts: 102
Joined: 27 Oct 2015, 02:59

Re: How do I do this? (tags after show name/episode)

Post by Wolfie » 11 Oct 2018, 12:12

I'm already doing basically that, but there are times when the file may have the wrong season or episode numbers (thus making s00e00 or similar useless), and that regex could match an unusually named show in the wrong place. I was hoping that since FileBot already detects the series name and s/e information, that it could be made to contain the rest of the name in a value to use. Sort of like how there the {group} is extracted from the filename as well.

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

Re: How do I do this? (tags after show name/episode)

Post by rednoah » 11 Oct 2018, 16:55

Wolfie wrote:
11 Oct 2018, 12:12
I'm already doing basically that, but there are times when the file may have the wrong season or episode numbers (thus making s00e00 or similar useless), and that regex could match an unusually named show in the wrong place. I was hoping that since FileBot already detects the series name and s/e information, that it could be made to contain the rest of the name in a value to use. Sort of like how there the {group} is extracted from the filename as well.
You could of course use {n} and {s00e00} and friends to remove these tokens from the file name. But since these patterns often aren't an exact match, it might be tricky. FileBot at no point tokenizes the file name into name / numbers / tags / etc so the file name is also not available in structured form.

Along those lines, try this, it'll work for what you have in the OP at the very least, and might generalize well:

Code: Select all

{fn.after(fn.stripReleaseInfo().replaceAll(/\W+/, '.'))}
:idea: Please read the FAQ and How to Request Help.

User avatar
Wolfie
Posts: 102
Joined: 27 Oct 2015, 02:59

Re: How do I do this? (tags after show name/episode)

Post by Wolfie » 12 Oct 2018, 01:49

I'll give that a try, though my hope was that if you are able to extract the name and episode information, why can't that be used to provide a string that has the remaining information? Just food for thought, but like I said, I'll give that code a try.

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

Re: How do I do this? (tags after show name/episode)

Post by rednoah » 12 Oct 2018, 02:58

Wolfie wrote:
12 Oct 2018, 01:49
I'll give that a try, though my hope was that if you are able to extract the name and episode information, why can't that be used to provide a string that has the remaining information? Just food for thought, but like I said, I'll give that code a try.
Well, FileBot does give you {n}, {s}, {e} etc so you can use those to do exactly that. Except it's not that easy. The series name might be completely different from whatever FileBot used to search for it. The episode file might not contain any series name or SxE numbers at all, or only absolute numbers, etc.

The best approach is probably to build your own list of 720p|PROPER|etc patterns and then just remove whatever comes before. There can't be too many of these patterns.
:idea: Please read the FAQ and How to Request Help.

User avatar
Wolfie
Posts: 102
Joined: 27 Oct 2015, 02:59

Re: How do I do this? (tags after show name/episode)

Post by Wolfie » 12 Oct 2018, 03:02

rednoah wrote:
12 Oct 2018, 02:58
Well, FileBot does give you {n}, {s}, {e} etc so you can use those to do exactly that. Except it's not that easy. The series name might be completely different from whatever FileBot used to search for it. The episode file might not contain any series name or SxE numbers at all, or only absolute numbers, etc.
Which is exactly why I was asking. I may be wrong on this, but I assume that there's a way to backtrack the final result to the original content, so that it can be used to remove items from the filename. Thus, my asking if there was already a way.

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

Re: How do I do this? (tags after show name/episode)

Post by rednoah » 12 Oct 2018, 03:15

1.
Unfortunately, there's no way to backtrack why a specific episode object turned out to be the best match for a specific file object. It's more like a washing machine in there and less like a sniper rifle. :lol:


2.
The other way around is much easier, with known patterns such as 720p / PROPER / etc. I'm fairly sure this is exactly what you want, and it might just work for all your use cases:

Code: Select all

{fn.stripReleaseInfo()}

Code: Select all

{fn.after(fn.stripReleaseInfo().replaceAll(/\W+/, '.'))}
:idea: Please read the FAQ and How to Request Help.

User avatar
Wolfie
Posts: 102
Joined: 27 Oct 2015, 02:59

Re: How do I do this? (tags after show name/episode)

Post by Wolfie » 12 Oct 2018, 04:04

Just tried and no good, as there are some instances where the filename has some sort of a prefix to it. I have a rather complex code I've been using that I know has its own problems, which is why I was hoping for something more reliable.

Code: Select all

{def ttl=any{fn.after(n.lower().replaceAll(/[, ]+/,'.')).after(/(${s00e00}|((s\d{1,2}|s\d{4})(e\d{1,3}){1,2})|^${e}|^${e00}|${n.space('.')})([. _](- )?|$)/).removeAll(/\.\[[\da-f]{8}\]/).removeAll(/\.eng(?!.)/)}{t.colon(" - ").validateFileName()}

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

Re: How do I do this? (tags after show name/episode)

Post by rednoah » 12 Oct 2018, 06:19

Wolfie wrote:
12 Oct 2018, 04:04
Just tried and no good, as there are some instances where the filename has some sort of a prefix to it.
Can you give me an example file path? Since we're using fn.after(...) the prefix should be skipped as well. Maybe there's a different underlying issue?
:idea: Please read the FAQ and How to Request Help.

User avatar
Wolfie
Posts: 102
Joined: 27 Oct 2015, 02:59

Re: How do I do this? (tags after show name/episode)

Post by Wolfie » 12 Oct 2018, 06:33

It's a prefix that doesn't really conform to the norm. It's not a bug with filebot, it's just someone sticking a tag (group tag?) at the beginning. I'll gladly PM you an example if you want to see what I'm talking about.

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

Re: How do I do this? (tags after show name/episode)

Post by rednoah » 12 Oct 2018, 06:50

Yep. Please PM me. Maybe there's a way to make it work once I see why it's not working.
:idea: Please read the FAQ and How to Request Help.

User avatar
Wolfie
Posts: 102
Joined: 27 Oct 2015, 02:59

Re: How do I do this? (tags after show name/episode)

Post by Wolfie » 12 Oct 2018, 07:42

Actually, FileBot does seem to be choking.. The stripReleaseInfo() returns blank on it.

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

Re: How do I do this? (tags after show name/episode)

Post by rednoah » 12 Oct 2018, 08:37

I see. It does seem to return no value if the file name starts with a release group. Not sure if that's a bug, or if that behaviour is useful internally to avoid mismatches. I'll look into it. I guess I don't have a good solution for you right now then.
:idea: Please read the FAQ and How to Request Help.

User avatar
Wolfie
Posts: 102
Joined: 27 Oct 2015, 02:59

Re: How do I do this? (tags after show name/episode)

Post by Wolfie » 12 Oct 2018, 08:50

If it's a bug, then would appear that this question/request had a positive benefit.

As for solutions, your help is phenomenal as it is and not all requests will have solutions. :)

Post Reply