[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnupod] Some gnupod scripts I wrote

From: H. Langos
Subject: Re: [Bug-gnupod] Some gnupod scripts I wrote
Date: Tue, 18 Aug 2009 11:16:51 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Richard,

On Tue, Aug 18, 2009 at 09:24:07AM +0200, Richard van den Berg wrote:
> On Mon, August 17, 2009 19:39, H. Langos wrote:
> > BTW: I hope I'll find the time to add gnupod_modify [snip]
> > for the next gnupod release
> While we're on the topic of tools/scripts, one script I need to add is
> gnupod_replace (or a similar flag to gnupod_addsong) to replace an mp3 on
> the ipod while keeping all the metadata the same (most notably the
> artwork). I need this because once in a while I come across an mp3 that
> skips, and after I rerip it, I want to be able to add it without having to
> create a new entry in the artworkDB.
Creating an extra gnupod_replace script looks like overkill to me. 
I'd rather do a shellscript that calls gnupod_find to get the unixpath
and then does a simple "cp". No need to update the GNUtunesDB or the 

If you want to write such a shell script you can put it in the tools/ 
directory. Please try to keep it free of bashisms and as robust as 
possible. I.e. 
- make it interactive by default to avoid replacing the wrong file, 
- run it "set -e",
- create a tempfile in the target directory
- install a trap function that removes the tempfile if an error occurs
- copy the new file to the tempfile,
- replace the old file by a "mv oldfile newfile"
- unset the trap
- maybe even have a "sync" at the end to avoid filesystem damage if you
  unplug the device too hasty

If you think this is complicated, try to get the same level of robustness
with a perl script and you'll go mad with the error handling ... :-)

> And/or perhaps a gnupod_artwork script to manipulate the artworkDB (remove
> unreferenced artwork, make artwork for song X the same as for song Y,
> etc).

Setting artwork and other attributes by reference is one of the things I was 
thinking about recently when one of my favorite podcasts changed artwork and
in the transition didn't have any artwork at all. Now my podcast list
sometimes shows their old artwork, something the new one, somtime just a
black square...

I imagine something like 

  gnupod_modify --filter album="foo bar" --set "artwork=/tmp/41YS02XZVDL.jpg"

for setting artwork by importing an external file, and

  gnupod_modify --filter album="foo bar" --set "artwork~1754"

for setting artwork to reference the same pictures as the song with ID 1754
does. Maybe we could even allow URL's in the direct assignment case.

I am not yet sure about the characters to use. The "=" is pretty self 
but "~" for reference is a bit arbitrary. You might think of it as "pointing
to the home directory of 1754 where all its attributes and picture files
I thought about "->" (for pointer) or "*" for (dereferencing a pointer) but
I am not happy with the side effects those can have when used unquoted on the 

Suggestions are welcome...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]