Specify renaming pattern for subtitles based on TV or Movie

Any questions? Need some help?
Post Reply
Paulamonopoly
Posts: 8
Joined: 18 Sep 2022, 22:08

Specify renaming pattern for subtitles based on TV or Movie

Post by Paulamonopoly »

Hello, I'm currently renaming subtitles and moving them around etc, however I can only seem to set one pattern for subtitle renaming, is there a way to specify the pattern based on the information detected from the file.

Ubuntu 20.04 server
Using CLI / AMC

This works, however uses this formatting for both TV Shows and Movies.

Code: Select all

find -name "*.srt" -type f -exec filebot -rename -r {} --format "/{id}_[{lang}]" \;
And I use this segment of code to rename movies and shows differently:

Code: Select all

filebot -script fn:amc blah blah blah blah --def movieDB=TheMovieDB seriesDB=TheMovieDB::TV movieFormat="/{n}-{y}" seriesFormat="/{n}-{y}-S{s}-E{e}" \;
So I thought I'd try AMC to rename my subtitles, however AMC doesn't seem to pick up subtitles ?

Code: Select all

find -name "*.srt" -type f -exec filebot -script fn:amc blah blah blah blah --def movieDB=TheMovieDB seriesDB=TheMovieDB::TV movieFormat="/{n}-{y}" seriesFormat="/{n}-{y}-S{s}-E{e}" \;
Is this possible or not ? I can't find too much online to help me. Thanks :)
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Specify renaming pattern for subtitles based on TV or Movie

Post by rednoah »

1.
You'll want to have separate filebot calls for movie subtitles and episode subtitles and use the --db option to force Movie mode or Episode mode depending the arguments being passed along. Alternatively, you can use a format such as {plex.name} that happens to work in both Movie mode and Episode mode.


2.
The amc script expects you to process video files alongside their corresponding subtitles files. Please read the console output for details.


3.
You'll want to use find -exec + and not find -exec \; because calling filebot once for each file is extremely inefficient.
:idea: Please read the FAQ and How to Request Help.
Paulamonopoly
Posts: 8
Joined: 18 Sep 2022, 22:08

Re: Specify renaming pattern for subtitles based on TV or Movie

Post by Paulamonopoly »

Firstly, thanks for your response, I hadn't realized you replied so quick...

All my subtitles come in from the same folder, so while using -db TheMovieDB would be fantastic, it also tries to rename my TV Shows to unrelated Movies such as The Walking Dead Movie TMDb ID: 27115, so I thought I'd run TV Shows first and then Movies afterwards on the presumption that it would detect the seasons and episodes in the titles and then move on to the movies which wouldn't have seasons and episodes in the title. So far no false positives, but this is bound to happen surely ?

Perfecting and Optimization comes soon, just trying to get things to work first :)
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Specify renaming pattern for subtitles based on TV or Movie

Post by rednoah »

Paulamonopoly wrote: 16 Jul 2023, 01:01 All my subtitles come in from the same folder, so while using -db TheMovieDB would be fantastic, it also tries to rename my TV Shows to unrelated Movies such as The Walking Dead Movie TMDb ID: 27115, so I thought I'd run TV Shows first and then Movies afterwards on the presumption that it would detect the seasons and episodes in the titles and then move on to the movies which wouldn't have seasons and episodes in the title. So far no false positives, but this is bound to happen surely ?
:arrow: If you run into mismatches, please copy & paste the console output here in the forums so we can have a look at it.


EDIT:

:!: In general, you'll want to process movies and episodes separately, specifying either --db TheMovieDB or --db TheMovieDB::TV depending on the files you are passing along:

Console Output: Select all

$ filebot -rename Alias.1x01.mp4 --db TheMovieDB::TV --format "{n} {s00e00}" --action TEST --log INFO
[TEST] from [Alias.1x01.mp4] to [Alias S01E01.mp4]
$ filebot -rename Avatar.2009.mp4 --db TheMovieDB --format "{ny}" --action TEST --log INFO
[TEST] from [Avatar.2009.mp4] to [Avatar (2009).mp4]


:!: If your files are all in the same folder, then you will have to find a solution for that first. This will be more or less easy depending on how files are named. You can use find to find files that match your specific patterns:

Console Output: Select all

$ find . -type f
./Alias.1x01.mp4
./Avatar.2009.mp4
$ find . -type f -regex '.*[0-9][xE][0-9][0-9].*'
./Alias.1x01.mp4


:idea: Alternatively, you can use the --file-filter option to include / exclude input arguments from processing using built-in heuristics:

Console Output: Select all

$ filebot -mediainfo . --format "{f.name}"
Alias.1x01.mp4
Avatar.2009.mp4
$ filebot -rename *.mp4 --file-filter 'f.episode' --db TheMovieDB::TV --format "{n} {s00e00}" -non-strict --action TEST --log INFO
[TEST] from [Alias.1x01.mp4] to [Alias S01E01.mp4]
$ filebot -rename *.mp4 --file-filter 'none{ f.episode }' --db TheMovieDB --format "{ny}" -non-strict --action TEST --log INFO
[TEST] from [Avatar.2009.mp4] to [Avatar (2009).mp4]
:arrow: Please read How do I process specific files with specific command-line options? for details and examples.



Paulamonopoly wrote: 16 Jul 2023, 01:01 Perfecting and Optimization comes soon, just trying to get things to work first :)
:idea: You'll want to use --action TEST during prototyping and testing so that you can do test runs in rapid succession without actually moving files. Also, make sure to always post the complete command and console output in the future.
:idea: Please read the FAQ and How to Request Help.
Post Reply