Program to recursively find images and rename to "cover.jpg"
As the title suggests, I'm looking for a simple way to rename all the album art that has accumulated in my music folders over the years. I've used multiple music players in a never ending quest to find the perfect audio player, consequently ending up with a bazillion different jpg's and png's in my music sub-folders (due to stupid automatic cover downloading plugins) with ridiculously long names, such as:
Code:
Accept_-_Metal_Masters-front.jpg What I want to do here is
Ideally I envision a graphical interface that will find the files and display them to me, allowing me to then perform one of the actions I listed above. Does such a program exist? The closest thing that I've ever seen to this is a program written for Windows called Album Art Downloader. It is an awesome program and runs in wine, but sometimes gives me weird results. Is there a native Linux program similar? Many thanks. **A caveat here is now I'm using xmms2 with xmms2tray, which uses dbus to display album art in the pop-ups. Every one of my albums has art, yet for some reason hardly any of it displays in the pop-up. Anyone know what the filename is that xmms2tray is looking for? |
I have no idea about a GUI application. But from the command line it is quite easy, with "find".
Code:
# find . -name ".jpg" -exec mv {} cover.jpg \; Alternatively you could replace "-exec mv {} cover.jpg \;" with -delete, to remove them completely. |
That sounds like it will work. Do you know if I could use the rename command rather than delete? I'll probably just use delete and start from scratch as it will less painful, but for future reference?
|
Quote:
|
Quote:
Code:
find . -name '*.jpg' -execdir echo mv {} cover.jpg \; |
Thanks for the tip about -execdir and echo. I wasn't familiar with that. I've got so much multiple art though I think I'm just going to delete it and start fresh. What a pain. How would I use echo with delete?
|
Quote:
Code:
find . -name '*.jpg' -exec echo rm '{}' \; |
Quote:
Code:
{} Experimenting: Code:
c@CW8:~$ echo {} |
Quote:
|
Also, use "-iname" instead of "-name" in you want to match case insensitively (*.jpg and *.JPG are different files in linux).
Use the following to find both *.jpg and *.png in one go. Quote:
|
I can understand wanting to remove 'excess' artwork......but why would you want them named 'folder.***' or 'cover.***'? Seems a bad idea to have 10s, 100s or 1000s or files with the same name, even if they are in different folders. I know some media players require 'cover.***' or 'folder.***' but that has always struck me as silly....and the media players I use with album art display dont have requirements like that.
I have no idea why xmms2tray wont display most of your album art. Try checking the art it will display, there are a few possibilities (like it gets the 1st pic file it finds, and tries to display it, but wont display images over 200x200, or wont display images that arent .jpeg, etc..). It might even be that it is only displaying artwork embedded into the tags.... |
Quote:
|
Quote:
Anyone know if exfalso do batch art embedding? (or any other program for that matter) |
Well, I'm not too familiar with python, but i think I've found the relevant portion of code handling album art. Can anyone clarify what I'm looking at here? (HAVE_IMAGING is set to true as long as python imaging library is found, which it is in this case) Looks to me like it wants a 64x64 image and will resize to this if the original image is larger. This could be my problem because all my art is MINIMUM 500x500. Any thoughts?
Code:
def newsong(self,res): |
Well I did some more digging and found that it is only reading embedded art from the ID3 tags. That really blows. Guess I'll get started embedding one song at a time....:rolleyes:
|
OK so I was looking into how I could possibly do this through the command line when I stumbled across a little program called eyeD3. I can use it to embed album art from the command line fairly easy. All I have to do first is remove all but one image from each directory in my Music folder hierarchy. Then I'll use find in conjunction with rename (the Debian perl rename) to rename any remaining images to cover.jpg (simply to have one standard name to feed to eyeD3 later). My problem now is, I can't get the syntax right on the perl regular expressions to rename any file ending in ".jpg" to "cover.jpg". This is as close as I've come:
Code:
find ~/Music -type f -iname "*.jpg" -exec rename 's/*.jpg/cover.jpg/' \; |
I'm over-complicating things here. I just really got stuck trying to figure out how to use this damn rename command.
Code:
find . -name '*.jpg' -execdir mv {} cover.jpg \; |
Quote:
I'm fairly sure that what happening is simply that the exact string {} has no special meaning to the shell. Since it doesn't correspond to any defined syntax, it gets passed on as a literal value to the command. It's similar in this way to what happens when you have a globbing pattern that doesn't match anything. I would personally still go ahead and quote it anyway, if only to not have bash waste a cycle attempting to parse it for meaning first. As for this: Code:
echo { echo foo > /dev/null } So all the elements are read as individual literal strings, except for > /dev/null, which is a redirection. It doesn't particularly matter where on a line you put redirections, other than that they get associated with the correct command; they are always evaluated and set up first, and removed from the command list before the rest of the line is processed. That's why you're getting no output. To demonstrate, take out the redirect, and you get this: Code:
$ echo { echo foo } |
David,
Thanks for that explanation. Makes sense. ---------- Post added 04-06-12 at 01:42 PM ---------- David, Thanks for that explanation. Makes sense. |
Wow quick reply is now giving me problems as well as not being able to edit previous posts. Anyone else experiencing issues with these forums? May just be my version of chromium.
|
Quote:
That makes sense (what was I thinking of :redface:?!). Another demonstration: Code:
c@CW8:~$ echo { echo foo > /dev/null; } |
I've found that a large part of scripting comprehension depends on having a clear understanding of just how the shell parses the line, and in what order. Knowing what gets done before what helps immensely in figuring out situations like this.
Code:
$ echo { echo foo > /dev/null; } But check this out: Code:
$ alias '}'='echo "Hi"' |
Great example. :hattip:
|
Quote:
"I know, I'll have the artwork displayed from the ID3 tags.....even though the FOSS codecs I should be supporting dont use ID3 tags normally, and can often have problems with ID3 tags when they are used, and who cares about the extra space being used from having artwork embedded into the tags". Im a little disgusted by that. But then again, what should I expect from something with virtually no documentation? Sorry about my little rant that doesnt really help your problem. BTW, if you really like album art give deadbeef a try. You wont get album art in popups, well, AFAIK anyway, I never really tired to do that. It might not be a media player that suits someone who likes XMMS2 (or maybe that is just caused by my 'omg its bloody winamp' reaction from the appearance), but its worth a look. It can be a little tricky to get the album art displayed, so if you do try deadbeef I can give you directions for how to display album art. |
Quote:
|
Yes, I was. My mistake, my bad. ;)
My own fault, I made that mistake when I was looking for media players that would do what I wanted (album art, and a non-standard playlist format). |
Its all good. :cool: I like not having to interact with my audio player. Just set it and forget it. I do like having the little pop-ups with a small album art thumbnail though. 99% of the time I just shuffle my entire collection while working. Don't care much for library management or playlists. Pcnanfm works fine for library management. XMMS2 and openbox with custom keybinds works great for me. I just like it to be as unobtrusive as possible.
|
Easytag will allow you to tag more than one file at a time -- I found out after going through a couple of albums that you need to tick the box to the right of the album art image to do so. I don't recall exactly when in the process to do this but you ought to be able to work it out now you know the secret of the tick box.
|
Quote:
|
OMG I didn't even see that tiny little check box on the side of the album art. I'm completely familiar with using it on all the rest of the fields, just didn't even see it there. So this thread was all for naught. :redface: I think I'm still going to continue with eyeD3 though, as I just like learning new ways to do things. Thanks to everyone who chimed in on this thread. Honestly it went on quite a bit longer than I thought it would. Marking solved. :D
|
It's far from obvious so not surprised you missed it. Glad you've solved things anyhow.
|
All times are GMT -5. The time now is 10:50 PM. |