Skip to content

Commit 3b80503

Browse files
committed
[plugin.video.cc.com] 1.0.0
1 parent 1533f10 commit 3b80503

26 files changed

+9865
-0
lines changed

.gitmodules

Whitespace-only changes.

plugin.video.cc.com/LICENSE.txt

+674
Large diffs are not rendered by default.

plugin.video.cc.com/addon.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# author: nixxo
2+
from resources.lib.main import ComedyCentral
3+
4+
cc = ComedyCentral()
5+
cc.main()

plugin.video.cc.com/addon.xml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<addon id="plugin.video.cc.com" version="1.0.0" name="Comedy Central" provider-name="nixxo">
3+
<requires>
4+
<import addon="xbmc.python" version="3.0.0"/>
5+
<import addon="script.module.simplecache" version="2.0.0"/>
6+
<import addon="script.module.requests" version="2.25.0"/>
7+
<import addon="script.module.inputstreamhelper" version="0.5.8" optional="true"/>
8+
</requires>
9+
<extension point="xbmc.python.pluginsource" library="addon.py">
10+
<provides>video</provides>
11+
</extension>
12+
<extension point="xbmc.addon.metadata">
13+
<summary lang="en_GB">Watch full episodes and clips from your favorite Comedy Central shows.</summary>
14+
<description lang="en_GB">Comedy Central brings you the funniest stuff on the planet. Watch hit shows like Workaholics, Tosh.0, The Daily Show with Trevor Noah, Key and Peele @midnight and Broad City, plus cutting-edge stand-up comedy you won't find anywhere else. Head to CC.com for full episodes, exclusives, previews and more.</description>
15+
<platform>all</platform>
16+
<license>GNU GENERAL PUBLIC LICENSE. Version 3, June 2007</license>
17+
<source>https://github.com/nixxo/plugin.video.cc.com</source>
18+
<website>https://www.cc.com/</website>
19+
<news>[B]1.0.0[/B]
20+
- first release on kodi addons repo
21+
- final fixes
22+
23+
[B]0.0.7[/B]
24+
- improved thumbnail setup
25+
- improved setContent
26+
- improved info extraction to avoid NoneType errors
27+
- added offscreen=True to listitem creation
28+
- created getPlaylist
29+
- improved settings
30+
- using f-strings
31+
- urllib > requests
32+
- moved videoInfo update before loop
33+
- addonutils improvements
34+
35+
[B]v0.0.6[/B]
36+
- improved translations
37+
- made settings.xml with kodi19 conventions
38+
- implemented better quality selection
39+
- added "Full Episodes" menu item
40+
41+
[B]v0.0.5[/B]
42+
- added inputstream helper option
43+
- fixed single video title
44+
- settings cleanup
45+
46+
[B]v0.0.4[/B]
47+
- using cache to save video info
48+
- added duration/airdate to videos
49+
- code improvements and cleanup
50+
51+
[B]v0.0.3[/B]
52+
- yt-dlp updated to 2021.10.22
53+
- pull listitem infos to set plot on all playlist elements
54+
- improved settings and localization
55+
56+
[B]v0.0.2[/B]
57+
- playlist index fix
58+
- strptime workaround
59+
60+
[B]v0.0.1[/B]
61+
- first release</news>
62+
<assets>
63+
<icon>resources/icon.png</icon>
64+
<fanart>resources/fanart.png</fanart>
65+
</assets>
66+
</extension>
67+
</addon>
18.3 KB
Loading
7.43 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Kodi Media Center language file
2+
# Addon Name: "Comedy Central"
3+
# Addon id: plugin.video.cc.com
4+
# Addon Provider: nixxo
5+
msgid ""
6+
msgstr ""
7+
"MIME-Version: 1.0\n"
8+
"Content-Type: text/plain; charset=UTF-8\n"
9+
"Content-Transfer-Encoding: 8bit\n"
10+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
11+
"Language: en\n"
12+
13+
msgctxt "#30000"
14+
msgid "General"
15+
msgstr ""
16+
17+
msgctxt "#31000"
18+
msgid "Playback"
19+
msgstr ""
20+
21+
msgctxt "#31001"
22+
msgid "Use InputStream Adaptive"
23+
msgstr ""
24+
25+
msgctxt "#31002"
26+
msgid "Manual quality selection"
27+
msgstr ""
28+
29+
msgctxt "#31003"
30+
msgid "Select Preferred Maximum Quality"
31+
msgstr ""
32+
33+
msgctxt "#31004"
34+
msgid "Low definition - 360p"
35+
msgstr ""
36+
37+
msgctxt "#31005"
38+
msgid "Standard definition - 540p"
39+
msgstr ""
40+
41+
msgctxt "#31006"
42+
msgid "High definition - 720p"
43+
msgstr ""
44+
45+
msgctxt "#31007"
46+
msgid "Full HD - 1080p"
47+
msgstr ""
48+
49+
msgctxt "#31008"
50+
msgid "Highest Available"
51+
msgstr ""
52+
53+
msgctxt "#31010"
54+
msgid "Debug"
55+
msgstr ""
56+
57+
msgctxt "#31011"
58+
msgid "Enable developer mode"
59+
msgstr ""
60+
61+
msgctxt "#32001"
62+
msgid "Shows"
63+
msgstr ""
64+
65+
msgctxt "#32002"
66+
msgid "Full Episodes"
67+
msgstr ""
68+
69+
msgctxt "#32003"
70+
msgid "Standup"
71+
msgstr ""
72+
73+
msgctxt "#32004"
74+
msgid "Digital Originals"
75+
msgstr ""
76+
77+
msgctxt "#32005"
78+
msgid "Load More"
79+
msgstr ""
80+
81+
msgctxt "#33001"
82+
msgid "Url not supported, check log."
83+
msgstr ""
84+
85+
msgctxt "#33002"
86+
msgid "No json data found, check log."
87+
msgstr ""
88+
89+
msgctxt "#33003"
90+
msgid "Video not available."
91+
msgstr ""
92+
93+
msgctxt "#33004"
94+
msgid "Something went wrong, Try again..."
95+
msgstr ""
96+
97+
msgctxt "#33005"
98+
msgid "_type not supported. See log."
99+
msgstr ""
100+
101+
msgctxt "#41001"
102+
msgid "Use InputStream Adaptive and let it manage quality."
103+
msgstr ""
104+
105+
msgctxt "#41002"
106+
msgid "Force maximum quality to InputStream Adaptive as well."
107+
msgstr ""
108+
109+
msgctxt "#41003"
110+
msgid "Maximum quality to be used by the plugin."
111+
msgstr ""
112+
113+
msgctxt "#41011"
114+
msgid "Enable developer mode to increase verbosity of logging and set everything to LOG_INFO level and avoid enableing Kodi Debug mode."
115+
msgstr ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
import os
2+
import sys
3+
from urllib.parse import parse_qsl
4+
from urllib.parse import urlencode
5+
6+
import xbmc
7+
import xbmcaddon
8+
import xbmcgui
9+
import xbmcplugin
10+
import xbmcvfs
11+
12+
ADDON = xbmcaddon.Addon()
13+
ID = ADDON.getAddonInfo('id')
14+
NAME = ADDON.getAddonInfo('name')
15+
VERSION = ADDON.getAddonInfo('version')
16+
ICON = ADDON.getAddonInfo('icon')
17+
FANART = ADDON.getAddonInfo('fanart')
18+
PATH = ADDON.getAddonInfo('path')
19+
DATA_PATH = ADDON.getAddonInfo('profile')
20+
PATH_T = xbmcvfs.translatePath(PATH)
21+
DATA_PATH_T = xbmcvfs.translatePath(DATA_PATH)
22+
IMAGE_PATH_T = os.path.join(PATH_T, 'resources', 'media')
23+
LANGUAGE = ADDON.getLocalizedString
24+
KODILANGUAGE = xbmc.getLocalizedString
25+
26+
HANDLE = int(sys.argv[1])
27+
28+
29+
def executebuiltin(func, block=False):
30+
xbmc.executebuiltin(func, block)
31+
32+
33+
def notify(msg):
34+
xbmcgui.Dialog().notification(NAME, msg, ICON)
35+
36+
37+
def log(msg, level=xbmc.LOGDEBUG):
38+
# DEBUG = 0, INFO = 1, WARNING = 2, ERROR = 3, FATAL = 4
39+
xbmc.log(f"[{ID}/{VERSION}] {msg}", level=level)
40+
41+
42+
def getParams():
43+
if not sys.argv[2]:
44+
return {}
45+
return dict(parse_qsl(sys.argv[2][1:]))
46+
47+
48+
def parameters(p, host=sys.argv[0]):
49+
for k, v in list(p.items()):
50+
if v:
51+
p[k] = v
52+
else:
53+
p.pop(k, None)
54+
return f"{host}?{urlencode(p)}"
55+
56+
57+
def getSetting(setting):
58+
return ADDON.getSetting(setting).strip()
59+
60+
61+
def getSettingAsBool(setting):
62+
return getSetting(setting).lower() == 'true'
63+
64+
65+
def getSettingAsNum(setting):
66+
num = 0
67+
try:
68+
num = float(getSetting(setting))
69+
except ValueError:
70+
pass
71+
return num
72+
73+
74+
def getSettingAsInt(setting):
75+
return int(getSettingAsNum(setting))
76+
77+
78+
def setSetting(setting, value):
79+
ADDON.setSetting(id=setting, value=str(value))
80+
81+
82+
def showOkDialog(line, heading=NAME):
83+
xbmcgui.Dialog().ok(heading, line)
84+
85+
86+
def createListItem(
87+
label='', params=None, label2=None,
88+
thumb=None, fanart=None, poster=None, arts={},
89+
videoInfo=None, properties={}, isFolder=True,
90+
path=None, subs=None):
91+
item = xbmcgui.ListItem(label, label2, path, offscreen=True)
92+
if thumb:
93+
arts['thumb'] = thumb
94+
if fanart:
95+
arts['fanart'] = fanart
96+
if poster:
97+
arts['poster'] = poster
98+
item.setArt(arts)
99+
item.setInfo('video', videoInfo)
100+
if subs is not None:
101+
item.setSubtitles(subs)
102+
if not isFolder:
103+
properties['IsPlayable'] = 'true'
104+
for key, value in list(properties.items()):
105+
item.setProperty(key, value)
106+
return item
107+
108+
109+
def addListItem(
110+
label='', params=None, label2=None,
111+
thumb=None, fanart=None, poster=None, arts={},
112+
videoInfo=None, properties={}, isFolder=True,
113+
path=None, subs=None):
114+
if isinstance(params, dict):
115+
url = parameters(params)
116+
else:
117+
url = params
118+
item = createListItem(
119+
label=label, params=params, label2=label2,
120+
thumb=thumb, fanart=fanart, poster=poster, arts=arts,
121+
videoInfo=videoInfo, properties=properties, isFolder=isFolder,
122+
path=path, subs=subs)
123+
return xbmcplugin.addDirectoryItem(
124+
handle=HANDLE, url=url, listitem=item, isFolder=isFolder)
125+
126+
127+
def getPlaylist(type=xbmc.PLAYLIST_VIDEO, clear=True):
128+
plst = xbmc.PlayList(type)
129+
if clear:
130+
plst.clear()
131+
xbmc.sleep(200)
132+
return plst
133+
134+
135+
def setResolvedUrl(
136+
url='', solved=True, headers=None, subs=None,
137+
item=None, exit=True):
138+
headerUrl = ''
139+
if headers:
140+
headerUrl = urlencode(headers)
141+
item = xbmcgui.ListItem(
142+
path=f"{url}|{headerUrl}", offscreen=True) if item is None else item
143+
if subs is not None:
144+
item.setSubtitles(subs)
145+
xbmcplugin.setResolvedUrl(HANDLE, solved, item)
146+
if exit:
147+
sys.exit(0)
148+
149+
150+
def setContent(ctype='videos'):
151+
xbmcplugin.setContent(HANDLE, ctype)
152+
153+
154+
def endScript(message=None, loglevel=2, closedir=True, exit=True):
155+
if message:
156+
log(message, loglevel)
157+
if closedir:
158+
xbmcplugin.endOfDirectory(handle=HANDLE, succeeded=True)
159+
if exit:
160+
sys.exit(0)
161+
162+
163+
log(f"Starting with command \"{sys.argv[2]}\"", 1)

0 commit comments

Comments
 (0)