Open iconoclasthero opened 6 months ago
The unary operator error is related to the definition of the config file. I can get rid of it by hard coding the default.cfg file ca. line 473:
InstructionFile="/home/user/.config/mpdq/default.cfg"
$ head /cache/mpdq.errors
!4566 bvargo@gigabyte$ cat /cache/mpdq.error |more
/home/bvargo/.config/mpdq/default.cfg
Loading instruction file commands
sed: -e expression #1, char 0: no previous regular expression
Adding 1:
Adding 1:(Ninguno)
Adding 1:2-Step, Downtempo, Electronic, Future Garage, House; Electronic Music; Electronica
Adding 1:A Capella Pop
Adding 1:A Cappella
Adding 1:A Cappella; Country Blues, Folk; Gospel Music
Adding 1:A Cappella; Western Classical Music
Adding 1:AOR Classic Rock
Adding 1:Acid House, Alternative Rock, Downtempo, Dub, Dub Techno; Alternative Rock
Adding 1:Acid House, Alternative Rock, Downtempo, Dub, Pop; Alternative Rock
Adding 1:Acid House, Alternative Rock, Downtempo, Dub, Rock; Alternative Rock; Pop Music
Adding 1:Acid House, Alternative Rock, Electronic, House, Rock; Alternative Rock
Adding 1:Acid House, Alternative Rock, Electronic, Pop, Rock; Alternative Rock
Adding 1:Acid House, Alternative Rock, Indie Rock, Psychedelic Rock, Rock; Alternative Rock
Adding 1:Acid House, Garage Rock, Indie Rock, Pop Rock, Rock; Alternative Rock
Adding 1:Acid House; Acid House, Alternative Rock, Electronic, House, Rock; Alternative Dance; Alternativ
e Rock; Dance-Rock; Electronica; House Music; Indie Pop; Neo-Psychedelia; Psychedelic Rock
Adding 1:Acid House; Acid House, Electronic, Experimental, House, Rock; Alternative Dance; Alternative Ro
ck; Dance-Rock; Electronica; House Music; Indie Pop; Neo-Psychedelia; Psychedelic Rock
Adding 1:Acid House; Acid House, Electronic, House, Rock; Alternative Dance; Alternative Rock; Dance-Rock
; Electronica; House Music; Indie Pop; Neo-Psychedelia; Psychedelic Rock
Here's what the change looks like in context, I subbed in $HOME. The last line below is where your unary operator error is coming from which means that the instruction file is not being read to the CurrWeight or DefaultPriority isn't being set or...
$ cat mpdq2 |head -500|tail -35
if [ ! -f "${InstructionFile}" ];then
if [ -f "${ConfigDir}/default.cfg" ];then
InstructionFile="${ConfigDir}/default.cfg"
fi
fi
InstructionFile="/home/bvargo/.config/mpdq/default.cfg"
echo "$InstructionFile"
if [ -f "${InstructionFile}" ];then
DefaultPriority=$(${grep_bin} -e "Default=" "${InstructionFile}" | cut -d = -f 2-)
fi
loud "Loading instruction file commands"
# go through list of genres from mpc/mpd
while read -r line; do
# is it in our instruction file?
CG="${line}"
InInstruction=$(sed -n /"${CG}"/p "${InstructionFile}" "${InstructionFile}" | wc -l)
if [ ${InInstruction} -eq 0 ];then
# if not, weight=default
CurrWeight=${DefaultPriority}
else
# if so, weight=value from instruction file
CurrWeight=$(sed -n /^"${CG}="/p "${InstructionFile}" | cut -d = -f 2-)
fi
i=1
# adds genre name to the array a number of times equal to the weight, so the RNG
# has more of a chance to select it.
loud "Adding ${CurrWeight}:${CG}"
while [ $i -le $CurrWeight ];do
Beyond the issues above, I have some questions to which I have not found sufficient answers to in the documentation or blog posts. Namely:
1) It appears that mpdq reads through my entire library every time it runs? Can this be cached?
2) When I look at the loud output, what is going on here where it terminates?
Search run 33 of 2475
Examining Rock / Pop
sed: -e expression #1, char 10: extra characters after command
sed: -e expression #1, char 10: extra characters after command
Default 1 :: Played 0 :: Weight 1
Adding song from Mark Knopfler by Mark Knopfler in the Rock / Pop genre.
Aside from the sed issues addressed before, it appears that it is supposed to run 2500 iterations and stops after 33 without any explanation. I can assume that is because of the queue size?
3) For better or worse, my genres were set by Picard from MBDB info (and thus should be rather standardized for parsing) the last time tags were written. I'm looking at the following and simply cannot figure out what this is actually saying... Does this mean that the genres aren't parsed by ,
or ;
? What good does it do me to have categories such as:
⋮
Funk; Funk, Gospel, Jam Band, Sacred Steel, Soul=1
Funk; Funk, Gospel, Jam Band, Sacred Steel, Soul; Southern Rock=1
Funk; Funk, Jam Band=1
Funk; Funk, Pop, R&B, Soul; Pop Rock; Psychedelic Soul; Rhythm And Blues; Rock Music; Soul Music=1
Funk; Funk, Psychedelic Soul, R&B, Soul; Pop Rock; Psychedelic Soul; Rhythm And Blues; Rock Music; Soul Music=1
Funk; Funk, Psychedelic Soul, Soul; Pop Rock; Psychedelic Soul; Rhythm And Blues; Rock Music; Soul Music=1
Funk; Funk, R&B, Soul; Jazz; Rock Music; Soul Music=1
Funk; Funk, R&B, Soul; Soul Music=1
Funk; Funk, Soul=1
⋮
While we're at it, how about a flag to include what file was just cataloged in that --loud output?
Edit: That comes from mpc list genre
? I guess not.
I got the list of genres down
$ cat /cache/genres.txt |sort|uniq|wc -l ; ./genres; cat ./genres
2475
593
#!/bin/bash
[[ ! -f /cache/genres.txt ]] && mpc list genre > /cache/genres.txt
rm /cache/split.txt
exec 3<> /cache/genres.txt
while read -r line
do
i="$line"
sed 's/[;,] /\n/g' <<< "$i" >> /cache/split.txt
done <&3
cat /cache/split.txt|sort|uniq|wc -l