LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-06-2012, 02:55 AM   #16
strungoutfan78
Member
 
Registered: Mar 2011
Location: San Diego, CA
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 0

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/' \;
Now I know this is wrong because apparently "." is the perl wildcard representing any character. What would I replace "*.jpg" with in the rename arguments to catch any file ending in ".jpg"?
 
Old 04-06-2012, 03:35 AM   #17
strungoutfan78
Member
 
Registered: Mar 2011
Location: San Diego, CA
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 0
Talking

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 \;
Works just fine. I'll post my results regarding eyeD3 tomorrow. Need sleep. Thanks everyone for your assistance with this tonight.
 
Old 04-06-2012, 01:34 PM   #18
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Quote:
Originally Posted by catkin View Post
It always used to be necessary but I routinely do not do so. IDK at what point it became unnecessary. From the GNU bash ref:
Code:
{}

              { list; }

    Placing a list of commands between curly braces causes the list to be executed in the current shell context. No subshell is created.
That does not define what happens when the list is empty.

Experimenting:
Code:
c@CW8:~$ echo {}
{}
c@CW8:~$ echo { echo foo > /dev/null }
[no output]
It would be nice to find a reference explaining that behaviour.

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 }
Since the first word in the line is a command name, all the rest of the "words" are treated as arguments to that command. The {list;} syntax doesn't apply in this situation (although it's certainly checked for correspondence to brace expansion syntax first, a-la my first point above).

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 }
{ echo foo }

Last edited by David the H.; 04-06-2012 at 01:48 PM. Reason: small fixes and addendum
 
1 members found this post helpful.
Old 04-06-2012, 03:41 PM   #19
strungoutfan78
Member
 
Registered: Mar 2011
Location: San Diego, CA
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 0
David,

Thanks for that explanation. Makes sense.

---------- Post added 04-06-12 at 01:42 PM ----------

David,

Thanks for that explanation. Makes sense.
 
Old 04-06-2012, 03:43 PM   #20
strungoutfan78
Member
 
Registered: Mar 2011
Location: San Diego, CA
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 0
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.
 
Old 04-06-2012, 10:45 PM   #21
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by David the H. View Post
As for this:
Code:
echo { echo foo > /dev/null }
Since the first word in the line is a command name, all the rest of the "words" are treated as arguments to that command. The {list;} syntax doesn't apply in this situation (although it's certainly checked for correspondence to brace expansion syntax first, a-la my first point above).
Thanks David

That makes sense (what was I thinking of ?!). Another demonstration:
Code:
c@CW8:~$ echo { echo foo > /dev/null; }
bash: syntax error near unexpected token `}'
 
Old 04-07-2012, 05:58 AM   #22
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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; }
bash: syntax error near unexpected token `}'
For anyone who can't figure this one out, the unquoted ";" is viewed as a command terminator, so it's really trying to run two commands in sequence, "echo +arguments" and "}" But of course the "}" keyword can't be used as a command name.

But check this out:

Code:
$ alias '}'='echo "Hi"'

$ echo { echo foo > /dev/null; }
Hi

Last edited by David the H.; 04-07-2012 at 06:06 AM. Reason: Simplified example
 
1 members found this post helpful.
Old 04-07-2012, 11:40 PM   #23
strungoutfan78
Member
 
Registered: Mar 2011
Location: San Diego, CA
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 0
Great example.
 
Old 04-08-2012, 02:53 AM   #24
cascade9
Senior Member
 
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 3,753

Rep: Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935
Quote:
Originally Posted by strungoutfan78 View Post
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....
W.T.F. What sort of crazy did that?

"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.
 
Old 04-09-2012, 03:18 AM   #25
strungoutfan78
Member
 
Registered: Mar 2011
Location: San Diego, CA
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by cascade9:4647535
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.
I'm fairly certain you're confusing XMMS2 with the original XMMS. XMMS2 is simply a daemon that runs in the background. It has no default gui although many exist. It can be used as a streaming client as well.
 
Old 04-10-2012, 06:01 AM   #26
cascade9
Senior Member
 
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 3,753

Rep: Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935Reputation: 935
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).
 
Old 04-10-2012, 02:48 PM   #27
strungoutfan78
Member
 
Registered: Mar 2011
Location: San Diego, CA
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 0
Its all good. 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.
 
Old 04-10-2012, 03:14 PM   #28
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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.
 
1 members found this post helpful.
Old 04-10-2012, 04:04 PM   #29
strungoutfan78
Member
 
Registered: Mar 2011
Location: San Diego, CA
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by 273:4649584
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.
I'll have to check that out. Thanks for the tip.
 
Old 04-10-2012, 11:18 PM   #30
strungoutfan78
Member
 
Registered: Mar 2011
Location: San Diego, CA
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 0
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. 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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How does a program "find" another file or program when it calls one? pottzie Programming 8 11-10-2011 10:07 PM
Rename all ".JPG" files to ".jpg" under all subfolders... jiapei100 Programming 4 04-25-2010 06:27 PM
please help with bash find / -name "*.sized.jpg" -exec rm -f {} ; rioguia Programming 4 01-16-2010 03:48 PM
Recursively add missing ".jpg" to all JPEG files. Chekote Linux - General 4 09-14-2009 11:45 PM
Just finished compiling Wine, getting "couldn't find program" error Maronflower Linux - Software 1 11-10-2003 06:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration