Esempio n. 1
0
  def send(self):
    if(not os.path.isfile(self.exportFile)):
      return

    msg = MIMEMultipart()
    #msg = EmailMessage()
    #msg['Subject'] = 'Export %s' % datetime.now().isoformat()
    msg['Subject'] = 'Export plugin.video.streams'
    msg['From'] = addon.getSetting('smtpUsername')
    msg['To'] = SETTINGS.EXPORT_EMAIL
    #msg.set_content(fp.read())
        
    fp=open(self.exportFile,"rb")
    attach = MIMEBase('application', 'json')
    attach.set_payload(fp.read())
    fp.close()
    # Encode the payload using Base64
    #encoders.encode_base64(msg)
    attach.add_header('Content-Disposition', 'attachment', filename='streams.json')
    msg.attach(attach)
    #msg.add_attachment(f.read(),
    #                   maintype='application',
    #                   subtype='json',
    #                   filename='export.json')
    
    try:  
      self.smtp.sendmail(addon.getSetting('smtpUsername'), SETTINGS.EXPORT_EMAIL, msg.as_string())
      #s.send_message(msg)
    except Exception as inst:
      addon_log(inst)
      xbmcgui.Dialog().ok(addon.getLocalizedString(30300), addon.getLocalizedString(30409), str(inst))
Esempio n. 2
0
 def checkSmtp(self):
   try:  
     self.smtp = smtplib.SMTP(addon.getSetting('smtp'), addon.getSetting('smtpPort'))
     self.smtp.ehlo()
     self.smtp.starttls()
     #if((addon.getSetting('smtpUsername') != "") and (addon.getSetting('smtpPasswd') != "")):
     self.smtp.login(addon.getSetting('smtpUsername'), addon.getSetting('smtpPasswd'))
     return True
   except Exception as inst:
     addon_log(inst)
     #xbmc.executebuiltin("Notification(%s,%s,%d)" % (addon.getLocalizedString(30409), "", 30000))
     xbmcgui.Dialog().ok(addon.getLocalizedString(30300), addon.getLocalizedString(30409), str(inst))
Esempio n. 3
0
def connSQL(dbname):
    cnx = None
    if usesqlite:
        from sqlite3 import dbapi2
        DBfile = getDBlocation(dbname)
        if not xbmcvfs.exists(DBfile):
            cnx = dbapi2.connect(DBfile)
            cnx.text_factory = str
            createDatabase(cnx, dbname)
        else:
            cnx = dbapi2.connect(DBfile)
            cnx.text_factory = str
    else:
        import mysql.connector
        from mysql.connector import errorcode
        dbname = 'amazon_' + dbname
        mysql_config = {
            'host': addon.getSetting('dbhost'),
            'port': addon.getSetting('dbport'),
            'user': addon.getSetting('dbuser'),
            'password': addon.getSetting('dbpass'),
            'database': dbname,
            'use_unicode': False,
            'get_warnings': True,
            'buffered': True
        }
        try:
            cnx = mysql.connector.connect(**mysql_config)
        except mysql.connector.Error as err:
            if err.errno == errorcode.CR_CONN_HOST_ERROR:
                Dialog.notification('MySQL/MariaDB', getString(30224),
                                    xbmcgui.NOTIFICATION_ERROR)
            elif err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
                Dialog.notification('MySQL/MariaDB', getString(30225),
                                    xbmcgui.NOTIFICATION_ERROR)
            elif err.errno == errorcode.ER_BAD_DB_ERROR:
                mysql_config['database'] = None
                cnx = mysql.connector.connect(**mysql_config)
                c = cnx.cursor()
                cur_exec(
                    c,
                    'CREATE DATABASE %s CHARACTER SET utf8 COLLATE utf8_general_ci;'
                    % dbname)
                cnx.database = dbname
                createDatabase(cnx, dbname)
            else:
                Log(err)

    if not cnx:
        exit()
    return cnx
Esempio n. 4
0
def getDBlocation(retvar):
    custdb = addon.getSetting('customdbfolder') == 'true'
    old_dbpath = xbmc.translatePath(getConfig('old_dbfolder')).decode('utf-8')
    cur_dbpath = dbpath

    if not old_dbpath:
        old_dbpath = cur_dbpath
    if custdb:
        cur_dbpath = xbmc.translatePath(
            addon.getSetting('dbfolder')).decode('utf-8')
    else:
        addon.setSetting('dbfolder', dbpath)

    orgDBfile = {
        'tv': os.path.join(dbpath, 'tv.db'),
        'movie': os.path.join(dbpath, 'movies.db')
    }
    oldDBfile = {
        'tv': os.path.join(old_dbpath, 'tv.db'),
        'movie': os.path.join(old_dbpath, 'movies.db')
    }
    DBfile = {
        'tv': os.path.join(cur_dbpath, 'tv.db'),
        'movie': os.path.join(cur_dbpath, 'movies.db')
    }

    if old_dbpath != cur_dbpath:
        Log('DBPath changed')
        if xbmcvfs.exists(oldDBfile['tv']) and xbmcvfs.exists(
                oldDBfile['movie']):
            if not xbmcvfs.exists(cur_dbpath):
                xbmcvfs.mkdir(cur_dbpath)
            if not xbmcvfs.exists(DBfile['tv']) or not xbmcvfs.exists(
                    DBfile['movie']):
                copyDB(oldDBfile, DBfile)
        writeConfig('old_dbfolder', cur_dbpath)

    if custdb:
        org_fileacc = int(
            xbmcvfs.Stat(orgDBfile['tv']).st_mtime() +
            xbmcvfs.Stat(orgDBfile['movie']).st_mtime())
        cur_fileacc = int(
            xbmcvfs.Stat(DBfile['tv']).st_mtime() +
            xbmcvfs.Stat(DBfile['movie']).st_mtime())
        if org_fileacc > cur_fileacc:
            copyDB(orgDBfile, DBfile, True)

    return DBfile[retvar]
Esempio n. 5
0
    def engine_connect(self):
        try:
            self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.sock.connect((SETTINGS.ACE_HOST, SETTINGS.ACE_PORT))
        except Exception as inst:
            addon_log(inst)
            try:
                xbmc.executebuiltin("Dialog.Close(all,true)")
            except:
                pass
            DEBUG = addon.getSetting('debug')
            if DEBUG == 'true':
                xbmc.executebuiltin("Notification(%s,%s,%i)" %
                                    (str(type(inst)), str(inst), 5))
            return False

        self.send("HELLOBG version=3")
        self.ace_read()
Esempio n. 6
0
  def sop_sleep(self, time):
    counter = 0
    increment = 5000
    #path="/proc/%s" % str(spsc_pid)

    #addon_log('proc exists')
    #addon_log(os.path.exists(path))
    try:
      #while counter < time and spsc_pid>0 and not xbmc.abortRequested and os.path.exists(path):
      while counter < time and self.spsc_pid>0 and not xbmc.abortRequested and self.sop_pid_exists():
        counter += increment
        xbmc.sleep(increment)
    except Exception as inst:
      addon_log(inst)
      DEBUG = addon.getSetting('debug')
      if DEBUG == 'true': xbmc.executebuiltin("Notification(%s,%s,%i)" % (str(type(inst)), str(inst), 5))
      return True
    if counter < time: return False
    else: return True
Esempio n. 7
0
  def engine_connect(self):
    with busy_dialog():
      try:
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.sock.connect((SETTINGS.ACE_HOST, SETTINGS.ACE_PORT))
      except Exception as inst:
        addon_log(inst)
        # try: xbmc.executebuiltin("Dialog.Close(all,true)")
        # except: pass
        DEBUG = addon.getSetting('debug')
        if DEBUG == 'true': xbmc.executebuiltin("Notification(%s,%s,%i)" % (str(type(inst)), str(inst), 5))
        return False

      self.send("HELLOBG version=3")
      player_url = self.ace_read()

    if(player_url != None):
      addon_log (player_url)
      self.player.callback = self.shutdown
      self.listitem.setInfo('video', {'Title': self.filename})
      self.player.play(player_url, self.listitem)
      self.player_started = True
Esempio n. 8
0
    def sop_sleep(self, time):
        counter = 0
        increment = 200
        #path="/proc/%s" % str(spsc_pid)

        #addon_log('proc exists')
        #addon_log(os.path.exists(path))
        try:
            #while counter < time and spsc_pid>0 and not xbmc.abortRequested and os.path.exists(path):
            while counter < time and self.spsc_pid > 0 and not xbmc.abortRequested and self.sop_pid_exists(
            ):
                counter += increment
                xbmc.sleep(increment)
        except Exception as inst:
            addon_log(inst)
            DEBUG = addon.getSetting('debug')
            if DEBUG == 'true':
                xbmc.executebuiltin("Notification(%s,%s,%i)" %
                                    (str(type(inst)), str(inst), 5))
            return True
        if counter < time: return False
        else: return True
 def add(self):
     # ダイアログの設定を取得
     source = addon.getSetting('source') # type(source)=str
     keyword = addon.getSetting('keyword') # type(keyword)=str
     # channel
     str2 = addon.getSetting('channel').decode('utf-8') # type(str2)=unicode
     channel = Channel().search(str2)
     # genre
     str0 = addon.getSetting('genre0').decode('utf-8') # type(str0)=unicode
     genre = Genre().search(str0)
     str1 = addon.getSetting(genre['id']).decode('utf-8') # type(str1)=unicode
     genre = Genre().search(str0, str1)
     # query
     query = 'n='+str(settings['apage'])+'&p=1&video=all'
     query += '&key='+urllib.quote(keyword)
     query += '&s='+['e','c'][int(source)]
     query += '&ch='+channel['id']
     query += '&genre0='+genre['id0']
     query += '&genre1='+genre['id1']
     # 既存のスマートリスト設定
     list = self.getList()
     # 既存のスマートリスト設定でqueryが一致するものを削除
     edited_query = addon.getSetting('query')
     for i in range(len(list)):
         if list[i]['query'] == edited_query:
             del list[i]
             break
     # データを追加
     data = {}
     data['title'] = keyword
     data['query'] = query
     data['channel'] = str2
     data['source'] = source
     data['keyword'] = keyword
     if genre['id0']: data['genre0'] = str0
     if genre['id1']: data[genre['id']] = str1
     list.append(data)
     # ファイルに書き込む
     self.setList(list)
Esempio n. 10
0
def CHANNEL_LIST(name, cat_id, mode=None, schedule=False):
  if (SETTINGS.DISABLE_SCHEDULE != 'true'):
    epgObj = epg()

  addon_log(name);
  rec = []
  try:
    sql = 'SELECT id, name, language, status, \
           address, thumbnail, protocol, \
           schedule_id, unverified \
           FROM channels \
           WHERE id_cat = ?'
    if((mode!=None) and (int(mode)==101)):
      sql += ' and unverified = 1'
    else:
      sql += ' and unverified IS NULL'
    sql += ' ORDER BY name'
    db_cursor.execute( sql, (cat_id,) )
    rec=db_cursor.fetchall()
  except Exception as inst:
    addon_log(inst)
    xbmcgui.Dialog().ok(addon.getLocalizedString(30300), addon.getLocalizedString(30301), str(inst))  #Cannot parse channel list !

  if len(rec)>0:
    for id, name, language, status, \
        address, thumbnail, protocol, \
        schedule_id, unverified in rec:

      #filter by country and language
      #if( (((country != '') and (addon.getSetting('country_'+country) == 'true')) or
           #((country == '') and (addon.getSetting('country_none') == 'true')) ) and
           #(((language != '') and (addon.getSetting('lang_'+language) == 'true')) or
           #((language == '') and (addon.getSetting('lang_none') == 'true')) )
        #):

      chan_name = name
      chan_url = address.strip()

      protocol = protocol.strip()
      #if protocol=='sop':
      #  protocol_color = '[COLOR lightgreen]'+protocol+'[/COLOR]'
      #else:
      #  protocol_color = '[COLOR yellow]'+protocol+'[/COLOR]'

      chan_thumb = thumbnail.strip()
      #addon_log(chan_thumb)
      chan_status = status

      if (((SETTINGS.SHOW_OFFLINE_CH=='true') and (int(chan_status)==1)) or (int(chan_status)!=1)): #if we show or not offline channels based on settings
        logo_name = chan_name.replace(' ', '').lower()
        logo_name = logo_name.encode('utf8')

        chan_name_formatted ="[B]"+chan_name+"[/B]"
        chan_name_formatted += " [[COLOR yellow]"+protocol+"[/COLOR]]"

        if int(chan_status)==1: chan_name_formatted += " [COLOR red]"+addon.getLocalizedString(30063)+"[/COLOR]"  #Offline

        thumb_path=""
        if chan_thumb and chan_thumb != "":
          fileName, fileExtension = os.path.splitext(chan_thumb)
          fileName=fileName.split("/")[-1]

          logoDir = os.path.join(SETTINGS.ADDON_PATH,"logos");
          #create logos directory if does not exists
          if(not os.path.isdir(logoDir)):
            os.makedirs(logoDir)

          if fileName != "":
            #thumb_path=os.path.join(ADDON_PATH,"logos",fileName+fileExtension)
            fileExtension = fileExtension.encode('utf8')
            thumb_path=os.path.join(logoDir,logo_name+fileExtension)

          if not os.path.isfile(thumb_path):
            if fileName != "":
              try:
                Downloader(chan_thumb, thumb_path, fileName+fileExtension, addon.getLocalizedString(30055)) #Downloading Channel Logo
              except Exception as inst:
                pass;

        #schedule
        if (schedule_id != 0) and \
            (schedule or (addon.getSetting('schedule_ch_list') == 'true')) \
            and (SETTINGS.DISABLE_SCHEDULE != 'true'):
          if (schedule): #update all by context menu
            update_all = True
          elif(addon.getSetting('schedule_ch_list') == 'true'): #update all when we display channel list
            update_all = False
          #addon_log('grab_schedule')
          epgObj.grab_schedule(schedule_id, chan_name, update_all=update_all)

        if (SETTINGS.DISABLE_SCHEDULE != 'true') and (int(cat_id) < 200):
          schedule_txt = epgObj.load_schedule(chan_name)
          chan_name_formatted += "   " + schedule_txt

        addLink(id, chan_name_formatted, chan_name, chan_url, protocol, str(schedule_id),
                name, cat_id, 2, thumb_path, "", len(rec))

  xbmc.executebuiltin("Container.SetViewMode(51)")
Esempio n. 11
0
  def start( self ):
    if xbmc.getCondVisibility('System.Platform.Android'):
      xbmc.executebuiltin('XBMC.StartAndroidActivity("com.devaward.soptohttp","android.intent.action.VIEW","",'+self.sopurl+')')
    else:
      try:
        with busy_dialog():
          # addon_log(self.cmd)
          self.spsc = subprocess.Popen(self.cmd, shell=False, bufsize=SETTINGS.BUFER_SIZE, stdin=None, stdout=None, stderr=None)
          # if(SETTINGS.ARM):
          #   self.spsc = subprocess.Popen(self.cmd, shell=False, bufsize=SETTINGS.BUFER_SIZE, stdin=None, stdout=None, stderr=None)
          # else:
          #   env = os.environ
          #   env['LD_LIBRARY_PATH'] = SETTINGS.SPSC_LIB
          #   addon_log(self.cmd)
          #   self.spsc = subprocess.Popen(self.cmd, shell=False, bufsize=SETTINGS.BUFER_SIZE, stdin=None, stdout=None, stderr=None, env=env)
            
          self.spsc_pid = self.spsc.pid

          xbmc.sleep(int(addon.getSetting('wait_time')))

          res=False
          counter=50
          #while counter > 0 and os.path.exists("/proc/"+str(spsc.pid)):
        
          while counter > 0 and self.sop_pid_exists():
            # xbmc.executebuiltin( "ActivateWindow(busydialog)" )
            xbmc.sleep(400)
            counter -= 1
            try:
              addon_log(SETTINGS.LOCAL_URL);
              urllib2.urlopen(SETTINGS.LOCAL_URL)
              counter=0
              res=self.sop_sleep(200)
              break
            except Exception as inst:
              addon_log(inst)

        addon_log(res)
        offline = None
        if res:

          #START PLAY
          self.player.callback = self.stop_spsc
          self.player.play(SETTINGS.LOCAL_URL, self.listitem)

        elif not self.sop_pid_exists():
          # try: xbmc.executebuiltin("Dialog.Close(all,true)")
          # except: pass
          try:
            urllib2.urlopen(SETTINGS.TEST_URL)
            if SETTINGS.NOTIFY_OFFLINE == "true": xbmc.executebuiltin("Notification(%s,%s,%i)" % (addon.getLocalizedString(30057), "",1))  #Channel is offline
            offline = True
          except:
            if SETTINGS.NOTIFY_OFFLINE == "true": xbmc.executebuiltin("Notification(%s,%s,%i)" % (addon.getLocalizedString(30058), "",1)) #Network is offline
        elif SETTINGS.NOTIFY_OFFLINE == "true":
          # try: xbmc.executebuiltin("Dialog.Close(all,true)")
          # except: pass
          xbmc.executebuiltin("Notification(%s,%s,%i)" % (addon.getLocalizedString(30059), "", 1)) #Channel initialization failed
          offline = True
          try: self.stop_spsc()
          except: pass
        
        if offline:
          ch = Channels();
          ch.markStream(chId = self.player.ch_id, status=Channel.STATUS_OFFLINE) #offline

      except Exception as inst:
        xbmcgui.Dialog().ok(addon.getLocalizedString(30060), str(type(inst)),str(inst),"")
        addon_log(str(inst))
        try:
          stop_spsc()
        except: pass
Esempio n. 12
0
    def start(self):
        if xbmc.getCondVisibility('System.Platform.Android'):
            xbmc.executebuiltin(
                'XBMC.StartAndroidActivity("com.devaward.soptohttp","android.intent.action.VIEW","",'
                + self.sopurl + ')')
        else:
            try:
                if (SETTINGS.ARM):
                    self.spsc = subprocess.Popen(self.cmd,
                                                 shell=False,
                                                 bufsize=SETTINGS.BUFER_SIZE,
                                                 stdin=None,
                                                 stdout=None,
                                                 stderr=None)
                else:
                    env = os.environ
                    env['LD_LIBRARY_PATH'] = SETTINGS.SPSC_LIB
                    self.spsc = subprocess.Popen(self.cmd,
                                                 shell=False,
                                                 bufsize=SETTINGS.BUFER_SIZE,
                                                 stdin=None,
                                                 stdout=None,
                                                 stderr=None,
                                                 env=env)

                self.spsc_pid = self.spsc.pid

                xbmc.sleep(int(addon.getSetting('wait_time')))

                res = False
                counter = 50
                #while counter > 0 and os.path.exists("/proc/"+str(spsc.pid)):
                while counter > 0 and self.sop_pid_exists():
                    xbmc.executebuiltin("ActivateWindow(busydialog)")
                    xbmc.sleep(400)
                    counter -= 1
                    try:
                        addon_log(SETTINGS.LOCAL_URL)
                        urllib2.urlopen(SETTINGS.LOCAL_URL)
                        counter = 0
                        res = self.sop_sleep(200)
                        break
                    except Exception as inst:
                        addon_log(inst)

                addon_log(res)
                offline = None
                if res:

                    #START PLAY
                    self.player.callback = self.stop_spsc
                    self.player.play(SETTINGS.LOCAL_URL, self.listitem)

                elif not self.sop_pid_exists():
                    try:
                        xbmc.executebuiltin("Dialog.Close(all,true)")
                    except:
                        pass
                    try:
                        urllib2.urlopen(SETTINGS.TEST_URL)
                        if SETTINGS.NOTIFY_OFFLINE == "true":
                            xbmc.executebuiltin(
                                "Notification(%s,%s,%i)" %
                                (addon.getLocalizedString(30057), "",
                                 1))  #Channel is offline
                        offline = True
                    except:
                        if SETTINGS.NOTIFY_OFFLINE == "true":
                            xbmc.executebuiltin(
                                "Notification(%s,%s,%i)" %
                                (addon.getLocalizedString(30058), "",
                                 1))  #Network is offline
                elif SETTINGS.NOTIFY_OFFLINE == "true":
                    try:
                        xbmc.executebuiltin("Dialog.Close(all,true)")
                    except:
                        pass
                    xbmc.executebuiltin("Notification(%s,%s,%i)" %
                                        (addon.getLocalizedString(30059), "",
                                         1))  #Channel initialization failed
                    offline = True
                    try:
                        self.stop_spsc()
                    except:
                        pass

                if offline:
                    mark = mark_stream(ch_id=self.player.ch_id)
                    mark.mark_offline()

            except Exception as inst:
                xbmcgui.Dialog().ok(addon.getLocalizedString(30060),
                                    str(type(inst)), str(inst), "")
                addon_log(str(inst))
                try:
                    stop_spsc()
                except:
                    pass
                try:
                    xbmc.executebuiltin("Dialog.Close(all,true)")
                except:
                    pass
Esempio n. 13
0
class SETTINGS(object):

    ADDON_PATH = addon.getAddonInfo('path')

    LANGUAGE = 'en'
    CHAN_LIST_URL = addon.getSetting('chan_list_url')

    parse_object = urlparse(CHAN_LIST_URL)
    f_name = basename(parse_object[2])
    #file name of the channel list
    CHAN_LIST = os.path.join(ADDON_PATH,
                             f_name)  #full path of the channel list
    CHAN_LIST_EXPIRE = int(addon.getSetting('chan_list_expire')) * 60 * 60
    CHANNELS_DB = os.path.join(ADDON_PATH, 'channels.sqlite')

    #DISABLE_SCHEDULE = addon.getSetting('disable_schedule')
    SHOW_OFFLINE_CH = addon.getSetting('show_offline_ch')
    SHOW_UNVERIFIED = addon.getSetting('show_unverified')

    NOTIFY_OFFLINE = "true"

    DISABLE_SCHEDULE = addon.getSetting('disable_schedule')
    SCHEDULE_PATH = os.path.join(ADDON_PATH, 'schedule.sqlite')
    EPG_URL = addon.getSetting('epg_url')

    ########################################## sopcast
    SPSC_BINARY = "sp-sc-auth"

    #raspberry pi
    QEMU = "qemu-i386"  #for raspberry pi to issue kill command
    QEMU64 = "qemuaarch-i386"
    ARM = False
    ARM64 = False

    if sys.platform.startswith('linux'):
        if (os.uname()[4][:3] == 'arm'):  #not supported by windows
            ARM = True
        elif (os.uname()[4][:3] == 'aar'):
            ARM = True
            ARM64 = True if sys.maxsize > 2**32 else False

    if ARM == False:
        SPSC = os.path.join(ADDON_PATH, 'bin/linux_x86/sopcast', SPSC_BINARY)
        SPSC_LIB = os.path.join(ADDON_PATH, 'bin/linux_x86/sopcast')

        #make executables
        is_exe(SPSC)

    elif ARM == True:
        SOPCAST_ARM_PATH = addon.getSetting('sopcast_arm_path')
        if (SOPCAST_ARM_PATH == ''):
            SOPCAST_ARM_PATH = os.path.join(ADDON_PATH, 'bin/arm/sopcast')
        is_exe(os.path.join(SOPCAST_ARM_PATH, "lib/ld-linux.so.2"))

        if ARM64 == False:
            is_exe(os.path.join(SOPCAST_ARM_PATH, QEMU))
            QEMU_SPSC = [
                os.path.join(SOPCAST_ARM_PATH, QEMU),
                os.path.join(SOPCAST_ARM_PATH, "lib/ld-linux.so.2"),
                "--library-path",
                os.path.join(SOPCAST_ARM_PATH, "lib")
            ]
        else:
            is_exe(os.path.join(SOPCAST_ARM_PATH, QEMU64))
            QEMU_SPSC = [
                os.path.join(SOPCAST_ARM_PATH, QEMU64),
                os.path.join(SOPCAST_ARM_PATH, "lib/ld-linux.so.2"),
                "--library-path",
                os.path.join(SOPCAST_ARM_PATH, "lib")
            ]

        SPSC = os.path.join(SOPCAST_ARM_PATH, SPSC_BINARY)

    LOCAL_PORT = addon.getSetting('local_port')
    VIDEO_PORT = addon.getSetting('video_port')
    BUFER_SIZE = int(addon.getSetting('buffer_size'))
    USE_PLEXUS_SOP = addon.getSetting('use_plexus_sop')

    LOCAL_URL = "http://localhost:" + str(VIDEO_PORT) + "/?"

    TEST_URL = "http://www.google.com"
    ##########################################################

    ########################################################## acestream
    #PRODUCT_KEY='kjYX790gTytRaXV04IvC-xZH3A18sj5b1Tf3I-J5XVS1xsj-j0797KwxxLpBl26HPvWMm' #free
    PRODUCT_KEY = 'n51LvQoTlJzNGaFxseRK-uvnvX-sD4Vm5Axwmc4UcoD-jruxmKsuJaH0eVgE'  #aceproxy
    ACE_HOST = addon.getSetting('ace_host')
    ACE_PORT = int(addon.getSetting('ace_port'))
    ACE_ENGINE_TYPE = int(addon.getSetting('ace_engine_type'))


##########################################################
Esempio n. 14
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from common import xbmc, addon, xbmcvfs, xbmcgui, os, Dialog, Log, getString, getConfig, writeConfig, homepath, pluginname
from BeautifulSoup import BeautifulSoup

usesqlite = addon.getSetting('dbsystem') == '0'
dbplugin = 'script.module.amazon.database'
dbpath = os.path.join(homepath, 'addons', dbplugin, 'lib')


def waitforDB(cnx):
    if not usesqlite:
        return

    c = cnx.cursor()
    error = True

    while error:
        error = False
        try:
            c.execute('SELECT name FROM sqlite_master WHERE type="table"'
                      ).fetchone()
        except:
            error = True
            xbmc.sleep(1000)
            Log('Database locked')
    c.close()


def getDBlocation(retvar):
    custdb = addon.getSetting('customdbfolder') == 'true'