Пример #1
0
def log(text):
    debug = True
    if (debug == True):
        xbmc.log('%s libname: %s' % (LIBNAME, text))
    else:
        if(DEBUG == True):
            xbmc.log('%s libname: %s' % (LIBNAME, text))
Пример #2
0
 def __log(self, text):
     debug = None
     if (debug == True):
         xbmc.log('%s class: %s' % (self.CLASSNAME, text))
     else:
         if(DEBUG == True):
             xbmc.log('%s class: %s' % (self.CLASSNAME, text))
Пример #3
0
def log(text):
    debug = None
    if (debug == True):
        xbmc.log('%s libname: %s' % (LIBNAME, text))
    else:
        if (DEBUG == True):
            xbmc.log('%s libname: %s' % (LIBNAME, text))
Пример #4
0
 def __log(self, text):
     debug = None
     if (debug == True):
         xbmc.log('%s class: %s' % (self.CLASSNAME, text))
     else:
         if (DEBUG == True):
             xbmc.log('%s class: %s' % (self.CLASSNAME, text))
Пример #5
0
def addDir(name,url,mode,iconimage,fanart,description):
    
    xbmc.log(url)    
    u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)+"&description="+urllib.quote_plus('')
    ok=True
    liz=xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
    liz.setInfo( type="Video", infoLabels={ "Title": name,"Plot":description} )
    liz.setProperty('fanart_image', fanart)
    liz.setProperty('tvshowthumb', iconimage)
    liz.setProperty( "player.art", iconimage)
    ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
    return ok
Пример #6
0
def get_cached_data(json_fn, timestamp_fn, TTL):
    '''Returns a JSON object from json_fn if json_fn exists and if the
    timestamp in timestamp_fn is not older than TTL. Returns None if cache
    isn't valid for any reason.
    '''
    if not os.path.exists(json_fn):
        xbmc.log('Missing XBMC Swift cache file at %s' % json_fn)
        return None

    if not os.path.exists(timestamp_fn):
        xbmc.log(
            'Missing XBMC Swift cache timestamp file at %s' % timestamp_fn)
        return None

    now = datetime.utcnow()
    file = open(timestamp_fn)
    timestamp = datetime.utcfromtimestamp(float(file.read()))

    if now - timestamp > TTL:
        xbmc.log('XBMC Swift cache file is older than TTL.')
        return None

    file = open(json_fn)
    xbmc.log('Returning XBMC Swift from cache.')
    return json.load(file)
Пример #7
0
def play(url):
    plugin_url = resolve(download_page(url))
    if plugin_url:
        return plugin.set_resolved_url(plugin_url)

    # Uh oh, things aren't working. Print the broken url to the log and ask if
    # we can submit the url to a google form.
    current_plugin_url = '?'.join([plugin._argv0, plugin._argv2])
    xbmc.log('REPORT THIS URL: %s' % current_plugin_url)

    dialog = xbmcgui.Dialog()
    user_resp = dialog.yesno('Documentary Heaven Playback Problem.',
                             'There was an issue playing this video.',
                             ('Would you like to report the URL to the'
                              ' developer?'))
    if user_resp:
       report_broken_url(current_plugin_url) 
Пример #8
0
def play(url):
    plugin_url = resolve(download_page(url))
    if plugin_url:
        return plugin.set_resolved_url(plugin_url)

    # Uh oh, things aren't working. Print the broken url to the log and ask if
    # we can submit the url to a google form.
    current_plugin_url = '?'.join([plugin._argv0, plugin._argv2])
    xbmc.log('REPORT THIS URL: %s' % current_plugin_url)

    dialog = xbmcgui.Dialog()
    user_resp = dialog.yesno('Documentary Heaven Playback Problem.',
                             'There was an issue playing this video.',
                             ('Would you like to report the URL to the'
                              ' developer?'))
    if user_resp:
        report_broken_url(current_plugin_url)
Пример #9
0
 def decorator_impl(*args):
     _json = get_cached_data(json_fn, timestamp_fn, TTL)
     if _json is None:
         _json = {}
     
     key = str(tuple(args))
     if key in _json:
         xbmc.log('XBMC Swift cache hit for %s w/ %s' % (cache_name, key))
         return _json[key]
     else:
         xbmc.log('XBMC Swift cache miss for %s w/ %s' % (cache_name, key))
     
     _json[key] =_data = f(*args)
         
     put_cached_data_as_json(_json, json_fn, timestamp_fn)
     
     return _data    
Пример #10
0
class login:

    token = ""
    data = ""
    request = ""
    login_iteration = 0

    def __init__(self, username, password, url, send=None):
        self.usr = username
        self.pas = password
        self.url = url

        self.openReadFile()

        if not self.token:
            self.logIN()
            if not self.token:
                return

        self.data = self.getLive()

        if send is not None:
            self.data.update(send)
        self.data = self.getData(SITE_PATH + url)

    def logIN(self):
        self.data = self.makeUserPass()
        self.token = self.getData(SITE_LOGIN_PAGE)
        if self.token:
            self.writeInFile()

        return

    def getData(self, url):
        send = urllib.urlencode(self.data)
        self.request = urllib2.Request(url,
                                       send,
                                       headers={
                                           "User-Agent":
                                           "XBMC/Kodi BGTime.TV Addon " +
                                           str(__version__)
                                       })

        try:
            response = urllib2.urlopen(self.request)
        except HTTPError, e:
            dialog = xbmcgui.Dialog()
            dialog.ok(__lang__(30003), e.code)
            return

        data_result = response.read()

        try:
            res = json.loads(data_result)
        except Exception, e:
            xbmc.log('%s addon: %s' % (__addon_name__, e))
            return
Пример #11
0
def playLiveStream(tv_username, tv_password, tvstation_params):
    log('Start playLiveStream')
    MyTVbg = mytv(tv_username, tv_password)    
    ofsets = MyTVbg.getTVChanelTimeShifts(   MyTVbg.openContentStream(mytv.MAINURL + '/channels/' + tvstation_params ,'' )   )
    stream_url= ''
    startPressed = 0
    selectedPosition = 0
    selectedTime = ''
    try:
        MyOffset = TimeShiftDialog(ofsets,tvstation_params,tv_username, tv_password)
        MyOffset.doModal()
        startPressed = MyOffset.start
        selectedPosition = MyOffset.selOffset
        selectedTime = MyOffset.timeStamp
        del MyOffset

    except:
        xbmc.log('PyXbmcT not supported. Enable to display timeOffsets')
        ofsets = []
        stream_url= ''
        MyOffset = 0

    if len(ofsets) != 0: # real live stream
        if ( 1 == startPressed ): # play only if START was pressed
          stream_url=MyTVbg.getTVStream(tvstation_params + ('&offset=%d' % selectedPosition)  )
          stream_url = stream_url[0:stream_url.find('&time=')] 
          stream_url = stream_url  +  ('&time=%d&t1=%d&t2=%d' % (selectedTime, selectedTime, selectedTime + 10000)) 
          xbmc.Player().play(stream_url)    
    else: # not a live stream, but a recordered one which is placed in /channels url
      stream_url=MyTVbg.getTVStream( tvstation_params )
      st = urllib.unquote(stream_url).decode('utf8') 
      #xbmc.log('%s %s' % (stream_url, st) )
      xbmc.Player().play(st)
    
    log('URL: ' + stream_url)
    log('Finished playLiveStream')
    html=''
    return 
Пример #12
0
def __log(text):
    xbmc.log('%s addon: %s' % (__addon_name__, text))
Пример #13
0
def __log(text):
    xbmc.log('%s addon: %s' % (__addon_name__, text))
Пример #14
0
def log(msg):
    xbmc.log(u'%s addon: %s' % (__ADDON_NAME__, msg))
Пример #15
0
def __log(text):
    xbmc.log("%s addon: %s" % (__addon_name__, text))