Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [f74abd4786]:

To Artifact [20027a66d7]:


110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137


138
139
140
141
142
143
144
145
146
147
148
149
150














151
152
153
154
155
156
157
158
159
160
161
162
        # downloads stream list from shoutcast for given category
        def update_streams(self, cat, search=""):

            if (not cat or cat == self.empty):
                __print__("nocat")
                return []
            ucat = urllib.quote(cat)

            
            # new extraction regex
            if not conf.get("pyquery") or not pq:
              rx_stream = re.compile("""
                 <a\s+class="?playbutton\d?[^>]+id="(\d+)".+?
		 <a\s+class="[\w\s]*title[\w\s]*"[^>]+href="(http://[^">]+)"[^>]*>([^<>]+)</a>.+?
                 (?:Recently\s*played|Coming\s*soon|Now\s*playing):\s*([^<]*).+?
                 ners">(\d*)<.+?
                 bitrate">(\d*)<.+?
                 type">([MP3AAC]*)
                 """, re.S|re.I|re.X)
            rx_next = re.compile("""onclick="showMoreGenre""")



            # loop
            entries = []
            next = 0
            max = int(conf.max_streams)
            count = max


            while (next < max):

               # page
               url = "http://www.shoutcast.com/genre-ajax/" + ucat
	       referer = url.replace("/genre-ajax", "/radio")
	       params = { "strIndex":"0", "count":str(count), "ajax":"true", "mode":"listeners", "order":"desc" }
               html = http.ajax(url, params, referer)   #,feedback=self.parent.status)

               __print__(html)

               # regular expressions
               if not conf.get("pyquery") or not pq:
               














                   # extract entries
                   self.parent.status("parsing document...")
                   __print__("loop-rx")
                   for uu in rx_stream.findall(html):
                       (id, homepage, title, playing, ls, bit, fmt) = uu
                       __print__(uu)
                       entries += [{
                           "title": self.entity_decode(title),
                           "url": "http://yp.shoutcast.com/sbin/tunein-station.pls?id=" + id,
                           "homepage": http.fix_url(homepage),
                           "playing": self.entity_decode(playing),
                           "genre": cat, #self.strip_tags(uu[4]),







<
<
<
<
<
<
<
<
<
<
<
<
<
<







>
>













>
>
>
>
>
>
>
>
>
>
>
>
>
>



|
|







110
111
112
113
114
115
116














117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
        # downloads stream list from shoutcast for given category
        def update_streams(self, cat, search=""):

            if (not cat or cat == self.empty):
                __print__("nocat")
                return []
            ucat = urllib.quote(cat)
















            # loop
            entries = []
            next = 0
            max = int(conf.max_streams)
            count = max
            rx_stream = None
            rx_next = re.compile("""onclick="showMoreGenre""")
            while (next < max):

               # page
               url = "http://www.shoutcast.com/genre-ajax/" + ucat
	       referer = url.replace("/genre-ajax", "/radio")
	       params = { "strIndex":"0", "count":str(count), "ajax":"true", "mode":"listeners", "order":"desc" }
               html = http.ajax(url, params, referer)   #,feedback=self.parent.status)

               __print__(html)

               # regular expressions
               if not conf.get("pyquery") or not pq:
               
                   # new extraction regex
                   if not rx_stream:
                       rx_stream = re.compile(
                           """
                           <a\s+class="?playbutton\d?[^>]+id="(\d+)".+?
                           <a\s+class="[\w\s]*title[\w\s]*"[^>]+href="(http://[^">]+)"[^>]*>([^<>]+)</a>.+?
                           (?:Recently\s*played|Coming\s*soon|Now\s*playing):\s*([^<]*).+?
                           ners">(\d*)<.+?
                           bitrate">(\d*)<.+?
                           type">([MP3AAC]*)
                           """,
                           re.S|re.I|re.X
                       )

                   # extract entries
                   self.parent.status("parsing document...")
                   __print__("loop-rx")
                   for m in rx_stream.findall(html):
                       (id, homepage, title, playing, ls, bit, fmt) = m
                       __print__(uu)
                       entries += [{
                           "title": self.entity_decode(title),
                           "url": "http://yp.shoutcast.com/sbin/tunein-station.pls?id=" + id,
                           "homepage": http.fix_url(homepage),
                           "playing": self.entity_decode(playing),
                           "genre": cat, #self.strip_tags(uu[4]),