Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 2611  / 3 Years ago, sat, september 4, 2021, 7:35:24

RadioTray icon applet is pretty neat and comes with a variety of predefined radio stations ordered by categories. To those I also added some additional local (Israeli) radio stations and ended up with few dozen.



In preparation for the coming Precise and the need to have one player for all, I would like to migrate this list to Rhythmbox.



The only thing I figured out so far is that the radio stations of Radio Tray are being kept in an XML file at @HOME/.local/share/radiotray/bookmarks.xml.



Any ideas how to import RadioTray stations into Rhythmbox?


More From » rhythmbox

 Answers
2

enter image description here



The image shows the default RadioTray radio stations imported into Rhythmbox



How did I do that?



RadioTray holds its radio-stations in an XML file located in:



~/.local/share/radiotray/bookmarks.xml


Rhythmbox holds all of its data similarly in an XML file located in:



~/.local/share/rhythmbox/rhythmdb.xml


If you examine both files its pretty obvious that the XML format (its defined structure) is very different.



One solution is to transform the Radiotray XML format to something that Rhythmbox can understand.



XSLT



You can use the structured XML translation language XSLT to perform this conversion.



To install:



sudo apt-get install python-4suite-xml


Next copy the contents below into a new gedit file



Save in a file (create the folder xml if necessary) called ~/xml/style



Next, copy the RadioTray XML file to the same folder ~/xml



Finally, copy the Rhythmbox XML file to the same folder ~/xml



Drop to a terminal:



cd ~/xml
4xslt bookmarks.xml style > test.xml


This will reformat the RadioTray into the XML that can be read by RhythmBox



Next we need to add this new data to Rhythmbox.



Now open both test.xml and rhythmdb.xml



Copy the contents of test.xml EXCEPT for the first line into the rhythmdb.xml file. Note - you paste the contents at the end of the file i.e.



</entry>

*****paste test.xml here*****

</rhythmdb>


Save.



Backup the old rhythmdb.xml file and then copy over the new rhythmdb.xml file.



Fire up Rhythmbox



<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<xsl:for-each select="bookmarks/group/group/bookmark">
<entry type="iradio">
<title><xsl:value-of select="@name"/></title>
<genre><xsl:value-of select="translate(../@name,'','')"/></genre>
<artist></artist>
<album></album>
<location><xsl:value-of select="@url"/></location>
<date>0</date>
<media-type>application/octet-stream</media-type>
</entry>
</xsl:for-each>

</xsl:template>
</xsl:stylesheet>

[#39881] Sunday, September 5, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eighethod

Total Points: 358
Total Questions: 112
Total Answers: 119

Location: Cayman Islands
Member since Fri, Mar 4, 2022
2 Years ago
;