Check-in [652576b7b3]
Overview
Comment: | peertube use correct /search/videos api for searches |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
652576b7b38e444cd114b29fd27e955c |
User & Date: | mario on 2020-05-16 10:08:39 |
Other Links: | manifest | tags |
Context
2020-05-16
| ||
10:09 | magnatune: radios are gone? check-in: a3e879ebcb user: mario tags: trunk | |
10:08 | peertube use correct /search/videos api for searches check-in: 652576b7b3 user: mario tags: trunk | |
10:08 | Minor Python 3 fixes (syntax and str.decode) check-in: 3d48a4ac68 user: mario tags: trunk | |
Changes
Modified channels/peertube.py from [fc7ec6bb9a] to [838bf4fd06].
︙ | ︙ | |||
152 153 154 155 156 157 158 159 | self.catmap = dict((k,int(v)) for v,k in cats.items()) # { "Music": 1 } self.categories = sorted(self.catmap, key=self.catmap.get) # sort by value # retrieve and parse def update_streams(self, cat, search=None): if search: params = { | > | | > < < | < < < | > > > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | self.catmap = dict((k,int(v)) for v,k in cats.items()) # { "Music": 1 } self.categories = sorted(self.catmap, key=self.catmap.get) # sort by value # retrieve and parse def update_streams(self, cat, search=None): if search: method = "search/videos" params = { "search": search, "count": 100, "sort": "-match", "nsfw": "false" } elif not cat in self.catmap: return [] elif cat: method = "videos" params = { "categoryOneOf": self.catmap[cat], "count": 100, "sort": "-publishedAt", "nsfw": "false" } # fetch + map self.status(0.9) #log.DATA(video) return [ self.map_data(video) for video in self.api(method, params) ] # peertube entry to streamtunter2 dict def map_data(self, v): #log.DATA(v) url = "http://" + v["channel"]["host"] return dict( uuid = v["uuid"], genre = v["category"]["label"], title = v["name"], playing = re.sub("\s+", " ", v["description"]) if v.get("description") else "", url = "urn:peertube:{}".format(v["uuid"]), |
︙ | ︙ |