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

βŒˆβŒ‹ βŽ‡ branch:  streamtuner2


Diff

Differences From Artifact [64c5bb569c]:

To Artifact [a40c90e15d]:


1
2
3
4
5


6
7
8
9
10
11
12
1
2
3


4
5
6
7
8
9
10
11
12



-
-
+
+







# encoding: UTF-8
# api: streamtuner2
# title: redditβ›±music
# description: Music recommendations from reddit /r/music etc.
# version: 0.5
# description: Music recommendations from reddit /r/music and associated subreddits.
# version: 0.6
# type: channel
# url: http://reddit.com/r/Music
# category: playlist
# config:
#   { name: reddit_pages, type: int, value: 2, description: Number of pages to fetch. }
#   ( name: kill_soundcloud, type: boolean, value: 1, description: Filter soundcloud links (no player configurable). )
# png:
94
95
96
97
98
99
100
101

102
103
104
105
106




107
108




109

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
94
95
96
97
98
99
100

101
102




103
104
105
106


107
108
109
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







-
+

-
-
-
-
+
+
+
+
-
-
+
+
+
+

+
-
-
+
+
+
+
+
+
+


















-
-




-



+







        
        # radioreddit
        if cat == "radioreddit":
           return self.radioreddit()

        # collect links
        data = []
        after = ""
        after = None
        for i in range(1, int(conf.reddit_pages) + 1):
            j = json.loads(ahttp.get(
                "http://www.reddit.com/r/{}/new.json?sort=new&after={}".format(
                    cat.lower(), after
                )
            j = ahttp.get(
                "http://www.reddit.com/r/{}/new.json".format(cat.lower()),
                { "sort": "new", "after": after }
            )
            ))
            if not j.get("data",[]).get("children"):
            try:
                j = json.loads(j)
            except Exception as e:
                log.ERR("Reddit down?", e)
                break
            if j.get("data",[]).get("children"):
            data += j["data"]["children"]
            after = j["data"]["after"]
                data += j["data"]["children"]
            else:
                break
            if j.get("data",[]).get("after"):
                after = j["data"]["after"]
            else:
                break

        # convert
        r = []
        for row in (ls["data"] for ls in data):

            # find links in text posts
            text_urls = re.findall("\]\((https?://(?:www\.)?youtu[^\"\'\]\)]+)", row.get("selftext", ""))
            url_ext = (re.findall("\.(\w+)$", row["url"]) or [None])[0]
            listformat = "href"

            # Youtube
            if re.search("youtu", row["url"]):
                format = "video/youtube"
                listformat = "srv"
            # direct MP3/Ogg
            elif url_ext in ("mp3", "ogg", "flac", "aac", "aacp"):
                format = "audio/" + url_ext
                listformat = "srv"
                print row
                print url_ext
            # playlists?
            elif url_ext in ("m3u", "pls", "xspf"):
                listformat = url_ext
                format = "audio/x-unknown"
                print url_ext
            # links from selftext
            elif text_urls:
                row["url"] = text_urls[0]
                format = "video/youtube"
            # filter out Soundcloud etc.
            else:
                continue

            # repack into streams list
            r.append(dict(
                title = row["title"],