This repository has been archived by the owner on May 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
windows.py
646 lines (586 loc) · 25.2 KB
/
windows.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
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
# -*- coding: utf-8 -*-
#
import xbmc,xbmcaddon,xbmcgui
from utilities import *
from rating import *
__author__ = "Ralph-Gordon Paul, Adrian Cowan"
__credits__ = ["Ralph-Gordon Paul", "Adrian Cowan", "Justin Nemeth", "Sean Rudford"]
__license__ = "GPL"
__maintainer__ = "Ralph-Gordon Paul"
__email__ = "[email protected]"
__status__ = "Production"
# read settings
__settings__ = xbmcaddon.Addon( "script.traktutilities" )
__language__ = __settings__.getLocalizedString
BACKGROUND = 102
TITLE = 103
OVERVIEW = 104
POSTER = 105
PLAY_BUTTON = 106
YEAR = 107
RUNTIME = 108
TAGLINE = 109
MOVIE_LIST = 110
TVSHOW_LIST = 110
RATING = 111
WATCHERS = 112
RATE_SCENE = 98
RATE_TITLE = 100
RATE_CUR_NO_RATING = 101
RATE_CUR_LOVE = 102
RATE_CUR_HATE = 103
RATE_SKIP_RATING = 104
RATE_LOVE_BTN = 105
RATE_HATE_BTN = 106
RATE_RATE_SHOW_BG = 107
RATE_RATE_SHOW_BTN = 108
#get actioncodes from keymap.xml
ACTION_PARENT_DIRECTORY = 9
ACTION_PREVIOUS_MENU = 10
ACTION_SELECT_ITEM = 7
ACTION_CONTEXT_MENU = 117
class MoviesWindow(xbmcgui.WindowXML):
movies = None
type = 'basic'
def initWindow(self, movies, type):
self.movies = movies
self.type = type
def onInit(self):
self.getControl(MOVIE_LIST).reset()
if self.movies != None:
for movie in self.movies:
li = xbmcgui.ListItem(movie['title'], '', movie['images']['poster'])
if not ('idMovie' in movie):
movie['idMovie'] = getMovieIdFromXBMC(movie['imdb_id'], movie['title'])
if movie['idMovie'] != -1:
li.setProperty('Available','true')
if self.type <> 'watchlist':
if 'watchlist' in movie:
if movie['watchlist']:
li.setProperty('Watchlist','true')
self.getControl(MOVIE_LIST).addItem(li)
self.setFocus(self.getControl(MOVIE_LIST))
self.listUpdate()
else:
Debug("MoviesWindow: Error: movies array is empty")
self.close()
def listUpdate(self):
try:
current = self.getControl(MOVIE_LIST).getSelectedPosition()
except TypeError:
return # ToDo: error output
try:
self.getControl(BACKGROUND).setImage(self.movies[current]['images']['fanart'])
except KeyError:
Debug("KeyError for Backround")
except TypeError:
Debug("TypeError for Backround")
try:
self.getControl(TITLE).setLabel(self.movies[current]['title'])
except KeyError:
Debug("KeyError for Title")
self.getControl(TITLE).setLabel("")
except TypeError:
Debug("TypeError for Title")
try:
self.getControl(OVERVIEW).setText(self.movies[current]['overview'])
except KeyError:
Debug("KeyError for Overview")
self.getControl(OVERVIEW).setText("")
except TypeError:
Debug("TypeError for Overview")
try:
self.getControl(YEAR).setLabel("Year: " + str(self.movies[current]['year']))
except KeyError:
Debug("KeyError for Year")
self.getControl(YEAR).setLabel("")
except TypeError:
Debug("TypeError for Year")
try:
self.getControl(RUNTIME).setLabel("Runtime: " + str(self.movies[current]['runtime']) + " Minutes")
except KeyError:
Debug("KeyError for Runtime")
self.getControl(RUNTIME).setLabel("")
except TypeError:
Debug("TypeError for Runtime")
try:
if self.movies[current]['tagline'] <> "":
self.getControl(TAGLINE).setLabel("\""+self.movies[current]['tagline']+"\"")
else:
self.getControl(TAGLINE).setLabel("")
except KeyError:
Debug("KeyError for Tagline")
self.getControl(TAGLINE).setLabel("")
except TypeError:
Debug("TypeError for Tagline")
try:
self.getControl(RATING).setLabel("Rating: " + self.movies[current]['certification'])
except KeyError:
Debug("KeyError for Rating")
self.getControl(RATING).setLabel("")
except TypeError:
Debug("TypeError for Rating")
if 'watchers' in self.movies[current]:
try:
self.getControl(WATCHERS).setLabel(str(self.movies[current]['watchers']) + " people watching")
except KeyError:
Debug("KeyError for Watchers")
self.getControl(WATCHERS).setLabel("")
except TypeError:
Debug("TypeError for Watchers")
def onFocus( self, controlId ):
self.controlId = controlId
def showContextMenu(self):
movie = self.movies[self.getControl(MOVIE_LIST).getSelectedPosition()]
li = self.getControl(MOVIE_LIST).getSelectedItem()
options = []
actions = []
if movie['idMovie'] != -1:
options.append("Play")
actions.append('play')
if self.type <> 'watchlist':
if 'watchlist' in movie:
if movie['watchlist']:
options.append("Remove from watchlist")
actions.append('unwatchlist')
else:
options.append("Add to watchlist")
actions.append('watchlist')
else:
options.append("Remove from watchlist")
actions.append('unwatchlist')
options.append("Rate")
actions.append('rate')
select = xbmcgui.Dialog().select(movie['title']+" - "+str(movie['year']), options)
if select != -1:
Debug("Select: " + actions[select])
if select == -1:
Debug ("menu quit by user")
return
elif actions[select] == 'play':
playMovieById(movie['idMovie'])
elif actions[select] == 'unwatchlist':
if removeMoviesFromWatchlist([movie]) == None:
notification("Trakt Utilities", __language__(1311).encode( "utf-8", "ignore" )) # Failed to remove from watch-list
else:
notification("Trakt Utilities", __language__(1312).encode( "utf-8", "ignore" )) # Successfully removed from watch-list
li.setProperty('Watchlist','false')
movie['watchlist'] = False;
elif actions[select] == 'watchlist':
if addMoviesToWatchlist([movie]) == None:
notification("Trakt Utilities", __language__(1309).encode( "utf-8", "ignore" )) # Failed to added to watch-list
else:
notification("Trakt Utilities", __language__(1310).encode( "utf-8", "ignore" )) # Successfully added to watch-list
li.setProperty('Watchlist','true')
movie['watchlist'] = True;
elif actions[select] == 'rate':
doRateMovie(imdbid=movie['imdb_id'], title=movie['title'], year=movie['year'])
def onAction(self, action):
if action.getId() == 0:
return
if action.getId() in (ACTION_PARENT_DIRECTORY, ACTION_PREVIOUS_MENU):
Debug("Closing MoviesWindow")
self.close()
elif action.getId() in (1,2,107):
self.listUpdate()
elif action.getId() == ACTION_SELECT_ITEM:
movie = self.movies[self.getControl(MOVIE_LIST).getSelectedPosition()]
if movie['idMovie'] == -1: # Error
xbmcgui.Dialog().ok("Trakt Utilities", movie['title'].encode( "utf-8", "ignore" ) + " " + __language__(1162).encode( "utf-8", "ignore" )) # "moviename" not found in your XBMC Library
else:
playMovieById(movie['idMovie'])
elif action.getId() == ACTION_CONTEXT_MENU:
self.showContextMenu()
else:
Debug("Uncaught action (movies): "+str(action.getId()))
class MovieWindow(xbmcgui.WindowXML):
movie = None
def initWindow(self, movie):
self.movie = movie
def onInit(self):
if self.movie != None:
try:
self.getControl(BACKGROUND).setImage(self.movie['images']['fanart'])
except KeyError:
Debug("KeyError for Backround")
except TypeError:
Debug("TypeError for Backround")
try:
self.getControl(POSTER).setImage(self.movie['images']['poster'])
except KeyError:
Debug("KeyError for Poster")
except TypeError:
Debug("TypeError for Poster")
try:
self.getControl(TITLE).setLabel(self.movie['title'])
except KeyError:
Debug("KeyError for Title")
except TypeError:
Debug("TypeError for Title")
try:
self.getControl(OVERVIEW).setText(self.movie['overview'])
except KeyError:
Debug("KeyError for Overview")
except TypeError:
Debug("TypeError for Overview")
try:
self.getControl(YEAR).setLabel("Year: " + str(self.movie['year']))
except KeyError:
Debug("KeyError for Year")
except TypeError:
Debug("TypeError for Year")
try:
self.getControl(RUNTIME).setLabel("Runtime: " + str(self.movie['runtime']) + " Minutes")
except KeyError:
Debug("KeyError for Runtime")
except TypeError:
Debug("TypeError for Runtime")
try:
self.getControl(TAGLINE).setLabel(self.movie['tagline'])
except KeyError:
Debug("KeyError for Runtime")
except TypeError:
Debug("TypeError for Runtime")
try:
self.playbutton = self.getControl(PLAY_BUTTON)
self.setFocus(self.playbutton)
except (KeyError,TypeError):
pass
def onFocus( self, controlId ):
self.controlId = controlId
def onClick(self, controlId):
if controlId == PLAY_BUTTON:
pass
def onAction(self, action):
buttonCode = action.getButtonCode()
actionID = action.getId()
if action.getId() == 0:
return
if action.getId() in (ACTION_PARENT_DIRECTORY, ACTION_PREVIOUS_MENU):
Debug("Closing MovieInfoWindow")
self.close()
else:
Debug("Uncaught action (movie info): "+str(action.getId()))
class TVShowsWindow(xbmcgui.WindowXML):
tvshows = None
type = 'basic'
def initWindow(self, tvshows, type):
self.tvshows = tvshows
self.type = type
def onInit(self):
if self.tvshows != None:
for tvshow in self.tvshows:
li = xbmcgui.ListItem(tvshow['title'], '', tvshow['images']['poster'])
if not ('idShow' in tvshow):
tvshow['idShow'] = getShowIdFromXBMC(tvshow['tvdb_id'], tvshow['title'])
if tvshow['idShow'] != -1:
li.setProperty('Available','true')
if self.type <> 'watchlist':
if 'watchlist' in tvshow:
if tvshow['watchlist']:
li.setProperty('Watchlist','true')
self.getControl(TVSHOW_LIST).addItem(li)
self.setFocus(self.getControl(TVSHOW_LIST))
self.listUpdate()
else:
Debug("TVShowsWindow: Error: tvshows array is empty")
self.close()
def onFocus( self, controlId ):
self.controlId = controlId
def listUpdate(self):
try:
current = self.getControl(TVSHOW_LIST).getSelectedPosition()
except TypeError:
return # ToDo: error output
try:
self.getControl(BACKGROUND).setImage(self.tvshows[current]['images']['fanart'])
except KeyError:
Debug("KeyError for Backround")
except TypeError:
Debug("TypeError for Backround")
try:
self.getControl(TITLE).setLabel(self.tvshows[current]['title'])
except KeyError:
Debug("KeyError for Title")
self.getControl(TITLE).setLabel("")
except TypeError:
Debug("TypeError for Title")
try:
self.getControl(OVERVIEW).setText(self.tvshows[current]['overview'])
except KeyError:
Debug("KeyError for Overview")
self.getControl(OVERVIEW).setText("")
except TypeError:
Debug("TypeError for Overview")
try:
self.getControl(YEAR).setLabel("Year: " + str(self.tvshows[current]['year']))
except KeyError:
Debug("KeyError for Year")
self.getControl(YEAR).setLabel("")
except TypeError:
Debug("TypeError for Year")
try:
self.getControl(RUNTIME).setLabel("Runtime: " + str(self.tvshows[current]['runtime']) + " Minutes")
except KeyError:
Debug("KeyError for Runtime")
self.getControl(RUNTIME).setLabel("")
except TypeError:
Debug("TypeError for Runtime")
try:
self.getControl(TAGLINE).setLabel(str(self.tvshows[current]['tagline']))
except KeyError:
Debug("KeyError for Tagline")
self.getControl(TAGLINE).setLabel("")
except TypeError:
Debug("TypeError for Tagline")
try:
self.getControl(RATING).setLabel("Rating: " + self.tvshows[current]['certification'])
except KeyError:
Debug("KeyError for Rating")
self.getControl(RATING).setLabel("")
except TypeError:
Debug("TypeError for Rating")
if self.type == 'trending':
try:
self.getControl(WATCHERS).setLabel(str(self.tvshows[current]['watchers']) + " people watching")
except KeyError:
Debug("KeyError for Watchers")
self.getControl(WATCHERS).setLabel("")
except TypeError:
Debug("TypeError for Watchers")
def showContextMenu(self):
show = self.tvshows[self.getControl(TVSHOW_LIST).getSelectedPosition()]
li = self.getControl(TVSHOW_LIST).getSelectedItem()
options = []
actions = []
if self.type <> 'watchlist':
if 'watchlist' in show:
if show['watchlist']:
options.append("Remove from watchlist")
actions.append('unwatchlist')
else:
options.append("Add to watchlist")
actions.append('watchlist')
else:
options.append("Add to watchlist")
actions.append('watchlist')
else:
options.append("Remove from watchlist")
actions.append('unwatchlist')
options.append("Rate")
actions.append('rate')
select = xbmcgui.Dialog().select(show['title'], options)
if select != -1:
Debug("Select: " + actions[select])
if select == -1:
Debug ("menu quit by user")
return
elif actions[select] == 'play':
xbmcgui.Dialog().ok("Trakt Utilities", "comming soon")
elif actions[select] == 'unwatchlist':
if removeTVShowsFromWatchlist([show]) == None:
notification("Trakt Utilities", __language__(1311).encode( "utf-8", "ignore" )) # Failed to remove from watch-list
else:
notification("Trakt Utilities", __language__(1312).encode( "utf-8", "ignore" )) # Successfully removed from watch-list
li.setProperty('Watchlist','false')
show['watchlist'] = False;
elif actions[select] == 'watchlist':
if addTVShowsToWatchlist([show]) == None:
notification("Trakt Utilities", __language__(1309).encode( "utf-8", "ignore" )) # Failed to added to watch-list
else:
notification("Trakt Utilities", __language__(1310).encode( "utf-8", "ignore" )) # Successfully added to watch-list
li.setProperty('Watchlist','true')
show['watchlist'] = True;
elif actions[select] == 'rate':
rateShow = RateShowDialog("rate.xml", __settings__.getAddonInfo('path'), "Default")
rateShow.initDialog(show['tvdb_id'], show['title'], show['year'], getShowRatingFromTrakt(show['tvdb_id'], show['title'], show['year']))
rateShow.doModal()
del rateShow
def onAction(self, action):
if action.getId() == 0:
return
if action.getId() in (ACTION_PARENT_DIRECTORY, ACTION_PREVIOUS_MENU):
Debug("Closing TV Shows Window")
self.close()
elif action.getId() in (1,2,107):
self.listUpdate()
elif action.getId() == ACTION_SELECT_ITEM:
pass # do something here ?
elif action.getId() == ACTION_CONTEXT_MENU:
self.showContextMenu()
else:
Debug("Uncaught action (tv shows): "+str(action.getId()))
class RateMovieDialog(xbmcgui.WindowXMLDialog):
def initDialog(self, imdbid, title, year, curRating):
self.imdbid = imdbid
self.title = title
self.year = year
self.curRating = curRating
if self.curRating <> "love" and self.curRating <> "hate": self.curRating = None
def onInit(self):
self.getControl(RATE_TITLE).setLabel(__language__(1303).encode( "utf-8", "ignore" )) # How would you rate that movie?
self.getControl(RATE_RATE_SHOW_BG).setVisible(False)
self.getControl(RATE_RATE_SHOW_BTN).setVisible(False)
self.getControl(RATE_CUR_NO_RATING).setEnabled(False)
self.setFocus(self.getControl(RATE_SKIP_RATING))
self.updateRatedButton();
return
def onFocus( self, controlId ):
self.controlId = controlId
def onClick(self, controlId):
if controlId == RATE_LOVE_BTN:
self.curRating = "love"
self.updateRatedButton()
rateMovieOnTrakt(self.imdbid, self.title, self.year, "love")
self.close()
return
elif controlId == RATE_HATE_BTN:
self.curRating = "hate"
self.updateRatedButton()
rateMovieOnTrakt(self.imdbid, self.title, self.year, "hate")
self.close()
return
elif controlId == RATE_SKIP_RATING:
self.close()
return
elif controlId in (RATE_CUR_LOVE, RATE_CUR_HATE): #unrate clicked
self.curRating = None
self.updateRatedButton()
rateMovieOnTrakt(self.imdbid, self.title, self.year, "unrate")
return
else:
Debug("Uncaught click (rate movie dialog): "+str(controlId))
def onAction(self, action):
buttonCode = action.getButtonCode()
actionID = action.getId()
if action.getId() in (0, 107):
return
if action.getId() in (ACTION_PARENT_DIRECTORY, ACTION_PREVIOUS_MENU):
Debug("Closing RateMovieDialog")
self.close()
else:
Debug("Uncaught action (rate movie dialog): "+str(action.getId()))
def updateRatedButton(self):
self.getControl(RATE_CUR_NO_RATING).setVisible(False if self.curRating <> None else True)
self.getControl(RATE_CUR_LOVE).setVisible(False if self.curRating <> "love" else True)
self.getControl(RATE_CUR_HATE).setVisible(False if self.curRating <> "hate" else True)
class RateEpisodeDialog(xbmcgui.WindowXMLDialog):
def initDialog(self, tvdbid, title, year, season, episode, curRating):
self.tvdbid = tvdbid
self.title = title
self.year = year
self.season = season
self.episode = episode
self.curRating = curRating
if self.curRating <> "love" and self.curRating <> "hate": self.curRating = None
def onInit(self):
self.getControl(RATE_TITLE).setLabel(__language__(1304).encode( "utf-8", "ignore" )) # How would you rate that episode?
self.getControl(RATE_RATE_SHOW_BTN).setLabel(__language__(1305).encode( "utf-8", "ignore" )) # Rate whole show
self.getControl(RATE_CUR_NO_RATING).setEnabled(False)
self.setFocus(self.getControl(RATE_SKIP_RATING))
self.updateRatedButton();
return
def onFocus( self, controlId ):
self.controlId = controlId
def onClick(self, controlId):
if controlId == RATE_LOVE_BTN:
self.curRating = "love"
self.updateRatedButton()
rateEpisodeOnTrakt(self.tvdbid, self.title, self.year, self.season, self.episode, "love")
self.close()
return
elif controlId == RATE_HATE_BTN:
self.curRating = "hate"
self.updateRatedButton()
rateEpisodeOnTrakt(self.tvdbid, self.title, self.year, self.season, self.episode, "hate")
self.close()
return
elif controlId == RATE_SKIP_RATING:
self.close()
return
elif controlId in (RATE_CUR_LOVE, RATE_CUR_HATE): #unrate clicked
self.curRating = None
self.updateRatedButton();
rateEpisodeOnTrakt(self.tvdbid, self.title, self.year, self.season, self.episode, "unrate")
return
elif controlId == RATE_RATE_SHOW_BTN:
self.getControl(RATE_RATE_SHOW_BG).setVisible(False)
self.getControl(RATE_RATE_SHOW_BTN).setVisible(False)
self.setFocus(self.getControl(RATE_SKIP_RATING))
rateShow = RateShowDialog("rate.xml", __settings__.getAddonInfo('path'), "Default")
rateShow.initDialog(self.tvdbid, self.title, self.year, getShowRatingFromTrakt(self.tvdbid, self.title, self.year))
rateShow.doModal()
del rateShow
else:
Debug("Uncaught click (rate episode dialog): "+str(controlId))
def onAction(self, action):
buttonCode = action.getButtonCode()
actionID = action.getId()
if action.getId() in (0, 107):
return
if action.getId() in (ACTION_PARENT_DIRECTORY, ACTION_PREVIOUS_MENU):
Debug("Closing RateEpisodeDialog")
self.close()
else:
Debug("Uncaught action (rate episode dialog): "+str(action.getId()))
def updateRatedButton(self):
self.getControl(RATE_CUR_NO_RATING).setVisible(False if self.curRating <> None else True)
self.getControl(RATE_CUR_LOVE).setVisible(False if self.curRating <> "love" else True)
self.getControl(RATE_CUR_HATE).setVisible(False if self.curRating <> "hate" else True)
class RateShowDialog(xbmcgui.WindowXMLDialog):
def initDialog(self, tvdbid, title, year, curRating):
self.tvdbid = tvdbid
self.title = title
self.year = year
self.curRating = curRating
if self.curRating <> "love" and self.curRating <> "hate": self.curRating = None
def onInit(self):
self.getControl(RATE_TITLE).setLabel(__language__(1306).encode( "utf-8", "ignore" )) # How would you rate that show?
self.getControl(RATE_SCENE).setVisible(False)
self.getControl(RATE_RATE_SHOW_BG).setVisible(False)
self.getControl(RATE_RATE_SHOW_BTN).setVisible(False)
self.getControl(RATE_CUR_NO_RATING).setEnabled(False)
self.setFocus(self.getControl(RATE_SKIP_RATING))
self.updateRatedButton();
return
def onFocus( self, controlId ):
self.controlId = controlId
def onClick(self, controlId):
if controlId == RATE_LOVE_BTN:
self.curRating = "love"
self.updateRatedButton()
rateShowOnTrakt(self.tvdbid, self.title, self.year, "love")
self.close()
return
elif controlId == RATE_HATE_BTN:
self.curRating = "hate"
self.updateRatedButton()
rateShowOnTrakt(self.tvdbid, self.title, self.year, "hate")
self.close()
return
elif controlId == RATE_SKIP_RATING:
self.close()
return
elif controlId in (RATE_CUR_LOVE, RATE_CUR_HATE): #unrate clicked
self.curRating = None
self.updateRatedButton();
rateShowOnTrakt(self.tvdbid, self.title, self.year, "unrate")
return
elif controlId == RATE_RATE_SHOW_BTN:
return
else:
Debug("Uncaught click (rate show dialog): "+str(controlId))
def onAction(self, action):
buttonCode = action.getButtonCode()
actionID = action.getId()
if action.getId() in (0, 107):
return
if action.getId() in (ACTION_PARENT_DIRECTORY, ACTION_PREVIOUS_MENU):
Debug("Closing RateShowDialog")
self.close()
else:
Debug("Uncaught action (rate show dialog): "+str(action.getId()))
def updateRatedButton(self):
self.getControl(RATE_CUR_NO_RATING).setVisible(False if self.curRating <> None else True)
self.getControl(RATE_CUR_LOVE).setVisible(False if self.curRating <> "love" else True)
self.getControl(RATE_CUR_HATE).setVisible(False if self.curRating <> "hate" else True)