Mismatch between "test" and "move"

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
ping
Posts: 6
Joined: 17 Jul 2014, 11:51

Mismatch between "test" and "move"

Post by ping »

Hi,

I'm facing a problem with my little script.
When I run it in test mode the movie is well recognised but when I run it with move mode it's another movie that is detected.

It's disturbing :?
First I launch my script with --action test to check that all movies are fetched correctly and then with --action move to rename.
But it seems I can't trust the test mode :(

here is my log :

Code: Select all

[TEST] Rename [/media/EXTRACTED/MOVIESHD/wild card 2015.mkv] to [/media/DATA/MOVIESHD/Wild_Card_(2015)/Wild_Card_(2015)[AC3-fr][fr][720p-x264-HD].mkv]

[MOVE] Rename [/media/EXTRACTED/MOVIESHD/wild card 2015.mkv] to [/media/DATA/MOVIESHD/Wild,The_(2006)/Wild,The_(2006)[AC3-fr][fr][720p-x264-HD].mkv]
Is there a fix or workaround for that ?
User avatar
rednoah
The Source
Posts: 23947
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Mismatch between "test" and "move"

Post by rednoah »

--action test implies -no-xattr while --action move does not, instead it'll use existing xattr metadata that you've set last time you've renamed the file.

So --action test and --action move is the same for files that have not been processed already, but possibly not for files that have already been processed and tagged.
:idea: Please read the FAQ and How to Request Help.
ping
Posts: 6
Joined: 17 Jul 2014, 11:51

Re: Mismatch between "test" and "move"

Post by ping »

Ok, I got it.
Now I use the "rollback" function instead of moving/renaming manually the files.. :oops:

I 've an another question, :D
How do I exclude some files extension to be processed ?
My script check .URL files and sometime .rar files as well and I don't want this files, only .mkv etc.
Or, perhaps, instead of excluding some files type we can only process certain files type ?

I don't know how to do it with my script.
I've read some posts that talk about exclude or restrict files type but I don't understand how to implement it.
I found this : http://www.filebot.net/forums/viewtopic.php?f=3&t=2127
That would be perfect, but I can't find the correct syntax for "exclude files type" or "restrict files type"

Here is my script :
It's a simple bash script, it's pretty locked to my needs but I'm working on it.
It's not perfect but it work for me :)

Code: Select all

#! /bin/bash

############# 
MODE='test'  # move : effective run; test : dry run
FOLDER='all' # void;MOVIESHD;MOVIES3D;ANIMATION;CARTOONS;TVSHOWS
input='/' # root directory to scan
output='/' # root directory to move/rename
#############

# link folders to scan and db : [dir-name]='db-name'
declare -A dir_db=( [MOVIESHD]='IMDb' [MOVIES3D]='IMDb' [ANIMATION]='IMDb' [CARTOONS]='IMDb' [TVSHOWS]='thetvdb' )

# renaming scheme for movies
schemeHD="{any{'_FOLDER_SAGA/'+collection.replaceAll(/[\`´‘’?\"\"“”!?.,<<>>]/,'').sortName().replaceAll(', The',',The').replaceAll(/[|:*\s]+/,'_').ascii()+'/'}{'_FOLDER/'}}{norm={it.replaceAll(/[\`´‘’?\"\"“”!?.,<<>>]/,'').sortName().replaceAll(', The',',The').upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[|:*\s]+/,'_').replaceAll(/\b[IiVvXx]+\b/,{it.upper()}).replaceAll(/\b[0-9](?i:th|nd|rd)\b/,{it.lower()}).ascii()};find3d={it.contains('[3D-SBS]')?'[3D-SBS]':it.contains('[3D-OU]')?'[3D-OU]':''};norm(primaryTitle)}_({y})/{norm(primaryTitle)}_({y}){find3d(fn)}{'['+audios.groupBy{it.Codec}.collect{c,a->[c]+a*.Language}.flatten().join('-')+']'}{'['+texts.language.flatten().join('-')+']'}{'Part'{pi}}[{allOf{vf}{vc}{source}{sdhd} join '-'}]"

# renaming scheme for tvshows
schemeTV="{'_FOLDER/'}{norm={it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[\`´‘’?\"\"“”!?.,<<>>]/,'').replaceAll(/[:|]/,'-').replaceAll(/[|:*\s]+/,'_').replaceAll(/\b[IiVvXx]+\b/,{it.upper()}).replaceAll(/\b[0-9](?i:th|nd|rd)\b/,{it.lower()}).ascii()};norm(primaryTitle)}/{episode.special?'Special_':'Season_'+s.pad(2)}_({episodelist.findAll{it.season==s}.airdate.year[0,-1].unique().join('-')})/{norm(n)}-{episode.special?'S00E'+special.pad(2):s00e00.replaceAll(/[|:*\s]+/,'')}-{norm(t).ascii().replaceAll(/[*\s]+/,'')}{'-'+lang}{'Part'{pi}}[{allOf{vf}{vc}{source}{sdhd} join '-'}]"

# link db and scheme [db-name]=$scheme-name
declare -A db_schemes=( [IMDb]=$schemeHD [thetvdb]=$schemeTV )

while getopts a:f:i:o: option
do
        case "${option}"
        in
                a) MODE=${OPTARG};;
                f) FOLDER=${OPTARG};;
                i) input=${OPTARG};;
                o) output=${OPTARG};;
        esac
done

log=$input # directory to save logs

# scan and move/rename each folders of input to output, non-matched files will be ignored, then clean input directory
for dir in "${!dir_db[@]}";
do
    if [ "$FOLDER" == "all" ] || [ "$FOLDER" == "$dir" ] && [ "$(ls -A "$input/$dir/")" ]; then
        # change _folder in scheme
        db_schemes[${dir_db[$dir]}]=${db_schemes[${dir_db[$dir]}]//_FOLDER/$dir};
        # go filebot!
        filebot --action $MODE -rename $input/$dir/ -r -non-strict --db ${dir_db[$dir]} --log all --log-file $log/.$dir.log --conflict override --output $output/ --format "${db_schemes[${dir_db[$dir]}]}";
        # cleaner
        filebot --action $MODE -script $input/EXTRACTED/cleaner.groovy --log all --log-file $log/.$dir.log $input/$dir/;
    fi
done
User avatar
rednoah
The Source
Posts: 23947
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Mismatch between "test" and "move"

Post by rednoah »

Pretty sure .url and .rar files will be ignored if you try to match them with an movie or series database... but since you're scripting things anyway you can just not pass them.

You can pass lots of individual files via arguments instead of passing a folder if you want, that way you can select and pass whatever files you want. Akin to this: viewtopic.php?f=4&t=280#p1135
:idea: Please read the FAQ and How to Request Help.
Post Reply