Come importare / esportare l'elenco delle stazioni radio di Rhythmbox?


10

È un modo per importare / esportare l'elenco delle stazioni radio di Rhythmbox?

In caso contrario, potresti suggerirmi un buon lettore musicale con funzionalità simili come Rhythmbox?

Grazie!


1
Intendi le stazioni radio?
— Javier Gonzalez,

Sì, intendo le stazioni radio
— Bakhtiyor,

Risposte:


7

rhythmbox memorizza informazioni su tutti i file musicali in ~ / .local / share / rhythmbox / rhythmdb.xml

Le voci riguardanti le radiostazioni iniziano con "entry type iradio".


Sì, hai ragione, lo sapevo prima. Ma sto cercando un modo più semplice, se ne esiste uno.
— Bakhtiyor,

3

ecco uno script Python per fare la stessa cosa, ovvero estrarre nomi e posizioni delle stazioni radio Internet dalla banca dati XML utilizzata da Rhythmbox:

import xml.sax.handler
import xml.sax
import pprint

class RhythmboxPlaylistHandler(xml.sax.handler.ContentHandler):
    def __init__(self):
        self.inRTitle = False
        self.inRLocation = False
        self.entrytype = "undefined"
        self.titlebuffer = ""
        self.locationbuffer = ""
        self.radiostations = {}

    def startElement(self, name, attributes):
        if name == "entry":
            self.entrytype = attributes["type"]  # we're interested in type="iradio"
        elif name == "title" and self.entrytype == "iradio":
            self.inRTitle = True
        elif name == "location" and self.entrytype == "iradio":
            self.inRLocation = True

    def characters(self, data):
        if self.inRTitle:
            self.titlebuffer += data
        elif self.inRLocation:
            self.locationbuffer += data

    def endElement(self, name):
        if name == "title":
            self.inRTitle = False
        elif name == "location":
            self.inRLocation = False
        elif name == "entry" and self.entrytype == "iradio":
            self.radiostations[self.titlebuffer] = self.locationbuffer
            self.titlebuffer=""
            self.locationbuffer=""

parser = xml.sax.make_parser(  )
handler = RhythmboxPlaylistHandler(  )
parser.setContentHandler(handler)
parser.parse("work_copy_of_rhythmdb.xml")
pprint.pprint(handler.radiostations)

rstations=handler.radiostations

rskeys=[key for key in rstations]
rskeys.sort()

ofile=open("rhytmbox_current_internet_radiostations.txt","w")
ofile.write("#   {0:41}  -->  {1}\r\n".format('radio station name','location'))
ofile.write("#"+120*'-'+"\r\n")
for key in rskeys:
    ofile.write("{0:45}  -->  {1}\r\n".format(key,rstations[key]))
ofile.close()

(Ho iniziato con questo tutorial su come lavorare con basi di dati XML da Python: http://oreilly.com/catalog/pythonxml/chapter/ch01.html )


2

È possibile utilizzare xmlstarlet per estrarre i dati essenziali dal file XML. Vedi qui per i dettagli:

http://steffen67.blogspot.com/2011/05/how-to-export-rhythmbox-radio-stations.html


bello indicare il tutorial xmlstarlet per questo
— Sabacon

1
Sebbene ciò possa teoricamente rispondere alla domanda, sarebbe preferibile includere qui le parti essenziali della risposta e fornire il collegamento come riferimento.
— Marco Ceppi

Mi dispiace per quello. L'ho appena modificato per includere l'idea principale. (Grazie per il link. Ero preoccupato che ripubblicare altre informazioni avrebbe duplicato inutilmente i dati web.)
— colan

0

per l'esportazione leggere il file ~/.local/share/rhythmbox/rhythmdb.xml
se si desidera importare Creare una playlist di file M3U come:

#EXTM3U
#EXTINF:-1,Quran - Eman City  Quran & Islam Talk
http://206.72.199.180:9990/;stream.nsv

#EXTINF:-1,Quran - Radio Quraan
http://66.45.232.131:9994/;stream.nsv

#EXTINF:-1,Quran - Allahu Akbar Radio
http://66.45.232.1ls32:10196/;stream.nsv

#EXTINF:-1,Quran - izlam
http://66.45.232.133:9998/;stream.nsv

#EXTINF:-1,Quran - tafsir Al Sheikh Mohammad Ratib Al Nabulsi & Sheikh Muhammad Mitwalli Al Sharawi
http://206.72.199.179:9992/;stream.nsv

#EXTINF:-1,Quran - radioislamico
http://66.45.232.134:9996/;stream.nsv

e aprilo con rhythmbox

Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.