Page 1 of 2

Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 19:29
by frontrange
Subject says it all, tried the command with "filebot -rename ?" no dice, and couldn't find it on git either.

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 19:52
by frontrange
NM, found it.

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 20:10
by rednoah
filebot doesn't really have sub-commands. -rename is just a flag that enables Rename mode. The majority of options are relevant to or even specific to Rename mode.

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 20:11
by frontrange
Is there no way to do a rename using the title and year?

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 20:19
by rednoah
:arrow: Here's a command that renames a movie using title and year for the target file name:

Console Output: Select all

$ filebot -rename *.mkv --db TheMovieDB --format "{ny}" -non-strict --action TEST --log INFO
[TEST] from [Avatar.mkv] to [Avatar (2009).mkv]

frontrange wrote: 12 Dec 2023, 20:11 Is there no way to do a rename using the title and year?
:?: What makes you think that? Adding thoughts will likely provide much needed context, because I'm not really sure what you're trying to do. :lol:

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 20:21
by frontrange
I'm trying to figure out how to use a year filter to -rename the correct movie where there are multiple same titles due to a remake.

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 20:23
by rednoah
:?: Specifically, what is the file name of the file that's giving you trouble?

:arrow: In General, please read FAQ #2.

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 20:30
by frontrange
I have multiple movies that include both original and later remakes, I'm trying to do a rename on these and specifying the year to get the right one, something like this only I still am trying to figure out the correct format:

Console Output: Select all

$ filebot -rename --db TheMovieDB --filter true 'y 1960' 'The Magnificent Seven.mkv' -non-strict
File does not exist: /share/movies/y 1960
Rename movies using [TheMovieDB]
Auto-detect movie from context [/share/movies/The Magnificent Seven.mkv]
[XATTR] The Magnificent Seven (1960) (/share/movies/The Magnificent Seven.mkv)
Apply filter [true] on [1] options
Include [The Magnificent Seven (1960)]
[1] options remaining
[MOVE] from [/share/movies/The Magnificent Seven.mkv] to [/share/movies/The Magnificent Seven (1960).mkv]
Processed 1 file

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 20:48
by rednoah
e.g.

Shell: Select all

--filter "y == 1960"
See --filter and fine-tuning for details and examples.



:!: Note that you are testing with a file that is already identified and tagged. If you're doing test runs then you will want to use -revert to revert previously renamed files after each test run, instead of manually renaming files back, to ensure a clean pristine test run each time:

Code: Select all

[XATTR] The Magnificent Seven (1960) (/share/movies/The Magnificent Seven.mkv)

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 20:57
by frontrange
Excellent, Thanks! Just to confirm I'm going about this the right way, my plan is this:
1 I currently have about 1K movies already indexed in kodi using title (year)
2 Since I can't process them as currently named, and don't want to end up with having to reindex everything I plane to write a script that removes the year from each file name, does a rename to get it back,
3 Then run the nfo script against each.
Does that sound logical?

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 21:19
by rednoah
:?: Why would you remove the year (which makes the file less identifiable) before identifying and renaming the now-year-less file name? What problem are you trying to solve?



EDIT:

:?: Do you mean to get around the "Skipped because file is already named as instructed" issue? If so, re-read my previous post with that in mind:
rednoah wrote: 12 Dec 2023, 18:23 :arrow: If the files are already well-named then you need to use --output to move/rename the file to a different folder or use --format {plex.id} to ensure a different file name.

Shell: Select all

--output "/path/to/new-target-folder" --format "{plex.id}"
** The Fetch artwork and NFO files (v2) script notably assumes that movies are well-organized into movie folders. The --format "{plex.id}" option ensures standard naming and folder structure.

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 21:24
by frontrange
You told me the file name being already in kodi format would keep the -rename from properly tagging the xattr, did I miss understand you?

I just need to create these nfo files, but I don't want rename every one of these files in plex format and break my existing media server. If I need to rename them in a script so I can then properly rename them back to title (year), I'll do that, is there a simpler option?

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 21:39
by rednoah
frontrange wrote: 12 Dec 2023, 21:24 You told me the file name being already in kodi format would keep the -rename from properly tagging the xattr, did I miss understand you?
In the specific case where you rename files in place and want to rename files to how files are already named, FileBot will do nothing as there is nothing to do:

Console Output: Select all

$ filebot -rename *.mkv --db TheMovieDB --format "{n} ({y})"
Rename movies using [TheMovieDB]
Auto-detect movie from context [The Magnificent Seven (2016).mkv]
[MOVE] Skipped [The Magnificent Seven (2016).mkv] because [The Magnificent Seven (2016).mkv] already exists
Processed 0 files

You could change the format to Name (Year) <something else> to ensure that files are renamed and processed:

Console Output: Select all

$ filebot -rename *.mkv --db TheMovieDB --format "{n} ({y}) [{vf}]"
Rename movies using [TheMovieDB]
Auto-detect movie from context [The Magnificent Seven (2016).mkv]
[MOVE] from [The Magnificent Seven (2016).mkv] to [The Magnificent Seven (2016) [480p].mkv]
Processed 1 file



However, I would organize files according to the standard (i.e. movie folder for each movie) and then everything will work itself out from there. If you have movie folders and *.nfo files then Kodi will quickly and reliably rescan your library:

Console Output: Select all

$ mkdir Library
$ filebot -rename *.mkv --db TheMovieDB --output Library --format "{plex.id}"
Rename movies using [TheMovieDB]
Auto-detect movie from context [The Magnificent Seven (2016).mkv]
[MOVE] from [The Magnificent Seven (2016).mkv] to [Library/Movies/The Magnificent Seven (2016) {tmdb-333484}/The Magnificent Seven (2016).mkv]
Processed 1 file
$ filebot -script fn:nfo Library
[MOVIE] The Magnificent Seven (2016) [Library/Movies/The Magnificent Seven (2016) {tmdb-333484}/The Magnificent Seven (2016).mkv]
Generate Movie NFO: The Magnificent Seven (2016) [Library/Movies/The Magnificent Seven (2016) {tmdb-333484}/The Magnificent Seven (2016).nfo]
Done ヾ(@⌒ー⌒@)ノ

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 21:41
by frontrange
I REALLY don't want to reorganize my entire media collection to to the plex format with a separate subdirectory for every movie. Besides, if did that, re-indexing kodi would take many, many hours and would leave me two entries per movie in the guide. I know no way to clean that mess up besides clicking on each movie one at a time, and then selecting the removing the entry option when the file isn't found.

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 21:57
by rednoah
Well, then adding {vf} (or anything really) to your format is your solution.


As for Kodi, you can do things your way, it's out-of-scope for us to discuss here. FileBot will do whatever you instruct it to do. However, it must be said that "Movie Folders is the recommended method for organising your movies. Each movie file is placed into its own folder which is then added to your Source. Placing movies in their own folder allows saving of local artwork and NFO files alongside the movie file. Using this method will provide the safest and most accurate scrape of your media collection." because that's what the official Kodi documentation says.

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 22:00
by frontrange
Can you elaborate on vf? I don't see it in the command list.

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 22:12
by rednoah
--format is the option name.

{n} ({y}) [{vf}] is the option value for the --format option. There is an infinite number of possible --format option values, as there are infinite ways of naming files. Please read naming scheme for details. You will find the {vf} binding documented there.




:!: Keep in mind that {vf} is not the point, "add something to make it different" is the point, could be the video format, could be an X, could be anything:

Console Output: Select all

$ filebot -rename *.mkv --db TheMovieDB --format "{n} ({y}) X"
Rename movies using [TheMovieDB]
Auto-detect movie from context [The Magnificent Seven (2016).mkv]
[MOVE] from [The Magnificent Seven (2016).mkv] to [The Magnificent Seven (2016) X.mkv]
Processed 1 file

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 22:21
by frontrange
If there's no way to make this work without renaming every file, there's no way to make this work without making a mess out of my media server and all of it's properly indexed content.

NM, I'll just tar off the library to an LTO and restore it later. The last time I just pointed kodi to a replacement nfs server, I had to blow the entire thing away reinstall kodi, and spend the entire day into the night re-indexing to clean up the resulting mess.

Thanks for your help!

Re: Where do I find a list of command line arguments for -rename?

Posted: 12 Dec 2023, 22:30
by rednoah
I would venture to make the educated guess that at least some of your unusual Kodi issues stem from you not following the recommended Kodi naming standard. You're not the first. You're not the last. Best to visit the Kodi Community Forum for advice and best practices on that one though.

Re: Where do I find a list of command line arguments for -rename?

Posted: 13 Dec 2023, 00:36
by frontrange
It's more of a function of the fact that a firetv stick is a painfully slow platform. Only the very latest generation is even fast enough to keep up with a very simple up/down remote control. When you get into making metadata operations on large volumes of files you have to accept each will take a minute or more. This is why I don't change all my metadata for no reason.

Re: Where do I find a list of command line arguments for -rename?

Posted: 13 Dec 2023, 15:46
by frontrange
After renaming all of the files, I'm running the nfo script on all of my movies, and most are working but a few generate this error:

Code: Select all

[MOVIE] Battleship (2012) [/share/movies/Movies/Battleship (2012)/Movies/Battleship (2012)/Battleship (2012).mp4]
Generate Movie NFO: Battleship (2012) [/share/movies/Movies/Battleship (2012)/Movies/Battleship (2012)/Battleship (2012).nfo]
No signature of method: java.util.ArrayList.replaceAll() is applicable for argument types: (String, String) values: [[ ].+, ]
Possible solutions: replaceAll(java.util.function.UnaryOperator), replace(java.util.Map)
groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.replaceAll() is applicable for argument types: (String, String) values: [[ ].+, ]
Possible solutions: replaceAll(java.util.function.UnaryOperator), replace(java.util.Map)
        at Script.doCall(Script:189)
        at Script.doCall(Script)
        at Script.doCall(Script:188)
        at Script.doCall(Script:187)
        at Script.doCall(Script)
        at Script.doCall(Script:186)
        at Script.doCall(Script)
        at Script.fileFragment(Script:185)
        at Script.doCall(Script:43)
        at Script.doCall(Script)
        at Script.doCall(Script:15)
        at Script.doCall(Script)
        at net.filebot.cli.ScriptShellBaseClass.XML(Unknown Source)
        at Script.fetchMovieNfo(Script:14)
        at Script.doCall(Script:230)
        at Script.run(Script:225)
        at net.filebot.GroovyEngine.eval(Unknown Source)
        at net.filebot.cli.ScriptShell.evaluate(Unknown Source)
        at net.filebot.cli.ScriptShell.runScript(Unknown Source)
        at net.filebot.cli.ArgumentProcessor.runScript(Unknown Source)
        at net.filebot.cli.ArgumentProcessor.run(Unknown Source)
        at net.filebot.Main.main(Unknown Source)

Error (o_O)

Re: Where do I find a list of command line arguments for -rename?

Posted: 13 Dec 2023, 16:26
by rednoah
Please paste the MediaInfo table for the file at hand:

Shell: Select all

filebot -script fn:mediainfo "/share/movies/Movies/Battleship (2012)/Movies/Battleship (2012)/Battleship (2012).mp4"

Re: Where do I find a list of command line arguments for -rename?

Posted: 13 Dec 2023, 16:28
by frontrange

Console Output: Select all

$ filebot -script fn:mediainfo "/share/movies/Movies/Battleship (2012)/Movies/Battleship (2012)/Battleship (2012).mp4"

# /share/movies/Movies/Battleship (2012)/Movies/Battleship (2012)/Battleship (2012).mp4

General #0
Count                 : 348
StreamCount           : 1
StreamKind            : General
StreamKind/String     : General
StreamKindID          : 0
Format                : MPEG-4
Format/String         : MPEG-4
Format/Extensions     : braw mov mp4 m4v m4a m4b m4p m4r 3ga 3gpa 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma ismt f4a f4b f4v
Format_Commercial     : MPEG-4
Format_Profile        : Base Media / Version 2
InternetMediaType     : video/mp4
CodecID               : mp42
CodecID/String        : mp42 (mp42/isom/avc1)
CodecID/Url           : http://www.apple.com/quicktime/download/standalone.html
CodecID_Compatible    : mp42/isom/avc1
FileSize              : 7707452583
FileSize/String       : 7.18 GiB
FileSize/String1      : 7 GiB
FileSize/String2      : 7.2 GiB
FileSize/String3      : 7.18 GiB
FileSize/String4      : 7.178 GiB
StreamSize            : 7707452583
StreamSize/String     : 7.18 GiB (100%)
StreamSize/String1    : 7 GiB
StreamSize/String2    : 7.2 GiB
StreamSize/String3    : 7.18 GiB
StreamSize/String4    : 7.178 GiB
StreamSize/String5    : 7.18 GiB (100%)
StreamSize_Proportion : 1.00000
HeaderSize            : 160
DataSize              : 7704885256
FooterSize            : 2567167
IsStreamable          : No
Done ヾ(@⌒ー⌒@)ノ

Re: Where do I find a list of command line arguments for -rename?

Posted: 13 Dec 2023, 16:37
by frontrange
I just noticed looking over the files that failed, so far they are all mp4, with the working ones being mkv's.

Re: Where do I find a list of command line arguments for -rename?

Posted: 13 Dec 2023, 17:24
by rednoah
The mediainfo console output seems to suggest that the file has neither a video stream nor an audio stream. That makes no sense. Looks like the file is corrupted so MediaInfo can't read it.