Exemplo n.º 1
0
def findGeoIPDB():
    dbs = [Settings.value(Settings.GEOIP2DB_LOCATION),
           os.path.join(os.getcwd(), 'GeoLite2-City.mmdb'),
           packagePathJoin('GeoLite2-City.mmdb'),
           os.path.join(os.getcwd(), 'GeoLite2-Country.mmdb'),
           packagePathJoin('GeoLite2-Country.mmdb')]
    for db in dbs:
        if db and os.path.isfile(db):
            return db
Exemplo n.º 2
0
def findGeoIPDB():
    dbs = [
        Settings.value(Settings.GEOIP2DB_LOCATION),
        os.path.join(os.getcwd(), "GeoLite2-City.mmdb"),
        packagePathJoin("GeoLite2-City.mmdb"),
        os.path.join(os.getcwd(), "GeoLite2-Country.mmdb"),
        packagePathJoin("GeoLite2-Country.mmdb"),
    ]
    for db in dbs:
        if db and os.path.isfile(db):
            return db
Exemplo n.º 3
0
    def runFBA(self, quark):
        if not self.checkRom():
            return
        if not self.fba:
            self.sigStatusMessage.emit(
                "Please configure Setting > Locate ggpofba.exe")
            return
        wine = ''
        args = []
        fba = self.fba
        if IS_WINDOWS:
            if Settings.value(Settings.SERVER_ADDRESS) == 'ggpo.net':
                ngexe = os.path.join(os.path.dirname(fba), 'ggpofba-ng.exe')
                if os.path.exists(ngexe):
                    fba = ngexe
            args = [fba, quark, '-w']
        else:
            wine = findWine()
            if Settings.value(Settings.SERVER_ADDRESS) != 'ggpo.net':
                fba = fba.replace('.exe', '.py')
                if IS_LINUX:
                    args = [
                        packagePathJoin('ggpo', 'scripts', 'ggpofba.sh'), fba,
                        quark
                    ]
                else:
                    args = [fba, quark]
            else:
                if not wine:
                    self.sigStatusMessage.emit(
                        "Please configure Setting > Locate wine")
                    return
                if IS_LINUX:
                    args = [
                        packagePathJoin('ggpo', 'scripts', 'ggpofba.sh'), wine,
                        fba, quark
                    ]
                else:
                    args = [wine, fba, quark]

        logdebug().info(" ".join(args))
        try:
            # starting python from cmd.exe and redirect stderr and we got
            # python WindowsError(6, 'The handle is invalid')
            # apparently it's still not fixed
            if IS_WINDOWS:
                Popen(args)
            else:
                devnull = open(os.devnull, 'w')
                Popen(args, stdout=devnull, stderr=devnull)
                devnull.close()
        except OSError, ex:
            self.sigStatusMessage.emit("Error executing " + " ".join(args) +
                                       "\n" + repr(ex))
Exemplo n.º 4
0
    def runFBA(self, quark):
        if not self.checkRom():
            return
        if not self.fba:
            self.sigStatusMessage.emit("Please configure Setting > Locate ggpofba.exe")
            return
        wine = ''
        args = []
        if IS_WINDOWS:
            args = [self.fba, quark, '-w']
        else:
            wine = findWine()
            if not wine:
                self.sigStatusMessage.emit("Please configure Setting > Locate wine")
                return
            if IS_LINUX:
                args = [packagePathJoin('ggpo', 'scripts', 'ggpofba.sh'), wine, self.fba, quark]
            else:
                args = [wine, self.fba, quark]

        logdebug().info(" ".join(args))
        try:
            # starting python from cmd.exe and redirect stderr and we got
            # python WindowsError(6, 'The handle is invalid')
            # apparently it's still not fixed
            if IS_WINDOWS:
                Popen(args)
            else:
                devnull = open(os.devnull, 'w')
                Popen(args, stdout=devnull, stderr=devnull)
                devnull.close()
        except OSError, ex:
            self.sigStatusMessage.emit("Error executing " + " ".join(args) + "\n" + repr(ex))
Exemplo n.º 5
0
    def runFBA(self, quark):
        if not self.checkRom():
            return
        if not self.fba:
            self.sigStatusMessage.emit("Please configure Setting > Locate ggpofba.exe")
            return
        wine = ''
        args = []
        fba = self.fba
        if IS_WINDOWS:
            if Settings.value(Settings.SERVER_ADDRESS) == 'ggpo.net':
                ngexe = os.path.join(os.path.dirname(fba), 'ggpofba-ng.exe')
                if os.path.exists(ngexe):
                    fba = ngexe
            args = [fba, quark, '-w']
        else:
            wine = findWine()
            if Settings.value(Settings.SERVER_ADDRESS) != 'ggpo.net':
                fba = fba.replace('.exe', '.py')
                if IS_LINUX:
                    args = [packagePathJoin('ggpo', 'scripts', 'ggpofba.sh'), fba, quark]
                else:
                    args = [fba, quark]
            else:
                if not wine:
                    self.sigStatusMessage.emit("Please configure Setting > Locate wine")
                    return
                if IS_LINUX:
                    args = [packagePathJoin('ggpo', 'scripts', 'ggpofba.sh'), wine, fba, quark]
                else:
                    args = [wine, fba, quark]

        logdebug().info(" ".join(args))
        try:
            # starting python from cmd.exe and redirect stderr and we got
            # python WindowsError(6, 'The handle is invalid')
            # apparently it's still not fixed
            if IS_WINDOWS:
                Popen(args)
            else:
                devnull = open(os.devnull, 'w')
                Popen(args, stdout=devnull, stderr=devnull)
                devnull.close()
        except OSError, ex:
            self.sigStatusMessage.emit("Error executing " + " ".join(args) + "\n" + repr(ex))