def get_uri_by_timestamp(cls):
        """Generate an URI based on the timestamp."""
        program = cls._get_selection()
        if not program:
            return None

        # Get a list of addons that can play the selected channel
        # We do the lookup based on Channel Name, since that's all we have
        try:
            addons = cls._get_addons_for_channel(program.get('channel'))
        except IOError:
            if kodiutils.yesno_dialog(message=kodiutils.localize(
                    30713)):  # The EPG data is not up to date...
                from resources.lib.modules.addon import Addon
                Addon.refresh(True)
            return None

        if not addons:
            # Channel was not found.
            _LOGGER.debug('No Add-on was found to play %s',
                          program.get('channel'))
            kodiutils.notification(message=kodiutils.localize(
                30710,
                channel=program.get('channel')))  # Could not find an Add-on...
            return None

        if len(addons) == 1:
            # Channel has one Add-on. Play it directly.
            _LOGGER.debug('One Add-on was found to play %s: %s',
                          program.get('channel'), addons)
            return cls._format_uri(list(addons.values())[0], program)

        # Ask the user to pick an Add-on
        _LOGGER.debug('Multiple Add-on were found to play %s: %s',
                      program.get('channel'), addons)
        addons_list = list(addons)
        ret = kodiutils.select(heading=kodiutils.localize(30711),
                               options=addons_list)  # Select an Add-on...
        if ret == -1:
            _LOGGER.debug('The selection to play an item from %s was canceled',
                          program.get('channel'))
            return None

        return cls._format_uri(addons.get(addons_list[ret]), program)
Esempio n. 2
0
    def run(self):
        """Background loop for maintenance tasks"""
        _LOGGER.debug('Service started')

        # Service loop
        while not self.abortRequested():
            # Check if we need to do an update
            if self._is_refresh_required():
                Addon.refresh()

            # Check if IPTV Simple needs to be restarted
            if IptvSimple.restart_required:
                IptvSimple.restart()

            # Stop when abort requested
            if self.waitForAbort(30):
                break

        _LOGGER.debug('Service stopped')
Esempio n. 3
0
    def update():
        """ Update the channels and epg data """
        channels = []
        epg = dict()

        addons = Addon.get_iptv_addons()
        for addon in addons:
            _LOGGER.info('Updating IPTV data for %s...', addon.addon_id)

            # Fetch channels
            channels.extend(addon.get_channels())

            # Fetch EPG data
            epg.update(addon.get_epg())

        # Write files
        IptvSimple.write_playlist(channels)
        IptvSimple.write_epg(epg)

        IptvSimple.restart()
Esempio n. 4
0
from __future__ import unicode_literals
from resources.lib.modules.addon import Addon
import sys, os
import urlparse, urllib
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
from resources.lib.modules import control, myLists, client
from resources.lib.modules.log_utils import log

addon = Addon("plugin.video.castaway", sys.argv)
addon_handle = int(sys.argv[1])

if not os.path.exists(control.dataPath):
    os.mkdir(control.dataPath)

AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath, "resources/media/")
fanart = os.path.join(AddonPath + "/fanart.jpg")


def icon_path(filename):
    if "http://" in filename:
        return filename
    return os.path.join(IconPath, filename)


args = urlparse.parse_qs(sys.argv[2][1:])
mode = args.get("mode", None)


if mode is None:
    addon.add_item(
Esempio n. 5
0
def refresh():
    """Refresh the channels and EPG"""
    Addon.refresh(True)

    # Open settings again
    kodiutils.open_settings()
Esempio n. 6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from resources.lib.modules.addon import Addon
from resources.lib.modules import control,client,webutils,convert
import re,sys,os,urlparse,xbmcgui,xbmcplugin

addon = Addon('plugin.video.laliga', sys.argv)
addon_handle = int(sys.argv[1])

if not os.path.exists(control.dataPath):
    os.mkdir(control.dataPath)

AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath, "resources/media/")
fanart = os.path.join(AddonPath + "/fanart.jpg")

def icon_path(filename):
    if 'http://' in filename:
        return filename
    return os.path.join(IconPath, filename)

class info():
    def __init__(self,ico=None):
        self.mode = 'laliga'
        self.name = 'La Liga'
        if ico==None:
            self.icon = icon_path('logo.png')
        else:
            self.icon = icon_path(ico + '.png')
        self.categorized = False
Esempio n. 7
0
def update():
    """Silently refresh the channels and EPG"""
    Addon.refresh(force=True)
Esempio n. 8
0
import sys, os

reload(sys)
sys.setdefaultencoding('utf-8')

import xbmc
from xbmcgui import ListItem
from xbmcplugin import addDirectoryItem, endOfDirectory

from resources.lib.modules.addon import Addon
from resources.lib.modules import routing
from resources.lib.modules.log_utils import log
from resources.lib.modules.acesearch import acesearch, acestream_channels

addon = Addon('plugin.video.sparkle', sys.argv)
addon_handle = int(sys.argv[1])

plugin = routing.Plugin()

AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath, "resources/media/")
fanart = os.path.join(AddonPath + "/fanart.jpg")

# Update path so that praw doesnt complain
sys.path.append(os.path.join(AddonPath, 'resources/lib/modules'))
from resources.lib.modules.subreddit_lists import streaming_subreddits
from resources.lib.modules.subreddits2 import subreddits

AS_LAUNCH_LINK = 'XBMC.RunPlugin(plugin://program.plexus/?mode=1&url={url}&name={name})'
Esempio n. 9
0
from resources.lib.modules import view
from resources.lib.modules import dom_parser as dom
from resources.lib.modules.addon import Addon

ADDON = xbmcaddon.Addon()
ADDON_DATA = ADDON.getAddonInfo('profile')
ADDON_PATH = ADDON.getAddonInfo('path')
DESCRIPTION = ADDON.getAddonInfo('description')
FANART = ADDON.getAddonInfo('fanart')
ICON = ADDON.getAddonInfo('icon')
ID = ADDON.getAddonInfo('id')
NAME = ADDON.getAddonInfo('name')
VERSION = ADDON.getAddonInfo('version')
Lang = ADDON.getLocalizedString
Dialog = xbmcgui.Dialog()
addon = Addon(ID, sys.argv)
vers = VERSION
ART = ADDON_PATH + "/resources/icons/"

Baseurl = 'https://www.scnsrc.me/'
ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 OPR/73.0.3856.329'
headers = {'User-Agent': ua, 'Referer': Baseurl}

allfun = [(
    control.lang(32007).encode('utf-8'),
    'RunPlugin(plugin://plugin.video.rlshub/?mode=settings)',
),
          (
              control.lang(32008).encode('utf-8'),
              'RunPlugin(plugin://plugin.video.rlshub/?mode=ClearCache)',
          ),
Esempio n. 10
0
def reload():
    """Refresh the channels and EPG without opening settings"""
    Addon.refresh(True, force=True)
Esempio n. 11
0
def reload():
    """Silently refresh the channels and EPG"""
    Addon.refresh()
Esempio n. 12
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from resources.lib.modules.addon import Addon
from resources.lib.modules import control, client, webutils, convert
import re, sys, os, urlparse, xbmcgui, xbmcplugin

addon = Addon('plugin.video.laliga', sys.argv)
addon_handle = int(sys.argv[1])

if not os.path.exists(control.dataPath):
    os.mkdir(control.dataPath)

AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath, "resources/media/")
fanart = os.path.join(AddonPath + "/fanart.jpg")


def icon_path(filename):
    if 'http://' in filename:
        return filename
    return os.path.join(IconPath, filename)


class info():
    def __init__(self, ico=None):
        self.mode = 'laliga'
        self.name = 'La Liga'
        if ico == None:
            self.icon = icon_path('logo.png')
        else:
Esempio n. 13
0
# -*- coding: utf-8 -*-
import xbmc, sys
import sqlite3 as sql
import control

from resources.lib.modules.addon import Addon
addon = Addon('plugin.video.castaway', sys.argv)

db_path = control.databaseFile




class Parental():
    def __init__(self):
        self.db = sql.connect(db_path)
        self.cur = self.db.cursor()
        self.cur.execute('CREATE TABLE IF NOT EXISTS Settings (Name TEXT PRIMARY KEY , Enabled INT DEFAULT 0, Value Text DEFAULT __not__set__, Modified INT DEFAULT 0)')
        self.db.commit()

    def isEnabled(self):
        item = self.cur.execute("SELECT * FROM Settings WHERE Name=?",('Parental',)).fetchall()
        if len(item)==0:
            self.cur.execute('INSERT INTO Settings Values(?,?,?,?)',('Parental',0,'__not__set__',0))
            self.db.commit()
            return False
        else:
            return item[0][1]==1

    def isVisible(self):
        item = self.cur.execute("SELECT * FROM Settings WHERE Name=?",('Adult visible',)).fetchall()
Esempio n. 14
0
from __future__ import unicode_literals
from resources.lib.modules.addon import Addon
import sys, os
import urlparse, urllib
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
from resources.lib.modules import control, myLists, client
from resources.lib.modules.log_utils import log

addon = Addon('plugin.video.castaway', sys.argv)
addon_handle = int(sys.argv[1])

if not os.path.exists(control.dataPath):
    os.mkdir(control.dataPath)

AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath, "resources/media/")
fanart = os.path.join(AddonPath + "/fanart.jpg")


def icon_path(filename):
    if 'http://' in filename:
        return filename
    return os.path.join(IconPath, filename)


args = urlparse.parse_qs(sys.argv[2][1:])
mode = args.get('mode', None)

if mode is None:
    addon.add_item({'mode': 'live_sport'}, {'title': 'Live Sport'},
                   img=icon_path('live_sport.jpg'),
Esempio n. 15
0
from __future__ import unicode_literals
from resources.lib.modules.addon import Addon
import sys, os
import urlparse, urllib
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
from resources.lib.modules import control
from resources.lib.modules.log_utils import log
import re

addon = Addon('plugin.video.castback', sys.argv)
addon_handle = int(sys.argv[1])

if not os.path.exists(control.dataPath):
    os.mkdir(control.dataPath)

AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath, "resources/media/")
fanart = os.path.join(AddonPath + "/fanart.jpg")


def icon_path(filename):
    if 'http://' in filename:
        return filename
    return os.path.join(IconPath, filename)


args = urlparse.parse_qs(sys.argv[2][1:])
mode = args.get('mode', None)

# if mode is None:
Esempio n. 16
0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from resources.lib.modules.addon import Addon
import sys, os
import urlparse, urllib
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
from resources.lib.modules import control, radio
from resources.lib.modules.log_utils import log

addon = Addon('plugin.video.croatia_od', sys.argv)
addon_handle = int(sys.argv[1])

AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath, "resources/media/")
fanart = os.path.join(AddonPath + "/fanart.jpg")


def icon_path(filename):
    if 'http://' in filename:
        return filename
    return os.path.join(IconPath, filename)


args = urlparse.parse_qs(sys.argv[2][1:])
mode = args.get('mode', None)

if mode is None:
    addon.add_item({'mode': 'on_demand_tv'},
                   {'title': 'Televizija na zahtjev'},
                   img=icon_path('TV.png'),
                   fanart=fanart,
Esempio n. 17
0
        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''
import xbmc
import json
import random
import sys
import re
from six.moves.urllib.parse import urlparse, urljoin, quote_plus, quote, unquote, unquote_plus
from resources.lib.modules import control
from resources.lib.modules import cache
from resources.lib.modules import client
from resources.lib.modules import view
from resources.lib.modules.addon import Addon

addon = Addon('plugin.video.rlshub', sys.argv)
Lang = control.lang
ADDON = control.addon()
FANART = ADDON.getAddonInfo('fanart')
ICON = ADDON.getAddonInfo('icon')
NAME = ADDON.getAddonInfo('name')
version = ADDON.getAddonInfo('version')
IconPath = control.addonPath + "/resources/icons/"
base = control.setting('domain')
BASE_URL = 'http://%s' % base.lower()
OLD_URL = 'http://old2.proxybb.com/'

try:
    from sqlite3 import dbapi2 as database
except ImportError:
    from pysqlite2 import dbapi2 as database
Esempio n. 18
0
import re
import sys
import os
from sys import argv
from six.moves.urllib.parse import parse_qsl, urlparse
from resources.lib.modules import client
from resources.lib.modules import control, tools
from resources.lib.modules import cache
from resources.lib.modules import search
from resources.lib.modules import view
from resources.lib.modules.addon import Addon

addon_id = 'plugin.video.rlshub'
plugin = xbmcaddon.Addon(id=addon_id)
DB = os.path.join(xbmc.translatePath("special://database"), 'cache.db')
addon = Addon(addon_id, sys.argv)

##### Queries ##########
queries = dict(parse_qsl(argv[2][1:]))
mode = queries.get('mode', None)
url = queries.get('url', None)
content = queries.get('content', None)
query = queries.get('query', None)
startPage = queries.get('startPage', None)
numOfPages = queries.get('numOfPages', None)
listitem = queries.get('listitem', None)
urlList = queries.get('urlList', None)
section = queries.get('section', None)
title = queries.get('title', None)
img = queries.get('img', None)
text = queries.get('text', None)
from resources.lib.modules.addon import Addon
import sys, os
import xbmc
import xbmcvfs
if sys.version_info[0] == 3:
    from urllib.parse import urlparse, parse_qs, urlencode
else:
    import urlparse
    from urllib import urlencode

import sys
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
from resources.lib.modules import control, cache, constants
from resources.lib.modules.log_utils import log

addon = Addon('plugin.video.KodiTVR_MATRIX-LEIA_SPORT', sys.argv)
addon_handle = int(sys.argv[1])

if not os.path.exists(control.dataPath):
    os.mkdir(control.dataPath)

AddonPath = control.addonPath
IconPath = os.path.join(AddonPath, control.transPath("resources/media/"))
fanart = os.path.join(AddonPath, control.transPath("/fanart.jpg"))


def icon_path(filename):
    if 'http' in filename:
        return filename
    return control.transPath(os.path.join(IconPath, filename))
Esempio n. 20
0
#
# The intention was to get familiar with Python as I had no clue of it prior. The coding is for sure not
# perfect and most likely not a good style. Helping comments are welcome - check the repo on github
# https://github.com/bigcookie/plugin.image.daily_dilbert/
# Desires: I would like to add images to the directories including thumbnails to allow right/left key browsing, but performance was too low. Any ideas to improve are welcome.
#

import urllib2, os, re, sys, datetime, xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.lib.modules.addon import Addon  # want to get rid of this to save imports
from calendar import monthrange
from urlparse import parse_qs
from random import randint, randrange

# Want to get rid of this - inherited from Garfield Plugin).
# Also want to replace Addon().add_item() (used later on)
addon = Addon('plugin.image.daily_dilbert', sys.argv)

### Global variables ###
# I dont like global variables, but in this case it is easier/faster for me.
# global variables including used Kodi arguments, which are not supposed to be changed or altered
g_AddonHandle = int(sys.argv[1])
g_AddonPath = xbmcaddon.Addon().getAddonInfo('path')
g_Args = parse_qs(sys.argv[2][1:])
g_Args_Mode = g_Args.get('mode', None)
g_Args_Year = g_Args['year'][0] if 'year' in g_Args else ""
g_Args_Month = g_Args['month'][0] if 'month' in g_Args else ""
g_Args_Day = g_Args['day'][0] if 'day' in g_Args else ""
g_Args_Page = g_Args['page'][0] if 'page' in g_Args else ""
g_CacheDir = g_AddonPath + "/cache/"  # Where to we store cached scraped Dilbert URLs
g_Now = datetime.date.today()  # Today
Esempio n. 21
0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from resources.lib.modules.addon import Addon
import sys,os
import urlparse,urllib
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
from resources.lib.modules import control,radio
from resources.lib.modules.log_utils import log

addon = Addon('plugin.video.croatia_od', sys.argv)
addon_handle = int(sys.argv[1])

AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath , "resources/media/")
fanart = os.path.join(AddonPath + "/fanart.jpg")
def icon_path(filename):
    if 'http://' in filename:
        return filename
    return os.path.join(IconPath, filename)

args = urlparse.parse_qs(sys.argv[2][1:])
mode = args.get('mode', None)


if mode is None:
    addon.add_item({'mode': 'on_demand_tv'}, {'title':'Televizija na zahtjev'}, img=icon_path('TV.png'), fanart=fanart,is_folder=True)
    addon.add_item({'mode': 'live_tv'}, {'title':('Televizija uživo').encode('utf-8')}, img=icon_path('TV.png'), fanart=fanart,is_folder=True)
    addon.add_item({'mode': 'on_demand_radio'}, {'title':'Radio na zahtjev'}, img=icon_path('Radio.png'), fanart=fanart,is_folder=True)
    addon.add_item({'mode': 'live_radio'}, {'title':('Radio uživo').encode('utf-8')}, img=icon_path('Radio.png'), fanart=fanart,is_folder=True)
    addon.add_item({'mode': 'downloads'}, {'title':'Preuzimanja'}, img=icon_path('Downloads.png'), fanart=fanart,is_folder=True)
    addon.add_item({'mode': 'tools'}, {'title':'Alati'}, img=icon_path('tools.png'), fanart=fanart,is_folder=True)