PDA

View Full Version : Squeezecenter: Artwork Folder (artwork not showing)



laohu
2008-08-28, 12:48
Hi all,

I'm trying to accomplish the following: copy all artwork to a single folder in the ALBUM - ARTIST.jpg (or .png) format. Under the advanced settings I've filled in the first field as follows: %ALBUM - ARTIST. The second field points to the artwork folder.

Unfortunately, if I browse through my FLAC files, not artwork is displayed. Please help me out. Thanks.

radish
2008-08-28, 16:50
It should probably be "%ALBUM - %ARTIST" (note the extra %). If that fixes it you might want to file a bug to get the help popup fixed.

laohu
2008-08-29, 10:07
It should probably be "%ALBUM - %ARTIST" (note the extra %). If that fixes it you might want to file a bug to get the help popup fixed.

That's odd. I changed the format like you suggested. Artwork is still not showing up. I manually copied 3 .jpg files (in the ALBUM - NAME.jpg format) and rescanned my library: still no results. Is anyone else having this problem? Do I really have to rename each file to cover.jpg before this can work?

radish
2008-08-29, 17:41
Did you try putting the files in the same directories as the music? It will default to looking there if all else fails, maybe the filename is OK but for some reason it can't read the directory you have set for artwork? \

Did you check the logs for any errors?

laohu
2008-08-30, 01:43
Yes, and that does not help either. It appears squeezecenter does not recognize album art which is not in the cover.jpg etc. formats. I receive the following message if I click on the empty album art picture: http://localhost:9000/music//cover.jpg

I renamed a few files to cover.jpg and those are displayed as expected. What should I do? Rename all files an manually copy them to the correct folders (lot of work)?

wilgartw
2008-08-30, 15:46
are you using windows or linux?

if linux you can do this very quickly. let me know and i'll write a script.

if windows, how big are all your jpgs?

laohu
2008-08-31, 01:55
Thx. I'm on a Mac. The renaming part is probably not so much the problem since there are tools which can take care of that. The copying to the correct folders will take most time I guess.

wilgartw
2008-08-31, 02:42
if you can zip them up, and put them on an ftp share, i can write a script to put them into a self extracting zip. it shouldn't take more than 5 mins.

wilgartw
2008-08-31, 02:46
in fact, for anyone else... the script would be something like this (not tested it yet)

for file in *.jpg
do
ARTIST=${file#.*-}
ALBUM=${file%-.*}
mkdir $ARTIST
mkdir $ARTIST/$ALBUM
mv $file $ARTIST/$ALBUM/cover.jpg
done

laohu
2008-08-31, 09:03
I'm not too familiar with scripts. Should I use the terminal to execute the script?

My album art folder is called "album art" and is located in "/Users/Myusername/Pictures/". Each file is name album - artist.jpg or album - artist.png

My Flacs are located in a folder called "Flac" and is located in "/Users/Myusername/Music/" From there on, the structure is "Artist name\Album Name (year)\Artist - Album (year).cue and Artist - Album (year).flac

I now notice that the jpg/png files are not in the same format as the flac files (i.e. album - artist.jpg vs. Artist - Album (year).flac).

Could this be the source of the problem? Can this be remedied by adjusting the naming schedule in squeezecenter? The reason behind the different naming scheme is that I exported the jpg/png files via Dougs Applescript http://dougscripts.com/itunes/scripts/ss.php?sp=savealbumart

wilgartw
2008-08-31, 11:34
i am unsure how scripting works on macs. the above script is for a linux box. macs will probably have an equivalent.

how many do you have and what's the average size. as said previously. if you can upload them somewhere i can produce a selfextracting zip that will put them in the right directories.

wilgartw
2008-08-31, 11:37
actually, just read this
http://developer.apple.com/internet/opensource/opensourcescripting.html

and it looks like you can use any shell scripting.

let me just tweak the above script to your requirements and test it.

give me 5 mins.

wilgartw
2008-08-31, 11:57
quick question, do the filenames have spaces either side of the dash?

laohu
2008-08-31, 12:01
Yes they do. E.g. "Antics - Interpol.png". I will PM the link to the uploaded file (a zip-file with approx. 700 files, 250kb average). Thanks a lot for your help!

laohu
2008-08-31, 12:05
Yes they do. E.g. "Antics - Interpol.png". I will PM the link to the uploaded file (a zip-file with approx. 700 files, 250kb average). Thanks a lot for your help!

By the way (don't know if this is relevant): not all files contained in the zip-file have corresponding Flac files. My Flac collection is actually a sub-set of my MP3 collection. Each Flac (single file with cue sheet) is also available as MP3

wilgartw
2008-08-31, 12:15
here is the script, tested on my system

for file in *jpg
do
ARTIST1=${file#*- }
ARTIST=${ARTIST1%.*}
ALBUM=${file% -*}
echo "###"$ARTIST/$ALBUM
if [[ -d ../$ARTIST/$ALBUM/ ]]
then
mv "$file" ../$ARTIST/$ALBUM/cover.jpg
else
echo $file" could not be moved" >> error.log
fi

done

just open up the terminal as instructed in the link above, the shell is /bin/bash
cd to your pictures directory, then copy and paste each line by line into the terminal. it should work. it may be wise to make a copy of your directory first ;)

laohu
2008-08-31, 12:34
Thank you! Just to be sure, do I have to fill in certain variables (e.g. folder locations?). As you may know, my FLAC files are in a different folder then my cover art files (see my previous post). If I understand correctly, this script will rename the file cover.jpg and move it to the proper Flac sub-folder?

wilgartw
2008-08-31, 12:47
oops spotted an error..

for file in *jpg
do
ARTIST1=${file#*- }
ARTIST=${ARTIST1%.*}
ALBUM=${file% -*}
echo "###"$ARTIST/$ALBUM
if [[ -d ../Music/$ARTIST/$ALBUM/ ]]
then
mv "$file" ../Music/$ARTIST/$ALBUM/cover.jpg
else
echo $file" could not be moved" >> error.log
fi
done


if you run this script whilst in the "/Users/Myusername/Pictures/" directory

it will take a file called "1999 - Prince.jpg" and move it to
"/Users/Myusername/Music/Prince/1999" and rename it to cover.jpg

if "/Users/Myusername/Music/Prince/1999/" does not exist it will create a line in error.log and leave the file where it is.

if you wanted to test it with just a small set of files change the first line to (for eg) for file in 1999*jpg

laohu
2008-08-31, 12:55
if you run this script whilst in the "/Users/Myusername/Pictures/" directory

it will take a file called "1999 - Prince.jpg" and move it to
"/Users/Myusername/Music/Prince/1999" and rename it to cover.jpg

if "/Users/Myusername/Music/Prince/1999/" does not exist it will create a line in error.log and leave the file where it is.

if you wanted to test it with just a small set of files change the first line to (for eg) for file in 1999*jpg

This looks good. In your example it should move the file to "/Users/Myusername/Music/Flac/Prince/1999 (year of album release)"

Will this work?

wilgartw
2008-08-31, 12:57
edit: ignore and see next post ..

wilgartw
2008-08-31, 12:59
quick rundown of the script line by line

1 select the files to loop through
2 starts the loop
3 ignores everything before the dash
4 ignores after the dot (.jpg)
5 ignores after the dash for the album
6 prints the file details to screen
7 checks if directory exists
8 then
9 moves and renames
10 else
11 writes to error.log
12 finishes the if statement
13 finishes (restarts) the loop

wilgartw
2008-08-31, 13:00
This looks good. In your example it should move the file to "/Users/Myusername/Music/Flac/Prince/1999 (year of album release)"

Will this work?

sorry bad example 1999 is the album name, not the year of release (that'd be 1983 from memory)

wilgartw
2008-08-31, 13:02
to add the "flac" directory in, just change lines 7 and 9
to ../Music/Flac/$ARTIST/$ALBUM

laohu
2008-08-31, 13:05
sorry bad example 1999 is the album name, not the year of release (that'd be 1983 from memory)

Sorry for the misunderstanding. My files are folder structure is: "/Users/Myusername/Music/Blur/Parklife (1994)". Please note the year of release after the foldername.

wilgartw
2008-08-31, 13:11
ah, well that makes it quite difficult as you don't have the year in the pictures folder anywhere (perhaps this is your issue as to why it doesn't show...)

laohu
2008-08-31, 13:21
That's a shame. I will see if I can find a solution for the name of the album folder. In any event, thanks a lot for your help. Really appreciate it!

wilgartw
2008-08-31, 13:51
here you go, this should work

for file in *jpg
do
ARTIST1=${file#*- }
ARTIST=${ARTIST1%.*}
ALBUM=${file% -*}
NEWDIR=`ls -d "../Music/Flac/$ARTIST/$ALBUM"*`
if [[ -d "$NEWDIR" ]]
then
mv "$file" "$NEWDIR""/cover.jpg"
fi
done

laohu
2008-08-31, 14:20
I ran the script and I receive a lot of error messages. In fact, no files have been moved. For example:

ls: ../Music/Flac/Common/Be*: No such file or directory
ls: ../Music/Flac/U2/Pop*: No such file or directory
ls: ../Music/Flac/Blur/The Best Of*: No such file or directory

The folder Users/Myusername/Pictures/Albumart does contain a file called "Pop - U2.jpg". It should be renamed/moved to the folder "/Users/Myusername/Music/Flac/U2/Pop (1997)" but is hasn't.

wilgartw
2008-08-31, 14:21
test it first by changing the first line to
for file in Parklife*jpg

or any other album name.

issues i can forsee ...
where you have two dashes in a name.
where the album name in your music directory is called "whatever (disc 2) year" .. but i think that should be ok.

wilgartw
2008-08-31, 14:27
just to check.

your working directory the ones with the jpgs in is
Users/Myusername/Pictures/
not
Users/Myusername/Pictures/AlbumArt

if it is the latter you need to chamnge the line to read

NEWDIR=`ls -d "../../Music/Flac/$ARTIST/$ALBUM"*`

laohu
2008-08-31, 14:38
It is. The file "Zooropa - U2.jpg" is located in Users/Myusername/Pictures/AlbumArt. I changed the 6th line to NEWDIR=`ls -d "../../Music/Flac/$ARTIST/$ALBUM"*`

However, I still get the following error: ls: ../Music/Flac/U2/Zooropa*: No such file or directory

wilgartw
2008-08-31, 15:47
that should work. what happens if you just type
ls -d "../../Music/Flac/$ARTIST/$ALBUM"*


if that errors try putting in the full path
eg
ls -d "/Users/Myusername/Music/Flac/$ARTIST/$ALBUM"*

wilgartw
2008-08-31, 16:34
note if it is like unix, it is also case sensitive throughout

laohu
2008-08-31, 23:48
That worked! (typing in NEWDIR=ls -d "../../Music/Flac/$ARTIST/$ALBUM"*). All folders are listed. I think I typed in 'NEWDIR=ls -d "../../Music/Flac/$ARTIST/$ALBUM"*' the first time (with single quotes).
Strange thing is, however, that if I try to repeat it the next morning, I receive the error -bash: -d: command not found. I assume this has something to do with the /bin/bash path? See however http://www.freeimagehosting.net/uploads/250f307518.png (http://www.freeimagehosting.net/)

wilgartw
2008-09-01, 01:08
it is very impotant where the quotes are, and what type of quotes are used.

NEWDIR=`ls -d "../../Music/Flac/$ARTIST/$ALBUM"*`


note the single quotes. they are backwards, it is the one above the tab key. this single quote says "execute the command, and use the output"

the double quotes tell the "ls" command that the filename is all one file/dir ie allow spaces once $ARTIST has been inetrpreted.

the ls -d says print the name of the directory. and the * says complete the name of the album (ie add in the year).

hope you get this working, you are very close.

unfortunately i cannot access this forum from work. but i will log on again this evening

wilgartw
2008-09-01, 10:28
did this work?

to recap:

for file in *jpg
do
ARTIST1=${file#*- }
ARTIST=${ARTIST1%.*}
ALBUM=${file% -*}
NEWDIR=`ls -d "../../Music/Flac/$ARTIST/$ALBUM"*`
if [[ -d "$NEWDIR" ]]
then
mv "$file" "$NEWDIR""/cover.jpg"
fi
done

laohu
2008-09-01, 12:07
Hi! It worked! All my .jpg and .png are moved to the correct folders. This is great. Thanks for your help and all the best!