示例#1
0
def handshake():
    global key
    global acc_ok

    if is_valid(None, None):
        with open(fkey) as f:
            mac_ref, login, pw, key = json.load(f)
        if (mac == mac_ref) and (donation == login):
            return [mac_ref, login, pw, key]

    getToken()
    info = getProfile()
    info = getAuth(info)
    #watchdog()

    if info:
        id, pw = info
        info = [mac, id, pw, key]
        js = json.dumps(info)
        with open(fkey, 'w') as f:
            f.write(js)

    else:
        alert('[COLOR red]ERROR:[/COLOR]\n\nINVALID  LOGIN')
        clear_caches(refreshed=False, silent=True)
        acc_ok = False

    return info
示例#2
0
def show_vod():

    language = stalker.get_language(lang_filtered)
    if language == -1: return
    
    genre = stalker.get_genre(genre_filtered)
    
    try: data = stalker.get_vod()
    except Exception as e:
        alert('ERROR: VOD\n'+str(e))
        data = None
    
    if not data: return
    
    for name, icon, url, meta in data:
        if not stalker.language_valid(language, name, ' (ES)', type='vod'): continue
        try:
            if genre not in ['ALL', meta['genre'].split(',')[0]]: continue
        except:
            pass
        info = json.dumps([name, icon, url, '0'])
        cmd = [None, {'mode':'play', 'data':info}]
        add_item(name, cmd, icon, menus=None, meta=meta, last=False)
    
    #if meta: view_mode(508)
    #else: view_mode(500)
    
    xbmcplugin.endOfDirectory(addon_handle)
示例#3
0
def run(action):

    if action == 'start':
        if serverOnline():
            xbmcgui.Dialog().notification(
                addonname, 'Server already started.\nPort: ' + str(port),
                xbmcgui.NOTIFICATION_INFO)
        else:
            startServer()
            time.sleep(5)
            if serverOnline():
                xbmcgui.Dialog().notification(
                    addonname, 'Server started.\nPort: ' + str(port),
                    xbmcgui.NOTIFICATION_INFO)
            else:
                xbmcgui.Dialog().notification(
                    addonname,
                    'Server not started. Wait a minute and try again. ',
                    xbmcgui.NOTIFICATION_ERROR)

    elif action == 'stop':
        if serverOnline():
            stopServer()
            time.sleep(5)
            xbmcgui.Dialog().notification(addonname, 'Server stopped.',
                                          xbmcgui.NOTIFICATION_INFO)
        else:
            xbmcgui.Dialog().notification(addonname,
                                          'Server is already stopped.',
                                          xbmcgui.NOTIFICATION_INFO)

    elif action == 'check':
        status = '[COLOR lime]O N[/COLOR]' if serverOnline(
        ) else '[COLOR red]O F F[/COLOR]'
        alert('Server:  ' + status)
示例#4
0
def key_passed(silent):

    key = xbmcgui.Dialog().input('Current  Password?',
                                 option=xbmcgui.ALPHANUM_HIDE_INPUT)
    if not key: return False

    passed = (hashText(key) == adult_key)
    if not (passed or silent): alert('WRONG  PASSWORD!')

    return passed
示例#5
0
    def do_GET(self):
        from tools import no_video

        try:
            if '.m3u' in self.path.lower():
                try:
                    fm3u = m3u.m3u_create()
                    with open(fm3u, 'r') as f:
                        EXTM3U = f.read()

                except Exception as e:
                    EXTM3U += '#EXTINF:-1, tvg-id="Error" tvg-name="Error" tvg-logo="" group-title="Error", ' + str(
                        e) + '\n'
                    EXTM3U += 'http://\n\n'

                send_obj(self, 'm3u', EXTM3U)
                self.finish()

            elif '/play' in self.path:
                args = parse_qs(urlparse(self.path).query)
                try:
                    channel = args['channel'][0]
                    url = stalker.get_url(channel)
                except Exception as e:
                    alert(str(e))
                    url = None

                if not url: url = no_video()

                redirect(self, url)

            elif '/stop' in self.path:
                msg = 'Stopping ...'
                send_obj(self, 'html', msg)
                server.socket.close()

            elif '/online' in self.path:
                msg = 'Yes. I am.'
                send_obj(self, 'html', msg)

            else:
                self.send_error(400, 'Bad Request')

        except IOError:
            self.send_error(500, 'Internal Server Error ' + str(IOError))
示例#6
0
def get_channels():

    if not acc_ok: return None

    if not mac_based:
        acc = [donation, donation, server]
        genres, channels, vod, adult = m3u_read(fgenre, fchannel, fvod, fadult)
        return channels

    if is_valid(fchannel, exp_iptv):
        with open(fchannel) as f:
            channels = json.load(f)
        return channels

    ok = handshake()
    if not ok: return None

    params = 'type=itv&action=get_all_channels'

    try:
        data = retrieve_data(params)['js']['data']
    except:
        data = None

    if not data: return None

    data = iptv_obj(data)

    for genre in ['3', '13']:
        data += get_extra(genre)

    js = json.dumps(data)
    with open(fchannel, 'w') as f:
        f.write(js)

    try:
        m3u_create()
    except Exception as e:
        alert(str(e))

    return data
示例#7
0
def play_video():
    from tools import header_ua, redirect, pipeURL

    try: name, icon, url, tmp = json.loads(args['data'][0])
    except: url = None
    
    if not url: return
    
    try: url = stalker.get_link(url, tmp)
    except: url = None
    
    if not url: return
    
    try:
        url = pipeURL(redirect(url, header_ua))
    
        li = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=icon)
        li.setInfo('video', {'Title': name})
    
        xbmc.Player().play(item=url, listitem=li)
    
    except Exception as e:
        alert('PLAY  ERROR:\n\n'+str(e))
示例#8
0
def record_channel():
    
    ############## removed ##############
    
    alert("SORRY!\n\nThis version does not have the .strm feature")
示例#9
0
文件: pvr.py 项目: kens13/Kens13_Repo
def stalker_settings(epg):

    alert(epg)