Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.
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
21 changes: 21 additions & 0 deletions account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Account:
id = ''
username = ''
password = ''
provider = ''
cookies_path = ''
pin_protected = True

def __init__(self, id, username, password, provider, cookies_path, pin_protected=True):
self.id = id
self.username = username
self.password = password
self.provider = provider
self.cookies_path = cookies_path
self.pin_protected = pin_protected

def is_valid(self):
if self.username and self.password and self.provider:
return True
else:
return False
2 changes: 1 addition & 1 deletion exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def create_m3u(channels, path, url):
c['stationid'],
url + logo_sl_location(c['title']) if url is not None else logo_id(c['title']),
c['title']))
file.write(u'plugin://plugin.video.sl/?action=play&id=%s&askpin=%s\n' % (c['id'], c['pin']))
file.write(u'plugin://plugin.video.sl/?action=play&account=%s&channel=%s&askpin=%s\n' % (c['account'], c['id'], c['pin']))


def create_epg(channels, epg, path, addon=None, url='https://livetv.skylink.sk/'):
Expand Down
23 changes: 11 additions & 12 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logger
import requests
import skylink
import account
import xbmc
import xbmcaddon
import xbmcgui
Expand All @@ -13,15 +14,14 @@

_id = int(sys.argv[1])
_addon = xbmcaddon.Addon()
_profile = xbmc.translatePath(_addon.getAddonInfo('profile')).decode("utf-8")
_user_name = xbmcplugin.getSetting(_id, 'username')
_password = xbmcplugin.getSetting(_id, 'password')
_provider = 'skylink.sk' if int(xbmcplugin.getSetting(_id, 'provider')) == 0 else 'skylink.cz'
_pin_protected_content = 'false' != xbmcplugin.getSetting(_id, 'pin_protected_content')

def play(channel_id, askpin):
logger.log.info('play: ' + channel_id)
sl = skylink.Skylink(_user_name, _password, _profile, _provider)
def play(account_id, channel_id, askpin):
sl = utils.get_provider(account_id)

if not sl:
return

logger.log.info('Play channel %s from %s' % (channel_id, sl.account.provider))

if askpin != 'False':
pin_ok = utils.ask_for_pin(sl)
Expand All @@ -44,13 +44,12 @@ def play(channel_id, askpin):
playitem.setProperty('inputstream.adaptive.license_key', info['key'])
xbmcplugin.setResolvedUrl(_id, True, playitem)


if __name__ == '__main__':
args = urlparse.parse_qs(sys.argv[2][1:])
if 'id' in args:
play(str(args['id'][0]), str(args['askpin'][0]) if 'askpin' in args else 'False')
if 'account' in args and 'channel' in args:
play(str(args['account'][0]), str(args['channel'][0]), str(args['askpin'][0]) if 'askpin' in args else 'False')
elif 'replay' in args:
replay.router(args, skylink.Skylink(_user_name, _password, _profile, _provider, _pin_protected_content))
replay.router(args)
else:
xbmcplugin.setPluginCategory(_id, '')
xbmcplugin.setContent(_id, 'videos')
Expand Down
56 changes: 40 additions & 16 deletions replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,34 @@ def get_logo(title, sl):
return os.path.join(_logos_folder, exports.logo_id(title))


def channels(sl):
channels = utils.call(sl, lambda: sl.channels(True))

def channels():
providers = utils.get_available_providers()
channels = []

for sl in providers:
channels = channels + utils.call(sl, lambda: sl.channels(True))

if bool(_addon.getSetting('playlist_unique')):
channels = utils.unique_channels(channels)

xbmcplugin.setPluginCategory(_handle, _addon.getLocalizedString(30600))
if channels:
for channel in channels:
list_item = xbmcgui.ListItem(label=channel['title'])
list_item.setInfo('video', {'title': channel['title']}) #TODO - genre?
list_item.setArt({'thumb': get_logo(channel['title'], sl)})
link = get_url(replay='days', stationid=channel['stationid'], channel=channel['title'], askpin=channel['pin'])
link = get_url(replay='days', accountid=channel['account'], stationid=channel['stationid'], channel=channel['title'], askpin=channel['pin'])
is_folder = True
xbmcplugin.addDirectoryItem(_handle, link, list_item, is_folder)
xbmcplugin.endOfDirectory(_handle)

def days(sl, stationid, channel, askpin):
def days(accountid, stationid, channel, askpin):
sl = utils.get_provider(accountid)

if not sl:
return

now = datetime.datetime.now()
xbmcplugin.setPluginCategory(_handle, _addon.getLocalizedString(30600) + ' / ' + channel)
if askpin != 'False':
Expand All @@ -72,12 +86,17 @@ def days(sl, stationid, channel, askpin):
title = _addon.getLocalizedString(int('3061' + str(d.weekday()))) + ', ' + title
list_item = xbmcgui.ListItem(label=title)
list_item.setArt({'icon':'DefaultAddonPVRClient.png'})
link = get_url(replay='programs', stationid=stationid, channel=channel, day=day, first=True)
link = get_url(replay='programs', accountid=accountid, stationid=stationid, channel=channel, day=day, first=True)
is_folder = True
xbmcplugin.addDirectoryItem(_handle, link, list_item, is_folder)
xbmcplugin.endOfDirectory(_handle)

def programs(sl, stationid, channel, day=0, first=False):
def programs(accountid, stationid, channel, day=0, first=False):
sl = utils.get_provider(accountid)

if not sl:
return

today = day == 0
if today:
now = datetime.datetime.now()
Expand All @@ -88,7 +107,7 @@ def programs(sl, stationid, channel, day=0, first=False):
if day < 6:
list_item = xbmcgui.ListItem(label=_addon.getLocalizedString(30604))
list_item.setArt({'icon':'DefaultVideoPlaylists.png'})
link = get_url(replay='programs', stationid=stationid, channel=channel, day=day+1)
link = get_url(replay='programs', accountid=accountid, stationid=stationid, channel=channel, day=day+1)
is_folder = True
xbmcplugin.addDirectoryItem(_handle, link, list_item, is_folder)
if epg:
Expand All @@ -108,20 +127,25 @@ def programs(sl, stationid, channel, day=0, first=False):
cover = sl.getUrl() + "/" + program['cover']
list_item.setArt({'thumb': cover, 'icon': cover})

link = get_url(replay='replay', locId=program['locId'])
link = get_url(replay='replay', accountid=accountid, locId=program['locId'])
is_folder = False
list_item.setProperty('IsPlayable','true')
xbmcplugin.addDirectoryItem(_handle, link, list_item, is_folder)
if day > 0:
list_item = xbmcgui.ListItem(label=_addon.getLocalizedString(30603))
list_item.setArt({'icon':'DefaultVideoPlaylists.png'})
link = get_url(replay='programs', stationid=stationid, channel=channel, day=day-1)
link = get_url(replay='programs', accountid=accountid, stationid=stationid, channel=channel, day=day-1)
is_folder = True
xbmcplugin.addDirectoryItem(_handle, link, list_item, is_folder)

xbmcplugin.endOfDirectory(_handle, updateListing=not first)

def replay(sl, locId):
def replay(accountid, locId):
sl = utils.get_provider(accountid)

if not sl:
return

info = utils.call(sl, lambda: sl.replay_info(locId))

if info:
Expand All @@ -135,15 +159,15 @@ def replay(sl, locId):
xbmcplugin.setResolvedUrl(_handle, True, playitem)


def router(args, sl):
def router(args):
if args:
if args['replay'][0] == 'programs':
programs(sl, args['stationid'][0], args['channel'][0], int(args['day'][0]) if 'day' in args else 0, 'first' in args)
programs(args['accountid'][0], args['stationid'][0], args['channel'][0], int(args['day'][0]) if 'day' in args else 0, 'first' in args)
elif args['replay'][0] == 'replay':
replay(sl, args['locId'][0])
replay(args['accountid'][0], args['locId'][0])
elif args['replay'][0] == 'days':
days(sl, args['stationid'][0], args['channel'][0], args['askpin'][0])
days(args['accountid'][0], args['stationid'][0], args['channel'][0], args['askpin'][0])
else:
channels(sl)
channels()
else:
channels(sl)
channels()
34 changes: 17 additions & 17 deletions resources/language/Czech/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,33 @@ msgid "Account"
msgstr "Účet"

msgctxt "#30101"
msgid "Provider"
msgstr "Poskytovatel"
msgid "Skylink SK"
msgstr "Skylink SK"

msgctxt "#30102"
msgid "Email / Card number"
msgstr "Číslo karty/Emailová adresa"
msgid "Skylink CZ"
msgstr "Skylink CZ"

msgctxt "#30103"
msgid "Email / Card number"
msgstr "Email / číslo karty"

msgctxt "#30104"
msgid "Password"
msgstr "Heslo"

msgctxt "#30111"
msgid "Skylink SK"
msgstr "Skylink SK"

msgctxt "#30112"
msgid "Skylink CZ"
msgstr "Skylink CZ"
msgctxt "#30105"
msgid "Generate and show pin protected channels"
msgstr "Generovat a zobrazovat obsah chráněný PIN-em"

msgctxt "#30104"
msgctxt "#30106"
msgid "When no device is available use oldest"
msgstr "Pokud není k dispozici žádné zařízení, použij nejstarší

msgctxt "#30105"
msgctxt "#30107"
msgid "Limit devices list to web browser"
msgstr "Omezit zařízení v seznamu pouze na prohlížeče"

msgctxt "#30106"
msgid "Generate and show pin protected channels"
msgstr "Generovat a zobrazovat obsah chráněný PIN-em"

msgctxt "#30200"
msgid "Playlist"
msgstr "Playlist"
Expand All @@ -56,6 +52,10 @@ msgid "Filename"
msgstr "Název souboru"

msgctxt "#30204"
msgid "Eliminate duplicate channels"
msgstr "Odstranit duplicitní stanice"

msgctxt "#30205"
msgid "Logo urls directly from Skylink Live TV site"
msgstr "Url adresy pro loga stanic přímo ze stránky Skylink Live TV"

Expand Down
32 changes: 16 additions & 16 deletions resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,33 @@ msgid "Account"
msgstr "Account"

msgctxt "#30101"
msgid "Provider"
msgstr "Provider"
msgid "Skylink SK"
msgstr "Skylink SK"

msgctxt "#30102"
msgid "Skylink CZ"
msgstr "Skylink CZ"

msgctxt "#30103"
msgid "Email / Card number"
msgstr "Email / Card number"

msgctxt "#30103"
msgctxt "#30104"
msgid "Password"
msgstr "Password"

msgctxt "#30111"
msgid "Skylink SK"
msgstr "Skylink SK"

msgctxt "#30112"
msgid "Skylink CZ"
msgstr "Skylink CZ"
msgctxt "#30105"
msgid "Generate and show pin protected channels"
msgstr "Generate and show pin protected channels"

msgctxt "#30104"
msgctxt "#30106"
msgid "When no device is available use oldest"
msgstr "When no device is available use oldest"

msgctxt "#30105"
msgctxt "#30107"
msgid "Limit devices list to web browser"
msgstr "Limit devices list to web browser"

msgctxt "#30106"
msgid "Generate and show pin protected channels"
msgstr "Generate and show pin protected channels"

msgctxt "#30200"
msgid "Playlist"
msgstr "Playlist"
Expand All @@ -56,6 +52,10 @@ msgid "Filename"
msgstr "Filename"

msgctxt "#30204"
msgid "Eliminate duplicate channels"
msgstr "Eliminate duplicate channels"

msgctxt "#30205"
msgid "Logo urls directly from Skylink Live TV site"
msgstr "Logo urls directly from Skylink Live TV site"

Expand Down
32 changes: 16 additions & 16 deletions resources/language/Slovak/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,33 @@ msgid "Account"
msgstr "Účet"

msgctxt "#30101"
msgid "Provider"
msgstr "Provider"
msgid "Skylink SK"
msgstr "Skylink SK"

msgctxt "#30102"
msgid "Skylink CZ"
msgstr "Skylink CZ"

msgctxt "#30103"
msgid "Email / Card number"
msgstr "Email / číslo karty"

msgctxt "#30103"
msgctxt "#30104"
msgid "Password"
msgstr "Heslo"

msgctxt "#30111"
msgid "Skylink SK"
msgstr "Skylink SK"

msgctxt "#30112"
msgid "Skylink CZ"
msgstr "Skylink CZ"
msgctxt "#30105"
msgid "Generate and show pin protected channels"
msgstr "Generovať a zobrazovať obsah chránený PIN-om"

msgctxt "#30104"
msgctxt "#30106"
msgid "When no device is available use oldest"
msgstr "Ak žiadne zariadenie nie je dostupé, použi najstaršie"

msgctxt "#30105"
msgctxt "#30107"
msgid "Limit devices list to web browser"
msgstr "Obmedziť zariadenia v zozname len na prehliadače"

msgctxt "#30106"
msgid "Generate and show pin protected channels"
msgstr "Generovať a zobrazovať obsah chránený PIN-om"

msgctxt "#30200"
msgid "Playlist"
msgstr "Playlist"
Expand All @@ -56,6 +52,10 @@ msgid "Filename"
msgstr "Súbor"

msgctxt "#30204"
msgid "Eliminate duplicate channels"
msgstr "Odstrániť duplikátne stanice"

msgctxt "#30205"
msgid "Logo urls directly from Skylink Live TV site"
msgstr "Url adresy pre logá staníc priamo zo stránky Skylink Live TV"

Expand Down
Loading