File Rename Tagging the not found ones

View previous topic View next topic Go down

File Rename Tagging the not found ones

Post  shadowcharly on Sun Feb 23, 2014 4:43 am

Hi,

I recently managed to get my head around a combination of comictagger, bash script and launchd daemon that automagically tags my comics when left on a certain folder. But found a problem when the comic is not yet recogniced and can't be correctly tagged/renamed.

Would it be possible to add an option like "--tag-failures" that simply added a prefix/suffix to the comic file so it's easier to know when a tagging run left some of them untagged?

Example:

somecomic.cbr

ComicTagger -s -t cbl -o -f somecomic.cbr

Comic processed, let's rename it

ComicTagger -r --tag-failures comecomic.cbr

if the tagging was successfull the resulting file would be
somecomic #001 (2014).cbr

If failed to tag, the resulting file would be:
FAIL_somecomic.cbr

or

somecomic -FAIL.cbr

or even a selectable suffix/prefix like the -t option

Is it possible?

shadowcharly

Posts : 3
Join date : 2014-02-12

View user profile

Back to top Go down

Re: File Rename Tagging the not found ones

Post  ComicTagger on Sun Feb 23, 2014 8:39 pm

You can use a little shell scripting to accomplish this using the exisiting ComicTagger options.

Code:
comictagger.py -p --terse *

will give you a list of one-line summaries of page counts and tag types in each comic.  (Use the '-R'  option to recursively scan all sub-folders)

Code:
comictagger.py -p --terse * |grep "\[ none \]"|cut -f1 -d:

will give a list of all comic files that don't have tags.

We can put this into a shell script to get what you want:

Code:

#!/bin/bash

# A small script to rename untagged comic files

COMICTAGGER="/Applications/ComicTagger.app/Contents/MacOS/ComicTagger"

# Set the field separator to new line
IFS=$'\n'

# get a list of untagged comics  
# (Use the '-R'  option to recursively scan all sub-folders)
UNTAGGED=`$COMICTAGGER -p --terse * |grep "\[ none \]"|cut -f1 -d:`

for i in $UNTAGGED
do
    if [[ $i == *\(UNTAGGED\)* ]]
    then
        echo "$i: No need to rename";
    else
        NEWNAME="${i%.*} (UNTAGGED).${i##*.}"
        mv $i $NEWNAME
        echo "\"$i\": renamed to " \"$NEWNAME\"
    fi

done
avatar
ComicTagger
Admin

Posts : 208
Join date : 2012-12-02

View user profile http://comictagger.forumotion.com

Back to top Go down

Yay!

Post  shadowcharly on Mon Feb 24, 2014 1:29 pm

Thank you very much!

Combined with a nice
UNTAGGED=`find $WORKDIR -name "*\(UNTAGGED\)*" -print`

And some mumbo jumbo, i can now determine if all the comics were successfully tagged and move them accordingly to their destination folder.

Didn't knew about the -p --terse option, you have it thoroughly thought about Wink

Very nice tool, hoping the comic vine database comes back from the abyss soon.

shadowcharly

Posts : 3
Join date : 2014-02-12

View user profile

Back to top Go down

Re: File Rename Tagging the not found ones

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum