Exemplo n.º 1
0
    def Load_RSA_KEYS(self):

        aKeyPathes = []

        #default adb key path
        aKeyPathes.append(cPath(OS_GetSystemUserPath() + '.android/adbkey'))

        #default Android Path
        if Globals.uPlatform == u'android':
            aKeyPathes.append(
                cPath(OS_GetSystemUserPath() + 'misc/adb/adb_keys/adbkey'))

        #Download path
        aKeyPathes.append(Globals.oPathUserDownload + "/adbkey")

        for oPath in aKeyPathes:
            if oPath.Exists():
                try:
                    self.aGlobalRSA_KEYS.append(
                        PythonRSASigner.FromRSAKeyPath(oPath.string))
                    Logger.info("RSA Keyfiles loaded from " + oPath)
                except Exception as e:
                    Logger.error("Error Loading RSA Keys from " +
                                 oPath.string + " " + str(e))
            else:
                Logger.debug("No RSA Keyfiles at " + oPath)
Exemplo n.º 2
0
def GetSystemTmpPath() -> cPath:
    """ Gets the path to the tmp folder """
    oPath: cPath

    oPath = cPath(GetEnvVar(u"TMP"))
    if oPath.Exists():
        return oPath

    oPath = OS_GetSystemUserPath() + "\\AppData\\Local\\Temp"
    if oPath.Exists():
        return oPath

    oPath = Globals.oPathUserDownload + "orcatmp"

    oPath.Create()
    return oPath
Exemplo n.º 3
0
 def HandleValue(self, uName, uValue):
     if uName.startswith("oPath"):
         uTmp = uValue
         if uTmp.startswith("~"):
             uTmp = OS_GetSystemUserPath() + uTmp[1:]
         self.oParameter[uName] = cPath(uTmp)
     elif uName.startswith("b"):
         self.oParameter[uName] = (uValue != "")
     else:
         self.oParameter[uName] = uValue
Exemplo n.º 4
0
    def Load_RSA_KEYS(self) -> None:
        # default adb key path
        aKeyPathes:List[cPath] = [cPath(OS_GetSystemUserPath() + '.android/adbkey')]

        #default Android Path
        if Globals.uPlatform==u'android':
            aKeyPathes.append(cPath(OS_GetSystemUserPath()+'misc/adb/adb_keys/adbkey'))

        #Download path
        aKeyPathes.append(Globals.oPathUserDownload+"/adbkey")

        for oPath in aKeyPathes:
            if oPath.Exists():
                try:
                    with open(str(oPath)) as f:
                        oPriv   = f.read()
                        oSigner = PythonRSASigner('', oPriv)
                        self.aGlobalRSA_KEYS.append(oSigner)
                        Logger.info("RSA Keyfiles loaded from "+str(oPath))
                except Exception as e:
                    Logger.error("Error Loading RSA Keys from "+str(oPath)+" "+str(e))
            else:
                Logger.debug("No RSA Keyfiles at "+oPath)
Exemplo n.º 5
0
 def HandleValue(self, uName: str, uValue: str):
     """
     Manages a given parameter of the command line
     identifies boolean parameter and paths for the home user folder across OS
     :param str uName: the name of the parameter
     :param str uValue: The value of he parameter
     :return:
     """
     if uName.startswith("oPath"):
         uTmp = uValue
         if uTmp.startswith("~"):
             uTmp = OS_GetSystemUserPath() + uTmp[1:]
         self.oParameter[uName] = cPath(uTmp)
     elif uName.startswith("b"):
         self.oParameter[uName] = (uValue != "")
     else:
         self.oParameter[uName] = uValue
Exemplo n.º 6
0
def get_home_directory():
    return OS_GetSystemUserPath().string
Exemplo n.º 7
0
    def CreateLogoSources(self, **kwargs) -> None:
        aSourceIcons: List[str]
        dFolderTarget: Dict[str, str] = {}
        oFnDest: cFileName
        oFnSource: cFileName
        oFnTarFile: cFileName
        oPathDest: cPath
        oPathDestRef: cPath
        oPathDestSub: cPath
        uFileCore: str
        uFile: str
        uFnSource: str
        uPathSource: str
        uSubFolder: str
        oPathSources: cPath
        oPathSourcesDebug: cPath
        aFolder: List[str]
        aFiles: List[str]

        oPathSources = cPath("$var(RESOURCEPATH)/tvlogos-src")
        oPathSourcesDebug = cPath("c:/tvlogos-src")
        if oPathSourcesDebug.Exists():
            oPathSources = oPathSourcesDebug

        oPathSourcesDebug = OS_GetSystemUserPath() + "tvlogos-src"
        if oPathSourcesDebug.Exists():
            oPathSources = oPathSourcesDebug

        aFiles = oPathSources.GetFileList(bSubDirs=False, bFullPath=True)
        if aFiles:
            oFnSource = cFileName(oPathSources) + "srp.index.txt"
            if not oFnSource.Exists():
                ShowErrorPopUp(
                    uMessage="srp.index.txt is missing in source folder!")
                return
            oPathSourcesDebug = OS_GetSystemTmpPath() + "tvlogos-src"
            oPathSourcesDebug.Delete()
            oPathSourcesDebug.Create()
            oFnSource.Copy(oNewFile=oPathSourcesDebug)
            for uFnXY in aFiles:
                if uFnXY.endswith(
                        ".tar.xz"
                ) and "snp-full" in uFnXY and "190x102." in uFnXY:
                    oTarFile = cTarFile().ImportFullPath(uFnFullName=uFnXY)
                    self.ShowDebug(uMsg="Untar: %s to %s" %
                                   (oTarFile.string, oPathSourcesDebug.string))
                    oTarFile.UnTar(oPath=oPathSourcesDebug)
            oPathSources = oPathSourcesDebug

        aFolder = oPathSources.GetFolderList(bFullPath=True)
        for uPathSource in aFolder:
            dFolderTarget.clear()
            uFileCore = uPathSource[uPathSource.rfind("102.") +
                                    4:uPathSource.find("_")]
            oPathDest = Globals.oPathTVLogos + uFileCore
            oPathDest.Create()

            self.ShowDebug(uMsg="Create Picons for: %s" % (oPathDest.string))

            oFnSource = cFileName(oPathSources) + "srp.index.txt"

            if not oFnSource.Exists():
                ShowErrorPopUp(
                    uMessage="srp.index.txt is missing in source folder!")
                return

            oFnSource.Copy(oNewFile=oPathDest)

            oPathDest = oPathDest + "picons"
            oPathDest.Create()
            oPathDestRef = oPathDest + "references"
            oPathDestRef.Create()
            aSourceIcons = cPath(uPathSource).GetFileList(bFullPath=False,
                                                          bSubDirs=False)
            for uFnSource in aSourceIcons:
                oFnSource = cFileName(cPath(uPathSource)) + uFnSource
                if uFnSource.startswith("1_"):
                    oFnSource.Copy(oNewFile=oPathDestRef)
                else:
                    uSubFolder = uFnSource.upper()[:2]
                    uSubFolder = uSubFolder.replace(".", "")
                    if uSubFolder[0].isnumeric():
                        uSubFolder = "0-9"
                    oPathDestSub = oPathDest + uSubFolder
                    if not uSubFolder in dFolderTarget:
                        dFolderTarget[uSubFolder] = uSubFolder
                        oPathDestSub.Create()
                    oFnSource.Copy(oNewFile=oPathDestSub)