How do I replace colon?

Any questions? Need some help?
Post Reply
DairyWinter
Posts: 15
Joined: 02 Jun 2021, 18:17

How do I replace colon?

Post by DairyWinter »

I tested your app for a while now, these are the only 2 very annoying flaws about it. I pay for this app and your are the coder, so you're the only one I can turn to.

I would like it to do one time all at once operation and give me opportunity to swap incompatible Character like ":" for anything I want when the popup window appear. As of now they are swapped for empty space, I would prefer "- ". It happen very often, so this feature would be very useful.

One time operation is for all the companion file including "folder.jpg" to be renamed during the output instead of having to re-run them into the app a second time. As you know "folder.jpg" doesn't rename either way, so that's also major issue. I have to copy and paste constantly, that defeat the purpose of your program.

Please work on this, test it out and release an update.
kim
Power User
Posts: 1199
Joined: 15 May 2014, 16:17

Re: 2 major issue with Filebot

Post by kim »

Take a look here:

[Plain File Mode] Batch Rename any type of file
viewtopic.php?f=3&t=2072
maybe you can use something like this (rename files the same as the file with biggest file size)

Code: Select all

{
def mainName = folder.listFiles().sort{it.length()}.name.last().nameWithoutExtension
folder.name + '/' + mainName
}
Plex Naming Schemes
viewtopic.php?t=4116

Code: Select all

{plex.tail}
Format Expressions
https://www.filebot.net/naming.html

Code: Select all

{ny.colon(' - ')}/{n.colon(' - ')}
Companion Files
viewtopic.php?t=12172
DairyWinter
Posts: 15
Joined: 02 Jun 2021, 18:17

Re: 2 major issue with Filebot

Post by DairyWinter »

If this will rename every small companion file including the "folder.jpg" it's a step in the right direction.
Were do I put this though?


{
def mainName = folder.listFiles().sort{it.length()}.name.last().nameWithoutExtension
folder.name + '/' + mainName
}
DairyWinter
Posts: 15
Joined: 02 Jun 2021, 18:17

Re: 2 major issue with Filebot

Post by DairyWinter »

DairyWinter
Posts: 15
Joined: 02 Jun 2021, 18:17

Re: 2 major issue with Filebot

Post by DairyWinter »

That didn't work at all,
The companion file outputted like usual not renamed and the movie was not renamed either.
DairyWinter
Posts: 15
Joined: 02 Jun 2021, 18:17

Re: 2 major issue with Filebot

Post by DairyWinter »

None of that stuff above is related to the 2 issues.
-INVALID CHARACHTERS
-Renaming all companion file at once.

So far my preset {ny}/{n}{' - '+fn.match(/tmdb/)} Only rename the video file and the subtitle. Companion files are being tossed in there with a generic name... Movie Folder tmdb

Even if I re-run the companion file alone that is an extra step and folder.jpg does not get renamed, I need to manually rename it. If
I get a movie with invalid character, that's even worst.
User avatar
rednoah
The Source
Posts: 20292
Joined: 16 Nov 2011, 08:59

Re: How do I replace colon?

Post by rednoah »

This format does not perform replacements, and will retain any any colon that the movie name {n} might contain:

Code: Select all

{ny}/{n}{' - '+fn.match(/tmdb/)}
Image



Windows users will want to customize their custom format to take care of : colon at ahead of time as illustrated in the first built-in example, so that that destination file path generated by your format cannot contain : colon in the first place, pre-emptively fixing the problem:

Code: Select all

{ny.colon(' - ')}/{n.colon(' - ')}{' - '+fn.match(/tmdb/)}
Image
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 20292
Joined: 16 Nov 2011, 08:59

Re: folder.jpg and cover.jpg

Post by rednoah »

Thank you for sharing screenshots and your application settings.


:!: folder.jpg is indeed ignored not not processed in any way. Renaming this file as if it was the movie is not possible. You could pre-process those files specifically in Plain File Mode as suggested by kim, and you may be able to streamline things with custom Presets and keyboard shortcuts, but it will always involve an extra custom step, and things that are not default behavior are always a bit more tricky and cumbersome. We can help you get there, but it will probably take a few days of back-and-forth and trial & error until we come up with something that works well for your specific use case.


:idea: The cover.jpg file is generated by FileBot because you have enabled the Fetch cover images post-processing feature. Notably, this is not your folder.jpg copied over, but a copy freshly downloaded from the internet.


:idea: We do not process folder.jpg / cover.jpg / other-extras.jpg files because a significant number of users prefer to either ignore them altogether, or copy them along without any renaming, since extra files like this are typically named for a reason, and changing the name breaks things, e.g. Windows Explorer, Plex, Kodi, etc use this naming convention to pick the folder image / cover image and expect to find files name folder.jpg or cover.jpg:
https://answers.microsoft.com/en-us/win ... 21d64d32ec


:arrow: For the sake of simplicity, I would stick to the current default behavior (i.e. ignore existing folder.jpg files or copy along while keeping the original name; fetch new cover.jpg files from the internet) even if it's not exactly what you want.



EDIT:

:arrow: If you're willing to accept an extra (fully automated) step that generically finds and renames *.jpg using the file name of a nearby video file, then this will get you started:

Image

Code: Select all

{ folder.listFiles{ it.video }.max{ it.length() }.nameWithoutExtension }-{fn}
i.e. list files from the same folder; select the video files; find the one video file with the largest file size; take the file name without extension from that; and then add a dash and the current file name as well


Image


:idea: You can remove the -{fn} part at the end of the format expression if you want to name your *.jpg files exactly as the video, and not add the current *.jpg file name as well at the end.

:idea: You can change Includes: to f.name == 'folder.jpg' if you want to select folder.jpg files specifically, and not all *.jpg files.
:idea: Please read the FAQ and How to Request Help.
DairyWinter
Posts: 15
Joined: 02 Jun 2021, 18:17

Re: How do I replace colon?

Post by DairyWinter »

Thanks! I will try all this and get back to you.
I really appreciate it.
DairyWinter
Posts: 15
Joined: 02 Jun 2021, 18:17

Re: How do I replace colon?

Post by DairyWinter »

So far so good, big improvement with this first step preset=> {ny.colon(' - ')}/{n.colon('- ')}{' - '+fn.match(/tmdb/)}

For second step preset in "Plain file mode" I follow your advice it does work but just for "folder.jpg"
Can all companion file process at the same time? something like=> f.name == 'folder.jpg'/'movie.nfo'/'tmdb.url'

The reason for them being named all the same in my library is for search in windows, everything contain within will show up. "Convenient"
Also to avoid mass delete of a particular file name a glitch or file corruption. "safer"
User avatar
rednoah
The Source
Posts: 20292
Joined: 16 Nov 2011, 08:59

Re: How do I replace colon?

Post by rednoah »

DairyWinter wrote: 24 Sep 2021, 14:28 Can all companion file process at the same time?
Yep, you can adjust your Includes: filter expression to include files as needed. You could include files based on the file name. Alternatively, you could include specific extension irregardless of the file name. The choice is yours. Either way will work I suppose.


e.g. select files of any type / extension that are named folder or movie or tmdb

Code: Select all

fn ==~ /folder|movie|tmdb/

e.g. select *.jpg and *.url and *.nfo files:

Code: Select all

ext ==~ /jpg|url|nfo/
:idea: Please read the FAQ and How to Request Help.
DairyWinter
Posts: 15
Joined: 02 Jun 2021, 18:17

Re: How do I replace colon?

Post by DairyWinter »

First Preset Step:
*Use original file selection
Expression=> {ny.colon(' - ')}/{n.colon('- ')}
Datasource=> TheMovieDB

Second Preset Step:
*Do Select Files
Input Folder=> fn ==~ /folder|movie|tmdb/
Expression=> { folder.listFiles{ it.video }.max{ it.length() }.nameWithoutExtension }{' - '+fn.match(/tmdb/)}
Datasource=> Plain File

This work 100% for companion file and for invalid character, so all renaming is a 2 steps process regardless. Finally!

Thanks RedNoah
Post Reply