Closed Doriginal closed 12 years ago
your xml is different from the texxas one ....
so you need to search for the channel AND the right time, or display the whole day
in mine i just had one entry per channel so its a lot easier
and in what line was the error ?
The error is in terminal when I ask siri tv program.
So with my xml can not?
yours
mine:
when you find a xml which shows only the current films, it would be easier
ok thanks i try that
Thank you for your advice, I understand your code.
http://img11.hostingpics.net/pics/468072Photo180312002550.png
It is not easy to find RSS feed with a lot of info in "title" I have not found one for TV programs in French
thank you again
you can use your xml and rewrite the parsing part to show every line, or make some time checks (probably not that easy) to show only one entry after the actual time. but im not that good in xml parsin ....
Me neither I'm a novice in the field.
how could your read two tag? title + description
I tried but without success
http://lmgtfy.com/?q=xml+parsing+ruby :-)
i prefer json files so you need to google yourself ...
ok thanks i look that,
Yes I saw a plugin with .json files, but how to create them.
same thing, you need to find them :-) some sites give you an option to get xml or json
good evening,
I found how to display the different times of my xml
http://img11.hostingpics.net/pics/173883Photo190312225051.png http://img11.hostingpics.net/pics/659756Photo190312225115.png
Will you look at the code that I modified? I just send it to you
Thank you again for your help.
One last question.
In the plugin code, it indicates the character was searching the xml. If characters are found, siri displays. But if the characters are not found, an error "invalid string ..." appears.
How would you add a code, which will allow to pass to the next line if it can not find the characters instead of the error "invalid string ..."
Thanks
there are many ways, you can do a simple if str == nil.
or you probably can use the rescue command
Thank you i look that
i have tried different way, but no result :(
while i < docs.length dos = docs[i].to_s dos = cleanup(dos) doss = dos[0,14] if doss == NIL
No work
if doss == "France 2 | 19:" or doss == NIL
dos = dosund(dos)
fr2 = dos
no work
That not easy
hello,
Thank you for all the help you provided me, a friend helped me to finish, thank you to him.
The aim of the program tv is: . display programs of early evening (20h to 22h) . display programs of the second part of the evening (22h to 00h)
example:
http://img15.hostingpics.net/pics/970555Photo210312214100.png http://img15.hostingpics.net/pics/543696Photo210312214159.png
Plugin no longer crashes if no characters have found, it continues and displays what it finds.
Thank you again, your code base was very good, it helped me a lot.
Hi ! can you share your code Doriginal ?
or a little help..
Good evening,
Your plugin is very interesting. I try to modify it to read the french TV program chains I modified as below code, but I get an error when I ask siri control
class SiriProxy::Plugin::TV < SiriProxy::Plugin
def tvprogramm(doc) # reading whats playing now - Austrian channels begin doc = Nokogiri::XML(eat("http://www.texxas.de/tv/oesterreichJetzt.xml")) return doc rescue doc = "" end end
def tvprogrammabend(doc) # reading whats playing in the evening (20:15) - Austrian channels begin doc = Nokogiri::XML(eat("http://www.programme-television.org/programme-tv-journee.xml")) return doc rescue doc = "" end end
def tvprogrammsat(dob) # reading whats playing now - 3SAT begin dob = Nokogiri::XML(eat("http://www.texxas.de/tv/spartensenderJetzt.xml")) return dob rescue dob = "" end end
def tvprogrammsatabend(dob) # reading whats playing in the evening (20:15) - 3SAT begin dob = Nokogiri::XML(eat("http://www.programme-television.org/programme-tv-journee.xml")) return dob rescue dob = "" end end
def cleanup(doc) doc = doc.gsub(/<\/?[^>]*>/, "") return doc end
def dosund(dos) if dos["&"] dos["&"] = "&" end return dos end
TV Programm Abend - TV Programm Evening - all channels
listen_for /(TV|télé|spielers).*(prime Time|soirée|soir)/i do doc = tvprogrammabend(doc) dob = tvprogrammsatabend(dob) if doc == NIL or doc == "" say "Es gab ein Problem beim Einlesen des Fernsehprogramms!" elsif dob == NIL or dob == "" say "Es gab ein Problem beim Einlesen des Fernsehprogramms!" else doc.encoding = 'utf-8' dob.encoding = 'utf-8' docs = doc.xpath('//title')
dobs = dob.xpath('//title')
i = 1 while i < docs.length dos = docs[i].to_s dos = cleanup(dos) doss = dos[0,8] if doss == "France 2" dos = dosund(dos) fr2 = dos elsif doss == "France 3" dos = dosund(dos) fr3 = dos elsif doss == "Canal pl" dos = dosund(dos) canal = dos elsif doss == "France 5" dos = dosund(dos) fr5 = dos elsif doss == "France 4" dos = dosund(dos) fr4 = dos elsif doss == "Direct 8 " dos = dosund(dos) dir8 = dos elsif doss == "Direct S" dos = dosund(dos) dirs = dos else end i += 1 end i = 1 while i < dobs.length dos = dobs[i].to_s dos = cleanup(dos) doss = dos[0,3]
end
I have this error:
[Info - Plugin Manager] Plugin Crashed: Unknown class NilClass. Try using :convert_unknown_to_string if you want to use unknown object types!
Can you help me? Thanks