-
Notifications
You must be signed in to change notification settings - Fork 15
/
context_info.py
94 lines (87 loc) · 2.85 KB
/
context_info.py
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
import os
import sys
import json
import xbmc
import xbmcgui
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
from plugin import getJSONResponse
from elementum.logger import log
info_labels = [
"ListItem.DBID",
"ListItem.DBTYPE",
"ListItem.Mediatype",
"ListItem.TMDB",
"ListItem.UniqueID(tmdb)",
"ListItem.UniqueID(Elementum)",
"ListItem.Property(ShowTMDBId)",
"ListItem.Label",
"ListItem.Label2",
"ListItem.ThumbnailImage",
"ListItem.Title",
"ListItem.OriginalTitle",
"ListItem.TVShowTitle",
"ListItem.Season",
"ListItem.Episode",
"ListItem.Premiered",
"ListItem.Plot",
"ListItem.PlotOutline",
"ListItem.Tagline",
"ListItem.Year",
"ListItem.Trailer",
"ListItem.Studio",
"ListItem.MPAA",
"ListItem.Genre",
"ListItem.Mediatype",
"ListItem.Writer",
"ListItem.Director",
"ListItem.Rating",
"ListItem.Votes",
"ListItem.IMDBNumber",
"ListItem.Code",
"ListItem.ArtFanart",
"ListItem.ArtBanner",
"ListItem.ArtPoster",
"ListItem.ArtLandscape",
"ListItem.ArtTvshowPoster",
"ListItem.ArtClearArt",
"ListItem.ArtClearLogo",
"ListItem.Property(TotalSeasons)",
"ListItem.Property(TotalEpisodes)",
"ListItem.Property(WatchedEpisodes)",
"ListItem.Property(UnWatchedEpisodes)",
"ListItem.Property(NumEpisodes)",
"ListItem.PlayCount",
"ListItem.Path",
"ListItem.FileName",
"ListItem.FileNameAndPath",
"ListItem.UserRating",
"ListItem.Progress",
"ListItem.Status",
"ListItem.Count",
"ListItem.PercentPlayed",
]
if __name__ == '__main__':
item = sys.listitem # xbmcgui.ListItem()
try:
path = item.getfilename()
except AttributeError:
path = item.getPath()
truelabel = item.getLabel()
infolabel = xbmc.getInfoLabel('ListItem.Label')
dbid = xbmc.getInfoLabel('ListItem.DBID')
mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
try:
tmdbID = item.getUniqueID('tmdb')
except AttributeError:
tmdbID = "not supported"
properties = {
'resume_time': item.getProperty('ResumeTime'),
'start_offset': item.getProperty('StartOffset'),
'start_percent': item.getProperty('StartPercent'),
'total_time': item.getProperty('TotalTime')
}
log.info("Properties: %s;" % properties)
all_labels = getJSONResponse('{"jsonrpc": "2.0", "method": "XBMC.GetInfoLabels", "params": { "labels": %s }, "id": "0"}' % json.dumps(info_labels))
log.info("Labels: %s" % json.dumps(all_labels["result"], indent=4))
log.info("truelabel: %s; infolabel: %s; dbid: %s; tmdbID: %s; mediatype: %s; path: %s;" % (truelabel, infolabel, dbid, tmdbID, mediatype, path))
xbmcgui.Dialog().notification("truelabel: %s" % truelabel, "infolabel: %s; dbid: %s; tmdbID: %s; mediatype: %s;" % (infolabel, dbid, tmdbID, mediatype))