Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[204234]: plugin.video.videovideo.dk / addon.py Maximize Restore History

Download this file

addon.py    70 lines (52 with data), 2.3 kB

 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
import re
import os
import sys
import xbmcgui
import xbmcplugin
import simplejson
import danishaddons
import danishaddons.web
SHOWS_URL = 'http://videovideo.dk/shows/json/'
EPISODES_URL = 'http://videovideo.dk/episodes/json/show_id/%s'
RSS_URL_TEMPLATE = 'http://videovideo.dk/show/%s/rss/720/mp4'
def showOverview():
json_path = os.path.join(danishaddons.ADDON_DATA_PATH, 'shows.json')
json = danishaddons.web.downloadAndCacheUrl(SHOWS_URL, json_path, 24 * 60)
shows = simplejson.loads(json)
for show in shows:
item = xbmcgui.ListItem(show['title'], iconImage = show['image'])
item.setInfo(type = 'video', infoLabels = {
'title' : show['title'],
'plot' : show['description']
})
item.setProperty('Fanart_Image', show['imagefull'])
m = re.search('([0-9]+)$', show['url'])
show_id = m.group(1)
url = danishaddons.ADDON_PATH + '?id=' + show_id
xbmcplugin.addDirectoryItem(danishaddons.ADDON_HANDLE, url, item, True)
xbmcplugin.endOfDirectory(danishaddons.ADDON_HANDLE)
def showShow(id):
json_path = os.path.join(danishaddons.ADDON_DATA_PATH, 'episodes_%s.json' % id)
json = danishaddons.web.downloadAndCacheUrl(EPISODES_URL % id, json_path, 24 * 60)
episodes = simplejson.loads(json)
for episode in episodes:
item = xbmcgui.ListItem(episode['title'], iconImage = episode['image'])
date = '%s.%s.%s' % (episode['timestamp'][8:10], episode['timestamp'][5:7], episode['timestamp'][0:4])
infoLabels = {
'title' : episode['title'],
'plot' : episode['shownotes'],
'date' : date,
'aired' : episode['timestamp'][0:11],
'year' : int(episode['timestamp'][0:4])
}
item.setInfo('video', infoLabels)
item.setProperty('Fanart_Image', episode['imagefull'])
xbmcplugin.addDirectoryItem(danishaddons.ADDON_HANDLE, episode['distributions']['720'], item, False)
xbmcplugin.addSortMethod(danishaddons.ADDON_HANDLE, xbmcplugin.SORT_METHOD_DATE)
xbmcplugin.endOfDirectory(danishaddons.ADDON_HANDLE)
if __name__ == '__main__':
danishaddons.init(sys.argv)
if danishaddons.ADDON_PARAMS.has_key('id'):
showShow(danishaddons.ADDON_PARAMS['id'])
else:
showOverview()