Page 1 of 1
Separate out WEBRip from WEB-DL
Posted: 15 Aug 2022, 16:19
by jwl
Is there an easy way to separate out WEBRip from WEB-DL? I'd like to keep WEBRip as it's own source and not bundle it together with WEB-DL.
Re: Separate out WEBRip from WEB-DL
Posted: 15 Aug 2022, 21:05
by rednoah
e.g. if the file says
WEBRip yield
WEBRip otherwise yield whatever value
vs has:
You would use this as part of the folder structure to separate different sources into different folders like so:
Code: Select all
{ drive }/Media/{ f =~ /WEBRip/ ? 'WEBRip' : vs }/{ ny }/{ plex.name }
Re: Separate out WEBRip from WEB-DL
Posted: 15 Aug 2022, 22:35
by jwl
Sorry, I should have be more clear. I don't want them in separate folders, I want to rename them using the
vs value but instead of grouping
WEBRip and
WEB-DL together, I want to keep
WEBRip as is.
But using your example above, I think I was able to come up with something that should work for me.
Code: Select all
{ source.lower() =~ /webrip/ ? 'WEBRip' : vs }
Thanks!
Re: Separate out WEBRip from WEB-DL
Posted: 16 Aug 2022, 09:01
by rednoah
e.g. you can do a case-insensitive match on the file name like so:
Code: Select all
{ fn =~ /(?i)WEBRip/ ? 'WEBRip' : vs }
or so:
Code: Select all
{ any{ fn.match(/WEBRip/) }{ vs } }
Re: Separate out WEBRip from WEB-DL
Posted: 25 Jan 2024, 18:33
by iKUd
How can I add more eg WebHD and so on?
Tried around with the
Shell: Select all
{ any{ fn.match(/WEBRip/) }{ vs } }
but didnt get it to work.
Re: Separate out WEBRip from WEB-DL
Posted: 25 Jan 2024, 19:59
by rednoah
If you want to match
WebHD then you need to use
/WebHD/ and not
/WEBRip/ as custom regex pattern:
fn refers to the file name. If the file name contain
WebHD then the snippet above will yield
WebHD as a result.
Re: Separate out WEBRip from WEB-DL
Posted: 26 Jan 2024, 12:19
by iKUd
ok maybe I wasnt precise enough. I want to add WebHD in additional to the existing WebRip. And perhaps also Webxx and so on.
Re: Separate out WEBRip from WEB-DL
Posted: 26 Jan 2024, 15:30
by rednoah
e.g.
If the file name contains
Web<two upper-case letters> then add that to the target file path.
Re: Separate out WEBRip from WEB-DL
Posted: 27 Jan 2024, 13:59
by iKUd
First of all thank you for your patience
With this I get the WebHD done but the WebRip turns into WebRi.
But my question was to add more excludes in additional to WebRip so it doesnt touch WebRip, xy, zy, and so on
Re: Separate out WEBRip from WEB-DL
Posted: 27 Jan 2024, 14:03
by rednoah
Can you list a few file paths with corresponding desired output path?
The code above is an example. You can modify the regex pattern to match your target patterns more specifically. You can write the code yourself and test it against your file paths, but if you need help our with that then we need your
sample file paths as text so that we can prototype and test the code against something.
Re: Separate out WEBRip from WEB-DL
Posted: 27 Jan 2024, 15:54
by iKUd
I want not only to separate out WEBRip from WEB-DL but also WebHD and maybe even more
like
Shell: Select all
{ any{ fn.match(/WEBRip AND WebHD AND xxx AND yyy AND zzz/) }{ vs } }
Re: Separate out WEBRip from WEB-DL
Posted: 27 Jan 2024, 16:07
by rednoah
rednoah wrote: ↑27 Jan 2024, 14:03
Can you list a few file paths with corresponding desired output path?
The code above is an example. You can modify the regex pattern to match your target patterns more specifically. You can write the code yourself and test it against your file paths, but if you need help our with that then we need your
sample file paths as text so that we can prototype and test the code against something.
Yes, please post
sample file paths as text for each case. If we write code, then we need to create a test case first. Presumably, you are looking at the test case and can easily copy & paste it so that we don't have to randomly conjure something up.
e.g.
Console Output: Select all
$ ls
Alias.1x01.WEB-DL.mp4
Alias.1x01.WebHD.mp4
Alias.1x01.WebHD.WEB-DL.mp4
Alias.1x01.WEBRip.mp4
$ filebot -mediainfo . --format "{fn} => { any{ fn.match(/WebHD/) }{ source } }"
Alias.1x01.WEB-DL => WEB-DL
Alias.1x01.WebHD => WebHD
Alias.1x01.WebHD.WEB-DL => WebHD
Alias.1x01.WEBRip => WEBRip
Notably, the
{source} binding already does what you're asking for in the title.
{source} doesn't match
WebHD though so we use
Match information from the file path to grab that or any other keyword from the file name to cover that case as well.
Re: Separate out WEBRip from WEB-DL
Posted: 27 Jan 2024, 17:03
by iKUd
Wow great - so far that looks exactly what I was looking for!
I do some more tests but atm it looks great.
Thanks alot