Rename subs with lang codes to {vs}{vf} without causing problems

Any questions? Need some help?
Post Reply
zhyp
Posts: 10
Joined: 12 May 2023, 00:30

Rename subs with lang codes to {vs}{vf} without causing problems

Post by zhyp »

Hello, recently I started using Radarr to manage my movies, and by some shallow research it looks like some times the quality guesses are not accurate enough if some infos are not available at the file name, like if it's Blu-ray and/or 1080p, I could do it manually, but it would be nice to have it be automatically detected.
So we come to the problem, the following format works great with video files: "{drive}/Media/{plex.id} [{vf}-{vs}]", but if I have a subtitle that is name seriessub.eng.srt, naturally it would remove the .srt and use only the seriessub.eng, causing a big problem (even overwriting some language codes along the way), resulting on something like this at the end: "seriessub.eng [1080p-BluRay].srt".
I did thinker with conditional statements, but couldn't get it to work properly without causing extra problems.
Thanks.
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename subs with lang codes to {vs}{vf} without causing problems

Post by rednoah »

Please read the {plex} format manual:
rednoah wrote: 12 Sep 2016, 10:03 e.g. Avatar (2009) by James Cameron [720p, x264, AC3].eng

Format: Select all

{ plex.derive{ " by $director" }{ " [$vf, $vc, $ac]" }.name }
:idea: plex.derive() can be used to insert additional information after the file name but before the subtitle language suffix and file extension.


e.g. copy & paste solution:

Format: Select all

{drive}/Media/{plex.id.derive{ "[$vf-$vs]" } }

e.g. better solution that accounts for the possibility of {vs} being undefined:

Format: Select all

{drive}/Media/{plex.id.derive{ allOf{vf}{vs}.joining('-', ' [', ']') } }
:idea: Please read the FAQ and How to Request Help.
zhyp
Posts: 10
Joined: 12 May 2023, 00:30

Re: Rename subs with lang codes to {vs}{vf} without causing problems

Post by zhyp »

Amazing, I did not notice that doc before, thanks for your help.
Post Reply