25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
-
+
-
+
|
# The current implementation is very inefficient. It reads the XML on every
# start. Caching it as JSON wouldn't be very wise, as it'd still be 20 MB.
#
# Untested.
import action
import http
import ahttp
from config import conf
from channels import *
import os, os.path
from pq import pq
import lxml.etree
import mygtk
import uikit
# return text entry from etree list
def get(item, tag, hint=None):
if hint != None:
if len(item) > hint: # hint tells us the usual position of the element
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
-
+
|
else:
self.warn()
ChannelPlugin.__init__(self,parent)
# gtk.messagebox
def warn(self):
mygtk.msg("Podspiderpdb.xml.tmp_ couldn't be found anywhere.\nInstall Radiograbber via Wine to create it.")
uikit.msg("Podspiderpdb.xml.tmp_ couldn't be found anywhere. Install Radiograbber via Wine to create it.")
# prevent cache file creation, as it would contain sublists and ends up being unreadable by json module
def save(self, *a):
pass
|
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
-
+
|
return r
# loads RSS and gets first entry url
def play(self, row):
audio = "audio/mp3"
r = []
for e in pq(http.get(row["homepage"])).find("enclosure"):
for e in pq(ahttp.get(row["homepage"])).find("enclosure"):
r.append(e.get("url"))
audio = e.get("type")
if r:
action.action.play(r[0], audioformat=audio, listformat="url/direct")
|