Garteal / MPDN_Extensions

Media Player .Net (MPDN) Open Source Extensions
Other
0 stars 0 forks source link

*Feature* Filter Playlist filename #18

Closed Ryrynz closed 9 years ago

Ryrynz commented 9 years ago

File names sometimes contain information which is sometimes not useful when displayed in a playlist. Things like CRC values, audio or video info, encoder name or group, packaging type or even the name of the series it belongs to can generally be hidden, I find anything generally within square brackets also can be omitted also.

For example if we have the Directory column showing we don't need the title displaying the same info.

Directory_____Title C:\TV Series\Suits__Suits.S04E11.Enough.Is.Enough.1080p.WEB-DL.DD5.1.H.264-NTb

Could potentially be displayed as

Directory_____Title C:\TV Series\Suits__S04E11 Enough Is Enough

Garteal commented 9 years ago

Go ahead and play with it. You can use literal strings such as "1080p" to filter out any "1080p"s from the filename or use regular expressions to filter out patterns such as everything in brackets for example.

For now I've hardcoded that tokens such as "-", "_" and "." will add spaces instead of remove like it will do with anything else. Not sure if you'd want to replace with anything other than those two, so I'll probably expand the list in code later unless there's a reason to have it exposed in the GUI.

Note: The reason why it's "." and not just "." is because the "." matches every character except a \n. Oh and it's all without the quotes. Just making sure you get the message right.

Also the order of things is important. Play around with it if things don't look right until it does!

Free regex

Filter out everything in square brackets: [[^]]+] Filter out everything in parenthesis: ([^]]+) Filter extensions (probably needs tweaking): [.]+[a-z0-9]+ Filter out codec: x(264|265) Filter out resolution (can be written explicitly like the codec one above): [0-9]{3,4}p

If you want to build your own regex, this online tool is your best friend: https://regex101.com/

Ryrynz commented 9 years ago

Nice.

I think stripping the directory in the file name is likely more useful when there's more than one file in folder, could you add that as a sub option?

Anything I can use to match normal and caps letters? A single command at the start of the regex perhaps?

Any chance of having the playlist remember it's position after making changes rather than moving back up to the top of the playlist? No big deal if it's too much hassle.

If you mess up and enter something you shouldn't in the regex the playlist will error for every single file in the playlist, could you have it just throw up the one error?

This could potentially be applied to the directory column and full path as well. Perhaps different regex groups for each column, full path, directory and file name.

Being able to get rid of double spaces would be cool, that happens sometimes after regex filtering.

Garteal commented 9 years ago

I think stripping the directory in the file name is likely more useful when there's more than one file in folder, could you add that as a sub option?

Think we should settle on either a default behavior over an option?

Anything I can use to match normal and caps letters? A single command at the start of the regex perhaps?

It's regex, so you can look up anywhere for the syntax. To match both upper- and lowercase, use [a-zA-Z]

Any chance of having the playlist remember it's position after making changes rather than moving back up to the top of the playlist? No big deal if it's too much hassle.

Yeah it happens when refilling the list. I'll see if I can though.

If you mess up and enter something you shouldn't in the regex the playlist will error for every single file in the playlist, could you have it just throw up the one error?

Aware of this one. Will probably use some workaround for this one, but for the meantime, play with a small playlist ;p.

This could potentially be applied to the directory column and full path as well. Perhaps different regex groups for each column, full path, directory and file name.

Going deeper huh ;p.

Being able to get rid of double spaces would be cool, that happens sometimes after regex filtering.

Yes, I hardcoded it to remove adjacent spaces when it's filtering when you're using one of the above tokens. Alternatively you can also write a regex to take care of this: [\s]{2,5} That will check for matches for 2 up to 5 whitespaces in the filename and remove them if found.

Ryrynz commented 9 years ago

Let's go with that being the default behavior for file name stripping. It's a lot more likely you'd want this stripped when there's multiple files.

Garteal commented 9 years ago

Interesting request, but alas, this is implemented now.

Ryrynz commented 9 years ago

I think it's worth clarifying that the striping of the directory in the filename only applies to folders containing multiple files. Tooltip?