125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144 | # INTERNA
#
# The /embed/ section of the url can sometimes be substituted with:
# · /videos/watch/UUID
# · /static/streaming-playlists/hls/UUID/master.m3u8
# · /static/webseed/UUID.mp4
# Though that's sometimes blocked / or not consistently supported on all instances.
# Which is why resoslve_urn does an extra /api/v1/videos/uuid lookup.
#
class peertube (ChannelPlugin):
# control attributes
listformat = "srv"
has_search = True
audioformat = "video/youtube"
titles = dict( genre="Channel", title="Title", playing="Description", bitrate=False, listeners=False )
srv = conf.peertube_srv
image_resize = 48
fixed_size = [48,32]
|
|
|
| 125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144 | # INTERNA
#
# The /embed/ section of the url can sometimes be substituted with:
# · /videos/watch/UUID
# · /static/streaming-playlists/hls/UUID/master.m3u8
# · /static/webseed/UUID.mp4
# Though that's sometimes blocked / or not consistently supported on all instances.
# Which is why resolve_urn does an extra /api/v1/videos/uuid lookup.
#
class peertube (ChannelPlugin):
# control attributes
listformat = "href"
has_search = True
audioformat = "video/youtube"
titles = dict( genre="Channel", title="Title", playing="Description", bitrate=False, listeners=False )
srv = conf.peertube_srv
image_resize = 48
fixed_size = [48,32]
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187 | "categoryOneOf": self.catmap[cat],
"count": 100,
"sort": "-publishedAt",
"nsfw": "false"
}
# fetch + map
entries = []
for video in self.api("videos", params):
#log.DATA(video)
entries.append(self.map_data(video))
#log.EN(json.dumps(entries, indent=4))
return entries
# peertube entry to streamtunter2 dict
def map_data(self, v):
url = "http://" + v["channel"]["host"]
return dict(
uuid = v["uuid"], |
>
>
| 169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189 | "categoryOneOf": self.catmap[cat],
"count": 100,
"sort": "-publishedAt",
"nsfw": "false"
}
# fetch + map
self.status(0.9)
entries = []
for video in self.api("videos", params):
#log.DATA(video)
entries.append(self.map_data(video))
#log.EN(json.dumps(entries, indent=4))
self.status(1.0)
return entries
# peertube entry to streamtunter2 dict
def map_data(self, v):
url = "http://" + v["channel"]["host"]
return dict(
uuid = v["uuid"], |
196
197
198
199
200
201
202
203
204
205
206
207
208
209 | )
# fetch one or multiple pages from API
def api(self, method, params={}, debug=False, count=200, **kw):
r = []
for i in range(0, 5):
add = json.loads(
ahttp.get("http://{}/api/v1/{}".format(conf.peertube_srv, method), params, **kw)
)
if not add.get("data"):
return add
else:
r += add["data"] |
>
| 198
199
200
201
202
203
204
205
206
207
208
209
210
211
212 | )
# fetch one or multiple pages from API
def api(self, method, params={}, debug=False, count=200, **kw):
r = []
for i in range(0, 5):
self.status(i / 6.0)
add = json.loads(
ahttp.get("http://{}/api/v1/{}".format(conf.peertube_srv, method), params, **kw)
)
if not add.get("data"):
return add
else:
r += add["data"] |