Post Reply 
Missing files --> Error: couldn't access file (with special characters) [SOLVED]
02-06-2016, 19:25 (This post was last modified: 02-06-2016 19:28 by MikeL.)
Post: #7
RE: Missing files --> Error: couldn't access file (with special characters) [SOLVED]
Funny how problems multiply! I downloaded a couple of new flacs and could not understand why they were not indexing. Investigating led here: then I discovered that there were more than a hundred tracks failing that I had never noticed were missing. I think that the problem in my case leads back to unpredictable characters coming from cddb which I use to make the filenames.

Anyway, I wrote a little script to parse the log file and make the fixes. Here it is if anyone else wants it. It basically wraps convmv and uchardet (widely available).

Code:
#!/bin/bash
# uncomment or define on command line to make it happen
#DOIT="--notest"
LOG=/mnt/terabyte/music/utils/minimserver/data/minimserver.log

IFS=$'\n'

# convert all file names to UTF8 that appear as an error in log
#   File name as it appears in log is altered by error char
#     so make a stub /a/path/to/nn-* then get the real name
#     by eval'ing an ls on it.
#     Assumes that all files start with /nn-

for  i in $(awk '/access file/{print $5 }' $LOG);do
    STUMP=$(echo $i|sed 's/\(\/[0-9]\+[-_]\).*/\1*/')
    FILE=$(eval "ls $STUMP")
    FROM=$(echo $FILE|uchardet)
    echo $FROM
    if [[ -f $FILE ]]; then
        convmv -f $FROM -t UTF8 $FILE $DOIT
    fi
done

Obviously the LOG path needs to match the target system. Either uncomment #DOIT in the script or provide it on the command line change talk into action
Code:
chmod 777 ./fixnames.sh
DOIT=--notest ./fixname.sh
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Missing files --> Error: couldn't access file (with special characters) [SOLVED] - MikeL - 02-06-2016 19:25

Forum Jump:


User(s) browsing this thread: 1 Guest(s)