Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[plugin.video.cc.com] 1.0.0 #3864

Open
wants to merge 1 commit into
base: matrix
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions plugin.video.cc.com/LICENSE.txt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions plugin.video.cc.com/addon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# author: nixxo
from resources.lib.main import ComedyCentral

cc = ComedyCentral()
cc.main()
67 changes: 67 additions & 0 deletions plugin.video.cc.com/addon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.video.cc.com" version="1.0.0" name="Comedy Central" provider-name="nixxo">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.simplecache" version="2.0.0"/>
<import addon="script.module.requests" version="2.25.0"/>
<import addon="script.module.inputstreamhelper" version="0.5.8" optional="true"/>
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>video</provides>
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Watch full episodes and clips from your favorite Comedy Central shows.</summary>
<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>
<platform>all</platform>
<license>GNU GENERAL PUBLIC LICENSE. Version 3, June 2007</license>
<source>https://github.com/nixxo/plugin.video.cc.com</source>
<website>https://www.cc.com/</website>
<news>[B]1.0.0[/B]
- first release on kodi addons repo
- final fixes

[B]0.0.7[/B]
- improved thumbnail setup
- improved setContent
- improved info extraction to avoid NoneType errors
- added offscreen=True to listitem creation
- created getPlaylist
- improved settings
- using f-strings
- urllib > requests
- moved videoInfo update before loop
- addonutils improvements

[B]v0.0.6[/B]
- improved translations
- made settings.xml with kodi19 conventions
- implemented better quality selection
- added "Full Episodes" menu item

[B]v0.0.5[/B]
- added inputstream helper option
- fixed single video title
- settings cleanup

[B]v0.0.4[/B]
- using cache to save video info
- added duration/airdate to videos
- code improvements and cleanup

[B]v0.0.3[/B]
- yt-dlp updated to 2021.10.22
- pull listitem infos to set plot on all playlist elements
- improved settings and localization

[B]v0.0.2[/B]
- playlist index fix
- strptime workaround

[B]v0.0.1[/B]
- first release</news>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.png</fanart>
</assets>
</extension>
</addon>
Binary file added plugin.video.cc.com/resources/fanart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin.video.cc.com/resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Kodi Media Center language file
# Addon Name: "Comedy Central"
# Addon id: plugin.video.cc.com
# Addon Provider: nixxo
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: en\n"

msgctxt "#30000"
msgid "General"
msgstr ""

msgctxt "#31000"
msgid "Playback"
msgstr ""

msgctxt "#31001"
msgid "Use InputStream Adaptive"
msgstr ""

msgctxt "#31002"
msgid "Manual quality selection"
msgstr ""

msgctxt "#31003"
msgid "Select Preferred Maximum Quality"
msgstr ""

msgctxt "#31004"
msgid "Low definition - 360p"
msgstr ""

msgctxt "#31005"
msgid "Standard definition - 540p"
msgstr ""

msgctxt "#31006"
msgid "High definition - 720p"
msgstr ""

msgctxt "#31007"
msgid "Full HD - 1080p"
msgstr ""

msgctxt "#31008"
msgid "Highest Available"
msgstr ""

msgctxt "#31010"
msgid "Debug"
msgstr ""

msgctxt "#31011"
msgid "Enable developer mode"
msgstr ""

msgctxt "#32001"
msgid "Shows"
msgstr ""

msgctxt "#32002"
msgid "Full Episodes"
msgstr ""

msgctxt "#32003"
msgid "Standup"
msgstr ""

msgctxt "#32004"
msgid "Digital Originals"
msgstr ""

msgctxt "#32005"
msgid "Load More"
msgstr ""

msgctxt "#33001"
msgid "Url not supported, check log."
msgstr ""

msgctxt "#33002"
msgid "No json data found, check log."
msgstr ""

msgctxt "#33003"
msgid "Video not available."
msgstr ""

msgctxt "#33004"
msgid "Something went wrong, Try again..."
msgstr ""

msgctxt "#33005"
msgid "_type not supported. See log."
msgstr ""

msgctxt "#41001"
msgid "Use InputStream Adaptive and let it manage quality."
msgstr ""

msgctxt "#41002"
msgid "Force maximum quality to InputStream Adaptive as well."
msgstr ""

msgctxt "#41003"
msgid "Maximum quality to be used by the plugin."
msgstr ""

msgctxt "#41011"
msgid "Enable developer mode to increase verbosity of logging and set everything to LOG_INFO level and avoid enableing Kodi Debug mode."
msgstr ""
163 changes: 163 additions & 0 deletions plugin.video.cc.com/resources/lib/addonutils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
import os
import sys
from urllib.parse import parse_qsl
from urllib.parse import urlencode

import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
import xbmcvfs

ADDON = xbmcaddon.Addon()
ID = ADDON.getAddonInfo('id')
NAME = ADDON.getAddonInfo('name')
VERSION = ADDON.getAddonInfo('version')
ICON = ADDON.getAddonInfo('icon')
FANART = ADDON.getAddonInfo('fanart')
PATH = ADDON.getAddonInfo('path')
DATA_PATH = ADDON.getAddonInfo('profile')
PATH_T = xbmcvfs.translatePath(PATH)
DATA_PATH_T = xbmcvfs.translatePath(DATA_PATH)
IMAGE_PATH_T = os.path.join(PATH_T, 'resources', 'media')
LANGUAGE = ADDON.getLocalizedString
KODILANGUAGE = xbmc.getLocalizedString

HANDLE = int(sys.argv[1])


def executebuiltin(func, block=False):
xbmc.executebuiltin(func, block)


def notify(msg):
xbmcgui.Dialog().notification(NAME, msg, ICON)


def log(msg, level=xbmc.LOGDEBUG):
# DEBUG = 0, INFO = 1, WARNING = 2, ERROR = 3, FATAL = 4
xbmc.log(f"[{ID}/{VERSION}] {msg}", level=level)


def getParams():
if not sys.argv[2]:
return {}
return dict(parse_qsl(sys.argv[2][1:]))


def parameters(p, host=sys.argv[0]):
for k, v in list(p.items()):
if v:
p[k] = v
else:
p.pop(k, None)
return f"{host}?{urlencode(p)}"


def getSetting(setting):
return ADDON.getSetting(setting).strip()


def getSettingAsBool(setting):
return getSetting(setting).lower() == 'true'


def getSettingAsNum(setting):
num = 0
try:
num = float(getSetting(setting))
except ValueError:
pass
return num


def getSettingAsInt(setting):
return int(getSettingAsNum(setting))


def setSetting(setting, value):
ADDON.setSetting(id=setting, value=str(value))


def showOkDialog(line, heading=NAME):
xbmcgui.Dialog().ok(heading, line)


def createListItem(
label='', params=None, label2=None,
thumb=None, fanart=None, poster=None, arts={},
videoInfo=None, properties={}, isFolder=True,
path=None, subs=None):
item = xbmcgui.ListItem(label, label2, path, offscreen=True)
if thumb:
arts['thumb'] = thumb
if fanart:
arts['fanart'] = fanart
if poster:
arts['poster'] = poster
item.setArt(arts)
item.setInfo('video', videoInfo)
if subs is not None:
item.setSubtitles(subs)
if not isFolder:
properties['IsPlayable'] = 'true'
for key, value in list(properties.items()):
item.setProperty(key, value)
return item


def addListItem(
label='', params=None, label2=None,
thumb=None, fanart=None, poster=None, arts={},
videoInfo=None, properties={}, isFolder=True,
path=None, subs=None):
if isinstance(params, dict):
url = parameters(params)
else:
url = params
item = createListItem(
label=label, params=params, label2=label2,
thumb=thumb, fanart=fanart, poster=poster, arts=arts,
videoInfo=videoInfo, properties=properties, isFolder=isFolder,
path=path, subs=subs)
return xbmcplugin.addDirectoryItem(
handle=HANDLE, url=url, listitem=item, isFolder=isFolder)


def getPlaylist(type=xbmc.PLAYLIST_VIDEO, clear=True):
plst = xbmc.PlayList(type)
if clear:
plst.clear()
xbmc.sleep(200)
return plst


def setResolvedUrl(
url='', solved=True, headers=None, subs=None,
item=None, exit=True):
headerUrl = ''
if headers:
headerUrl = urlencode(headers)
item = xbmcgui.ListItem(
path=f"{url}|{headerUrl}", offscreen=True) if item is None else item
if subs is not None:
item.setSubtitles(subs)
xbmcplugin.setResolvedUrl(HANDLE, solved, item)
if exit:
sys.exit(0)


def setContent(ctype='videos'):
xbmcplugin.setContent(HANDLE, ctype)


def endScript(message=None, loglevel=2, closedir=True, exit=True):
if message:
log(message, loglevel)
if closedir:
xbmcplugin.endOfDirectory(handle=HANDLE, succeeded=True)
if exit:
sys.exit(0)


log(f"Starting with command \"{sys.argv[2]}\"", 1)
Loading