Skip to content

Commit

Permalink
v1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz89B committed Aug 8, 2022
1 parent fad6da8 commit cf029cf
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
44 changes: 30 additions & 14 deletions addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
excatchup = params.get('catchup', '')
exstart = params.get('start', '')
exend = params.get('end', '')
exlabels = params.get('info_labels', '')

profile_path = xbmcvfs.translatePath(addon.getAddonInfo('profile'))

Expand Down Expand Up @@ -160,6 +161,9 @@ def add_item(label, url, mode, folder, playable, media_id='', catchup='', start=
info = x_localized(19047)
context_menu.insert(0, (info, 'Action(Info)'))

else:
list_item.setProperty('IsPlayable', 'false')

if context_menu:
list_item.addContextMenuItems(context_menu, replaceItems=True)

Expand All @@ -178,7 +182,7 @@ def add_item(label, url, mode, folder, playable, media_id='', catchup='', start=

xbmcplugin.addDirectoryItem(
handle=addon_handle,
url=build_url({'title': title, 'mode': mode, 'url': url, 'media_id': media_id, 'catchup': catchup, 'start': start, 'end': end}),
url=build_url({'title': title, 'mode': mode, 'url': url, 'media_id': media_id, 'catchup': catchup, 'start': start, 'end': end, 'info_labels': info_labels}),
listitem=list_item,
isFolder=folder)

Expand Down Expand Up @@ -537,7 +541,7 @@ def video_on_demand():
add_item(label=localized(30030), url='', mode='vod_genre_movies', icon=icon, fanart=fanart, folder=True, playable=False)
add_item(label=localized(30031), url='', mode='vod_genre_series', icon=icon, fanart=fanart, folder=True, playable=False)

xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=False)
xbmcplugin.endOfDirectory(addon_handle)

def vod_genre(genre):
beartoken = addon.getSetting('cmore_beartoken')
Expand Down Expand Up @@ -600,7 +604,7 @@ def vod(genre_id):
json = {
'operationName': 'getCommonBrowsePage',
'variables': {
'mediaContentLimit': 16,
'mediaContentLimit': 60,
'pageId': genre_id
},

Expand Down Expand Up @@ -766,7 +770,7 @@ def get_items(data, thumb=thumb, poster=poster, banner=banner, clearlogo=clearlo

if title not in titles:
count += 1
add_item(label=label, url='vod', mode=mode, media_id=media_id, folder=folder, playable=playable, info_labels={'title': title, 'originaltitle': title, 'plot': plot, 'plotoutline': outline, 'aired': date, 'dateadded': date, 'duration': duration, 'genre': genre, 'userrating': rating, 'mpaa': age}, icon=icon, poster=poster, fanart=fanart, context_menu=context_menu, item_count=count)
add_item(label=label, url='vod', mode=mode, media_id=media_id, folder=folder, playable=playable, info_labels={'title': title, 'sorttitle': title, 'originaltitle': title, 'plot': plot, 'plotoutline': outline, 'aired': date, 'dateadded': date, 'duration': duration, 'genre': genre, 'userrating': rating, 'mpaa': age}, icon=icon, poster=poster, fanart=fanart, context_menu=context_menu, item_count=count)
titles.add(title)

xbmcplugin.setContent(addon_handle, 'sets')
Expand Down Expand Up @@ -950,7 +954,7 @@ def vod_episodes(season, season_id):
ext = localized(30027)
context_menu = [('{0}'.format(ext), 'RunScript(plugin.video.cmore,0,?mode=ext,label={0})'.format(label))]

add_item(label=label, url='vod', mode='play', media_id=media_id, folder=False, playable=True, info_labels={'title': title, 'originaltitle': title, 'plot': plot, 'genre': genre, 'director': directors, 'cast': actors_lst, 'sortepisode': episode_nr, 'sortseason': season_nr, 'mpaa': age, 'year': date}, icon=icon, poster=poster, fanart=fanart, context_menu=context_menu, item_count=count)
add_item(label=label, url='vod', mode='play', media_id=media_id, folder=False, playable=True, info_labels={'title': title, 'sorttitle': title, 'originaltitle': title, 'plot': plot, 'genre': genre, 'director': directors, 'cast': actors_lst, 'sortepisode': episode_nr, 'sortseason': season_nr, 'mpaa': age, 'year': date}, icon=icon, poster=poster, fanart=fanart, context_menu=context_menu, item_count=count)

xbmcplugin.setContent(addon_handle, 'sets')
xbmcplugin.endOfDirectory(addon_handle)
Expand Down Expand Up @@ -1315,7 +1319,7 @@ def live_channels():

return channel_lst

def catchup_channel(exlink, start):
def get_programme(exlink, start):
country = int(addon.getSetting('cmore_locale'))
beartoken = addon.getSetting('cmore_beartoken')
tv_client_boot_id = addon.getSetting('cmore_tv_client_boot_id')
Expand Down Expand Up @@ -1389,7 +1393,7 @@ def catchup_channel(exlink, start):
if playback_spec:
excatchup = playback_spec.get('watchMode')

programs.update({'exlink':exlink, 'extitle': extitle, 'exid': exid, 'excatchup': excatchup, 'exstart': exstart_ts, 'exend': exend_ts})
programs.update({'exlink': exlink, 'extitle': extitle, 'exid': exid, 'excatchup': excatchup, 'exstart': exstart_ts, 'exend': exend_ts})

if programs:
return programs
Expand Down Expand Up @@ -1488,18 +1492,18 @@ def live_channel(exlink, extitle):
label = label[:50]

if int(now) >= int(start_time) and int(now) <= int(end_time):
name_ = label + '[B][COLOR violet] ● [/COLOR][/B]'
name_ = label + '[B][COLOR violet] [/COLOR][/B]'

elif int(end_time) >= int(now):
name_ = '[COLOR grey]{0}[/COLOR] [B][/B]'.format(label)

else:
name_ = label + '[B][COLOR limegreen] ● [/COLOR][/B]'
name_ = label + '[B][COLOR limegreen] [/COLOR][/B]'

title = name_ + '[COLOR grey]({0})[/COLOR]'.format(date)

except:
name_ = label + '[B][COLOR violet] ● [/COLOR][/B]'
name_ = label + '[B][COLOR violet] [/COLOR][/B]'
title = name_ + '[COLOR grey](00:00 - 23:59)[/COLOR]'

start_time = 0
Expand Down Expand Up @@ -2174,13 +2178,13 @@ def play(exlink, title, media_id, catchup_type, start, end):
is_helper = inputstreamhelper.Helper(PROTOCOL, drm=DRM)
if is_helper.check_inputstream():
play_item = xbmcgui.ListItem(path=strm_url)
play_item.setInfo( type="Video", infoLabels={ "Title": title, } )
play_item.setInfo('Video', infoLabels={'title': title})
play_item.setContentLookup(False)
play_item.setProperty('inputstream', is_helper.inputstream_addon)
play_item.setMimeType('application/xml+dash')
play_item.setProperty('inputstream.adaptive.license_type', DRM)
play_item.setProperty('inputstream.adaptive.license_key', license_url)
play_item.setProperty('inputstream.adaptive.stream_headers', 'Referer: https://www.cmore.se/&User-Agent='+quote(UA))
play_item.setProperty('inputstream.adaptive.stream_headers', 'Referer: https://www.cmore.se/&User-Agent=' + quote(UA))
play_item.setProperty('inputstream.adaptive.manifest_type', 'mpd')
play_item.setProperty('IsPlayable', 'true')
if catchup_type != 'LIVE':
Expand Down Expand Up @@ -2364,13 +2368,25 @@ def router(param):
start = utc
url = args.get('url')
if url:
prog = catchup_channel(url, start)
prog = get_programme(url, start)
if not prog:
return

play(prog['exlink'], prog['extitle'], prog['exid'], prog['excatchup'], prog['exstart'], prog['exend'])
else:
play(exlink, extitle, exid, excatchup, exstart, exend)
start = args.get('start')
url = args.get('url')

if not start:
catchup = 'LIVE'

start = 0
end = 0

play(exlink, extitle, exid, catchup, start, end)

else:
play(exlink, extitle, exid, excatchup, exstart, exend)

elif mode == 'programs':
live_channel(exlink, extitle)
Expand Down
7 changes: 5 additions & 2 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.cmore" name="C More" version="1.1.2" provider-name="mariusz89b">
<addon id="plugin.video.cmore" name="C More" version="1.1.3" provider-name="mariusz89b">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.inputstreamhelper" version="0.2.4"/>
Expand All @@ -24,7 +24,10 @@
<platform>all</platform>
<license>GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 and MIT LICENSE.</license>
<source>https://github.com/Mariusz89B/plugin.video.cmore</source>
<news>v1.1.2 (2022-08-06)
<news>v1.1.3 (2022-08-08)
- Code refactoring.

v1.1.2 (2022-08-06)
- Added Live TV.
- Added catchup function for M3U playlist.
- Other fixes.
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v1.1.3 (2022-08-08)
- Code refactoring.

v1.1.2 (2022-08-06)
- Added Live TV.
- Added catchup function for M3U playlist.
Expand Down

0 comments on commit cf029cf

Please sign in to comment.