The branch, eden-pre has been updated
via e25884cc531a6336ccea86a8d76829f2e3a14040 (commit)
via a45b758f3e21ad7d7e9ca0183183a240c83c5582 (commit)
via b4e168ac43b79a075a099969a91a0a61f329dd74 (commit)
from d3aac994eadf29fc75864f01b374fd8f2b26b418 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=e25884cc531a6336ccea86a8d76829f2e3a14040
commit e25884cc531a6336ccea86a8d76829f2e3a14040
Author: spiff <[email protected]>
Date: Sun Jan 1 18:40:57 2012 +0100
[plugin.video.gametest.dk] updated to version 2.0.0
diff --git a/.gitignore b/.gitignore
index 9ba7dd0..34ed9d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,3 +60,6 @@ plugin.video.borsentv.dk/.git/
plugin.audio.dr.dk.netradio/.git
plugin.audio.dr.dk.netradio/.idea
plugin.video.revision3/.git/
+plugin.video.gametest.dk/.idea
+plugin.video.gametest.dk/.gitignore
+plugin.video.gametest.dk/.git
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=a45b758f3e21ad7d7e9ca0183183a240c83c5582
commit a45b758f3e21ad7d7e9ca0183183a240c83c5582
Author: spiff <[email protected]>
Date: Sun Jan 1 18:39:19 2012 +0100
[plugin.video.revision3] updated to version 2.0.0
diff --git a/.gitignore b/.gitignore
index 95b86a5..9ba7dd0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,3 +59,4 @@ plugin.video.gaffa.tv/.idea
plugin.video.borsentv.dk/.git/
plugin.audio.dr.dk.netradio/.git
plugin.audio.dr.dk.netradio/.idea
+plugin.video.revision3/.git/
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=b4e168ac43b79a075a099969a91a0a61f329dd74
commit b4e168ac43b79a075a099969a91a0a61f329dd74
Author: spiff <[email protected]>
Date: Sun Jan 1 18:32:40 2012 +0100
[plugin.video.drnu] updated to version 2.1.0
diff --git a/plugin.video.drnu/addon.py b/plugin.video.drnu/addon.py
index 8b56725..1bdfdd6 100644
--- a/plugin.video.drnu/addon.py
+++ b/plugin.video.drnu/addon.py
@@ -1,10 +1,30 @@
+#
+# Copyright (C) 2011 Tommy Winther
+# http://tommy.winther.nu
+#
+# 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 2, 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 XBMC; see the file COPYING. If not, write to
+# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+# http://www.gnu.org/copyleft/gpl.html
+#
import pickle
import os
import sys
-import cgi as urlparse
+import urlparse
import urllib2
import re
import datetime
+import random
import xbmc
import xbmcgui
@@ -12,6 +32,7 @@ import xbmcaddon
import xbmcplugin
import nuapi
+import buggalo
class NuAddon(object):
def __init__(self):
@@ -45,43 +66,49 @@ class NuAddon(object):
def showMainMenu(self):
fanartImage = os.path.join(ADDON.getAddonInfo('path'), 'fanart.jpg')
+ items = list()
# All Program Series
item = xbmcgui.ListItem(ADDON.getLocalizedString(30000),
iconImage=os.path.join(ADDON.getAddonInfo('path'), 'resources', 'icons',
'all.png'))
item.setProperty('Fanart_Image', fanartImage)
- xbmcplugin.addDirectoryItem(HANDLE, PATH + '?show=allProgramSeries',
item, isFolder = True)
+ items.append((PATH + '?show=allProgramSeries', item, True))
# Program Series label
item = xbmcgui.ListItem(ADDON.getLocalizedString(30012),
iconImage=os.path.join(ADDON.getAddonInfo('path'), 'resources', 'icons',
'tag.png'))
item.setProperty('Fanart_Image', fanartImage)
- xbmcplugin.addDirectoryItem(HANDLE, PATH +
'?show=programSeriesLabels', item, isFolder = True)
+ items.append((PATH + '?show=programSeriesLabels', item, True))
# Latest
item = xbmcgui.ListItem(ADDON.getLocalizedString(30001),
iconImage=os.path.join(ADDON.getAddonInfo('path'), 'resources', 'icons',
'new.png'))
item.setProperty('Fanart_Image', fanartImage)
- xbmcplugin.addDirectoryItem(HANDLE, PATH + '?show=newest', item,
isFolder = True)
+ items.append((PATH + '?show=newest', item, True))
# Most viewed
item = xbmcgui.ListItem(ADDON.getLocalizedString(30011),
iconImage=os.path.join(ADDON.getAddonInfo('path'), 'resources', 'icons',
'eye.png'))
item.setProperty('Fanart_Image', fanartImage)
- xbmcplugin.addDirectoryItem(HANDLE, PATH + '?show=mostViewed', item,
isFolder = True)
+ items.append((PATH + '?show=mostViewed', item, True))
# Spotlight
item = xbmcgui.ListItem(ADDON.getLocalizedString(30002),
iconImage=os.path.join(ADDON.getAddonInfo('path'), 'resources', 'icons',
'star.png'))
item.setProperty('Fanart_Image', fanartImage)
- xbmcplugin.addDirectoryItem(HANDLE, PATH + '?show=spotlight', item,
isFolder = True)
+ items.append((PATH + '?show=spotlight', item, True))
+ # Highlights
+ item = xbmcgui.ListItem(ADDON.getLocalizedString(30021),
iconImage=os.path.join(ADDON.getAddonInfo('path'), 'resources', 'icons',
'star.png'))
+ item.setProperty('Fanart_Image', fanartImage)
+ items.append((PATH + '?show=highlights', item, True))
# Last chance
item = xbmcgui.ListItem(ADDON.getLocalizedString(30014),
iconImage=os.path.join(ADDON.getAddonInfo('path'), 'resources', 'icons',
'clock.png'))
item.setProperty('Fanart_Image', fanartImage)
- xbmcplugin.addDirectoryItem(HANDLE, PATH + '?show=lastChance', item,
isFolder = True)
+ items.append((PATH + '?show=lastChance', item, True))
# Search videos
item = xbmcgui.ListItem(ADDON.getLocalizedString(30003),
iconImage=os.path.join(ADDON.getAddonInfo('path'), 'resources', 'icons',
'search.png'))
item.setProperty('Fanart_Image', fanartImage)
- xbmcplugin.addDirectoryItem(HANDLE, PATH + '?show=search', item,
isFolder = True)
+ items.append((PATH + '?show=search', item, True))
# Recently watched Program Series
item = xbmcgui.ListItem(ADDON.getLocalizedString(30007),
iconImage=os.path.join(ADDON.getAddonInfo('path'), 'resources', 'icons',
'eye-star.png'))
item.setProperty('Fanart_Image', fanartImage)
- xbmcplugin.addDirectoryItem(HANDLE, PATH + '?show=recentlyWatched',
item, isFolder = True)
+ items.append((PATH + '?show=recentlyWatched', item, True))
# Favorite Program Series
item = xbmcgui.ListItem(ADDON.getLocalizedString(30008),
iconImage=os.path.join(ADDON.getAddonInfo('path'), 'resources', 'icons',
'plusone.png'))
item.setProperty('Fanart_Image', fanartImage)
- xbmcplugin.addDirectoryItem(HANDLE, PATH + '?show=favorites', item,
isFolder = True)
+ items.append((PATH + '?show=favorites', item, True))
+ xbmcplugin.addDirectoryItems(HANDLE, items)
xbmcplugin.endOfDirectory(HANDLE)
def showProgramSeriesVideos(self, slug):
@@ -93,6 +120,9 @@ class NuAddon(object):
def showSpotlightVideos(self):
self.listVideos(self.api.getSpotlightVideos())
+ def showHighlightVideos(self):
+ self.listVideos(self.api.getHighlightVideos())
+
def showMostViewedVideos(self):
self.listVideos(self.api.getMostViewedVideos())
@@ -100,7 +130,7 @@ class NuAddon(object):
self.listVideos(self.api.getLastChanceVideos())
def showFavorites(self):
- nuAddon.showProgramSeries(self.favorites, False)
+ self.showProgramSeries(self.favorites, False)
def showRecentlyWatched(self):
videos = list()
@@ -113,7 +143,7 @@ class NuAddon(object):
if not videos:
xbmcplugin.endOfDirectory(HANDLE, succeeded = False)
- xbmcgui.Dialog().ok(ADDON.getAddonInfo('name'),
ADDON.getLocalizedString(30013))
+ xbmcgui.Dialog().ok(ADDON.getAddonInfo('name'),
ADDON.getLocalizedString(30013), ADDON.getLocalizedString(30020))
else:
self.listVideos(videos)
@@ -122,8 +152,12 @@ class NuAddon(object):
if not programs:
xbmcplugin.endOfDirectory(HANDLE, succeeded = False)
- xbmcgui.Dialog().ok(ADDON.getAddonInfo('name'),
ADDON.getLocalizedString(30013))
+ if not addToFavorites:
+ xbmcgui.Dialog().ok(ADDON.getAddonInfo('name'),
ADDON.getLocalizedString(30013), ADDON.getLocalizedString(30018),
ADDON.getLocalizedString(30019))
+ else:
+ xbmcgui.Dialog().ok(ADDON.getAddonInfo('name'),
ADDON.getLocalizedString(30013))
else:
+ items = list()
for program in programs:
infoLabels = {}
@@ -149,16 +183,17 @@ class NuAddon(object):
item.setInfo('video', infoLabels)
item.setProperty('Fanart_Image', fanartImage)
- if addToFavorites:
- runScript =
"XBMC.RunPlugin(plugin://plugin.video.drnu/?addfavorite=%s)" % program['slug']
-
item.addContextMenuItems([(ADDON.getLocalizedString(30200), runScript)], True)
- else:
+ if self.favorites.count(program['slug']) > 0:
runScript =
"XBMC.RunPlugin(plugin://plugin.video.drnu/?delfavorite=%s)" % program['slug']
item.addContextMenuItems([(ADDON.getLocalizedString(30201), runScript)], True)
+ else:
+ runScript =
"XBMC.RunPlugin(plugin://plugin.video.drnu/?addfavorite=%s)" % program['slug']
+
item.addContextMenuItems([(ADDON.getLocalizedString(30200), runScript)], True)
url = PATH + '?listVideos=' + program['slug']
- xbmcplugin.addDirectoryItem(HANDLE, url, item, isFolder =
True, totalItems = int(program['videoCount']))
+ items.append((url, item, True))
+ xbmcplugin.addDirectoryItems(HANDLE, items)
xbmcplugin.setContent(HANDLE, 'tvshows')
xbmcplugin.endOfDirectory(HANDLE)
@@ -167,14 +202,15 @@ class NuAddon(object):
fanartImage = os.path.join(ADDON.getAddonInfo('path'), 'fanart.jpg')
labels = self.api.getProgramSeriesLabels()
-
+ items = list()
for label in labels:
item = xbmcgui.ListItem(label.capitalize(), iconImage=iconImage)
item.setProperty('Fanart_Image', fanartImage)
url = PATH + '?programSeriesLabel=' + label
- xbmcplugin.addDirectoryItem(HANDLE, url, item, isFolder = True)
+ items.append((url, item, True))
+ xbmcplugin.addDirectoryItems(HANDLE, items)
xbmcplugin.endOfDirectory(HANDLE)
@@ -187,47 +223,10 @@ class NuAddon(object):
def listVideos(self, videos):
- tvShowTitles = dict()
+ items = list()
for video in videos:
- infoLabels = dict()
-
- if video['title'] is not None:
- infoLabels['title'] = video['title']
- else:
- infoLabels['title'] = ADDON.getLocalizedString(30006)
-
- if video.has_key('spotSubTitle') and video['spotSubTitle'] is not
None:
- infoLabels['plot'] = video['spotSubTitle']
- elif video.has_key('description') and video['description'] is not
None:
- infoLabels['plot'] = video['description']
-
- if video.has_key('duration') and video['duration'] is not None:
- infoLabels['duration'] = video['duration']
- if video.has_key('broadcastChannel') and video['broadcastChannel']
is not None:
- infoLabels['studio'] = video['broadcastChannel']
- if video.has_key('broadcastTime') and video['broadcastTime'] is
not None:
- broadcastTime = self.parseDate(video['broadcastTime'])
- if broadcastTime:
- infoLabels['plotoutline'] =
ADDON.getLocalizedString(30015) % broadcastTime.strftime('%d. %b %Y kl. %H:%M')
- infoLabels['date'] = broadcastTime.strftime('%d.%m.%Y')
- infoLabels['aired'] = broadcastTime.strftime('%Y-%m-%d')
- infoLabels['year'] = int(broadcastTime.strftime('%Y'))
- infoLabels['season'] = infoLabels['year']
- if video.has_key('programSerieSlug') and video['programSerieSlug']
is not None:
- if tvShowTitles.has_key(video['programSerieSlug']):
- infoLabels['tvshowtitle'] =
tvShowTitles[video['programSerieSlug']]
- else:
- serie =
self.api.getProgramSeriesInfo(video['programSerieSlug'])
- if serie is not None:
- tvShowTitles[video['programSerieSlug']] =
serie['title']
- infoLabels['tvshowtitle'] = serie['title']
- else:
- tvShowTitles[video['programSerieSlug']] = None
- if video.has_key('expireTime') and video['expireTime'] is not None:
- expireTime = self.parseDate(video['expireTime'])
- if expireTime:
- infoLabels['plot'] += '[CR][CR]' +
ADDON.getLocalizedString(30016) % expireTime.strftime('%d. %b %Y kl. %H:%M')
+ infoLabels = self.createInfoLabels(video)
iconImage = self.api.getVideoImageUrl(str(video['id']), 256)
thumbnailImage = self.api.getVideoImageUrl(str(video['id']), 512)
@@ -235,17 +234,71 @@ class NuAddon(object):
item = xbmcgui.ListItem(infoLabels['title'], iconImage=iconImage,
thumbnailImage=thumbnailImage)
item.setInfo('video', infoLabels)
- item.setProperty('IsPlayable', 'true')
item.setProperty('Fanart_Image', fanartImage)
url = PATH + '?videoId=' + str(video['id'])
- xbmcplugin.addDirectoryItem(HANDLE, url, item, isFolder = False)
+ if video.has_key('chapters') and video['chapters'] and
ADDON.getSetting('enable.chapters') == 'true':
+ url += "&chapters=true"
+ items.append((url, item, True))
+ else:
+ item.setProperty('IsPlayable', 'true')
+ items.append((url, item))
+ xbmcplugin.addDirectoryItems(HANDLE, items)
xbmcplugin.setContent(HANDLE, 'episodes')
xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_DATE)
xbmcplugin.endOfDirectory(HANDLE)
+ def listVideoChapters(self, videoId):
+ video = self.api.getVideoById(videoId)
+ items = list()
+ startTimes = list()
+
+ for chapter in video['chapters']:
+ startTimes.append(self.parseTime(chapter['startTime']))
+ startTimes.append(self.parseTime(video['duration']))
+
+ # 'Play from the start' item
+ iconImage = self.api.getVideoImageUrl(str(video['id']), 256)
+ thumbnailImage = self.api.getVideoImageUrl(str(video['id']), 512)
+ fanartImage = self.api.getVideoImageUrl(str(video['id']), 1280, 720)
+ item = xbmcgui.ListItem(ADDON.getLocalizedString(30017),
iconImage=iconImage, thumbnailImage=thumbnailImage)
+ item.setProperty('IsPlayable', 'true')
+ item.setProperty('Fanart_Image', fanartImage)
+ url = PATH + '?videoId=' + str(video['id'])
+ items.append((url, item))
+
+ for idx, chapter in enumerate(video['chapters']):
+ infoLabels = self.createInfoLabels(video)
+
+ if chapter['title'] is not None:
+ infoLabels['title'] = chapter['title']
+ else:
+ infoLabels['title'] = ADDON.getLocalizedString(30006)
+ infoLabels['plot'] = video['description']
+
+ startTime = startTimes[idx]
+ if startTime:
+ duration = startTimes[idx + 1] - startTime
+ infoLabels['duration'] = str(duration.seconds)
+
+ iconImage = self.api.getChapterImageUrl(str(chapter['id']), 256)
+ thumbnailImage = self.api.getChapterImageUrl(str(chapter['id']),
512)
+ fanartImage = self.api.getChapterImageUrl(str(chapter['id']),
1280, 720)
+
+ item = xbmcgui.ListItem(chapter['title'], iconImage=iconImage,
thumbnailImage=thumbnailImage)
+ item.setInfo('video', infoLabels)
+ item.setProperty('IsPlayable', 'true')
+ item.setProperty('Fanart_Image', fanartImage)
+ url = PATH + '?videoId=' + str(video['id'])
+ if startTime:
+ url += "&startTime=" + self.formatStartTime(startTime)
+ items.append((url, item))
+
+ xbmcplugin.addDirectoryItems(HANDLE, items)
+ xbmcplugin.setContent(HANDLE, 'episodes')
+ xbmcplugin.endOfDirectory(HANDLE)
- def playVideo(self, videoId):
+ def playVideo(self, videoId, startTime = None):
self._updateRecentlyWatched(videoId)
video = self.api.getVideoById(videoId)
@@ -258,6 +311,8 @@ class NuAddon(object):
d.ok(ADDON.getLocalizedString(30100),
ADDON.getLocalizedString(30101), ADDON.getLocalizedString(30102))
else:
rtmpUrl = rtmpUrl.replace('rtmp://vod.dr.dk/',
'rtmp://vod.dr.dk/cms/')
+ if startTime:
+ rtmpUrl += ' start=' + startTime
item = xbmcgui.ListItem(path = rtmpUrl)
xbmcplugin.setResolvedUrl(HANDLE, True, item)
@@ -269,6 +324,59 @@ class NuAddon(object):
except ValueError:
return None
+ def parseTime(self, timeString):
+ try:
+ m = re.search('([0-9]+):([0-9]+):([0-9]+)(.([0-9]+))?', timeString)
+ hours = int(m.group(1))
+ minutes = int(m.group(2))
+ seconds = int(m.group(3))
+ return datetime.datetime(2011, 12, 28, hours, minutes, seconds)
+ except ValueError:
+ return None
+
+ def formatStartTime(self, time):
+ startTime = time.hour * 3600
+ startTime += time.minute * 60
+ startTime += time.second
+ return str(startTime * 1000)
+
+ def createInfoLabels(self, video):
+ infoLabels = dict()
+
+ if video['title'] is not None:
+ infoLabels['title'] = video['title']
+ else:
+ infoLabels['title'] = ADDON.getLocalizedString(30006)
+
+ if video.has_key('spotSubTitle') and video['spotSubTitle'] is not None:
+ infoLabels['plot'] = video['spotSubTitle']
+ elif video.has_key('description') and video['description'] is not None:
+ infoLabels['plot'] = video['description']
+
+ if video.has_key('duration') and video['duration'] is not None:
+ infoLabels['duration'] = video['duration']
+ if video.has_key('broadcastChannel') and video['broadcastChannel'] is
not None:
+ infoLabels['studio'] = video['broadcastChannel']
+ if video.has_key('broadcastTime') and video['broadcastTime'] is not
None:
+ broadcastTime = self.parseDate(video['broadcastTime'])
+ if broadcastTime:
+ infoLabels['plotoutline'] = ADDON.getLocalizedString(30015) %
broadcastTime.strftime('%d. %b %Y kl. %H:%M')
+ infoLabels['date'] = broadcastTime.strftime('%d.%m.%Y')
+ infoLabels['aired'] = broadcastTime.strftime('%Y-%m-%d')
+ infoLabels['year'] = int(broadcastTime.strftime('%Y'))
+ infoLabels['season'] = infoLabels['year']
+ if video.has_key('programSerieSlug') and video['programSerieSlug'] is
not None:
+ serie = self.api.getProgramSeriesInfo(video['programSerieSlug'])
+ if serie:
+ infoLabels['tvshowtitle'] = serie['title']
+ if video.has_key('expireTime') and video['expireTime'] is not None:
+ expireTime = self.parseDate(video['expireTime'])
+ if expireTime:
+ infoLabels['plot'] += '[CR][CR]' +
ADDON.getLocalizedString(30016) % expireTime.strftime('%d. %b %Y kl. %H:%M')
+ if video.has_key('isHq') and video['isHq']:
+ infoLabels['overlay'] = xbmcgui.ICON_OVERLAY_HD
+
+ return infoLabels
def addFavorite(self, slug):
if not self.favorites.count(slug):
@@ -289,6 +397,11 @@ class NuAddon(object):
self.recentlyWatched.insert(0, videoId)
self._save()
+ def displayError(self, message = 'n/a'):
+ heading = ADDON.getLocalizedString(random.randint(99980, 99985))
+ line1 = ADDON.getLocalizedString(30900)
+ line2 = ADDON.getLocalizedString(30901)
+ xbmcgui.Dialog().ok(heading, line1, line2, message)
if __name__ == '__main__':
ADDON = xbmcaddon.Addon(id = 'plugin.video.drnu')
@@ -304,41 +417,56 @@ if __name__ == '__main__':
RECENT_PATH = os.path.join(CACHE_PATH, 'recent.pickle')
nuAddon = NuAddon()
- if PARAMS.has_key('show'):
- if PARAMS['show'][0] == 'allProgramSeries':
- nuAddon.showProgramSeries()
- elif PARAMS['show'][0] == 'programSeriesLabels':
- nuAddon.showProgramSeriesLabels()
- elif PARAMS['show'][0] == 'newest':
- nuAddon.showNewestVideos()
- elif PARAMS['show'][0] == 'spotlight':
- nuAddon.showSpotlightVideos()
- elif PARAMS['show'][0] == 'mostViewed':
- nuAddon.showMostViewedVideos()
- elif PARAMS['show'][0] == 'lastChance':
- nuAddon.showLastChanceVideos()
- elif PARAMS['show'][0] == 'search':
- nuAddon.searchVideos()
- elif PARAMS['show'][0] == 'favorites':
- nuAddon.showFavorites()
- elif PARAMS['show'][0] == 'recentlyWatched':
- nuAddon.showRecentlyWatched()
-
- elif PARAMS.has_key('programSeriesLabel'):
- nuAddon.showProgramSeries(label = PARAMS['programSeriesLabel'][0])
-
- elif PARAMS.has_key('listVideos'):
- nuAddon.showProgramSeriesVideos(PARAMS['listVideos'][0])
-
- elif PARAMS.has_key('videoId'):
- nuAddon.playVideo(PARAMS['videoId'][0])
-
- elif PARAMS.has_key('addfavorite'):
- nuAddon.addFavorite(PARAMS['addfavorite'][0])
-
- elif PARAMS.has_key('delfavorite'):
- nuAddon.delFavorite(PARAMS['delfavorite'][0])
-
- else:
- nuAddon.showMainMenu()
+ try:
+ if PARAMS.has_key('show'):
+ if PARAMS['show'][0] == 'allProgramSeries':
+ nuAddon.showProgramSeries()
+ elif PARAMS['show'][0] == 'programSeriesLabels':
+ nuAddon.showProgramSeriesLabels()
+ elif PARAMS['show'][0] == 'newest':
+ nuAddon.showNewestVideos()
+ elif PARAMS['show'][0] == 'spotlight':
+ nuAddon.showSpotlightVideos()
+ elif PARAMS['show'][0] == 'highlights':
+ nuAddon.showHighlightVideos()
+ elif PARAMS['show'][0] == 'mostViewed':
+ nuAddon.showMostViewedVideos()
+ elif PARAMS['show'][0] == 'lastChance':
+ nuAddon.showLastChanceVideos()
+ elif PARAMS['show'][0] == 'search':
+ nuAddon.searchVideos()
+ elif PARAMS['show'][0] == 'favorites':
+ nuAddon.showFavorites()
+ elif PARAMS['show'][0] == 'recentlyWatched':
+ nuAddon.showRecentlyWatched()
+
+ elif PARAMS.has_key('programSeriesLabel'):
+ nuAddon.showProgramSeries(label = PARAMS['programSeriesLabel'][0])
+
+ elif PARAMS.has_key('listVideos'):
+ nuAddon.showProgramSeriesVideos(PARAMS['listVideos'][0])
+
+ elif PARAMS.has_key('videoId') and PARAMS.has_key('chapters'):
+ nuAddon.listVideoChapters(PARAMS['videoId'][0])
+
+ elif PARAMS.has_key('videoId') and PARAMS.has_key('startTime'):
+ nuAddon.playVideo(PARAMS['videoId'][0], PARAMS['startTime'][0])
+
+ elif PARAMS.has_key('videoId'):
+ nuAddon.playVideo(PARAMS['videoId'][0])
+
+ elif PARAMS.has_key('addfavorite'):
+ nuAddon.addFavorite(PARAMS['addfavorite'][0])
+
+ elif PARAMS.has_key('delfavorite'):
+ nuAddon.delFavorite(PARAMS['delfavorite'][0])
+
+ else:
+ nuAddon.showMainMenu()
+
+ except nuapi.DrNuException, ex:
+ nuAddon.displayError(str(ex))
+
+ except Exception:
+ buggalo.onExceptionRaised()
diff --git a/plugin.video.drnu/addon.xml b/plugin.video.drnu/addon.xml
index 587ccf8..e7fa6b5 100644
--- a/plugin.video.drnu/addon.xml
+++ b/plugin.video.drnu/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<addon id="plugin.video.drnu" version="2.0.2" name="DR NU Player"
provider-name="InKaKiLLeR, twinther [[email protected]]">
+<addon id="plugin.video.drnu" version="2.1.0" name="DR NU Player"
provider-name="twinther [[email protected]]">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.simplejson" version="2.0.10"/>
@@ -8,16 +8,10 @@
<provides>video</provides>
</extension>
<extension point="xbmc.addon.metadata">
- <summary lang="en">DR NU</summary>
- <summary lang="da">DR NU</summary>
- <description lang="en">Watch the latest shows from DR.dk/nu[CR][CR]
-All programs that DR has the rights to show on the internet is available in DR
NU. The typically means DR's own programs, news, sports and magazine - but not
movies and some international tv-shows.[CR][CR]
-You can added program series to favorites using the context menu.
- </description>
- <description lang="da">Se de seneste udsendelser fra DR.dk/nu[CR][CR]
-Alle de programmer, DR har rettigheder til at vise på nettet, vil være at
finde i DR NU. Dette gælder typisk DR's egne programmer, nyheder, sport og
magasiner - men ikke film eller visse udenlandske tv-serier.[CR][CR]
-Du kan tilføje programmer til foretrukne ved brug af højreklik-menuen.
- </description>
+ <summary lang="en">Watch the latest shows from DR.dk/nu</summary>
+ <summary lang="da">Se de seneste udsendelser fra DR.dk/nu</summary>
+ <description lang="en">All programs that DR has the rights to show on
the internet is available in DR NU. The typically means DR's own programs,
news, sports and magazine - but usually not movies and some international
tv-shows.[CR][CR]If you have comments or suggestions for this addon, please
feel free to participate in the debate on my blog at
http://tommy.winther.nu</description>
+ <description lang="da">Alle de programmer, DR har rettigheder til at
vise på nettet, vil være at finde i DR NU. Dette gælder typisk DR's egne
programmer, nyheder, sport og magasiner - men typisk ikke film og visse
udenlandske tv-serier.[CR][CR]Har du kommentarer, ris eller ros til denne addon
er du velkommen til at deltage i debatten på min blog på
http://tommy.winther.nu</description>
<disclaimer lang="en">Some parts of this addon may not be legal in
your country of residence - please check with your local laws.</disclaimer>
<disclaimer lang="da">Nogle dele af denne addon er muligvis ikke
lovlig i dit land - kontroller venligst dine lokale love.</disclaimer>
<license>GPL 2.0</license>
diff --git a/plugin.video.drnu/changelog.txt b/plugin.video.drnu/changelog.txt
index 431abb4..3fb6f8a 100644
--- a/plugin.video.drnu/changelog.txt
+++ b/plugin.video.drnu/changelog.txt
@@ -1,3 +1,12 @@
+[B]Version 2.1.0 - 2011-12-30[/B]
+- Improved error handling with option for the user to submit exceptions/bugs
+- Added option to navigate chapters (can be enabled in settings)
+ This is useful for some shows, such as [I]PÃ¥ skinner[/I], but breaks date
sorting.
+- Added [I]Highlights[I] and indicator for HD videos
+- There is a problem with loading some icons, I have opened an issue:
+ http://trac.xbmc.org/ticket/12316
+- Fixed a number of minor issue, such as search for multiple words
+
[B]Version 2.0.2 - 2011-09-21[/B]
- Fix script error on 32 bit OS when expire date of a clip is Jan, 1st 3000
diff --git a/plugin.video.drnu/nuapi.py b/plugin.video.drnu/nuapi.py
index 8c8565b..c49646b 100644
--- a/plugin.video.drnu/nuapi.py
+++ b/plugin.video.drnu/nuapi.py
@@ -1,6 +1,26 @@
+#
+# Copyright (C) 2011 Tommy Winther
+# http://tommy.winther.nu
+#
+# 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 2, 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 XBMC; see the file COPYING. If not, write to
+# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+# http://www.gnu.org/copyleft/gpl.html
+#
import os
import simplejson
import time
+import urllib
import urllib2
API_URL = 'http://www.dr.dk/NU/api/%s'
@@ -73,14 +93,23 @@ class DrNuApi(object):
def getSpotlightVideos(self):
return self._call_api('videos/spot', 'spot.json') or list()
+ def getHighlightVideos(self):
+ return self._call_api('videos/highlight', 'highlight.json') or list()
+
def getProgramSeriesVideos(self, programSeriesSlug):
return self._call_api('programseries/%s/videos' % programSeriesSlug,
'programseries-%s.json' % programSeriesSlug) or list()
def getVideoById(self, id):
- return self._call_api('videos/%s' % id, 'videobyid-%s.json' % id)
+ response = self._call_api('videos/%s' % id, 'videobyid-%s.json' % id)
+ if type(response) in [str, unicode]:
+ return None
+ else:
+ return response
def search(self, term):
- return self._call_api('search/%s' % term) or list()
+ if not term:
+ return list()
+ return self._call_api('search/%s' % urllib.quote(term)) or list()
def getProgramSeriesImageUrl(self, programSlug, width, height = None):
if height is None:
@@ -107,7 +136,7 @@ class DrNuApi(object):
except OSError: # File not found
cachedOn = 0
- if time.time() - self.cacheMinutes * 60 >= cachedOn:
+ if not os.path.exists(cachePath) or time.time() -
self.cacheMinutes * 60 >= cachedOn:
# Cache expired or miss
content = self._http_request(path)
@@ -125,23 +154,29 @@ class DrNuApi(object):
content = self._http_request(path)
if content is not None:
- return simplejson.loads(content)
+ try:
+ return simplejson.loads(content)
+ except Exception, ex:
+ raise DrNuException(ex)
else:
- return None
+ return []
def _http_request(self, path):
try:
u = urllib2.urlopen(API_URL % path)
content = u.read()
u.close()
- except urllib2.HTTPError, ex:
- print "HTTPError: " + str(ex.msg)
- content = None
+ except urllib2.URLError, ex:
+ raise DrNuException(ex)
return content
+class DrNuException(Exception):
+ pass
+
if __name__ == '__main__':
api = DrNuApi('/tmp', 0)
- json = api.getProgramSeriesLabels()
+# json = api.getProgramSeriesVideos('paa-skinner')
+ json = api.getVideoById(26877)
s = simplejson.dumps(json, sort_keys=True, indent=' ')
print '\n'.join([l.rstrip() for l in s.splitlines()])
\ No newline at end of file
diff --git a/plugin.video.drnu/resources/language/Danish/strings.xml
b/plugin.video.drnu/resources/language/Danish/strings.xml
index 3245aa8..28cbb69 100644
--- a/plugin.video.drnu/resources/language/Danish/strings.xml
+++ b/plugin.video.drnu/resources/language/Danish/strings.xml
@@ -11,12 +11,17 @@
<string id="30008">Foretrukne programmer</string>
<string id="30009">Program tilføjet</string>
<string id="30010">Program fjernet</string>
- <string id="30011">Mest sete videoer på DR.dk</string>
+ <string id="30011">Mest sete videoer på DR NU</string>
<string id="30012">Progammer efter område</string>
- <string id="30013">Listen er tom</string>
+ <string id="30013">Listen er tom.</string>
<string id="30014">Udløber snart</string>
<string id="30015">Sendt: %s</string>
<string id="30016">Udløber: %s</string>
+ <string id="30017">Afspil fra starten</string>
+ <string id="30018">Du kan tilføje programmer til foretrukne ved
brug</string>
+ <string id="30019">af højreklik-menuen.</string>
+ <string id="30020">De videoer du sidst har set tilføjest
automatisk.</string>
+ <string id="30021">Højdepunkter</string>
<string id="30100">Videoen er ikke tilgængelig</string>
<string id="30101">DR har slettet den videofil du forsøger at
afspille,</string>
@@ -25,4 +30,23 @@
<string id="30200">Tilføj til foretrukne programmer</string>
<string id="30201">Fjern fra foretrukne programmer</string>
+ <string id="30500">Generelt</string>
+ <string id="30501">Aktiver [I]kapitel[/I] navigation</string>
+
+ <string id="30900">Der er sket en fejl i kommunikationen med DR
NU.</string>
+ <string id="30901">Prøv igen senere. Fejlen er:</string>
+
+ <string id="99980">Game over, man! [I]Game over![/I]</string>
+ <string id="99981">You can't handle the truth!</string>
+ <string id="99982">Danger Will Robinson</string>
+ <string id="99983">Why does it cry, Sméagol?</string>
+ <string id="99984">Houston, we have a problem...</string>
+ <string id="99985">E.T. phone home</string>
+
+ <string id="99990">Der er desværre opstået en fejl i addon'en.</string>
+ <string id="99991">Du kan hjælpe med at løse fejlen ved at indsende
en</string>
+ <string id="99992">fejlrapport. Der sendes ikke personlige
oplysninger.</string>
+ <string id="99993">Indsend fejlrapport</string>
+ <string id="99994">Indsend ikke</string>
+ <string id="99995">Tak!</string>
</strings>
diff --git a/plugin.video.drnu/resources/language/English/strings.xml
b/plugin.video.drnu/resources/language/English/strings.xml
index 5cca318..5d886b8 100644
--- a/plugin.video.drnu/resources/language/English/strings.xml
+++ b/plugin.video.drnu/resources/language/English/strings.xml
@@ -11,12 +11,17 @@
<string id="30008">Favorite programs</string>
<string id="30009">Program added</string>
<string id="30010">Program removed</string>
- <string id="30011">Most watched videos on DR.dk</string>
+ <string id="30011">Most watched videos on DR NU</string>
<string id="30012">Programs by area</string>
- <string id="30013">The list is empty</string>
+ <string id="30013">The list is empty.</string>
<string id="30014">Expires soon</string>
<string id="30015">Aired: %s</string>
<string id="30016">Expires on: %s</string>
+ <string id="30017">Play from the start</string>
+ <string id="30018">You can added program series to favorites using</string>
+ <string id="30019">the context menu.</string>
+ <string id="30020">Your recently watched videos are automatically
added.</string>
+ <string id="30021">Highlights</string>
<string id="30100">Video is not available</string>
<string id="30101">DR has deleted the video file you want to
watch,</string>
@@ -24,4 +29,25 @@
<string id="30200">Add to favorite program series</string>
<string id="30201">Remove from favorite program series</string>
+
+ <string id="30500">General</string>
+ <string id="30501">Enable [I]chapter[/I] navigation</string>
+
+ <string id="30900">There was an error while communication with DR
NU.</string>
+ <string id="30901">Please try again later. Error message is:</string>
+
+ <string id="99980">Game over, man! [I]Game over![/I]</string>
+ <string id="99981">You can't handle the truth!</string>
+ <string id="99982">Danger Will Robinson</string>
+ <string id="99983">Why does it cry, Sméagol?</string>
+ <string id="99984">Houston, we have a problem...</string>
+ <string id="99985">E.T. phone home</string>
+
+ <string id="99990">Unfortunately an error occurred in the addon.</string>
+ <string id="99991">You can help with fixing the problem by
submitting</string>
+ <string id="99992">an error report. No personal information is
sent.</string>
+ <string id="99993">Submit error report</string>
+ <string id="99994">Don't submit</string>
+ <string id="99995">Thank you!</string>
+
</strings>
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 4 +
plugin.video.drnu/.gitignore | 2 +
plugin.video.drnu/addon.py | 326 ++++++++++++++------
plugin.video.drnu/addon.xml | 16 +-
.../buggalo.py | 0
plugin.video.drnu/changelog.txt | 9 +
plugin.video.drnu/nuapi.py | 53 +++-
.../resources/language/Danish/strings.xml | 28 ++-
.../resources/language/English/strings.xml | 30 ++-
plugin.video.drnu/resources/settings.xml | 7 +
.../LICENSE.txt | 0
plugin.video.gametest.dk/addon.py | 157 ++++++++++
plugin.video.gametest.dk/addon.xml | 21 ++
.../buggalo.py | 2 +-
plugin.video.gametest.dk/changelog.txt | 19 ++
plugin.video.gametest.dk/fanart.jpg | Bin 0 -> 303167 bytes
plugin.video.gametest.dk/icon.png | Bin 0 -> 92642 bytes
.../resources/language/Danish/strings.xml | 7 +
.../resources/language/English/strings.xml | 8 +-
plugin.video.revision3/addon.xml | 21 ++
plugin.video.revision3/changelog.txt | 43 +++
plugin.video.revision3/default.py | 286 +++++++++++++++++
.../resources/language/English/strings.xml | 14 +
.../resources/media/current.png | Bin 22166 -> 22166 bytes
.../resources/media}/downloads.png | Bin 23477 -> 23477 bytes
plugin.video.revision3/resources/media/more.png | Bin 0 -> 41191 bytes
plugin.video.revision3/resources/media/next.png | Bin 0 -> 23910 bytes
plugin.video.revision3/resources/media/old.png | Bin 0 -> 44225 bytes
plugin.video.revision3/resources/media/search.png | Bin 0 -> 31515 bytes
plugin.video.revision3/resources/settings.xml | 8 +
30 files changed, 936 insertions(+), 125 deletions(-)
create mode 100644 plugin.video.drnu/.gitignore
copy {plugin.audio.dr.dk.netradio => plugin.video.drnu}/buggalo.py (100%)
create mode 100644 plugin.video.drnu/resources/settings.xml
copy {plugin.audio.abradio.cz => plugin.video.gametest.dk}/LICENSE.txt (100%)
create mode 100644 plugin.video.gametest.dk/addon.py
create mode 100644 plugin.video.gametest.dk/addon.xml
copy {plugin.audio.dr.dk.netradio => plugin.video.gametest.dk}/buggalo.py (97%)
create mode 100644 plugin.video.gametest.dk/changelog.txt
create mode 100644 plugin.video.gametest.dk/fanart.jpg
create mode 100644 plugin.video.gametest.dk/icon.png
copy {plugin.audio.dr.dk.netradio =>
plugin.video.gametest.dk}/resources/language/Danish/strings.xml (78%)
copy {plugin.audio.dr.dk.netradio =>
plugin.video.gametest.dk}/resources/language/English/strings.xml (79%)
create mode 100644 plugin.video.revision3/addon.xml
create mode 100644 plugin.video.revision3/changelog.txt
create mode 100644 plugin.video.revision3/default.py
create mode 100644
plugin.video.revision3/resources/language/English/strings.xml
copy plugin.video.bliptv/thumbnails/shows.png =>
plugin.video.revision3/resources/media/current.png (100%)
copy {plugin.video.bliptv/thumbnails =>
plugin.video.revision3/resources/media}/downloads.png (100%)
create mode 100644 plugin.video.revision3/resources/media/more.png
create mode 100644 plugin.video.revision3/resources/media/next.png
create mode 100644 plugin.video.revision3/resources/media/old.png
create mode 100644 plugin.video.revision3/resources/media/search.png
create mode 100644 plugin.video.revision3/resources/settings.xml
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons