Unpack magnatune flac album and move artwork into album dir

magunp() {for i in ./*-flac.zip ;do AlbumPath="$(dirname "$(unzip -l -qq "$i" |tail -n 1 |cut -c 31-)")" && unp "$i" && mv ./cover.jpg "$AlbumPath/" && mv ./artwork.pdf "$AlbumPath/" && ls "$AlbumPath/" ; rm "$i";done ;}
https://www.magnatune.com depends on unp but does not need to but unp is the easiest way to unpack any archive. it's in Debian repo's. !note: it deletes flac zip when done, if successful.
Sample Output
user@computer:<you cd'd in to dir where single flac album and artwork is>$ magunp 
Archive:  ./kalotone-endgame-flac.zip
  inflating: Kalotone/End Game/01-End Game-Kalotone.flac  
  inflating: Kalotone/End Game/02-Black-Kalotone.flac  
  inflating: Kalotone/End Game/03-Dots-Kalotone.flac  
  inflating: Kalotone/End Game/04-War-Kalotone.flac  
  inflating: Kalotone/End Game/05-Brain Wash-Kalotone.flac  
  inflating: Kalotone/End Game/06-GTFO-Kalotone.flac  
  inflating: Kalotone/End Game/07-Pear Drop-Kalotone.flac  
  inflating: Kalotone/End Game/08-Psycho-X-Kalotone.flac  
  inflating: Kalotone/End Game/09-Gravity-Kalotone.flac  
  inflating: Kalotone/End Game/10-Binary-Kalotone.flac  
  inflating: Kalotone/End Game/11-Hide and Seek-Kalotone.flac  
  inflating: Kalotone/End Game/12-Equal Phase-Kalotone.flac  
  inflating: Kalotone/End Game/13-Shiver-Kalotone.flac  
  inflating: Kalotone/End Game/14-Zigzag-Kalotone.flac  
  inflating: Kalotone/End Game/15-Be Here Now-Kalotone.flac  
  inflating: Kalotone/End Game/16-Guinea Pig-Kalotone.flac  
  inflating: Kalotone/End Game/17-Mind Fuel-Kalotone.flac  
01-End Game-Kalotone.flac  04-War-Kalotone.flac         07-Pear Drop-Kalotone.flac  10-Binary-Kalotone.flac         13-Shiver-Kalotone.flac       16-Guinea Pig-Kalotone.flac  cover.jpg
02-Black-Kalotone.flac     05-Brain Wash-Kalotone.flac  08-Psycho-X-Kalotone.flac   11-Hide and Seek-Kalotone.flac  14-Zigzag-Kalotone.flac       17-Mind Fuel-Kalotone.flac
03-Dots-Kalotone.flac      06-GTFO-Kalotone.flac        09-Gravity-Kalotone.flac    12-Equal Phase-Kalotone.flac    15-Be Here Now-Kalotone.flac  artwork.pdf

By: astr
2014-12-25 15:04:56

What Others Think

In this they are discussing about the impact magnitude flak album and to move our work into album directory and the code related to it is also shared here so those who are interested can try it out Plant-Based Diet
Kaitlyn · 21 weeks and 6 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: