Esempio n. 1
0
def listcatchup(url):
    if 'server1' in url:
        username = control.setting('server1user')
        password = control.setting('server1pass')
        host = user.server1host
        port = user.server1port
        u = '%s:%s/panel_api.php?username=%s&password=%s' % (
            host, port, username, password)
    elif 'server2' in url:
        username = control.setting('server2user')
        password = control.setting('server2pass')
        host = user.server2host
        port = user.server2port
        u = '%s:%s/panel_api.php?username=%s&password=%s' % (
            host, port, username, password)
    open = tools.OPEN_URL(u)
    all = tools.regex_get_all(open, '{"num', 'direct')
    for a in all:
        if '"tv_archive":1' in a:
            name = tools.regex_from_to(a, '"epg_channel_id":"',
                                       '"').replace('\/', '/')
            thumb = tools.regex_from_to(a, '"stream_icon":"',
                                        '"').replace('\/', '/')
            id = tools.regex_from_to(a, 'stream_id":"', '"')
            if not name == "":
                tools.addDir(name, url, 12, thumb, fanart, id)
Esempio n. 2
0
def correctPVR(url):

    if 'server1' in url:
        username = control.setting('server1user')
        password = control.setting('server1pass')
        host = user.server1host
        port = user.server1port
    elif 'server2' in url:
        username = control.setting('server2user')
        password = control.setting('server2pass')
        host = user.server2host
        port = user.server2port

    addon = xbmcaddon.Addon(user.id)

    jsonSetPVR = '{"jsonrpc":"2.0", "method":"Settings.SetSettingValue", "params":{"setting":"pvrmanager.enabled", "value":true},"id":1}'
    IPTVon = '{"jsonrpc":"2.0","method":"Addons.SetAddonEnabled","params":{"addonid":"pvr.iptvsimple","enabled":true},"id":1}'
    nulldemo = '{"jsonrpc":"2.0","method":"Addons.SetAddonEnabled","params":{"addonid":"pvr.demo","enabled":false},"id":1}'
    loginurl = host + ':' + port + "/get.php?username="******"&password="******"&type=m3u_plus&output=ts"
    EPGurl = host + ':' + port + "/xmltv.php?username="******"&password="******"false")
    moist.setSetting(id='epgCache', value="false")
    xbmc.executebuiltin("Container.Refresh")

    xbmcgui.Dialog().ok('Attention', 'PVR integration Complete', '')
Esempio n. 3
0
def livecategory(url):
    if 'server1' in url:
        username = control.setting('server1user')
        password = control.setting('server1pass')
        host = user.server1host
        port = user.server1port
    elif 'server2' in url:
        username = control.setting('server2user')
        password = control.setting('server2pass')
        host = user.server2host
        port = user.server2port

    url = '%s:%s/enigma2.php?username=%s&password=%s&type=get_live_categories' % (
        host, port, username, password)
    open = tools.OPEN_URL(url)
    all_cats = tools.regex_get_all(open, '<channel>', '</channel>')
    for a in all_cats:
        name = tools.regex_from_to(a, '<title>', '</title>')
        name = base64.b64decode(name)
        url1 = tools.regex_from_to(a, '<playlist_url>',
                                   '</playlist_url>').replace('<![CDATA[',
                                                              '').replace(
                                                                  ']]>', '')
        if not 'Install Videos' in name:
            if not 'TEST CHANNELS' in name:
                tools.addDir(name, url1, 2, icon, fanart, '')
Esempio n. 4
0
def settingsmenu():
	check  = control.setting('ADULT')
	if check == 'true':status = '[COLOR lime]Enabled[/COLOR]'
	else:status = '[COLOR red]Disabled[/COLOR]'
	
	tools.addDir('Edit Advanced Settings','ADS',10,icon,fanart,'')
	tools.addDir('Adult Cateogry: %s'%status,'ADULT',10,icon,fanart,'')
	tools.addDir('Log Out','LO',10,icon,fanart,'')
Esempio n. 5
0
def m3uselector(url):

    if 'server1' in url:
        username = control.setting('server1user')
        password = control.setting('server1pass')
        host = user.server1host
        port = user.server1port
    elif 'server2' in url:
        username = control.setting('server2user')
        password = control.setting('server2pass')
        host = user.server2host
        port = user.server2port

    dialog = xbmcgui.Dialog().select(
        'Select a M3U Format',
        ['M3U Standard', 'M3U Plus (Has Channel Categorys)'])
    if dialog == 0:
        type = 'm3u'
    elif dialog == 1:
        type = 'm3u_plus'
    else:
        return

    dialog = xbmcgui.Dialog().select('Select a Stream Format',
                                     ['MPEGTS (Recommended)', 'HLS', 'RTMP'])
    if dialog == 0:
        output = 'ts'
    elif dialog == 1:
        output = 'm3u8'
    elif dialog == 2:
        output = 'rtmp'
    else:
        return

    m3u = host + ':' + port + '/get.php?username='******'&password='******'&type=' + type + '&output=' + output
    epg = host + ':' + port + '/xmltv.php?username='******'&password='******'Here Is Your Shortened M3U & EPG URL[CR][CR]M3U URL: %s[CR][CR]EPG URL: %s' % (
        m3u, epg)
    popupd(text)
Esempio n. 6
0
def vod(url):
    if 'VOD:' in url:
        a = url.replace('VOD:', '')
        if 'server1' in a:
            username = control.setting('server1user')
            password = control.setting('server1pass')
            host = user.server1host
            port = user.server1port
            url = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories' % (
                host, port, username, password)
        elif 'server2' in a:
            username = control.setting('server2user')
            password = control.setting('server2pass')
            host = user.server2host
            port = user.server2port
            url = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories' % (
                host, port, username, password)

        open = tools.OPEN_URL(url)

    else:
        open = tools.OPEN_URL(url)
    all_cats = tools.regex_get_all(open, '<channel>', '</channel>')
    for a in all_cats:
        if '<playlist_url>' in open:
            name = tools.regex_from_to(a, '<title>', '</title>')
            url1 = tools.regex_from_to(a, '<playlist_url>',
                                       '</playlist_url>').replace(
                                           '<![CDATA[', '').replace(']]>', '')
            tools.addDir(
                str(base64.b64decode(name)).replace('?', ''), url1, 3, icon,
                fanart, '')
        else:
            name = tools.regex_from_to(a, '<title>', '</title>')
            name = base64.b64decode(name)
            thumb = tools.regex_from_to(a, '<desc_image>',
                                        '</desc_image>').replace(
                                            '<![CDATA[',
                                            '').replace(']]>', '')
            url = tools.regex_from_to(a, '<stream_url>',
                                      '</stream_url>').replace(
                                          '<![CDATA[', '').replace(']]>', '')
            desc = tools.regex_from_to(a, '<description>', '</description>')
            tools.addDir(name, url, 13, thumb, fanart, base64.b64decode(desc))
Esempio n. 7
0
def search(url):
    if url == "" or mode == 3:
        return False
    text = searchdialog()
    if not text:
        xbmc.executebuiltin(
            "XBMC.Notification([COLOR white][B]Search is Empty[/B][/COLOR],Aborting search,4000,"
            + icon + ")")
        return

    if 'server1' in url:
        username = control.setting('server1user')
        password = control.setting('server1pass')
        host = user.server1host
        port = user.server1port
        url = '%s:%s/panel_api.php?username=%s&password=%s' % (
            host, port, username, password)
    elif 'server2' in url:
        username = control.setting('server2user')
        password = control.setting('server2pass')
        host = user.server2host
        port = user.server2port
        url = '%s:%s/panel_api.php?username=%s&password=%s' % (
            host, port, username, password)

    open = tools.OPEN_URL(url)
    all_chans = tools.regex_get_all(open, '{"num":', 'epg')
    for a in all_chans:
        name = tools.regex_from_to(a, 'name":"', '"').replace('\/', '/')
        url = tools.regex_from_to(a, '"stream_id":"', '"')
        thumb = tools.regex_from_to(a, 'stream_icon":"',
                                    '"').replace('\/', '/')
        if text in name.lower():
            burl = '%s:%s/live/%s/%s/' % (host, port, username, password)
            tools.addDir(name, burl + url + '.ts', 4, thumb, fanart, '')
        elif text not in name.lower() and text in name:
            burl = '%s:%s/live/%s/%s/' % (host, port, username, password)
            tools.addDir(name, burl + url + '.ts', 4, thumb, fanart, '')
Esempio n. 8
0
def log(msg, level=LOGDEBUG):
    # override message level to force logging when addon logging turned on
    if control.setting('debug') == 'true' and level == LOGDEBUG:
        level = LOGNOTICE

    try:
        xbmc.log(
            '{0}, {1}:: {2}'.format(control.addonInfo('name'),
                                    control.addonInfo('version'), msg), level)
    except Exception as e:
        try:
            xbmc.log('Logging Failure: %s' % e, level)
        except BaseException:
            pass  # just give up
Esempio n. 9
0
    def subztv(self, query=None):
        if not query:
            query = self.query

        try:

            if control.setting('provider.subztv') == 'false':
                raise TypeError

            result = subztv.subztv().get(query)

            return result

        except TypeError:
            pass
Esempio n. 10
0
    def yifi(self, query=None):
        if not query:
            query = self.query

        try:

            if control.setting('provider.yifi') == 'false':
                raise TypeError

            result = yifi.yifi().get(query)

            return result

        except TypeError:

            pass
Esempio n. 11
0
def get_events(url):  # 5
    data = client.request(url)
    # xbmc.log('@#@EDATAAA: {}'.format(data), xbmc.LOGNOTICE)
    events = list(
        zip(
            client.parseDOM(str(data), 'li', attrs={'class': "item itemhov"}),
            re.findall(r'<i class="material-icons">(.+?)</a> </li>', str(data),
                       re.DOTALL)))
    # addDir('[COLORcyan]Time in GMT+2[/COLOR]', '', 'BUG', ICON, FANART, '')
    for event, streams in events:
        # xbmc.log('@#@EVENTTTTT:%s' % event, xbmc.LOGNOTICE)
        watch = '[COLORlime]*[/COLOR]' if '>Live<' in event else '[COLORred]*[/COLOR]'
        try:
            teams = client.parseDOM(event, 'td')
            # xbmc.log('@#@TEAMSSSS:%s' % str(teams), xbmc.LOGNOTICE)
            home, away = re.sub(r'\s*(<img.+?>)\s*', '',
                                teams[0]), re.sub(r'\s*(<img.+?>)\s*', '',
                                                  teams[2])
            if six.PY2:
                home = home.strip().encode('utf-8')
                away = away.strip().encode('utf-8')
            teams = '[B]{0} vs {1}[/B]'.format(home, away)
        except IndexError:
            teams = client.parseDOM(event, 'center')[0]
            teams = re.sub(r'<.+?>|\s{2}', '', teams)
            teams = teams.encode('utf-8') if six.PY2 else teams
            teams = '[B]{}[/B]'.format(teams)
        # xbmc.log('@#@TEAM-FINAL:%s' % str(teams), xbmc.LOGNOTICE)
        lname = client.parseDOM(event, 'a')[1]
        lname = re.sub(r'<.+?>', '', lname)
        time = client.parseDOM(event, 'span', attrs={'class': 'gmt_m_time'})[0]
        time = time.split('GMT')[0].strip()
        cov_time = convDateUtil(
            time, 'default', 'GMT{}'.format(str(control.setting('timezone'))))
        # xbmc.log('@#@COVTIMEEE:%s' % str(cov_time), xbmc.LOGNOTICE)
        ftime = '[COLORgold][I]{}[/COLOR][/I]'.format(cov_time)
        name = '{0}{1} {2} - [I]{3}[/I]'.format(watch, ftime, teams, lname)

        # links = re.findall(r'<a href="(.+?)".+?>( Link.+? )</a>', event, re.DOTALL)
        streams = str(quote(base64.b64encode(six.ensure_binary(streams))))

        icon = client.parseDOM(event, 'img', ret='src')[0]
        icon = urljoin(BASEURL, icon)

        addDir(name, streams, 4, icon, FANART, name)
Esempio n. 12
0
def livecategory(url):
	
	open = tools.OPEN_URL(live_url)
	all_cats = tools.regex_get_all(open,'<channel>','</channel>')
	for a in all_cats:
		name = tools.regex_from_to(a,'<title>','</title>')
		name = base64.b64decode(name)
		
		url1  = tools.regex_from_to(a,'<playlist_url>','</playlist_url>').replace('<![CDATA[','').replace(']]>','')
	
		check = control.setting('ADULT')
		
		if not 'TWITCH TV' in name:

			if check=='true':
				tools.addDir(name,url1,2,icon,fanart,'')
			else:
				if not 'ADULT XXX' in name:
					tools.addDir(name,url1,2,icon,fanart,'')
Esempio n. 13
0
 #############Imports#############
import xbmc,xbmcaddon,xbmcgui,xbmcplugin,base64,os,re,unicodedata,requests,time,string,sys,urllib,urllib2,json,urlparse,datetime,zipfile,shutil
from resources.modules import client,control,tools,shortlinks
from resources.ivue import ivuesetup
from datetime import date
import xml.etree.ElementTree as ElementTree
#################################

#############Defined Strings#############
addon_id     = 'plugin.video.bosstechmediaV3'
selfAddon    = xbmcaddon.Addon(id=addon_id)
icon         = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id, 'icon.png'))
fanart       = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id , 'fanart.jpg'))

username     = control.setting('Username')
password     = control.setting('Password')

host         = 'http://www.ipcctv.org'
port         = '80'

live_url     = '%s:%s/enigma2.php?username=%s&password=%s&type=get_live_categories'%(host,port,username,password)
vod_url      = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories'%(host,port,username,password)
panel_api    = '%s:%s/panel_api.php?username=%s&password=%s'%(host,port,username,password)
play_url     = '%s:%s/live/%s/%s/'%(host,port,username,password)


Guide = xbmc.translatePath(os.path.join('special://home/addons/plugin.video.bosstechmediaV3/resources/catchup', 'guide.xml'))
GuideLoc = xbmc.translatePath(os.path.join('special://home/addons/plugin.video.bosstechmediaV3/resources/catchup', 'g'))

advanced_settings           =  xbmc.translatePath('special://home/addons/'+addon_id+'/resources/advanced_settings')
advanced_settings_target    =  xbmc.translatePath(os.path.join('special://home/userdata','advancedsettings.xml'))
Esempio n. 14
0
def download_media(url, path, file_name, progress=None):

    try:
        if progress is None:
            progress = int(control.setting('progress_dialog'))

        active = not progress == PROGRESS.OFF
        background = progress == PROGRESS.BACKGROUND

        with control.ProgressDialog(
                control.addonInfo('name'), control.lang(30500).format(file_name), background=background, active=active
        ) as pd:

            try:
                headers = dict([item.split('=') for item in (url.split('|')[1]).split('&')])
                for key in headers:
                    headers[key] = unquote(headers[key])
            except:
                headers = {}

            if 'User-Agent' not in headers:
                headers['User-Agent'] = randomagent()

            request = urllib2.Request(url.split('|')[0], headers=headers)
            response = urllib2.urlopen(request)

            if 'Content-Length' in response.info():
                content_length = int(response.info()['Content-Length'])
            else:
                content_length = 0

            file_name += '.' + get_extension(url, response)
            full_path = control.join(path, file_name)
            log_debug('Downloading: %s -> %s' % (url, full_path))

            path = control.transPath(control.legalfilename(path))

            try:
                control.makeFiles(path)
            except Exception as e:
                log_debug('Path Create Failed: %s (%s)' % (e, path))

            from os import sep

            if not path.endswith(sep):
                path += sep
            if not control.exists(path):
                raise Exception('Failed to create dir')

            file_desc = control.openFile(full_path, 'w')
            total_len = 0
            cancel = False
            while 1:
                data = response.read(512 * 1024)
                if not data:
                    break

                if pd.is_canceled():
                    cancel = True
                    break

                total_len += len(data)
                if not file_desc.write(data):
                    raise Exception('Failed to write file')

                percent_progress = total_len * 100 / content_length if content_length > 0 else 0
                log_debug('Position : {0} / {1} = {2}%'.format(total_len, content_length, percent_progress))
                pd.update(percent_progress)

            file_desc.close()

        if not cancel:
            control.infoDialog(control.lang(30501).format(file_name))
            log_debug('Download Complete: {0} -> {1}'.format(url, full_path))

    except Exception as e:
        log_debug('Error ({0}) during download: {1} -> {2}'.format(str(e), url, file_name))
        control.infoDialog(control.lang(30502).format(str(e), file_name))
Esempio n. 15
0
def accountinfo(url):
    if 'server1' in url:
        username = control.setting('server1user')
        password = control.setting('server1pass')
        host = user.server1host
        port = user.server1port
        url = '%s:%s/panel_api.php?username=%s&password=%s' % (
            host, port, username, password)
        sub = '[COLOR FFE5E4E2]Platnium[/COLOR]'
    elif 'server2' in url:
        username = control.setting('server2user')
        password = control.setting('server2pass')
        host = user.server2host
        port = user.server2port
        url = '%s:%s/panel_api.php?username=%s&password=%s' % (
            host, port, username, password)
        sub = '[COLOR gold]Gold[/COLOR]'
    try:
        open = tools.OPEN_URL(url)
        username = tools.regex_from_to(open, '"username":"******"')
        password = tools.regex_from_to(open, '"password":"******"')
        status = tools.regex_from_to(open, '"status":"', '"')
        connects = tools.regex_from_to(open, '"max_connections":"', '"')
        active = tools.regex_from_to(open, '"active_cons":"', '"')
        expiry = tools.regex_from_to(open, '"exp_date":"', '"')
        if expiry == "":
            expiry = 'Unlimited'
        else:
            expiry = datetime.datetime.fromtimestamp(
                int(expiry)).strftime('%d/%m/%Y - %H:%M')
            expreg = re.compile('^(.*?)/(.*?)/(.*?)$',
                                re.DOTALL).findall(expiry)
            for day, month, year in expreg:
                month = tools.MonthNumToName(month)
                year = re.sub(' -.*?$', '', year)
                expiry = month + ' ' + day + ' - ' + year
        ip = tools.getlocalip()
        extip = tools.getexternalip()
        tools.addDir(
            '[COLOR white]Service:[/COLOR] [COLOR red]' + sub + '[/COLOR]', '',
            '', icon, fanart, '')
        tools.addDir('[COLOR white]Username:[/COLOR] ' + username, '', '',
                     icon, fanart, '')
        tools.addDir('[COLOR white]Password:[/COLOR] ' + password, '', '',
                     icon, fanart, '')
        tools.addDir('[COLOR white]Expiry Date:[/COLOR] ' + expiry, '', '',
                     icon, fanart, '')
        tools.addDir('[COLOR white]Account Status :[/COLOR] %s' % status, '',
                     '', icon, fanart, '')
        tools.addDir('[COLOR white]Current Connections:[/COLOR] ' + active, '',
                     '', icon, fanart, '')
        tools.addDir('[COLOR white]Allowed Connections:[/COLOR] ' + connects,
                     '', '', icon, fanart, '')
        tools.addDir('[COLOR white]Local IP Address:[/COLOR] ' + ip, '', '',
                     icon, fanart, '')
        tools.addDir('[COLOR white]External IP Address:[/COLOR] ' + extip, '',
                     '', icon, fanart, '')
        tools.addDir('[COLOR white]Kodi Version:[/COLOR] ' + str(KODIV), '',
                     '', icon, fanart, '')
    except:
        pass
Esempio n. 16
0
def tvarchive(name, url, description):
    if 'server1' in url:
        username = control.setting('server1user')
        password = control.setting('server1pass')
        host = user.server1host
        port = user.server1port
        days = 7
    elif 'server2' in url:
        username = control.setting('server2user')
        password = control.setting('server2pass')
        host = user.server2host
        port = user.server2port
        days = 5

    now = str(datetime.datetime.now()).replace('-', '').replace(':',
                                                                '').replace(
                                                                    ' ', '')
    date3 = datetime.datetime.now() - datetime.timedelta(days)
    date = str(date3)
    date = str(date).replace('-', '').replace(':', '').replace(' ', '')
    APIv2 = base64.b64decode(
        "JXM6JXMvcGxheWVyX2FwaS5waHA/dXNlcm5hbWU9JXMmcGFzc3dvcmQ9JXMmYWN0aW9uPWdldF9zaW1wbGVfZGF0YV90YWJsZSZzdHJlYW1faWQ9JXM="
    ) % (host, port, username, password, description)

    link = tools.OPEN_URL(APIv2)
    match = re.compile(
        '"title":"(.+?)".+?"start":"(.+?)","end":"(.+?)","description":"(.+?)"'
    ).findall(link)
    for ShowTitle, start, end, DesC in match:
        ShowTitle = base64.b64decode(ShowTitle)
        DesC = base64.b64decode(DesC)
        format = '%Y-%m-%d %H:%M:%S'
        try:
            modend = dtdeep.strptime(end, format)
            modstart = dtdeep.strptime(start, format)
        except:
            modend = datetime.datetime(*(time.strptime(end, format)[0:6]))
            modstart = datetime.datetime(*(time.strptime(start, format)[0:6]))
        StreamDuration = modend - modstart
        modend_ts = time.mktime(modend.timetuple())
        modstart_ts = time.mktime(modstart.timetuple())
        FinalDuration = int(modend_ts - modstart_ts) / 60
        strstart = start
        Realstart = str(strstart).replace('-',
                                          '').replace(':',
                                                      '').replace(' ', '')
        start2 = start[:-3]
        editstart = start2
        start2 = str(start2).replace(' ', ' - ')
        start = str(editstart).replace(' ', ':')
        Editstart = start[:13] + '-' + start[13:]
        Finalstart = Editstart.replace('-:', '-')
        if Realstart > date:
            if Realstart < now:
                catchupURL = base64.b64decode(
                    "JXM6JXMvc3RyZWFtaW5nL3RpbWVzaGlmdC5waHA/dXNlcm5hbWU9JXMmcGFzc3dvcmQ9JXMmc3RyZWFtPSVzJnN0YXJ0PQ=="
                ) % (host, port, username, password, description)
                ResultURL = catchupURL + str(
                    Finalstart) + "&duration=%s" % (FinalDuration)
                kanalinimi = "[COLOR white]%s[/COLOR] - %s" % (start2,
                                                               ShowTitle)
                tools.addDir(kanalinimi, ResultURL, 4, icon, fanart, DesC)
Esempio n. 17
0
def showhideadult():
	check = control.setting('ADULT')
	
	if check == 'true':control.setSetting('ADULT','false')
	else:control.setSetting('ADULT','true')
	xbmc.executebuiltin('Container.Refresh')
Esempio n. 18
0
def start(url):
    if 'server1' in url:
        username = control.setting('server1user')
        password = control.setting('server1pass')
        host = user.server1host
        port = user.server1port
        if username == "":
            usern = userpopup()
            passw = passpopup()
            control.setSetting('server1user', usern)
            control.setSetting('server1pass', passw)
            xbmc.executebuiltin('Container.Refresh')
            auth = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories' % (
                host, port, usern, passw)
            auth = tools.OPEN_URL(auth)
            if auth == "":
                line1 = "Incorrect Login Details"
                line2 = "Please Re-enter"
                line3 = ""
                xbmcgui.Dialog().ok('Attention', line1, line2, line3)
                MAIN()
            else:
                line1 = "Login Sucsessfull"
                line2 = "Welcome to " + user.name
                line3 = ('[COLOR white]%s[/COLOR]' % usern)
                xbmcgui.Dialog().ok(user.name, line1, line2, line3)
                xbmc.executebuiltin('Container.Refresh')
                tools.addDir(
                    'Account Information', 'server1', 6,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'myacc.png')), fanart,
                    'My Account Info - Containing Information Inlcuding Your Expiry Date & More'
                )
                tools.addDir(
                    'Live TV', 'server1', 1,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'livetv.png')), fanart,
                    'Live TV - Containing Our Selection of Live TV Channels')
                if xbmc.getCondVisibility('Pvr.HasTVChannels'):
                    tools.addDir(
                        'TV Guide', 'server1', 7,
                        xbmc.translatePath(
                            os.path.join(iconFolder, 'tvguide.png')), fanart,
                        'TV Guide - IPTV Simple Client PVR TV Guide')
                tools.addDir(
                    'Catchup TV', 'server1', 9,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'catchup.png')), fanart,
                    'Catchup TV - Catchup On Your Favourite Shows From the Past 7 Days'
                )
                tools.addDir(
                    'On Demand', 'VOD:server1', 3,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'vod.png')), fanart,
                    'VOD - Containing A Wide Selection of Movies & TV Series')
                tools.addDir(
                    'Search', 'server1', 5,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'search.png')), fanart,
                    'Search - Search Horizon IPTV For Your Favourite Channel or Movie'
                )
                tools.addDir(
                    'Extras', 'server1', 11,
                    xbmc.translatePath(os.path.join(iconFolder, 'extras.png')),
                    fanart, 'Extras - Horizon Extras')
                tools.addDir(
                    'Settings', 'AS', 10,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'settings.png')), fanart,
                    'Settings - Open Addon Settings')
        else:
            auth = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories' % (
                host, port, username, password)
            auth = tools.OPEN_URL(auth)
            if not auth == "":
                tools.addDir(
                    'Account Information', 'server1', 6,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'myacc.png')), fanart,
                    'My Account Info - Containing Information Inlcuding Your Expiry Date & More'
                )
                tools.addDir(
                    'Live TV', 'server1', 1,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'livetv.png')), fanart,
                    'Live TV - Containing Our Selection of Live TV Channels')
                if xbmc.getCondVisibility('Pvr.HasTVChannels'):
                    tools.addDir(
                        'TV Guide', 'server1', 7,
                        xbmc.translatePath(
                            os.path.join(iconFolder, 'tvguide.png')), fanart,
                        'TV Guide - IPTV Simple Client PVR TV Guide')
                tools.addDir(
                    'Catchup TV', 'server1', 9,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'catchup.png')), fanart,
                    'Catchup TV - Catchup On Your Favourite Shows From the Past 7 Days'
                )
                tools.addDir(
                    'On Demand', 'VOD:server1', 3,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'vod.png')), fanart,
                    'VOD - Containing A Wide Selection of Movies & TV Series')
                tools.addDir(
                    'Search', 'server1', 5,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'search.png')), fanart,
                    'Search - Search Horizon IPTV For Your Favourite Channel or Movie'
                )
                tools.addDir(
                    'Extras', 'server1', 11,
                    xbmc.translatePath(os.path.join(iconFolder, 'extras.png')),
                    fanart, 'Extras - Horizon Extras')
                tools.addDir(
                    'Settings', 'AS', 10,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'settings.png')), fanart,
                    'Settings - Open Addon Settings')
    elif 'server2' in url:
        username = control.setting('server2user')
        password = control.setting('server2pass')
        host = user.server2host
        port = user.server2port
        if username == "":
            usern = userpopup()
            passw = passpopup()
            control.setSetting('server2user', usern)
            control.setSetting('server2pass', passw)
            xbmc.executebuiltin('Container.Refresh')
            auth = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories' % (
                host, port, usern, passw)
            auth = tools.OPEN_URL(auth)
            if auth == "":
                line1 = "Incorrect Login Details"
                line2 = "Please Re-enter"
                line3 = ""
                xbmcgui.Dialog().ok('Attention', line1, line2, line3)
                MAIN()
            else:
                line1 = "Login Sucsessfull"
                line2 = "Welcome to " + user.name
                line3 = ('[COLOR white]%s[/COLOR]' % usern)
                xbmcgui.Dialog().ok(user.name, line1, line2, line3)
                xbmc.executebuiltin('Container.Refresh')
                tools.addDir(
                    'Account Information', 'server2', 6,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'myacc.png')), fanart,
                    'My Account Info - Containing Information Inlcuding Your Expiry Date & More'
                )
                tools.addDir(
                    'Live TV', 'server2', 1,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'livetv.png')), fanart,
                    'Live TV - Containing Our Selection of Live TV Channels')
                if xbmc.getCondVisibility('Pvr.HasTVChannels'):
                    tools.addDir(
                        'TV Guide', 'server2', 7,
                        xbmc.translatePath(
                            os.path.join(iconFolder, 'tvguide.png')), fanart,
                        'TV Guide - IPTV Simple Client PVR TV Guide')
                tools.addDir(
                    'Catchup TV', 'server2', 9,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'catchup.png')), fanart,
                    'Catchup TV - Catchup On Your Favourite Shows From the Past 7 Days'
                )
                tools.addDir(
                    'On Demand', 'VOD:server2', 3,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'vod.png')), fanart,
                    'VOD - Containing A Wide Selection of Movies & TV Series')
                tools.addDir(
                    'Search', 'server2', 5,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'search.png')), fanart,
                    'Search - Search Horizon IPTV For Your Favourite Channel or Movie'
                )
                tools.addDir(
                    'Extras', 'server2', 11,
                    xbmc.translatePath(os.path.join(iconFolder, 'extras.png')),
                    fanart, 'Extras - Horizon Extras')
                tools.addDir(
                    'Settings', 'AS', 10,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'settings.png')), fanart,
                    'Settings - Open Addon Settings')
        else:
            auth = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories' % (
                host, port, username, password)
            auth = tools.OPEN_URL(auth)
            if not auth == "":
                tools.addDir(
                    'Account Information', 'server2', 6,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'myacc.png')), fanart,
                    'My Account Info - Containing Information Inlcuding Your Expiry Date & More'
                )
                tools.addDir(
                    'Live TV', 'server2', 1,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'livetv.png')), fanart,
                    'Live TV - Containing Our Selection of Live TV Channels')
                if xbmc.getCondVisibility('Pvr.HasTVChannels'):
                    tools.addDir(
                        'TV Guide', 'server2', 7,
                        xbmc.translatePath(
                            os.path.join(iconFolder, 'tvguide.png')), fanart,
                        'TV Guide - IPTV Simple Client PVR TV Guide')
                tools.addDir(
                    'Catchup TV', 'server2', 9,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'catchup.png')), fanart,
                    'Catchup TV - Catchup On Your Favourite Shows From the Past 7 Days'
                )
                tools.addDir(
                    'On Demand', 'VOD:server2', 3,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'vod.png')), fanart,
                    'VOD - Containing A Wide Selection of Movies & TV Series')
                tools.addDir(
                    'Search', 'server2', 5,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'search.png')), fanart,
                    'Search - Search Horizon IPTV For Your Favourite Channel or Movie'
                )
                tools.addDir(
                    'Extras', 'server2', 11,
                    xbmc.translatePath(os.path.join(iconFolder, 'extras.png')),
                    fanart, 'Extras - Horizon Extras')
                tools.addDir(
                    'Settings', 'AS', 10,
                    xbmc.translatePath(os.path.join(iconFolder,
                                                    'settings.png')), fanart,
                    'Settings - Open Addon Settings')
Esempio n. 19
0
    def run(self, query=None):

        if not 'Greek' in str(langs).split(','):
            control.directory(syshandle)
            control.infoDialog(control.lang(32002).encode('utf-8'))
            return

        if query is None:
            if control.condVisibility('Player.HasVideo'):
                title = control.infoLabel('VideoPlayer.Title')

                if re.search(r'[^\x00-\x7F]+', title) is not None:
                    title = control.infoLabel('VideoPlayer.OriginalTitle')
                year = control.infoLabel('VideoPlayer.Year')

                tvshowtitle = control.infoLabel('VideoPlayer.TVshowtitle')

                season = control.infoLabel('VideoPlayer.Season')

                episode = control.infoLabel('VideoPlayer.Episode')
                try:
                    imdb = control.infoLabel('VideoPlayer.IMDBNumber')
                    if not imdb:
                        imdb = '0'
                except BaseException:
                    imdb = '0'
            else:
                title = xbmc.getInfoLabel("ListItem.OriginalTitle")
                year = xbmc.getInfoLabel("ListItem.Year")
                tvshowtitle = xbmc.getInfoLabel("ListItem.TVShowTitle")
                season = xbmc.getInfoLabel("ListItem.Season")
                episode = xbmc.getInfoLabel("ListItem.Episode")
                #labelType = xbmc.getInfoLabel("ListItem.DBTYPE")
                try:
                    imdb = control.infoLabel('ListItem.IMDBNumber')
                    # xbmc.log('$#$QUERY-NONE-IMDB: %s' % imdb, xbmc.LOGNOTICE)
                    if not imdb:
                        imdb = '0'
                except BaseException:
                    imdb = '0'

            if 's' in episode.lower():
                season, episode = '0', episode[-1:]

            if not tvshowtitle == '':  # episode
                query = '%s S%02dE%02d/imdb=%s' % (tvshowtitle, int(season),
                                                   int(episode), str(imdb))

            elif not year == '':  # movie
                query = '%s (%s)/imdb=%s' % (title, year, str(imdb))

            elif '(S' in title:
                query = '%s/imdb=%s' % (title, str(imdb))

            else:  # file
                query, year = getCleanMovieTitle(title)
                if not year == '':
                    query = '%s (%s)/imdb=%s' % (query, year, str(imdb))
            # xbmc.log('$#$QUERY-NONE-FINAL: %s' % query, xbmc.LOGNOTICE)

        else:
            query = '%s/imdb=0' % re.sub('[\(|\)]', '', query)
            # xbmc.log('$#$QUERY-ELSE: %s' % query, xbmc.LOGNOTICE)

        self.query = query
        # xbmc.log('$#$QUERY: %s' % query, xbmc.LOGNOTICE)

        threads = []
        if control.setting('provider.subztv.club'):
            threads.append(workers.Thread(self.subztv))
        if control.setting('provider.s4f'):
            threads.append(workers.Thread(self.s4f))
        if control.setting('provider.yifi'):
            threads.append(workers.Thread(self.yifi))

        [i.start() for i in threads]
        [i.join() for i in threads]

        f = []

        f += [i for i in self.list if i['source'] == 'subztv']

        f += [i for i in self.list if i['source'] == 's4f']

        f += [i for i in self.list if i['source'] == 'yifi']

        self.list = sorted(f, key=lambda k: k['rating'], reverse=True)

        for i in self.list:

            try:

                if i['source'] == 'subztv':
                    i['name'] = '[subztv] %s' % i['name']

                elif i['source'] == 's4f':
                    i['name'] = '[S4F] %s' % i['name']

                elif i['source'] == 'yifi':
                    i['name'] = '[yifi] %s' % i['name']
            except BaseException:
                pass

        for i in self.list:

            try:
                name, url, source, rating = i['name'], i['url'], i[
                    'source'], i['rating']

                u = {'action': 'download', 'url': url, 'source': source}
                u = '%s?%s' % (sysaddon, urllib.urlencode(u))

                item = control.item(label='Greek',
                                    label2=name,
                                    iconImage=str(rating),
                                    thumbnailImage='el')
                item.setProperty('sync', 'false')
                item.setProperty('hearing_imp', 'false')

                control.addItem(handle=syshandle,
                                url=u,
                                listitem=item,
                                isFolder=False)
            except BaseException:
                pass

        control.directory(syshandle)
Esempio n. 20
0
#
#  You should have received a copy of the GNU General Public License
#  along with this Program; see the file LICENSE.txt.  If not, write to
#  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#  http://www.gnu.org/copyleft/gpl.html
#
# http://kodi.wiki/view/How-to:Write_Python_Scripts
################################################

import urllib2, xbmc, xbmcgui, os, shutil, zipfile, re, string, time
import datetime
from resources.modules import control
from resources.modules import downloader
from resources.modules import tools

username = control.setting('Username')
password = control.setting('Password')
USERDATA = xbmc.translatePath(os.path.join('special://home/userdata', ''))
ini = xbmc.translatePath(
    os.path.join(
        'special://home/addons/plugin.video.hypersonicIPTV2/resources/ivue',
        'addons_index.ini'))
drxini = xbmc.translatePath(
    os.path.join(
        'special://home/addons/plugin.video.hypersonicIPTV2/resources/ivue',
        'addons2.ini.ini'))
inizip = xbmc.translatePath(
    os.path.join(
        'special://home/addons/plugin.video.hypersonicIPTV2/resources/ivue',
        'addons_index.zip'))
tmpini = xbmc.translatePath(os.path.join('special://home/userdata', ''))