I am running out of ideas (and sources of ideas) on this one. I am getting a file-path from Audacious, and trying to get album art from the directory referenced. The info provided is correct, and works in terminal.
Things I have tried:
Redirected variable to a file, and looked with hexedit for odd characters.
Checked script for odd characters the same way.
Executed the script with /bin/bash directly.
Made a new script with only the non-functional code.
Because the path returned is relative [~/Music/Eagles/Desperado] have tried it as [/home/freebird/Music/Eagles/Desperado].
Because [Music] is a soft link to another drive have tried it as [/mnt/data/Music/Eagles/Desperado]
Have been using the Eagles because I didn't want to deal with [~/Music/Alice Cooper/School's Out] until I had the simpler case working!
IT does not have any CR's or other extraneous characters from editing on Windows or elsewhere - haven't used Windows for anything but Freecell and Spider Solitaire since 2007.
Nothing so far can resolve the resulting path into usability from inside the script, ALL work from the terminal (including cd).
Here is the actual error message from a recent try:
freebird@nest:~$ ~/check.sh
/home/freebird/check.sh: line 8: cd: ~/Music/Eagles/Desperado: No such file or directory
Any further suspects for me?
Here is the check script for testing:
#!/bin/bash
file_path=`audtool --current-song-tuple-data file-path`
echo > test2 ${file_path}
#${file-path}="/mnt/data/""${file_path:2}"
echo > testpath ${file_path}
cd "${file_path}"
#cd -P "${file-path}"
pwd
exit 1
if [[ ! -e "folder.jpg" ]]; # if no art work found
then
cp ~/Work/headphone.png /tmp/cover.png # put in placeholder
echo "Placeholder"
else
convert "${file_path}""/folder.jpg" -resize 120x120 /tmp/cover.png # ready for showing
echo "found cover"
fi
It contains various 'test' additions still, the equivalent of scattered printf() to see what's going on :)
new version of testing script:
#!/bin/bash
file_path=`audtool --current-song-tuple-data file-path`
file_path=$(eval echo $file_path)
echo > test2 ${file_path}
${file-path}="$HOME"${file_path:1}
echo > testpath ${file_path}
cd ${file-path}
#cd -P "${file-path}"
pwd
exit 1
if [[ ! -e "folder.jpg" ]]; # if no art work found
then
cp ~/Work/headphone.png /tmp/cover.png # put in placeholder
echo "Placeholder"
else
convert "${file_path}""/folder.jpg" -resize 120x120 /tmp/cover.png # ready for showing
echo "found cover"
fi
New error messages:
freebird@nest:~$ ~/check.sh
/home/freebird/check.sh: line 5: path=/home/freebirdhome/freebird/Music/Eagles/Desperado: No such file or directory
/home/freebird/check.sh: line 7: cd: path: No such file or directory
/home/freebird
freebird@nest:~$
I am assuming the
audtool --current-song-tuple-data file-path
command returns a string which starts with~
. You have to expand this string so that the~
character will be replaced with your home folder. One method is this:Please, insert the above statement just after the line running
audtool ...
.Also, delete line 5
it is of no use. Replace
file-path
withfile_path
in thecd
statement.