forked from Mnk3y/OLD-plugin.video.lastship-Eingestellt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlastship.py
475 lines (359 loc) · 14.3 KB
/
lastship.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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# -*- coding: UTF-8 -*-
"""
Lastship Add-on (C) 2019
Credits to Placenta and Covenant; our thanks go to their creators
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
# Addon Name: Lastship
# Addon id: plugin.video.lastship
# Addon Provider: LastShip
import urlparse,sys,urllib
params = dict(urlparse.parse_qsl(sys.argv[2].replace('?','')))
action = params.get('action')
name = params.get('name')
title = params.get('title')
year = params.get('year')
imdb = params.get('imdb')
tvdb = params.get('tvdb')
tmdb = params.get('tmdb')
season = params.get('season')
episode = params.get('episode')
tvshowtitle = params.get('tvshowtitle')
premiered = params.get('premiered')
url = params.get('url')
image = params.get('image')
meta = params.get('meta')
select = params.get('select')
query = params.get('query')
source = params.get('source')
content = params.get('content')
windowedtrailer = params.get('windowedtrailer')
windowedtrailer = int(windowedtrailer) if windowedtrailer in ("0","1") else 0
if action == None:
from resources.lib.modules import cache
from resources.lib.indexers import navigator
cache.cache_version_check()
navigator.navigator().root()
elif action == 'newsNavigator':
from resources.lib.indexers import navigator
navigator.navigator().news()
elif action == 'movieNavigator':
from resources.lib.indexers import navigator
navigator.navigator().movies()
elif action == 'movieliteNavigator':
from resources.lib.indexers import navigator
navigator.navigator().movies(lite=True)
elif action == 'mymovieNavigator':
from resources.lib.indexers import navigator
navigator.navigator().mymovies()
elif action == 'mymovieliteNavigator':
from resources.lib.indexers import navigator
navigator.navigator().mymovies(lite=True)
elif action == 'tvNavigator':
from resources.lib.indexers import navigator
navigator.navigator().tvshows()
elif action == 'tvliteNavigator':
from resources.lib.indexers import navigator
navigator.navigator().tvshows(lite=True)
elif action == 'mytvNavigator':
from resources.lib.indexers import navigator
navigator.navigator().mytvshows()
elif action == 'mytvliteNavigator':
from resources.lib.indexers import navigator
navigator.navigator().mytvshows(lite=True)
elif action == 'downloadNavigator':
from resources.lib.indexers import navigator
navigator.navigator().downloads()
elif action == 'libraryNavigator':
from resources.lib.indexers import navigator
navigator.navigator().library()
elif action == 'toolNavigator':
from resources.lib.indexers import navigator
navigator.navigator().tools()
elif action == 'searchNavigator':
from resources.lib.indexers import movies
from resources.lib.modules import control
from resources.lib.indexers import tvshows
import xbmcgui
if not control.setting('search.quick') == '0':
searchSelect = xbmcgui.Dialog().select("Suche",
[
"Filme",
"TV-Serien",
"Darsteller/Crew (Filme)",
"Darsteller/Crew (TV-Serien)"
])
if searchSelect == 0:
movies.movies().search()
movies.movies().search_new()
elif searchSelect == 1:
tvshows.tvshows().search()
tvshows.tvshows().search_new()
elif searchSelect == 2:
movies.movies().person()
elif searchSelect == 3:
tvshows.tvshows().person()
else:
pass
else:
from resources.lib.indexers import navigator
navigator.navigator().search()
elif action == 'viewsNavigator':
from resources.lib.indexers import navigator
navigator.navigator().views()
elif action == 'clearCache':
from resources.lib.indexers import navigator
navigator.navigator().clearCache()
elif action == 'clearCacheSearch':
from resources.lib.indexers import navigator
navigator.navigator().clearCacheSearch()
elif action == 'clearCacheAll':
from resources.lib.indexers import navigator
navigator.navigator().clearCacheAll()
elif action == 'clearCacheMeta':
from resources.lib.indexers import navigator
navigator.navigator().clearCacheMeta()
elif action == 'infoCheck':
from resources.lib.indexers import navigator
navigator.navigator().infoCheck('')
elif action == 'movies':
from resources.lib.indexers import movies
movies.movies().get(url)
elif action == 'moviePage':
from resources.lib.indexers import movies
movies.movies().get(url)
elif action == 'movieWidget':
from resources.lib.indexers import movies
movies.movies().widget()
elif action == 'movieSearch':
from resources.lib.indexers import movies
movies.movies().search()
elif action == 'movieSearchnew':
from resources.lib.indexers import movies
movies.movies().search_new()
elif action == 'movieSearchterm':
from resources.lib.indexers import movies
movies.movies().search_term(name)
elif action == 'moviePerson':
from resources.lib.indexers import movies
movies.movies().person()
elif action == 'movieGenres':
from resources.lib.indexers import movies
movies.movies().genres()
elif action == 'movieLanguages':
from resources.lib.indexers import movies
movies.movies().languages()
elif action == 'movieCertificates':
from resources.lib.indexers import movies
movies.movies().certifications()
elif action == 'movieAwards':
from resources.lib.indexers import movies
movies.movies().award()
elif action == 'movieYears':
from resources.lib.indexers import movies
movies.movies().years()
elif action == 'moviePersons':
from resources.lib.indexers import movies
movies.movies().persons(url)
elif action == 'movieUserlists':
from resources.lib.indexers import movies
movies.movies().userlists()
elif action == 'moviePostloadAndPlay':
from resources.lib.indexers import movies
movies.movies().LoadAndPlay(tmdb,meta)
elif action == 'tvshows':
from resources.lib.indexers import tvshows
tvshows.tvshows().get(url)
elif action == 'tvshowPage':
from resources.lib.indexers import tvshows
tvshows.tvshows().get(url)
elif action == 'tvSearch':
from resources.lib.indexers import tvshows
tvshows.tvshows().search()
elif action == 'tvSearchnew':
from resources.lib.indexers import tvshows
tvshows.tvshows().search_new()
elif action == 'tvSearchterm':
from resources.lib.indexers import tvshows
tvshows.tvshows().search_term(name)
elif action == 'tvPerson':
from resources.lib.indexers import tvshows
tvshows.tvshows().person()
elif action == 'tvGenres':
from resources.lib.indexers import tvshows
tvshows.tvshows().genres()
elif action == 'tvNetworks':
from resources.lib.indexers import tvshows
tvshows.tvshows().networks()
elif action == 'tvLanguages':
from resources.lib.indexers import tvshows
tvshows.tvshows().languages()
elif action == 'tvCertificates':
from resources.lib.indexers import tvshows
tvshows.tvshows().certifications()
elif action == 'tvAwards':
from resources.lib.indexers import tvshows
tvshows.tvshows().award()
elif action == 'tvPersons':
from resources.lib.indexers import tvshows
tvshows.tvshows().persons(url)
elif action == 'tvUserlists':
from resources.lib.indexers import tvshows
tvshows.tvshows().userlists()
elif action == 'seasons':
from resources.lib.indexers import episodes
episodes.seasons().get(tvshowtitle, year, imdb, tvdb)
elif action == 'episodes':
from resources.lib.indexers import episodes
episodes.episodes().get(tvshowtitle, year, imdb, tvdb, season, episode)
elif action == 'calendar':
from resources.lib.indexers import episodes
episodes.episodes().calendar(url)
elif action == 'tvWidget':
from resources.lib.indexers import episodes
episodes.episodes().widget()
elif action == 'calendars':
from resources.lib.indexers import episodes
episodes.episodes().calendars()
elif action == 'episodeUserlists':
from resources.lib.indexers import episodes
episodes.episodes().userlists()
elif action == 'refresh':
from resources.lib.modules import control
control.refresh()
elif action == 'queueItem':
from resources.lib.modules import control
control.queueItem()
elif action == 'openSettings':
from resources.lib.modules import control
control.openSettings()
elif action == 'artwork':
from resources.lib.modules import control
control.artwork()
elif action == 'addView':
from resources.lib.modules import views
views.addView(content)
elif action == 'moviePlaycount':
from resources.lib.modules import playcount
playcount.movies(imdb, query)
elif action == 'episodePlaycount':
from resources.lib.modules import playcount
playcount.episodes(imdb, tvdb, season, episode, query)
elif action == 'tvPlaycount':
from resources.lib.modules import playcount
playcount.tvshows(name, imdb, tvdb, season, query)
elif action == 'trailer':
from resources.lib.modules import trailer
trailer.trailer().play(name, url, windowedtrailer)
elif action == 'traktManager':
from resources.lib.modules import trakt
trakt.manager(name, imdb, tvdb, content)
elif action == 'authTrakt':
from resources.lib.modules import trakt
trakt.authTrakt()
elif action == 'urlResolver':
try: import urlresolver
except: pass
urlresolver.display_settings()
elif action == 'download':
from resources.lib.modules import downloader
from resources.lib.modules import sources
import json
try: downloader.download(name, image, sources.sources().sourcesResolve(json.loads(source)[0], True))
except: pass
elif action == 'play':
from resources.lib.modules import sources
sources.sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select)
elif action == 'addItem':
from resources.lib.modules import sources
sources.sources().addItem(title)
elif action == 'playItem':
from resources.lib.modules import sources
sources.sources().playItem(title, source)
elif action == 'alterSources':
from resources.lib.modules import sources
sources.sources().alterSources(url, meta)
elif action == 'clearSources':
from resources.lib.modules import sources
sources.sources().clearSources()
elif action == 'random':
from resources.lib.indexers import movies
from resources.lib.indexers import episodes
from resources.lib.indexers import tvshows
from resources.lib.modules import control
rtype = params.get('rtype')
if rtype == 'movie':
rlist = movies.movies().get(url, create_directory=False)
r = sys.argv[0]+"?action=play"
elif rtype == 'episode':
rlist = episodes.episodes().get(tvshowtitle, year, imdb, tvdb, season, create_directory=False)
r = sys.argv[0]+"?action=play"
elif rtype == 'season':
rlist = episodes.seasons().get(tvshowtitle, year, imdb, tvdb, create_directory=False)
r = sys.argv[0]+"?action=random&rtype=episode"
elif rtype == 'show':
rlist = tvshows.tvshows().get(url, create_directory=False)
r = sys.argv[0]+"?action=random&rtype=season"
from random import randint
import json
try:
rand = randint(1,len(rlist))-1
for p in ['title','year','imdb','tvdb','season','episode','tvshowtitle','premiered','select']:
if rtype == "show" and p == "tvshowtitle":
try: r += '&'+p+'='+urllib.quote_plus(rlist[rand]['title'])
except: pass
else:
try: r += '&'+p+'='+urllib.quote_plus(rlist[rand][p])
except: pass
try: r += '&meta='+urllib.quote_plus(json.dumps(rlist[rand]))
except: r += '&meta='+urllib.quote_plus("{}")
if rtype == "movie":
try: control.infoDialog(rlist[rand]['title'], "Spiele", time=30000)
except: pass
elif rtype == "episode":
try: control.infoDialog(rlist[rand]['tvshowtitle']+" - Season "+rlist[rand]['season']+" - "+rlist[rand]['title'], "Spiele", time=30000)
except: pass
control.execute('RunPlugin(%s)' % r)
except:
control.infoDialog("Nichts gefunden zum Abspielen", time=8000)
elif action == 'movieToLibrary':
from resources.lib.modules import libtools
libtools.libmovies().add(name, title, year, imdb, tmdb)
elif action == 'moviesToLibrary':
from resources.lib.modules import libtools
libtools.libmovies().range(url)
elif action == 'moviesToLibrarySilent':
from resources.lib.modules import libtools
libtools.libmovies().silent(url)
elif action == 'tvshowToLibrary':
from resources.lib.modules import libtools
libtools.libtvshows().add(tvshowtitle, year, imdb, tvdb)
elif action == 'tvshowsToLibrary':
from resources.lib.modules import libtools
libtools.libtvshows().range(url)
elif action == 'tvshowsToLibrarySilent':
from resources.lib.modules import libtools
libtools.libtvshows().silent(url)
elif action == 'updateLibrary':
from resources.lib.modules import libtools
libtools.libepisodes().update(query)
elif action == 'service':
from resources.lib.modules import libtools
libtools.libepisodes().service()
elif action == 'devUpdateNavigator':
from resources.lib.modules import updateManager
updateManager.updateLastShip()
elif action == 'showFaultyProvider':
from resources.lib.modules import source_faultlog as faultlog
from resources.lib.modules import control
infoString = faultlog.getFaultInfoString()
control.dialog.ok("Faulty Providers",infoString)