Ejemplo n.º 1
0
def CheckVersion():
    try:
        prev = ADDON.getSetting('VERSION')
        curr = VERSION

        if prev == curr:
            return

        verifySuperSearch()
        VerifySettings()
        VerifyZipFiles()

        src = os.path.join(ROOT, 'cache')
        dst = os.path.join(ROOT, 'C')
        sfile.rename(src, dst)

        ADDON.setSetting('VERSION', curr)

        if prev == '0.0.0' or prev == '1.0.0':
            sfile.makedirs(PROFILE)

        #call showChangeLog like this to workaround bug in openElec
        script = os.path.join(HOME, 'showChangelog.py')
        cmd = 'AlarmClock(%s,RunScript(%s),%d,True)' % ('changelog', script, 0)
        xbmc.executebuiltin(cmd)
    except:
        pass
Ejemplo n.º 2
0
def CheckVersion():
    try:
        prev = ADDON.getSetting('VERSION')
        curr = VERSION

        if prev == curr:        
            return

        verifySuperSearch()
        VerifySettinngs()
        VerifyZipFiles()

        src = os.path.join(ROOT, 'cache')
        dst = os.path.join(ROOT, 'C')
        sfile.rename(src, dst)

        ADDON.setSetting('VERSION', curr)

        if prev == '0.0.0' or prev == '1.0.0':
            sfile.makedirs(PROFILE) 

        #call showChangeLog like this to workaround bug in openElec
        script = os.path.join(HOME, 'showChangelog.py')
        cmd    = 'AlarmClock(%s,RunScript(%s),%d,True)' % ('changelog', script, 0)
        xbmc.executebuiltin(cmd)
    except:
        pass
Ejemplo n.º 3
0
def doExport():
    try:
        include = utils.DialogYesNo(GETTEXT(30129),
                                    line2='',
                                    line3=GETTEXT(30130),
                                    noLabel=None,
                                    yesLabel=None)
        folder = getFolder(GETTEXT(30131))

        if not folder:
            return False

        filename = 'Super Favourites.zip'
        src = os.path.join(HOME, filename)
        dst = os.path.join(folder, filename)

        doZipfile(src, include)

        sfile.remove(dst)
        sfile.rename(src, dst)

        utils.DialogOK(GETTEXT(30132))
        return True

    except Exception, e:
        utils.log('Error in doExport %s' % str(e))
Ejemplo n.º 4
0
def CheckVersion():
    try:
        prev = ADDON.getSetting("VERSION")
        curr = VERSION

        if xbmcgui.Window(10000).getProperty("OTT_RUNNING") != "True":
            VerifyKeymaps()

        if prev == curr:
            return

        verifySuperSearch()

        src = os.path.join(ROOT, "cache")
        dst = os.path.join(ROOT, "C")
        sfile.rename(src, dst)

        ADDON.setSetting("VERSION", curr)

        if prev == "0.0.0" or prev == "1.0.0":
            sfile.makedirs(PROFILE)

        # call showChangeLog like this to workaround bug in openElec
        script = os.path.join(HOME, "showChangelog.py")
        cmd = "AlarmClock(%s,RunScript(%s),%d,True)" % ("changelog", script, 0)
        xbmc.executebuiltin(cmd)
    except:
        pass
Ejemplo n.º 5
0
def verifySuperSearch():
    old = os.path.join(ROOT, 'Search')
    dst = os.path.join(ROOT, 'S')

    sfile.rename(old, dst)

    try:
        sfile.makedirs(dst)
    except:
        pass

    src = os.path.join(HOME, 'resources', 'search', FILENAME)
    dst = os.path.join(dst, FILENAME)

    if not sfile.exists(dst):
        sfile.copy(src, dst)

    try:
        #patch any changes
        xml = sfile.read(dst)

        xml = xml.replace('is/?action=movies_search&',
                          'is/?action=movieSearch&')
        xml = xml.replace('is/?action=people_movies&',
                          'is/?action=moviePerson&')
        xml = xml.replace('is/?action=shows_search&', 'is/?action=tvSearch&')
        xml = xml.replace('is/?action=people_shows&', 'is/?action=tvPerson&')

        f = sfile.file(dst, 'w')
        f.write(xml)
        f.close()
    except:
        pass

    import favourite

    new = favourite.getFavourites(src, validate=False)

    #line1 = GETTEXT(30123)
    #line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            #line = line1 % item[0]
            #if DialogYesNo(line1=line, line2=line2):
            favourite.addFave(dst, item)
Ejemplo n.º 6
0
def verifySuperSearch():
    src = os.path.join(ROOT, 'Search')
    dst = os.path.join(ROOT, 'S')

    sfile.rename(src, dst)

    dst = os.path.join(ROOT, 'S')
    src = os.path.join(HOME, 'resources', 'Search', FILENAME)

    try:
        sfile.makedirs(dst)
    except:
        pass

    dst = os.path.join(dst, FILENAME)

    if not sfile.exists(dst):
        sfile.copy(src, dst)

    try:
        #patch any changes
        xml = sfile.read(dst)

        xml = xml.replace('1channel/?mode=7000', '1channel/?mode=Search')
        xml = xml.replace('plugin.video.genesis/?action=actors_movies',
                          'plugin.video.genesis/?action=people_movies')
        xml = xml.replace('plugin.video.genesis/?action=actors_shows',
                          'plugin.video.genesis/?action=people_shows')

        f = sfile.file(dst, 'w')
        f.write(xml)
        f.close()
    except:
        pass

    import favourite

    new = favourite.getFavourites(src, validate=False)
    line1 = GETTEXT(30123)
    line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            line = line1 % item[0]
            if DialogYesNo(line1=line, line2=line2):
                favourite.addFave(dst, item)
Ejemplo n.º 7
0
def extract(src, dp):
    success = False
    try:
        src = xbmc.translatePath(src)
        import zipfile

        update = os.path.join(PROFILE, 'update')
        update = xbmc.translatePath(update)
        sfile.makedirs(update)

        zin   = zipfile.ZipFile(src, 'r')
        nItem = float(len(zin.infolist()))

        index = 0
        for item in zin.infolist():
            index += 1

            percent  = int(index / nItem *100)
            #filename = item.filename

            zin.extract(item, update)
  
            if dp:
                dp.update(percent, utils.GETTEXT(30118), utils.GETTEXT(30080))

        addons = os.path.join('special://home', 'addons')
        current, folders, files = sfile.walk(update)

        for folder in folders:
            ori = os.path.join(addons, folder)
            src = os.path.join(current, folder)
            dst = os.path.join(addons, folder + '.temp')
            sfile.copytree(src, dst)
            sfile.rmtree(ori)
            while not sfile.exists(dst):
                xbmc.sleep(100)
            while sfile.exists(ori):
                xbmc.sleep(100)
            sfile.rename(dst, ori)   

        success = True
    except:
        success = False

    sfile.delete(update)
    return success
def verifySuperSearch():
    src = os.path.join(ROOT, "Search")
    dst = os.path.join(ROOT, "S")

    sfile.rename(src, dst)

    dst = os.path.join(ROOT, "S")
    src = os.path.join(HOME, "resources", "Search", FILENAME)

    try:
        sfile.makedirs(dst)
    except:
        pass

    dst = os.path.join(dst, FILENAME)

    if not sfile.exists(dst):
        sfile.copy(src, dst)

    try:
        # patch any changes
        xml = sfile.read(dst)

        xml = xml.replace("1channel/?mode=7000", "1channel/?mode=Search")
        xml = xml.replace("plugin.video.genesis/?action=actors_movies", "plugin.video.genesis/?action=people_movies")
        xml = xml.replace("plugin.video.genesis/?action=actors_shows", "plugin.video.genesis/?action=people_shows")

        f = sfile.file(dst, "w")
        f.write(xml)
        f.close()
    except:
        pass

    import favourite

    new = favourite.getFavourites(src, validate=False)
    line1 = GETTEXT(30123)
    line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            line = line1 % item[0]
            if DialogYesNo(line1=line, line2=line2):
                favourite.addFave(dst, item)
Ejemplo n.º 9
0
def verifySuperSearch():
    old = os.path.join(ROOT, 'Search')
    dst = os.path.join(ROOT, 'S')

    sfile.rename(old, dst)

    try:    sfile.makedirs(dst)
    except: pass

    src = os.path.join(HOME, 'resources', 'search', FILENAME)
    dst = os.path.join(dst, FILENAME)

    if not sfile.exists(dst):
        sfile.copy(src, dst)

    try:
        #patch any changes
        xml = sfile.read(dst)

        xml = xml.replace('is/?action=movies_search&', 'is/?action=movieSearch&')
        xml = xml.replace('is/?action=people_movies&', 'is/?action=moviePerson&')
        xml = xml.replace('is/?action=shows_search&',  'is/?action=tvSearch&')
        xml = xml.replace('is/?action=people_shows&',  'is/?action=tvPerson&')


        f = sfile.file(dst, 'w')
        f.write(xml)            
        f.close()
    except:
        pass

    import favourite

    new = favourite.getFavourites(src, validate=False)

    #line1 = GETTEXT(30123)
    #line2 = GETTEXT(30124)

    for item in new:
        fave, index, nFaves = favourite.findFave(dst, item[2])
        if index < 0:
            #line = line1 % item[0]
            #if DialogYesNo(line1=line, line2=line2):
            favourite.addFave(dst, item)
Ejemplo n.º 10
0
def doExport():
    try:
        include = utils.DialogYesNo(GETTEXT(30129), line2='', line3=GETTEXT(30130), noLabel=None, yesLabel=None)
        folder  = getFolder(GETTEXT(30131))        

        if not folder:
            return False

        filename = 'Super Favourites.zip'
        src      = os.path.join(HOME,   filename)
        dst      = os.path.join(folder, filename)

        doZipfile(src, include)

        sfile.remove(dst)
        sfile.rename(src, dst)

        utils.DialogOK(GETTEXT(30132))
        return True

    except Exception, e:
        utils.log('Error in doExport %s' % str(e))
Ejemplo n.º 11
0
def doBackup():
    import datetime
    
    src = os.path.join(epgpath, 'channels')
    dst = os.path.join(epgpath, 'channels-backup')
    
    try:
        sfile.remove(dst)
        sfile.copy(src, dst)
    except:
        pass
    
    if os.path.exists(logos):
        now  = datetime.datetime.now()
        date = now.strftime('%B-%d-%Y %H-%M')
    
        cur = Addon.getSetting('dixie.logo.folder')
        src = os.path.join(logos, cur)
        dst = os.path.join(logos, cur+'-%s' % date)
    
        try:
            sfile.rename(src, dst)
        except:
            pass
Ejemplo n.º 12
0
def doBackup():
    import datetime

    src = os.path.join(epgpath, 'channels')
    dst = os.path.join(epgpath, 'channels-backup')

    try:
        sfile.remove(dst)
        sfile.copy(src, dst)
    except:
        pass

    if os.path.exists(logos):
        now = datetime.datetime.now()
        date = now.strftime('%B-%d-%Y %H-%M')

        cur = Addon.getSetting('dixie.logo.folder')
        src = os.path.join(logos, cur)
        dst = os.path.join(logos, cur + '-%s' % date)

        try:
            sfile.rename(src, dst)
        except:
            pass
Ejemplo n.º 13
0
def doBackup():
    import datetime

    src = os.path.join(epgpath, "channels")
    dst = os.path.join(epgpath, "channels-backup")

    try:
        sfile.remove(dst)
        sfile.copy(src, dst)
    except:
        pass

    if os.path.exists(logos):
        now = datetime.datetime.now()
        date = now.strftime("%B-%d-%Y %H-%M")

        cur = Addon.getSetting("dixie.logo.folder")
        src = os.path.join(logos, cur)
        dst = os.path.join(logos, cur + "-%s" % date)

        try:
            sfile.rename(src, dst)
        except:
            pass
Ejemplo n.º 14
0
def DoDownload(name, dst, src, image=None, orignalSrc=None, progressClose=True, silent=False):
    import download
    import s3
    import sfile

    dst = dst.replace(os.sep, DELIMETER)
    src = src.replace(os.sep, DELIMETER)

    if orignalSrc == None or len(orignalSrc) == 0:
        orignalSrc = src

    temp  = dst + '.temp'

    url = urllib.quote_plus(src)
    url = s3.getURL(url)
    url = s3.convertToCloud(url)

    #image no longer used
    #if image and image.startswith('http'):
    #    pass
    #else:
    #    image = None
    image = None

    resp = download.getResponse(url, 0, '')
    if not resp:
        return 1

    dp = None

    name = name.decode('utf-8')

    if not silent:
        dp = DialogProgress(GETTEXT(30079) % name)
        
    download.doDownload(url, temp, name, dp=dp, silent=silent)
    
    if dp and progressClose:
        dp.close()

    if sfile.exists(temp + '.part'): #if part file exists then download has failed
        return 1

    if not sfile.exists(temp): #download was cancelled
        return 2

    sfile.remove(dst)
    sfile.rename(temp, dst)

    src = orignalSrc

    #recursively get dsc files
    dscFile = removeExtension(dst) + '.%s' % DSC
    while len(src) > 0:
        try:
            plot = getAmazonContent(src, DSC)
            sfile.write(dscFile, plot)

            newSrc = src.rsplit(DELIMETER, 1)[0]
            if newSrc == src:
                break

            src     = newSrc 
            dscFile = dscFile.rsplit(DELIMETER, 1)[0] + '.%s' % DSC

        except:
            pass


    #original image handling - no longer used
    if image:            
        img   = image.rsplit('?', 1)[0]
        ext   = img.rsplit('.'  , 1)[-1]
        root  = dst.rsplit('.'  , 1)[0]
        jpg   = root + '.%s' %  ext
        gif   = root + '.%s' % 'gif'

        gifURL = s3.getURL(urllib.quote_plus(_src.rsplit('.', 1)[0] + '.gif'))
        
        DownloadIfExists(image,  jpg)
        DownloadIfExists(gifURL, gif)


    #recursively get image files
    src = orignalSrc.rsplit('.', 1)[0]
    dst = dst.rsplit('.', 1)[0]

    imageTypes = IMG_EXT
    imageTypes.append('.gif')

    while len(src) > 0:
        for ext in imageTypes: 
            image = src + ext

            image = s3.getURL(urllib.quote_plus(image))
            image = s3.convertToCloud(image)

            DownloadIfExists(image, dst+ext)

        newSrc = src.rsplit(DELIMETER, 1)[0]

        if newSrc == src:    
            break

        src = newSrc 
        dst = dst.rsplit(DELIMETER, 1)[0]

    return 0