[Rhythmbox-devel] tools/scripts to manipulate the rhythmdb.xml file?



I have through various means and methods and thanks to some tricks with
filesystem links wound up with a rhythmdb.xml file which has duplicate
entries (albeit with different "location"s) which I would like to merge.

For example:

  <entry type="song">
    <title>The night comes down</title>
    <genre>Pop</genre>
    <artist>Queen</artist>     <album>Queen I</album>
    <duration>263</duration>
    <file-size>4217754</file-size>
    <location>file:///data/mp3/mp3s/Queen/Queen/06%20The%20night%20comes%20down.mp3</location>
    <mountpoint>file:///data/mp3</mountpoint>
    <mtime>980761526</mtime>
    <first-seen>1129753382</first-seen>
    <last-seen>1129823025</last-seen>
    <rating>2.500000</rating>
    <auto-rate>1</auto-rate>
    <bitrate>128</bitrate>
    <mimetype>application/x-id3</mimetype>
  </entry>

and

  <entry type="song">
    <title>The night comes down</title>
    <genre>Pop</genre>
    <artist>Queen</artist>
    <album>Queen I</album>
    <duration>257</duration>
    <file-size>4217754</file-size>
    <location>file:///data/mp3/Queen/Queen/06%20The%20night%20comes%20down.mp3</location>
    <mountpoint>file:///data/mp3</mountpoint>
    <mtime>980761526</mtime>
    <first-seen>1129299591</first-seen>
    <last-seen>1129823025</last-seen>
    <play-count>2</play-count>
    <last-played>1126426486</last-played>
    <mimetype></mimetype>
  </entry>

These are really one and the same, just different links to the same
file.  I would like to merge those two entries, removing the location
with the "mp3s" in it and taking the most recent last-seen, the least
recent first-seen, adding the two play-counts, etc.

I am pretty handy with scripting, just not so familiar with XML in
either of Perl or Python (preferred) and not quite getting the XML
functions to return the data I want.

Does anyone have anything in either perl or python (again the latter
preferred) cooked up already to read the rhythmdb.xml file so I can hit
the ground running with this project?

Thanx,
b.

-- 
My other computer is your Microsoft Windows server.

Brian J. Murrell

Attachment: signature.asc
Description: This is a digitally signed message part



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