Skip to content

Commit

Permalink
add option to hide plot for unwatched items
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnKaijser committed Feb 15, 2013
1 parent a5e5b56 commit 0d59352
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
4 changes: 3 additions & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.skin.widgets" name="Skin Widgets" version="0.0.20" provider-name="Martijn">
<addon id="service.skin.widgets" name="Skin Widgets" version="0.0.21" provider-name="Martijn">
<requires>
<import addon="xbmc.addon" version="12.0.0"/>
<import addon="xbmc.json" version="6.0.0"/>
Expand Down Expand Up @@ -43,5 +43,7 @@
<description lang="sv">Skal widgetar</description>
<description lang="zh">皮肤微件</description>
<platform>all</platform>
<forum>http://forum.xbmc.org/showthread.php?tid=142389</forum>
<source>https://github.com/XBMC-Addons/service.skin.widgets</source>
</extension>
</addon>
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v0.0.21
- Add option to hide plot for unwatched items

v0.0.20
- Use proper Runtime
- Catch bad JSON results
Expand Down
28 changes: 25 additions & 3 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
__addonversion__ = __addon__.getAddonInfo('version')
__addonid__ = __addon__.getAddonInfo('id')
__addonname__ = __addon__.getAddonInfo('name')
__localize__ = __addon__.getLocalizedString

def log(txt):
message = '%s: %s' % (__addonname__, txt.encode('ascii', 'ignore'))
Expand Down Expand Up @@ -86,6 +87,7 @@ def _init_property(self):
self.WINDOW.setProperty('SkinWidgets_RandomItems_Update', 'false')
self.RANDOMITEMS_UPDATE_METHOD = int(__addon__.getSetting("randomitems_method"))
self.RECENTITEMS_HOME_UPDATE = __addon__.getSetting("recentitems_homeupdate")
self.PLOT_ENABLE = __addon__.getSetting("plot_enable") == 'true'
# convert time to seconds, times 2 for 0,5 second sleep compensation
self.RANDOMITEMS_TIME = int(float(__addon__.getSetting("randomitems_time"))) * 60 * 2

Expand Down Expand Up @@ -168,6 +170,10 @@ def _fetch_movies(self, request):
watched = "true"
else:
watched = "false"
if not self.PLOT_ENABLE and watched == "false":
plot = __localize__(32014)
else:
plot = item['plot']
art = item['art']
path = media_path(item['file'])
play = 'XBMC.RunScript(' + __addonid__ + ',movieid=' + str(item.get('movieid')) + ')'
Expand All @@ -177,7 +183,7 @@ def _fetch_movies(self, request):
self.WINDOW.setProperty("%s.%d.Year" % (request, count), str(item['year']))
self.WINDOW.setProperty("%s.%d.Genre" % (request, count), " / ".join(item['genre']))
self.WINDOW.setProperty("%s.%d.Studio" % (request, count), item['studio'][0])
self.WINDOW.setProperty("%s.%d.Plot" % (request, count), item['plot'])
self.WINDOW.setProperty("%s.%d.Plot" % (request, count), plot)
self.WINDOW.setProperty("%s.%d.PlotOutline" % (request, count), item['plotoutline'])
self.WINDOW.setProperty("%s.%d.Tagline" % (request, count), item['tagline'])
self.WINDOW.setProperty("%s.%d.Runtime" % (request, count), str(int((item['runtime'] / 60) + 0.5)))
Expand Down Expand Up @@ -235,6 +241,14 @@ def _fetch_tvshows_recommended(self, request):
else:
resume = "false"
played = '0%'
if item2['playcount'] >= 1:
watched = "true"
else:
watched = "false"
if not self.PLOT_ENABLE and watched == "false":
plot = __localize__(32014)
else:
plot = item['plot']
art = item['art']
path = media_path(item['file'])
play = 'XBMC.RunScript(' + __addonid__ + ',episodeid=' + str(item2.get('episodeid')) + ')'
Expand All @@ -244,7 +258,7 @@ def _fetch_tvshows_recommended(self, request):
self.WINDOW.setProperty("%s.%d.Episode" % (request, count), episode)
self.WINDOW.setProperty("%s.%d.EpisodeNo" % (request, count), episodeno)
self.WINDOW.setProperty("%s.%d.Season" % (request, count), season)
self.WINDOW.setProperty("%s.%d.Plot" % (request, count), item2['plot'])
self.WINDOW.setProperty("%s.%d.Plot" % (request, count), plot)
self.WINDOW.setProperty("%s.%d.TVshowTitle" % (request, count), item2['showtitle'])
self.WINDOW.setProperty("%s.%d.Rating" % (request, count), rating)
self.WINDOW.setProperty("%s.%d.Runtime" % (request, count), str(int((item2['runtime'] / 60) + 0.5)))
Expand Down Expand Up @@ -313,6 +327,14 @@ def _fetch_tvshows(self, request):
else:
resume = "false"
played = '0%'
if item['playcount'] >= 1:
watched = "true"
else:
watched = "false"
if not self.PLOT_ENABLE and watched == "false":
plot = __localize__(32014)
else:
plot = item['plot']
art = item['art']
path = media_path(item['file'])
play = 'XBMC.RunScript(' + __addonid__ + ',episodeid=' + str(item.get('episodeid')) + ')'
Expand All @@ -322,7 +344,7 @@ def _fetch_tvshows(self, request):
self.WINDOW.setProperty("%s.%d.Episode" % (request, count), episode)
self.WINDOW.setProperty("%s.%d.EpisodeNo" % (request, count), episodeno)
self.WINDOW.setProperty("%s.%d.Season" % (request, count), season)
self.WINDOW.setProperty("%s.%d.Plot" % (request, count), item['plot'])
self.WINDOW.setProperty("%s.%d.Plot" % (request, count), plot)
self.WINDOW.setProperty("%s.%d.TVshowTitle" % (request, count), item['showtitle'])
self.WINDOW.setProperty("%s.%d.Rating" % (request, count), rating)
self.WINDOW.setProperty("%s.%d.Runtime" % (request, count), str(int((item['runtime'] / 60) + 0.5)))
Expand Down
12 changes: 12 additions & 0 deletions resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,15 @@ msgstr ""
msgctxt "#32011"
msgid "Only unplayed and unfinished"
msgstr ""

msgctxt "#32012"
msgid "General"
msgstr ""

msgctxt "#32013"
msgid "Show plot for unwatched items"
msgstr ""

msgctxt "#32014"
msgid "* Hidden to prevent spoilers *"
msgstr ""
3 changes: 3 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<settings>
<category label="32012">
<setting label="32013" type="bool" id="plot_enable" default="true"/>
</category>
<category label="32001">
<setting label="32001" type="bool" id="recommended_enable" default="true"/>
</category>
Expand Down

0 comments on commit 0d59352

Please sign in to comment.