aboutsummaryrefslogtreecommitdiff
path: root/addons/metadata.demo.tv/demo.py
blob: 1ebd5a39c59db4689f68e0215e4bfabb61ad9d4e (plain)
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
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import xbmcplugin,xbmcgui,xbmc,xbmcaddon
import os,sys,urllib

def get_params():
        param=[]
        paramstring=sys.argv[2]
        if len(paramstring)>=2:
                params=sys.argv[2]
                cleanedparams=params.replace('?','')
                if (params[len(params)-1]=='/'):
                        params=params[0:len(params)-2]
                pairsofparams=cleanedparams.split('&')
                param={}
                for i in range(len(pairsofparams)):
                        splitparams={}
                        splitparams=pairsofparams[i].split('=')
                        if (len(splitparams))==2:
                                param[splitparams[0]]=splitparams[1]
                                
        return param


params=get_params()

action=urllib.unquote_plus(params["action"])

if action == 'find':
    year = 0
    title=urllib.unquote_plus(params["title"])
    try:
        year=int(urllib.unquote_plus(params["year"]))
    except:
        pass

    print('Find TV show with title %s from year %i' %(title, int(year)))
    liz=xbmcgui.ListItem('Demo show 1', thumbnailImage='DefaultVideo.png', offscreen=True)
    liz.setProperty('relevance', '0.5')
    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url="/path/to/show", listitem=liz, isFolder=True)
    liz=xbmcgui.ListItem('Demo show 2', thumbnailImage='DefaultVideo.png', offscreen=True)
    liz.setProperty('relevance', '0.3')
    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url="/path/to/show2", listitem=liz, isFolder=True)
elif action == 'getdetails':
    url=urllib.unquote_plus(params["url"])
    if url == '/path/to/show':
        liz=xbmcgui.ListItem('Demo show 1', offscreen=True)
        liz.setInfo('video',
                    {'title': 'Demo show 1',
                     'originaltitle': 'Demo shåvv 1',
                     'sorttitle': '2',
                     'userrating': 5,
                     'plotoutline': 'Outline yo',
                     'plot': 'Plot yo',
                     'tagline': 'Tag yo',
                     'duration': 110,
                     'mpaa': 'T',
                     'trailer': '/home/akva//porn/bukkake.mkv',
                     'genre': ['Action', 'Comedy'],
                     'country': ['Norway', 'Sweden', 'China'],
                     'credits': ['None', 'Want', 'To Admit It'],
                     'director': ['spiff', 'spiff2'],
                     'studio': ['Studio1', 'Studio2'],
                     'dateadded': '2016-01-01',
                     'premiered': '2015-01-01',
                     'aired': '2007-01-01',
                     'status': 'Cancelled',
                     'episodeguide': '/path/to/show/guide',
                     'tag': ['Porn', 'Umomz']
                    })
        liz.setRating("imdb", 9, 100000, True )
        liz.setRating("tvdb", 8.9, 1000)
        liz.setUniqueIDs({ 'imdb': 'tt8938399', 'tvdb' : '9837493' }, 'tvdb')
        liz.addSeason(1, 'Horrible')
        liz.addSeason(2, 'Crap')
        liz.setCast([{'name': 'spiff', 'role': 'himself', 'thumbnail': '/home/akva/Pictures/fish.jpg', 'order': 2},
                    {'name': 'monkey', 'role': 'orange', 'thumbnail': '/home/akva/Pictures/coffee.jpg', 'order': 1}])
        liz.addAvailableArtwork('DefaultBackFanart.png', 'banner')
        liz.addAvailableArtwork('/home/akva/Pictures/hawaii-shirt.png', 'poster')
        liz.setAvailableFanart([{'image': 'DefaultBackFanart.png', 'preview': 'DefaultBackFanart.png'}, 
                                {'image': '/home/akva/Pictures/hawaii-shirt.png', 'preview': '/home/akva/Pictures/hawaii-shirt.png'}])
        xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=liz)
elif action == 'getepisodelist':
    url=urllib.unquote_plus(params["url"])
    print('in here yo ' + url)
    if url == '/path/to/show/guide':
        liz=xbmcgui.ListItem('Demo Episode 1x1', offscreen=True)
        liz.setInfo('video',
                    {'title': 'Demo Episode 1',
                     'season': 1,
                     'episode': 1,
                     'aired': '2015-01-01'
                     })
        liz.addAvailableArtwork('/path/to/episode1','banner')
        xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url="/path/to/episode1", listitem=liz, isFolder=False)
        liz=xbmcgui.ListItem('Demo Episode 2x2', offscreen=True)
        liz.setInfo('video',
                    {'title': 'Demo Episode 2',
                     'season': 2,
                     'episode': 2,
                     'aired': '2014-01-01'
                     })
        liz.addAvailableArtwork('/path/to/episode2','banner')
        #liz.setProperty('video.sub_episode', '1')
        xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url="/path/to/episode2", listitem=liz, isFolder=False)
elif action == 'getepisodedetails':
    url=urllib.unquote_plus(params["url"])
    if url == '/path/to/episode1':
        liz=xbmcgui.ListItem('Demo Episode 1', offscreen=True)
        liz.setInfo('video',
                    {'title': 'Demo Episode 1',
                     'originaltitle': 'Demo æpisod 1x1',
                     'sorttitle': '2',
                     'episode': 1,
                     'season': 1,
                     'userrating': 5,
                     'plotoutline': 'Outline yo',
                     'plot': 'Plot yo',
                     'tagline': 'Tag yo',
                     'duration': 110,
                     'mpaa': 'T',
                     'trailer': '/home/akva//porn/bukkake.mkv',
                     'genre': ['Action', 'Comedy'],
                     'country': ['Norway', 'Sweden', 'China'],
                     'credits': ['None', 'Want', 'To Admit It'],
                     'director': ['spiff', 'spiff2'],
                     'studio': ['Studio1', 'Studio2'],
                     'dateadded': '2016-01-01',
                     'premiered': '2015-01-01',
                     'aired': '2007-01-01',
                     'tag': ['Porn', 'Umomz']
                    })
        liz.setRating("imdb", 9, 100000, True )
        liz.setRating("tvdb", 8.9, 1000)
        liz.setUniqueIDs({ 'tvdb': '3894', 'imdb' : 'tt384940' }, 'tvdb')
        liz.addSeason(1, 'Horrible')
        liz.addSeason(2, 'Crap')
        liz.setCast([{'name': 'spiff', 'role': 'himself', 'thumbnail': '/home/akva/Pictures/fish.jpg', 'order': 2},
                    {'name': 'monkey', 'role': 'orange', 'thumbnail': '/home/akva/Pictures/coffee.jpg', 'order': 1}])
        liz.addAvailableArtwork('DefaultBackFanart.png', 'banner')
        liz.addAvailableArtwork('/home/akva/Pictures/hawaii-shirt.png', 'poster')
        liz.setAvailableFanart([{'image': 'DefaultBackFanart.png', 'preview': 'DefaultBackFanart.png'}, 
                                {'image': '/home/akva/Pictures/hawaii-shirt.png', 'preview': '/home/akva/Pictures/hawaii-shirt.png'}])
        xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=liz)
    elif url == '/path/to/episode2':
        liz=xbmcgui.ListItem('Demo Episode 2', offscreen=True)
        liz.setInfo('video',
                    {'title': 'Demo Episode 2',
                     'originaltitle': 'Demo æpisod 2x2',
                     'sorttitle': '1',
                     'episode': 2,
                     'season': 2,
                     'userrating': 8,
                     'plotoutline': 'Outline yo',
                     'plot': 'Plot yo',
                     'tagline': 'Tag yo',
                     'duration': 110,
                     'mpaa': 'T',
                     'trailer': '/home/akva//porn/bukkake.mkv',
                     'genre': ['Action', 'Comedy'],
                     'country': ['Norway', 'Sweden', 'China'],
                     'credits': ['None', 'Want', 'To Admit It'],
                     'director': ['spiff', 'spiff2'],
                     'studio': ['Studio1', 'Studio2'],
                     'dateadded': '2016-01-01',
                     'premiered': '2015-01-01',
                     'aired': '2007-01-01',
                     'tag': ['Porn', 'Umomz']
                    })
        liz.setRating("imdb", 7, 25457, True )
        liz.setRating("tvdb", 8.1, 5478)
        liz.setUniqueIDs({ 'tvdb': '3894', 'imdb' : 'tt384940' })
        liz.addSeason(1, 'Horrible')
        liz.addSeason(2, 'Crap')
        liz.setCast([{'name': 'spiff', 'role': 'himself', 'thumbnail': '/home/akva/Pictures/fish.jpg', 'order': 2},
                    {'name': 'monkey', 'role': 'orange', 'thumbnail': '/home/akva/Pictures/coffee.jpg', 'order': 1}])
        liz.addAvailableArtwork('DefaultBackFanart.png','banner')
        liz.addAvailableArtwork('/home/akva/Pictures/hawaii-shirt.png','poster')
        liz.setAvailableFanart([{'image': 'DefaultBackFanart.png', 'preview': 'DefaultBackFanart.png'}, 
                                {'image': '/home/akva/Pictures/hawaii-shirt.png', 'preview': '/home/akva/Pictures/hawaii-shirt.png'}])
        xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=liz)
elif action == 'nfourl': 
    nfo=urllib.unquote_plus(params["nfo"]) 
    print 'Find url from nfo file' 
    liz=xbmcgui.ListItem('Demo show 1', offscreen=True) 
    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url="/path/to/show", listitem=liz, isFolder=True) 
 



xbmcplugin.endOfDirectory(int(sys.argv[1]))