forked from benticlaskaris/plugin.video.vvvvid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefault.py
449 lines (421 loc) · 17.2 KB
/
default.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
import re
import urllib, urllib2
import re, string
import threading
import os
import base64
import sys
#from t0mm0.common.addon import Addon
#from t0mm0.common.net import Net
import urlparse
import urllib2
import json
from requester import *
from xbmcswift2 import *
from resources.lib.F4mProxy import f4mProxyHelper
import xbmcplugin
# plugin constants
__plugin__ = "plugin.video.vvvvid"
__author__ = "evilsephiroth"
plugin = Plugin()
handleAddon = int(sys.argv[1])
@plugin.route('/',name="root")
def show_main_channels():
items = [{
'label': ROOT_LABEL_ANIME,
'path' : plugin.url_for('animeChannels'),
'is_playable': False
},
{
'label': ROOT_LABEL_MOVIES,
'path' : plugin.url_for('movieChannels'),
'is_playable': False
},
{
'label': ROOT_LABEL_SHOWS,
'path' : plugin.url_for('tvChannels'),
'is_playable': False
}];
return items;
@plugin.route('/movie/channels',name="movieChannels")
def showMovieChannels():
channels = get_section_channels(MODE_MOVIES)
currentGlobalChannels = channels
items = []
for channel in currentGlobalChannels:
item = dict()
item['label'] = channel.title
item['is_playable'] = False
if(len(channel.filterList) != 0):
item['path'] = plugin.url_for('showMovieChannelFilters',idChannel=channel.id)
elif(len(channel.categoryList) != 0):
item['path'] = plugin.url_for('showMovieChannelCategories',idChannel=channel.id)
else:
item['path'] = plugin.url_for('showMovieSingleChannel',idChannel=channel.id)
items.append(item)
return items
@plugin.route('/movie/channel/<idChannel>/filter/<filter>',name="showMovieSingleChannelFilter")
@plugin.route('/movie/channel/<idChannel>/category/<category>',name="showMovieSingleChannelCategory")
@plugin.route('/movie/channel/<idChannel>',name="showMovieSingleChannel")
def showMovieSingleChannel(idChannel,filter = '',category = ''):
channelsElements = get_elements_from_channel(idChannel,MODE_MOVIES,filter,category)
items = []
for element in channelsElements:
item = dict()
item['label'] = element.title
item['is_playable'] = False
item['icon']= element.thumb
item['thumbnail']= element.thumb
item['path'] = plugin.url_for('showSingleMovieItem',idItem = element.show_id)
items.append(item)
return items
@plugin.route('/movie/channel/<idChannel>/filters',name="showMovieChannelFilters")
def showMovieChannelFilters(idChannel):
items = []
channels = get_section_channels(MODE_MOVIES)
currentGlobalChannels = channels
for channel in currentGlobalChannels:
if(channel.id == idChannel):
for filter in channel.filterList:
item = dict()
item['label'] = str(filter)
item['is_playable'] = False
item['path'] = plugin.url_for('showMovieSingleChannelFilter',idChannel=channel.id,filter = str(filter))
items.append(item)
return items
@plugin.route('/movie/channel/<idChannel>/categories',name="showMovieChannelCategories")
def showMovieChannelCategories(idChannel):
items = []
channels = get_section_channels(MODE_MOVIES)
currentGlobalChannels = channels
for channel in currentGlobalChannels:
if(channel.id == idChannel):
for category in channel.categoryList:
item = dict()
item['label'] = str(category.name)
item['is_playable'] = False
item['path'] = plugin.url_for('showMovieSingleChannelCategory',idChannel=channel.id,category = str(category.id))
items.append(item)
return items
@plugin.route('/movie/item/<idItem>',name='showSingleMovieItem')
def showSingleMovieItem(idItem):
items = []
itemPlayable = get_item_playable(idItem)
if(len(itemPlayable.seasons) > 1):
for season in itemPlayable.seasons:
item = dict()
item['label'] = season.title
item['is_playable'] = False
item['path'] = plugin.url_for('showSingleMovieItemSeason',idItem=idItem,seasonId = season.season_id)
items.append(item)
else:
episodes = itemPlayable.seasons[0].episodes
xbmcplugin.setContent(handleAddon, 'movies')
for episode in episodes:
item = dict()
item['label'] = episode.title
item['icon']= episode.thumb
item['thumbnail']= episode.thumb
props = dict()
props.update(fanart_image = item['thumbnail'])
item['properties'] = props
if(episode.stream_type == F4M_TYPE):
item['path'] = plugin.url_for('playManifest',manifest=episode.manifest,title = episode.title)
item['is_playable'] = False
elif(episode.stream_type == M3U_TYPE):
item['path'] = episode.manifest
item['is_playable'] = True
items.append(item)
return items
@plugin.route('/movie/item/<seasonId>/<idItem>',name='showSingleMovieItemSeason')
def showSingleMovieItemSeason(seasonId,idItem):
items = []
itemPlayable = get_item_playable(idItem)
xbmcplugin.setContent(handleAddon, 'movies')
for season in itemPlayable.seasons:
if(unicode(season.season_id) == seasonId):
for episode in season.episodes:
item = dict()
item['label'] = episode.title
item['icon']= episode.thumb
item['thumbnail']= episode.thumb
props = dict()
props.update(fanart_image = item['thumbnail'])
item['properties'] = props
if(episode.stream_type == F4M_TYPE):
item['path'] = plugin.url_for('playManifest',manifest=episode.manifest,title = episode.title)
item['is_playable'] = False
elif(episode.stream_type == M3U_TYPE):
item['path'] = episode.manifest
item['is_playable'] = True
items.append(item)
return items
@plugin.route('/show/channels',name="showChannels")
def showTvShowsChannels():
channels = get_section_channels(MODE_SHOWS)
items = []
for channel in channels:
print
'''
Start tv
'''
@plugin.route('/tv/channels',name="tvChannels")
def showTvChannels():
channels = get_section_channels(MODE_SHOWS)
currentGlobalChannels = channels
items = []
for channel in currentGlobalChannels:
item = dict()
item['label'] = channel.title
item['is_playable'] = False
if(len(channel.filterList) != 0):
item['path'] = plugin.url_for('showTvChannelFilters',idChannel=channel.id)
elif(len(channel.categoryList) != 0):
item['path'] = plugin.url_for('showTvChannelCategories',idChannel=channel.id)
else:
item['path'] = plugin.url_for('showTvSingleChannel',idChannel=channel.id)
items.append(item)
return items
@plugin.route('/tv/channel/<idChannel>/filter/<filter>',name="showTvSingleChannelFilter")
@plugin.route('/tv/channel/<idChannel>/category/<category>',name="showTvSingleChannelCategory")
@plugin.route('/tv/channel/<idChannel>',name="showTvSingleChannel")
def showTvSingleChannel(idChannel,filter = '',category = ''):
channelsElements = get_elements_from_channel(idChannel,MODE_SHOWS,filter,category)
items = []
for element in channelsElements:
item = dict()
item['label'] = element.title
item['is_playable'] = False
item['icon']= element.thumb
item['thumbnail']= element.thumb
item['path'] = plugin.url_for('showSingleTvItem',idItem = element.show_id)
items.append(item)
return items
@plugin.route('/tv/channel/<idChannel>/filters',name="showTvChannelFilters")
def showTvChannelFilters(idChannel):
items = []
channels = get_section_channels(MODE_SHOWS)
currentGlobalChannels = channels
for channel in currentGlobalChannels:
if(channel.id == idChannel):
for filter in channel.filterList:
item = dict()
item['label'] = str(filter)
item['is_playable'] = False
item['path'] = plugin.url_for('showTvSingleChannelFilter',idChannel=channel.id,filter = str(filter))
items.append(item)
return items
@plugin.route('/tv/channel/<idChannel>/categories',name="showTvChannelCategories")
def showTvChannelCategories(idChannel):
items = []
channels = get_section_channels(MODE_SHOWS)
currentGlobalChannels = channels
for channel in currentGlobalChannels:
if(channel.id == idChannel):
for category in channel.categoryList:
item = dict()
item['label'] = str(category.name)
item['is_playable'] = False
item['path'] = plugin.url_for('showTvSingleChannelCategory',idChannel=channel.id,category = str(category.id))
items.append(item)
return items
@plugin.route('/tv/item/<idItem>',name='showSingleTvItem')
def showSingleTvItem(idItem):
items = []
itemPlayable = get_item_playable(idItem)
if(len(itemPlayable.seasons) > 1):
for season in itemPlayable.seasons:
item = dict()
item['label'] = season.title
item['is_playable'] = False
item['path'] = plugin.url_for('showSingleTvItemSeason',idItem=idItem,seasonId = season.season_id)
items.append(item)
else:
episodes = itemPlayable.seasons[0].episodes
xbmcplugin.setContent(handleAddon, 'tvshows')
for episode in episodes:
item = dict()
item['label'] = episode.title
item['icon']= episode.thumb
item['thumbnail']= episode.thumb
props = dict()
props.update(fanart_image = item['thumbnail'])
item['properties'] = props
if(episode.stream_type == F4M_TYPE):
item['path'] = plugin.url_for('playManifest',manifest=episode.manifest,title = episode.title)
item['is_playable'] = False
elif(episode.stream_type == M3U_TYPE):
item['path'] = episode.manifest
item['is_playable'] = True
items.append(item)
return items
@plugin.route('/tv/item/<seasonId>/<idItem>',name='showSingleTvItemSeason')
def showSingleTvItemSeason(seasonId,idItem):
items = []
itemPlayable = get_item_playable(idItem)
xbmcplugin.setContent(handleAddon, 'tvshows')
for season in itemPlayable.seasons:
if(unicode(season.season_id) == seasonId):
for episode in season.episodes:
item = dict()
item['label'] = episode.title
item['icon']= episode.thumb
item['thumbnail']= episode.thumb
props = dict()
props.update(fanart_image = item['thumbnail'])
item['properties'] = props
if(episode.stream_type == F4M_TYPE):
item['path'] = plugin.url_for('playManifest',manifest=episode.manifest,title = episode.title)
item['is_playable'] = False
elif(episode.stream_type == M3U_TYPE):
item['path'] = episode.manifest
item['is_playable'] = True
items.append(item)
return items
'''
end tv
'''
'''
start anime
'''
@plugin.route('/anime/channels',name="animeChannels")
def showAnimeChannels():
channels = get_section_channels(MODE_ANIME)
currentGlobalChannels = channels
items = []
for channel in currentGlobalChannels:
item = dict()
item['label'] = channel.title
item['is_playable'] = False
if(len(channel.filterList) != 0):
item['path'] = plugin.url_for('showAnimeChannelFilters',idChannel=channel.id)
elif(len(channel.categoryList) != 0):
item['path'] = plugin.url_for('showAnimeChannelCategories',idChannel=channel.id)
else:
item['path'] = plugin.url_for('showAnimeSingleChannel',idChannel=channel.id)
items.append(item)
return items
@plugin.route('/anime/channel/<idChannel>/filter/<filter>',name="showAnimeSingleChannelFilter")
@plugin.route('/anime/channel/<idChannel>/category/<category>',name="showAnimeSingleChannelCategory")
@plugin.route('/anime/channel/<idChannel>',name="showAnimeSingleChannel")
def showAnimeSingleChannel(idChannel,filter = '',category = ''):
channelsElements = get_elements_from_channel(idChannel,MODE_ANIME,filter,category)
items = []
for element in channelsElements:
item = dict()
item['label'] = element.title
item['is_playable'] = False
item['icon']= element.thumb
item['thumbnail']= element.thumb
item['path'] = plugin.url_for('showSingleAnimeItem',idItem = element.show_id)
items.append(item)
return items
@plugin.route('/anime/channel/<idChannel>/filters',name="showAnimeChannelFilters")
def showAnimeChannelFilters(idChannel):
items = []
channels = get_section_channels(MODE_ANIME)
currentGlobalChannels = channels
for channel in currentGlobalChannels:
if(channel.id == idChannel):
for filter in channel.filterList:
item = dict()
item['label'] = str(filter)
item['is_playable'] = False
item['path'] = plugin.url_for('showAnimeSingleChannelFilter',idChannel=channel.id,filter = str(filter))
items.append(item)
return items
@plugin.route('/anime/channel/<idChannel>/categories',name="showAnimeChannelCategories")
def showAnimeChannelCategories(idChannel):
items = []
channels = get_section_channels(MODE_ANIME)
currentGlobalChannels = channels
for channel in currentGlobalChannels:
if(channel.id == idChannel):
for category in channel.categoryList:
item = dict()
item['label'] = str(category.name)
item['is_playable'] = False
item['path'] = plugin.url_for('showAnimeSingleChannelCategory',idChannel=channel.id,category = str(category.id))
items.append(item)
return items
@plugin.route('/anime/item/<idItem>',name='showSingleAnimeItem')
def showSingleAnimeItem(idItem):
items = []
itemPlayable = get_item_playable(idItem)
if(len(itemPlayable.seasons) > 1):
for season in itemPlayable.seasons:
item = dict()
item['label'] = season.title
item['is_playable'] = False
item['path'] = plugin.url_for('showSingleAnimeItemSeason',idItem=idItem,seasonId = season.season_id)
items.append(item)
else:
episodes = itemPlayable.seasons[0].episodes
xbmcplugin.setContent(handleAddon, 'tvshows')
for episode in episodes:
item = dict()
item['label'] = episode.title
item['icon']= episode.thumb
item['thumbnail']= episode.thumb
props = dict()
props.update(fanart_image = item['thumbnail'])
item['properties'] = props
if(episode.stream_type == F4M_TYPE):
item['path'] = plugin.url_for('playManifest',manifest=episode.manifest,title = episode.title)
item['is_playable'] = False
elif(episode.stream_type == M3U_TYPE):
item['path'] = episode.manifest
item['is_playable'] = True
items.append(item)
return items
@plugin.route('/anime/item/<seasonId>/<idItem>',name='showSingleAnimeItemSeason')
def showSingleAnimeItemSeason(seasonId,idItem):
items = []
itemPlayable = get_item_playable(idItem)
xbmcplugin.setContent(handleAddon, 'tvshows')
for season in itemPlayable.seasons:
if(unicode(season.season_id) == seasonId):
for episode in season.episodes:
item = dict()
item['label'] = episode.title
item['icon']= episode.thumb
item['thumbnail']= episode.thumb
props = dict()
props.update(fanart_image = item['thumbnail'])
item['properties'] = props
if(episode.stream_type == F4M_TYPE):
item['path'] = plugin.url_for('playManifest',manifest=episode.manifest,title = episode.title)
item['is_playable'] = False
elif(episode.stream_type == M3U_TYPE):
item['path'] = episode.manifest
item['is_playable'] = True
items.append(item)
return items
'''
end anime
'''
@plugin.route('/watch/<manifest>/<title>',name='playManifest')
def playManifest(manifest,title):
print manifest
print manifest
print manifest
print manifest
print manifest
print manifest
print manifest
player=f4mProxyHelper()
player.playF4mLink(manifest,title)
print
if __name__ == '__main__':
handleAddon = int(sys.argv[1])
xbmcplugin.setContent(handleAddon, 'files')
plugin.run()
"""
kwargs = {
'label': label,
'label2': label2,
'iconImage': icon,
'thumbnailImage': thumbnail,
'path': path,
}
"""