Help with Script for Moving and Renaming Movies

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
twitchfidelis
Posts: 6
Joined: 20 Mar 2015, 21:57

Help with Script for Moving and Renaming Movies

Post by twitchfidelis »

Hello-

I need help making a script. Here's what I need it to do. I need it to rename the movie file and folder in "C:\dtemp\movies" and then move the movie folder to "C:\transfer". Now I want to use this string to rename the files :

Code: Select all

{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)} ({y}){' CD'+pi}
If I am correct the above string should detect movies beginning with The, AN, or A and rename them like the example below:

A Nightmare on Elm Street (1984) ==> Renames to ==> Nightmare on Elm street, A (1984)

I have created a batch file for SABnzbd to run after downloading a movie with the following code:

Code: Select all

"C:\Program Files\Filebot\filebot.exe" -rename "C:\dtemp\movies" --format "{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)} ({y})/{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)} ({y}){' CD'+pi}" --output "C:\transfer"
This kind of works. It does rename the folder, but not the file and it duplicates the folder.

So I end up with C:\transfer\Nightmare on Elm Street, A (1984)\Nightmare on Elm Street, A (1984)\Nightmare on Elm Street, A (1984).mkv

Instead of C:\transfer\Nightmare on Elm Street, A (1984)\Nightmare on Elm Street, A (1984).mkv


Any suggestions on how to fix this?
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help with Script for Moving and Renaming Movies

Post by rednoah »

:idea: Please read the FAQ and How to Request Help.
twitchfidelis
Posts: 6
Joined: 20 Mar 2015, 21:57

Re: Help with Script for Moving and Renaming Movies

Post by twitchfidelis »

I added --log-file amr.log and this is what it is in the log:

Filename pattern: [NaN] SxE, [NaN] CWS
Rename movies using [TheMovieDB]
Auto-detect movie from context: [C:\dtemp\movies\A Nightmare on Elm Street 1984]
[MOVE] Rename [C:\dtemp\movies\A Nightmare on Elm Street 1984] to [C:\transfer\Nightmare on Elm Street, A (1984)\Nightmare on Elm Street, A (1984)]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
twitchfidelis
Posts: 6
Joined: 20 Mar 2015, 21:57

Re: Help with Script for Moving and Renaming Movies

Post by twitchfidelis »

Here is the output of the System Info Script

Code: Select all

C:\Users\media>"C:\Users\media\Documents\Sabnzbd Scripts\sysinfo.bat"

C:\Users\media>"C:\Program Files\Filebot\filebot.exe" -script fn:sysinfo
Java HotSpot(TM) Client VM warning: TieredCompilation is disabled in this releas
e.
FileBot 4.5.6 (r2818)
JNA Native: 4.0.0
MediaInfo: java.lang.UnsatisfiedLinkError: Unable to load library 'mediainfo': N
ative library (win32-x86/mediainfo.dll) not found in resource path ([file:/C:/Pr
ogram%20Files/FileBot/FileBot.jar])
Mar 23, 2015 8:31:12 AM net.filebot.archive.SevenZipLoader requireNativeLibrarie
s
WARNING: Failed to preload library: java.lang.UnsatisfiedLinkError: no mingwm10
in java.library.path
7-Zip-JBinding: net.sf.sevenzipjbinding.SevenZipNativeInitializationException: F
ailed to load 7z-JBinding: C:\Program Files\FileBot\7-Zip-JBinding.dll: Can't lo
ad AMD 64-bit .dll on a IA 32-bit platform
chromaprint-tools: fpcalc version 1.1.0 (C:\Program Files\Filebot\fpcalc.exe)
Extended Attributes: OK
Groovy Engine: 2.3.9
JRE: Java(TM) SE Runtime Environment 1.8.0_40
JVM: 32-bit Java HotSpot(TM) Client VM
CPU/MEM: 8 Core / 247 MB Max Memory / 12 MB Used Memory
OS: Windows 7 (x86)
Done ?(?????)?
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help with Script for Moving and Renaming Movies

Post by rednoah »

1.
What's inside the "A Nightmare on Elm Street 1984" folder? Why would FileBot think that it's some sort of Disk folder? Are you sure there's only a *.mkv file in that folder?

Folders are considered "disk folders", folders that will be processed as a single unit, if one of the entries matches the following:

Code: Select all

BDMV|HVDVD_TS|VIDEO_TS|AUDIO_TS|VCD|MovieObject.bdmv|VIDEO_TS.VOB
The log should look like this:

Code: Select all

Filename pattern: [0.00] SxE, [0.00] CWS
Rename movies using [TheMovieDB]
Auto-detect movie from context: [/Users/reinhard/Test/AMC-TEST/A Nightmare on Elm Street 1984/A Nightmare on Elm Street 1984.mkv]
[MOVE] Rename [**/A Nightmare on Elm Street 1984/A Nightmare on Elm Street 1984.mkv] to [**/A Nightmare on Elm Street (1984).mkv]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ

2.
Unrelated but... Use 64-bit Java on 64-bit Windows.
:idea: Please read the FAQ and How to Request Help.
twitchfidelis
Posts: 6
Joined: 20 Mar 2015, 21:57

Re: Help with Script for Moving and Renaming Movies

Post by twitchfidelis »

I don't know why Filebot thinks it's a "Disk Folder" or even how to check for that. The movie is an mkv file inside a single folder. I want both the folder and the mkv to be renamed, however, as of now it does not rename the mkv file but renames the existing folder and then creates a new folder also with the correct name and finally put s the mkv file in the newly created folder. I did uninstall 32 bit Java and installed 64 bit.

So instead of my folder structre looking like this:

C:\transfer\Nightmare on Elm Street, A (1984)\Nightmare on Elm Street, A (1984).mkv

I get:

C:\transfer\Nightmare on Elm Street, A (1984)\Nightmare on Elm Street, A (1984)\A Nightmare on Elm Street (1984).mkv
twitchfidelis
Posts: 6
Joined: 20 Mar 2015, 21:57

Re: Help with Script for Moving and Renaming Movies

Post by twitchfidelis »

Can you tell me what a "Disk Folder" is so I can see if that's my issue? I really like Filebot and it seems to be the perfect software for my needs if I can just figure out this one bug. The folders I am testing with only contain an MKV file, and nothing else.
User avatar
rednoah
The Source
Posts: 23950
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help with Script for Moving and Renaming Movies

Post by rednoah »

1.
Folders are considered "disk folders", folders that will be processed as a single unit, if one of the entries matches the following:

Code: Select all

BDMV|HVDVD_TS|VIDEO_TS|AUDIO_TS|VCD|MovieObject.bdmv|VIDEO_TS.VOB
2.
Have you tried the -r recursive flag?
:idea: Please read the FAQ and How to Request Help.
twitchfidelis
Posts: 6
Joined: 20 Mar 2015, 21:57

Re: Help with Script for Moving and Renaming Movies

Post by twitchfidelis »

Thank you adding the -r fixed to renaming issue. However now it leaves an empty folder behind in dtemp that was not renamed. Is there a way to automatically delete this? I think the cleaner script may do the trick but I don't know how to call multiple scripts in a single batch file.

The code for my current batch file:

Code: Select all

"C:\Program Files\Filebot\filebot.exe" -rename "C:\dtemp\movies" --format "{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)} ({y})/{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)} ({y}){' CD'+pi}" --output "C:\transfer\Movies" -non-strict -r --log-file amr.log
Post Reply