domenica, maggio 25, 2008

 

Importare OPML per MythNews

Il plugin MythNews del pacchetto MythTv prevede una raccolta di feed standard.

Io ho un mio elenco di feed in formato opml ma come portarlo in myth?

Bè ecco uno script ke fa il minimo indispensabile:

require 'rexml/document'
url = "google-reader-subscriptions.xml"

# extract event information
doc = REXML::Document.new(File.new(url))
titles = []
links = []
doc.elements.each('//outline') do |ele|
if ele.attributes['xmlUrl']
puts "<item>"
puts "<title>#{ele.attributes['title']}</title>"
puts "<url>#{ele.attributes['xmlUrl']}</url>"
puts "</item>"
end
end


Questo spara i tag da inserire nel file /usr/share/mythtv/mythnews/news-sites.xml. Va creata una category personalizzata ed incollato il testo. Attenzione: non faccio escape delle stringhe strane, ad esempio sono dovuto intervenire sulle "&" per tradurle in &amp;

Commenti: Posta un commento

Iscriviti a Commenti sul post [Atom]





<< Home page

This page is powered by Blogger. Isn't yours?

Iscriviti a Post [Atom]