Skip to content

Commit fe28f55

Browse files
committed
implement RelatedPaginator watched/progress generically;
1 parent 93e8093 commit fe28f55

File tree

4 files changed

+10
-21
lines changed

4 files changed

+10
-21
lines changed

lib/windows/pagination.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# coding=utf-8
22
import kodigui
3+
from lib import util
34

45

56
class MLCPaginator(object):
@@ -189,4 +190,12 @@ def createListItem(self, rel):
189190
rel.title or '',
190191
thumbnailImage=rel.defaultThumb.asTranscodedImageURL(*self.parentWindow.RELATED_DIM),
191192
data_source=rel
192-
)
193+
)
194+
195+
def prepareListItem(self, data, mli):
196+
if data.type in ('season', 'show'):
197+
if not mli.dataSource.isWatched:
198+
mli.setProperty('unwatched.count', str(mli.dataSource.unViewedLeafCount))
199+
else:
200+
mli.setProperty('unwatched', not mli.dataSource.isWatched and '1' or '')
201+
mli.setProperty('progress', util.getProgressImage(mli.dataSource))

lib/windows/preplay.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ class RelatedPaginator(pagination.BaseRelatedPaginator):
2727
def getData(self, offset, amount):
2828
return self.parentWindow.video.getRelated(offset=offset, limit=amount)
2929

30-
def prepareListItem(self, data, mli):
31-
mli.setProperty('unwatched', not mli.dataSource.isWatched and '1' or '')
32-
mli.setProperty('progress', util.getProgressImage(mli.dataSource))
33-
3430

3531
class PrePlayWindow(kodigui.ControlledWindow, windowutils.UtilMixin):
3632
xmlFile = 'script-plex-pre_play.xml'

lib/windows/subitems.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ class RelatedPaginator(pagination.BaseRelatedPaginator):
2929
def getData(self, offset, amount):
3030
return self.parentWindow.mediaItem.getRelated(offset=offset, limit=amount)
3131

32-
def prepareListItem(self, data, mli):
33-
if data.type in ('show', 'season'):
34-
if not mli.dataSource.isWatched:
35-
mli.setProperty('unwatched.count', str(mli.dataSource.unViewedLeafCount))
36-
else:
37-
mli.setProperty('unwatched', not mli.dataSource.isWatched and '1' or '')
38-
mli.setProperty('progress', util.getProgressImage(mli.dataSource))
39-
4032

4133
class ShowWindow(kodigui.ControlledWindow, windowutils.UtilMixin):
4234
xmlFile = 'script-plex-seasons.xml'

lib/windows/videoplayer.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ def readyForPaging(self):
3030
def getData(self, offset, amount):
3131
return (self.parentWindow.prev or self.parentWindow.next).getRelated(offset=offset, limit=amount)
3232

33-
def prepareListItem(self, data, mli):
34-
if self.parentWindow.prev and self.parentWindow.prev.type == 'episode':
35-
if not mli.dataSource.isWatched:
36-
mli.setProperty('unwatched.count', str(mli.dataSource.unViewedLeafCount))
37-
else:
38-
mli.setProperty('unwatched', not mli.dataSource.isWatched and '1' or '')
39-
mli.setProperty('progress', util.getProgressImage(mli.dataSource))
40-
4133

4234
class OnDeckPaginator(pagination.MLCPaginator):
4335
def readyForPaging(self):

0 commit comments

Comments
 (0)