Page 1 of 1

Renaming with a word search inside nfo file

Posted: 01 Feb 2024, 23:42
by screamjojo
Hello,

I've a folder with a mkv file and a nfo file. I would like to search a key word inside the nfo for renaming the mkv file.
I've found

Format: Select all

(model.any{id == it.id && it.ext == 'nfo' && it.f.text =~ /(?i)VFQ/}) {return '.VFQ'})
but it works only if the folder is the input, but if the mkv file is the input the nfo file in the same folder is not taken, can you help me ?
Thanks in advance

Re: Renaming with a word search inside nfo file

Posted: 02 Feb 2024, 08:12
by rednoah
:?: What is your test case? Please post sample file paths as text and NFO file contents so that we are prototyping your custom format with sample files that actually match your use case.


:?: (A) Maybe like this?

Code: Select all

Avatar.mkv
Avatar.nfo
:?: (B) Maybe like this?

Code: Select all

Avatar.mkv
movie.nfo
:?: (C) Maybe something else?


:?: Maybe something different (A) (B) (C) for each movie folder?

:?: Can we assume that movies are already organized into movie folders with one movie / NFO file per folder?

Re: Renaming with a word search inside nfo file

Posted: 02 Feb 2024, 09:14
by screamjojo
Hello,
Yes my path is like this :

Code: Select all

Avatar.2009.1080p.mkv
Avatar.2009.1080p.nfo
:?: Can we assume that movies are already organized into movie folders with one movie / NFO file per folder?
Yes exactly, and sometimes with a sample file.

And I only need to rename the mkv because the nfo will not move and will be delete.

Thank you for help

Re: Renaming with a word search inside nfo file

Posted: 02 Feb 2024, 10:01
by rednoah
1. Select only movie files. See How do I process only specific kinds of files? for details.

2. Rewrite file paths using the following format:

Format: Select all

{ files.any{ it.name =~ /[.]nfo$/ && it.text =~ /(?i)VFQ/ } ? '.VFQ' : null }
:idea: {files} is a built-in binding that gives you the "group by same file name" set of files. So for <name>.mkv it'll give a list of <name>.mkv and <name>.nfo from the same folder.

Re: Renaming with a word search inside nfo file

Posted: 02 Feb 2024, 11:57
by screamjojo
Thank you it works perfectly !

Re: Renaming with a word search inside nfo file

Posted: 19 Apr 2024, 17:37
by screamjojo
rednoah wrote: 02 Feb 2024, 10:01 1. Select only movie files. See How do I process only specific kinds of files? for details.

2. Rewrite file paths using the following format:

Format: Select all

{ files.any{ it.name =~ /[.]nfo$/ && it.text =~ /(?i)VFQ/ } ? '.VFQ' : null }
:idea: {files} is a built-in binding that gives you the "group by same file name" set of files. So for <name>.mkv it'll give a list of <name>.mkv and <name>.nfo from the same folder.
And if my nfo file has not the same name of my mkv file ?

Thanks in advance

Edit : Found the solution :

Format: Select all

{ folder.listFiles{ it.name =~ /[.]nfo$/ && it.text =~ /(?i)VFQ/ } ? '.VFQ' : null }