Make the directories and filenames match the "posix portable filename character set"

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
christopherc
Posts: 2
Joined: 24 Feb 2023, 22:08

Make the directories and filenames match the "posix portable filename character set"

Post by christopherc »

Hi,

I am looking to purchase this software. Admittedly, I have not done a whole lot of reading\research on it.

My sample directory of Movies

Code: Select all

"Movies/Downloaded/Alien³ (1992) {imdb-tt0103644}/Alien³ (1992) {imdb-tt0103644}.mkv"
"Movies/Downloaded/Star Wars: Episode I - The Phantom Menace (1999) {imdb-tt0120915}/Star Wars: Episode I - The Phantom Menace (1999) {imdb-tt0120915}.mkv"
My sample directory of Series

Code: Select all

"Show Series/Downloaded/Loki (2021) {tmdb-84958}/Season 01/Loki (2021) - s01e01 - Glorious Purpose.mkv"
"Show Series/Downloaded/Ted Lasso (2020) {tmdb-97546}/Season 02/Ted Lasso (2020) - s02e01 - Goodbye Earl.mkv"
My aim is to use this software to make the directories and filenames match the "posix portable filename character set", in the examples provided you will notice the tittles "Alien³" and "Star Wars: Episode I - The Phantom Menace (1999) {imdb-tt0120915}"

This is for plex media server.

So, I am hoping I can point filebot to "Movies/Downloaded/" for example, and let it go through and clean up the files.

If you have a sample command I can issue for this, that would be great!

I have it installed on my qnap server already, running the command filebot I get

Code: Select all

[/share/Media] # filebot
FileBot 4.9.6 (r9125)
As an FYI, I will be looking into installing it as a docker image and not natively as I have currently.

Thanks for your help in advance.

Thanks.
Chris.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Looking to purchase

Post by rednoah »

:!: The file paths you have are already perfect for Plex. ³ is just Latin-1 Supplement, so not very special. It'll work just fine on Windows and Linux. : is problematic on Windows, so you may want to replace those if you plan on accessing these files paths from a Windows machine.


:?: Are you sure that you need to rename files for Plex? Plex works best if the file names you have match exactly the the movie name in the database. Alien³ will work best, and may work less well if you change that. Star Wars: Episode I or Star Wars - Episode I or Star Wars Episode I will work equally well because Plex knows that Windows users cannot use : in file names.


:arrow: If you're organizing files for Plex, then I'd just stick to the {plex} format. That'll work best. See How do I organize files for Plex? for details.




Assuming that you just want to do what you want to do for your own reasons, and not for Plex, then you can use the following example as a starting point:
rednoah wrote: 03 Dec 2015, 17:36 Rename current selection of files and replace all non-ASCII characters with suitable ASCII equivalents, and replace all spaces with underscore:

Code: Select all

{ fn.ascii().space('_') }
Image

e.g. use the filebot command inside a docker container to rewrite file paths:

Code: Select all

docker run --rm -it -v "$PWD:$PWD" -v data:/data rednoah/filebot -rename -r "$PWD" --db file --format "{ f.path.colon(' - ').ascii() }" --apply prune

Code: Select all

Rename files using [Plain File]
[MOVE] from [Movies/Downloaded/Alien³ (1992) {imdb-tt0103644}/Alien³ (1992) {imdb-tt0103644}.mp4] to [Movies/Downloaded/Alien (1992) {imdb-tt0103644}/Alien (1992) {imdb-tt0103644}.mp4]
[MOVE] from [Movies/Downloaded/Star Wars: Episode I - The Phantom Menace (1999) {imdb-tt0120915}/Star Wars: Episode I - The Phantom Menace (1999) {imdb-tt0120915}.mp4] to [Movies/Downloaded/Star Wars - Episode I - The Phantom Menace (1999) {imdb-tt0120915}/Star Wars - Episode I - The Phantom Menace (1999) {imdb-tt0120915}.mp4]
[PRUNE] Delete empty folders (Movies/Downloaded/Alien³ (1992) {imdb-tt0103644})
[PRUNE] Delete empty folders (Movies/Downloaded/Star Wars: Episode I - The Phantom Menace (1999) {imdb-tt0120915})
Processed 2 files
:arrow: See Plain File Mode and FileBot Docker for details.


:idea: If this is a one-off task, then you will want to use the GUI via the filebot-xpra container.




EDIT:

Note that "posix portable filename character set" doesn't even allow space characters - and more notably in this context - does not allow () and {} which you need for (2023) and {id-12345} patterns, so you probably don't want to adhere to that too strictly if you are organizing files for Plex:

Code: Select all

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 . _ -
But if this is indeed what you want to do, then the --format can be adjusted of course:

Code: Select all

{ f.path.space('_').replaceAll('[^A-Za-z0-9/._-]', '') }
:idea: Please read the FAQ and How to Request Help.
christopherc
Posts: 2
Joined: 24 Feb 2023, 22:08

Re: Make the directories and filenames match the "posix portable filename character set"

Post by christopherc »

Thank you for this. Nice write up and explains things well. I purchased the software.

Yes, you are right, I don't want to adhere to "posix portable filename character set" to strictly.

I am running filebot-node and filebot-xpra as docker containers. I am assuming that its ok they share the same docker volume.

Will be looking at filebot-node over the next weeks but from what I am able to glean, it does all that I need. But just to sort of confirm, the flow I would be looking at is;

(1) Watch a folder for movies\tv shows.
(2) Rename them according to plex naming standards (including the directory structure)
This includes matching to the various online databases, IMDB, etc, etc. This implies that filebot will perform the match and name so when I move them into plex directories, its well known at that point.

Quickly glancing at the filebot-node, I noticed that in the file options there is "Conflict: overwrite if the new file is better", my question is how is "better" determined?

Thanks once again.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Make the directories and filenames match the "posix portable filename character set"

Post by rednoah »

1.
:arrow: viewtopic.php?t=2733

:arrow: viewtopic.php?t=13038

:idea: FileBot Node does not monitor directories. You can use the filebot-watcher shell script (or container) to monitor the file system for changes and call filebot on those changes. Personally, I'd call filebot on a schedule once per day at 4am.



2.
:arrow: viewtopic.php?t=12891

:idea: FileBot defines "better" with simple numeric values such as bitrate, resolution, file size, etc. This is not set in stone and may change over time.
:idea: Please read the FAQ and How to Request Help.
Post Reply