当前位置: 首页>>代码示例>>Python>>正文


Python Logutil.error方法代码示例

本文整理汇总了Python中util.Logutil.error方法的典型用法代码示例。如果您正苦于以下问题:Python Logutil.error方法的具体用法?Python Logutil.error怎么用?Python Logutil.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在util.Logutil的用法示例。


在下文中一共展示了Logutil.error方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __handleCompressedFile

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
	def __handleCompressedFile(self, gui, filext, rom, emuParams):

		log.info("__handleCompressedFile")

		# Note: Trying to delete temporary files (from zip or 7z extraction) from last run
		# Do this before launching a new game. Otherwise game could be deleted before launch
		tempDir = os.path.join(util.getTempDir(), 'extracted', self.romCollection.name)
		# check if folder exists
		if not xbmcvfs.exists(tempDir +'\\'):
			log.info("Create temporary folder: " +tempDir)
			xbmcvfs.mkdir(tempDir)

		try:
			if xbmcvfs.exists(tempDir +'\\'):
				log.info("Trying to delete temporary rom files")
				#can't use xbmcvfs.listdir here as it seems to cache the file list and RetroPlayer won't find newly created files anymore
				files = os.listdir(tempDir)
				for f in files:
					#RetroPlayer places savestate files next to the roms. Don't delete these files.
					fname, ext = os.path.splitext(f)
					if(ext not in ('.sav', '.xml', '.png')):
						xbmcvfs.delete(os.path.join(tempDir, f))
		except Exception, (exc):
			log.error("Error deleting files after launch emu: " + str(exc))
			gui.writeMsg(util.localize(32036) + ": " + str(exc))
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:27,代码来源:launcher.py

示例2: get_scraper_by_name

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
	def get_scraper_by_name(self, sname):
		"""Given a scraper name, returns the scraper class

		Args:
			sname: Name of the scraper, e.g. thegamesdb.net or MAME

		Raises:
			ConfigScraperSiteDoesNotExistException: No scraper matches the name

		"""
		try:
			target = self.scrapers[sname]
		except KeyError as e:
			raise ConfigScraperSiteDoesNotExistException("Unsupported scraper: {0}".format(sname))

		log.debug("Instantiating scraper class {0} - {1}".format(sname, target))
		try:
			module = __import__(target.lower())
			class_ = getattr(module, target)
			instance = class_()
		except ImportError:
			log.error("Unable to find scraper {0}".format(sname))
			raise

		return instance
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:27,代码来源:scraper.py

示例3: search

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
	def search(self, gamename, platform=None):
		""" Ignore platform """
		# Newer versions support multi systems, $info=XXX indicates an arcade ROM
		startmarker = "$info=%s," %gamename
		gamedata = False
		data = ""

		historyfile_path = self._get_history_path()

		try:
			with io.open(historyfile_path, 'r', encoding="utf-8") as historyfile:
				for line in historyfile:
					if line.startswith(startmarker):
						gamedata = True

					if gamedata:
						data += line

					if line.startswith("$end"):
						gamedata = False

		except Exception as e:
			log.error(e)
			raise

		try:
			# Note the regex has to search for either Windows-style line endings (\r\n) or Unix-style (\n)
			# Earlier history.dat files had 3 line breaks, newer versions have 2
			# We also rename manufacturer and Publisher, and Description is all data between the bio heading and the first
			# subheading (e.g. - TECHNICAL - or - CONTRIBUTE -). The romset entry is delimited by the $end.
			# Japanese (or other foreign titles) have the translated name in brackets underneath.
			# Newer versions have an age-based reference (e.g. A 24-year-old SNK Neo-Geo MVS Cart) between the $bio
			# and title line
			pattern = r"\$bio(\r?\n){2}" \
			           "(?P<AgeRef>.*?(\r?\n){2})?" \
			           "(?P<Game>.*?) \(c\) (?P<ReleaseYear>\d{4}) (?P<Publisher>.*?)\.(\r?\n)" \
			           "(\((?P<Translation>.*?)\))?(\r?\n){1,2}" \
			           "(?P<Description>.*?)(\r?\n){2,3}" \
			           "- [A-Z]"

			rdata = re.search(pattern, data, re.DOTALL | re.MULTILINE | re.UNICODE)

			if rdata is None:
				raise ScraperNoSearchResultsFoundException("Unable to find %s in MAME history dat file" %gamename)

		except Exception as e:
			print "Error searching for game %s using regex: %s" %(gamename, str(e))
			return []

		self.resultdata = [rdata.groupdict()]
		self.resultdata[0]['id'] = self.resultdata[0]['Game']
		self.resultdata[0]['SearchKey'] = self.resultdata[0]['Game']

		# HACK - This is only used to retain backwards compatibility with existing scraper, where each key value was a
		# list, even if only one value is in that list
		for k, v in self.resultdata[0].iteritems():
			self.resultdata[0][k] = [v]

		return self.resultdata
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:61,代码来源:mame_scraper.py

示例4: onClick

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
	def onClick(self, controlID):

		log.info('onClick')

		if controlID == CONTROL_BUTTON_EXIT:
			# Close window button
			log.info('Close')
			self.close()
		elif controlID == CONTROL_BUTTON_CANCEL:
			# Cancel button
			self.close()
		elif controlID == CONTROL_BUTTON_SAVE:
			# OK
			log.info('Save')

			# Store selectedRomCollection
			if self.selectedRomCollection is not None:
				# Code to Remove Roms
				log.info('Removing Roms')
				self._setDeleteStatus(True)
				# Code to Remove Collection
				if self.romDelete == 'RCollection':
					self._setRCDeleteStatus(True)
					Logutil.log('Removing Rom Collection', util.LOG_LEVEL_INFO)
					configWriterRCDel = ConfigXmlWriter(False)
					RCName = str(self.selectedRomCollection.name)
					success, message = configWriterRCDel.removeRomCollection(RCName)
					if success is False:
						log.error(message)
						xbmcgui.Dialog().ok(util.localize(32019), util.localize(32020))
			log.info('Click Close')
			self.close()

		elif self.selectedControlId in (CONTROL_BUTTON_RC_DOWN, CONTROL_BUTTON_RC_UP):
			# Changing selection in Rom Collection list
			if self.selectedRomCollection is not None:
				# Store previous selectedRomCollections state
				self.romCollections[self.selectedRomCollection.id] = self.selectedRomCollection

			# HACK: add a little wait time as XBMC needs some ms to execute the MoveUp/MoveDown actions from the skin
			xbmc.sleep(util.WAITTIME_UPDATECONTROLS)
			self.updateControls()
		elif self.selectedControlId in (CONTROL_BUTTON_DEL_DOWN, CONTROL_BUTTON_DEL_UP):
			# Changing selection in Delete Option list
			control = self.getControlById(CONTROL_LIST_DELETEOPTIONS)
			selectedDeleteOption = str(control.getSelectedItem().getLabel2())
			log.info('selectedDeleteOption = {0}'.format(selectedDeleteOption))
			self.romDelete = selectedDeleteOption
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:50,代码来源:dialogdeleteromcollection.py

示例5: __getArchives7z

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
	def __getArchives7z(self, filepath, archiveList):

		try:
			import py7zlib
		except ImportError:
			xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32039), util.localize(32129))
			msg = ("You have tried to launch a .7z file but you are missing required libraries to extract the file. "
				   "You can download the latest RCB version from RCBs project page. It contains all required libraries.")
			log.error(msg)
			return None

		fp = open(str(filepath), 'rb')
		archive = py7zlib.Archive7z(fp)
		archivesDecompressed = [(name, archive.getmember(name).read())for name in archiveList]
		fp.close()
		return archivesDecompressed
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:18,代码来源:launcher.py

示例6: __getNames7z

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
	def __getNames7z(self, filepath):

		try:
			import py7zlib
		except ImportError as e:
			xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32039), util.localize(32129))
			msg = ("You have tried to launch a .7z file but you are missing required libraries to extract the file. "
				   "You can download the latest RCB version from RCBs project page. It contains all required libraries.")
			log.error(msg)
			log.error("Error: " + str(e))
			return None

		fp = open(str(filepath), 'rb')
		archive = py7zlib.Archive7z(fp)
		names = archive.getnames()
		fp.close()
		return names
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:19,代码来源:launcher.py

示例7: search

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
    def search(self, gamename, platform=None):

        #use description to search for the game name as the name attribute also contains the region
        #FIXME TODO
        #currently not working with MAME xml files as the rom files don't use the friendly game name
        pattern = "\<description\>(.*%s.*)\</description\>" % GameNameUtil().prepare_gamename_for_searchrequest(gamename)
        results = []

        try:
            with io.open(self._get_xml_path(), 'r', encoding="utf-8") as xmlfile:
                for line in xmlfile:
                    result = re.search(pattern, line)
                    if result:
                        gamename = result.groups()[0]
                        results.append({'id': gamename,
                                        'title': gamename,
                                        'SearchKey': [gamename]})
        except Exception as e:
            log.error(e)
            raise

        return results
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:24,代码来源:offline_gdbi_scraper.py

示例8: insertGame

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
    def insertGame(self, gameName, description, romCollectionId, publisherId, developerId, reviewerId, yearId,
                   players, rating, votes, url, region, media, perspective, controller, originalTitle, alternateTitle,
                   translatedBy, version, isFavorite, launchCount, isUpdate, gameId, allowUpdate):
        # Check if exists and insert/update as appropriate; move this functionality to the Game object
        try:
            if not isUpdate:
                log.info(u"Game does not exist in database. Insert game: %s" % gameName)
                Game(self.gdb).insert(
                    (gameName, description, None, None, romCollectionId, publisherId, developerId, reviewerId, yearId,
                     players, rating, votes, url, region, media, perspective, controller, int(isFavorite),
                     int(launchCount), originalTitle, alternateTitle, translatedBy, version))
                return self.gdb.cursor.lastrowid
            else:
                if allowUpdate:

                    # check if we are allowed to update with null values
                    allowOverwriteWithNullvalues = __addon__.getSetting(
                        util.SETTING_RCB_ALLOWOVERWRITEWITHNULLVALUES).upper() == 'TRUE'
                    log.info("allowOverwriteWithNullvalues: {0}".format(allowOverwriteWithNullvalues))

                    log.info(u"Game does exist in database. Update game: %s" % gameName)
                    Game(self.gdb).update(('name', 'description', 'romCollectionId', 'publisherId', 'developerId',
                                           'reviewerId', 'yearId', 'maxPlayers', 'rating', 'numVotes',
                                           'url', 'region', 'media', 'perspective', 'controllerType', 'originalTitle',
                                           'alternateTitle', 'translatedBy', 'version', 'isFavorite', 'launchCount'),
                                          (gameName, description, romCollectionId, publisherId, developerId, reviewerId,
                                           yearId, players, rating, votes, url, region, media, perspective, controller,
                                           originalTitle, alternateTitle, translatedBy, version, int(isFavorite),
                                           int(launchCount)),
                                          gameId, allowOverwriteWithNullvalues)
                else:
                    log.info(
                        u"Game does exist in database but update is not allowed for current rom collection. game: %s" % gameName)

                return gameId
        except Exception, (exc):
            log.error(u"An error occured while adding game '%s'. Error: %s" % (gameName, exc))
            return None
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:40,代码来源:dbupdate.py

示例9: getThumbFromOnlineSource

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
    def getThumbFromOnlineSource(self, gamedescription, fileType, fileName, artworkurls):
        log.info("Get thumb from online source")

        try:
            # maybe we got a thumb url from desc parser
            thumbKey = 'Filetype' + fileType
            log.info("using key: %s" % thumbKey)
            thumbUrl = self.resolveParseResult(gamedescription, thumbKey)
            if thumbUrl == '':
                return True, artworkurls

            artworkurls[fileType] = thumbUrl

            log.info("Get thumb from url: %s" % thumbUrl)

            rootExtFile = os.path.splitext(fileName)
            rootExtUrl = os.path.splitext(thumbUrl)

            files = []
            if len(rootExtUrl) == 2 and len(rootExtFile) != 0:
                fileName = rootExtFile[0] + rootExtUrl[1]
                gameName = rootExtFile[0] + ".*"
                files = self.getFilesByWildcard(gameName)
            del rootExtFile, rootExtUrl

            if len(files) > 0:
                log.info("File already exists. Won't download again.")
                return True, artworkurls

            # Create folder if it doesn't already exist
            dirname = os.path.join(os.path.dirname(fileName), '')  # Add the trailing slash that xbmcvfs.exists expects
            log.debug("Checking for artwork directory %s" % dirname)
            if KodiVersions.getKodiVersion() >= KodiVersions.KRYPTON:
                exists = xbmcvfs.exists(dirname)
            else:
                exists = os.path.exists(dirname)
            if not exists:
                log.info("Artwork directory %s doesn't exist, creating it" % dirname)
                success = xbmcvfs.mkdirs(dirname)
                log.info("Directory successfully created: %s" %success)
                if not success:
                    #HACK: check if directory was really not created.
                    directoryExists = xbmcvfs.exists(dirname)
                    log.info("Directory exists: %s" %directoryExists)
                    if not directoryExists:
                        log.error("Could not create artwork directory: '%s'" % dirname)
                        xbmcgui.Dialog().ok(util.localize(32010), util.localize(32011))
                        del dirname
                        return False, artworkurls

            log.info("File %s does not exist, starting download" % fileName)
            # Dialog Status Art Download

            # Update progress dialog to state we are downloading art
            try:
                msg = "%s: %s" % (util.localize(32123), self._guiDict["gameNameKey"])
                submsg = "%s - downloading art" % self._guiDict["scraperSiteKey"][thumbKey]
                self._gui.writeMsg(self._guiDict["dialogHeaderKey"], msg, submsg, self._guiDict["fileCountKey"])
            except KeyError:
                log.warn("Unable to retrieve key from GUI dict")

            try:
                self.download_thumb(thumbUrl, fileName)

            except Exception, (exc):
                log.error("Could not create file: '%s'. Error message: '%s'" % (fileName, exc))
                # xbmcgui.Dialog().ok(util.localize(32012), util.localize(32011))
                return False, artworkurls

            Logutil.log("Download finished.", util.LOG_LEVEL_INFO)
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:72,代码来源:dbupdate.py

示例10: useSingleScrapers

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
    def useSingleScrapers(self, romCollection, romFile, gamenameFromFile, progDialogRCHeader, fileCount):
        """Scrape site for game metadata

		Args:
			romCollection:
			gamenameFromFile:
			progDialogRCHeader:
			fileCount:

		Returns:
			dict for the game result:
				{'SearchKey': ['Chrono Trigger'],
				 'Publisher': ['Squaresoft'],
				 'Description': ["The millennium. A portal is opened. The chain of time is broken...],
				 'Players': ['1'],
				 'Platform': ['Super Nintendo (SNES)'],
				 'Game': ['Chrono Trigger'],
				 'Filetypeboxfront': ['http://thegamesdb.net/banners/boxart/original/front/1255-1.jpg'],
				 'Filetypeboxback': ['http://thegamesdb.net/banners/boxart/original/back/1255-1.jpg'],
				 'Filetypescreenshot': ['http://thegamesdb.net/banners/screenshots/1255-1.jpg', 'http://thegamesdb.net/banners/screenshots/1255-2.jpg', 'http://thegamesdb.net/banners/screenshots/1255-3.jpg', 'http://thegamesdb.net/banners/screenshots/1255-4.jpg', 'http://thegamesdb.net/banners/screenshots/1255-5.jpg'],
				 'Filetypefanart': ['http://thegamesdb.net/banners/fanart/original/1255-1.jpg', 'http://thegamesdb.net/banners/fanart/original/1255-10.jpg', 'http://thegamesdb.net/banners/fanart/original/1255-11.jpg', 'http://thegamesdb.net/banners/fanart/original/1255-2.jpg', 'http://thegamesdb.net/banners/fanart/original/1255-3.jpg', 'http://thegamesdb.net/banners/fanart/original/1255-4.jpg', 'http://thegamesdb.net/banners/fanart/original/1255-5.jpg', 'http://thegamesdb.net/banners/fanart/original/1255-6.jpg', 'http://thegamesdb.net/banners/fanart/original/1255-7.jpg', 'http://thegamesdb.net/banners/fanart/original/1255-8.jpg', 'http://thegamesdb.net/banners/fanart/original/1255-9.jpg'],
				 'Genre': ['Role-Playing'],
				 'Developer': ['Squaresoft']}
			dict for artwork urls:
				{'Filetypefanart': 'thegamesdb.net', 'Filetypeboxback': 'thegamesdb.net', 'Filetypescreenshot': 'thegamesdb.net', 'Filetypeboxfront': 'thegamesdb.net'}
				Note - this only contains entries for artwork that was found (i.e. is not empty list)
		"""
        gameresult = {}
        artScrapers = {}

        scraperSite = romCollection.scraperSites[0]

        try:
            #first check if a local nfo file is available
            nfoscraper = NFO_Scraper()
            nfofile = nfoscraper.get_nfo_path(gamenameFromFile, romCollection.name, romFile)
            if xbmcvfs.exists(nfofile) and __addon__.getSetting(util.SETTING_RCB_PREFERLOCALNFO).upper() == 'TRUE':
                log.info("Found local nfo file. Using this to scrape info.")
                newscraper = nfoscraper
            else:
                newscraper = AbstractScraper().get_scraper_by_name(scraperSite.name)
                #set path to desc file (only useful for offline scrapers)
                newscraper.path = scraperSite.path

            results = newscraper.search(gamenameFromFile, romCollection.name)
            log.debug(u"Searching for %s - found %s results: %s" % (gamenameFromFile, len(results), results))
        except ScraperExceededAPIQuoteException as ke:
            # API key is invalid - we need to stop scraping
            log.error("Scraper exceeded API key, stopping scraping")
            raise
        except Exception as e:
            log.error("Error searching for %s using scraper %s - %s %s" % (
            gamenameFromFile, scraperSite.name, type(e), e))
            return gameresult, artScrapers

        if results == []:
            log.warn("No search results found for %s using scraper %s" % (gamenameFromFile, scraperSite.name))
            return gameresult, artScrapers

        matched = Matcher().getBestResults(results, gamenameFromFile)
        if matched is None:
            log.error("No matches found for %s, skipping" % gamenameFromFile)
            return gameresult, artScrapers
        log.debug("After matching: %s" % matched)

        try:
            retrievedresult = newscraper.retrieve(matched['id'], romCollection.name)
            log.debug(u"Retrieving %s - found %s" % (matched['id'], retrievedresult))
        except Exception as e:
            # FIXME TODO Catch exceptions specifically
            log.error("Error retrieving %s - %s %s" % (matched['id'], type(e), e))
            return gameresult, artScrapers

        # Update the gameresult with any new fields
        gameresult = self.addNewElements(gameresult, retrievedresult)

        self._gui.writeMsg(progDialogRCHeader, util.localize(32123) + ": " + gamenameFromFile,
                           scraperSite.name + " - " + util.localize(32131), fileCount)

        # Find Filetypes and Scrapers for Art Download
        # FIXME TODO The following is kept to keep artwork downloading working as it currently is. We already have
        # the URLs and so could handle/download here, rather than deferring
        if len(gameresult) > 0:
            for path in romCollection.mediaPaths:
                thumbKey = 'Filetype' + path.fileType.name
                if len(self.resolveParseResult(gameresult, thumbKey)) > 0:
                    if (thumbKey in artScrapers) == 0:
                        artScrapers[thumbKey] = scraperSite.name

        log.debug(u"After scraping, result = %s, artscrapers = %s" % (gameresult, artScrapers))
        return gameresult, artScrapers
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:93,代码来源:dbupdate.py

示例11: updateDB

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
    def updateDB(self, gdb, gui, romCollections, isRescrape):
        self.gdb = gdb
        self._gui = gui

        log.info("Start Update DB")

        log.info("Iterating Rom Collections")
        rccount = 1

        # always do full reimports when in rescrape-mode
        enableFullReimport = isRescrape or __addon__.getSetting(util.SETTING_RCB_ENABLEFULLREIMPORT).upper() == 'TRUE'
        log.info("enableFullReimport: {0}".format(enableFullReimport))

        continueUpdate = True
        # Added variable to allow user to continue on errors
        ignoreErrors = False

        for romCollection in romCollections.values():

            # timestamp1 = time.clock()

            # check if import was canceled
            if not continueUpdate:
                log.info("Game import canceled")
                break

            # prepare Header for ProgressDialog
            progDialogRCHeader = util.localize(32122) + " (%i / %i): %s" % (
            rccount, len(romCollections), romCollection.name)
            rccount += 1

            log.info("current Rom Collection: {0}".format(romCollection.name))

            # Read settings for current Rom Collection
            log.info("ignoreOnScan: {0}".format(romCollection.ignoreOnScan))
            if romCollection.ignoreOnScan:
                log.info("current Rom Collection will be ignored.")
                # self.scrapeResultsFile.write('Rom Collection will be ignored.\n')
                continue

            log.info("update is allowed for current rom collection: {0}".format(romCollection.allowUpdate))
            log.info("max folder depth: {0}".format(romCollection.maxFolderDepth))

            files = self.getRomFilesByRomCollection(romCollection, enableFullReimport)
            if len(files) == 0:
                log.info(u"No files found for rom collection {0}, skipping".format(romCollection.name))
                continue

            log.info(u"Found {0} game files for rom collection {1}".format(len(files), romCollection.name))

            # itemCount is used for percentage in ProgressDialogGUI
            self._gui.itemCount = len(files) + 1

            successfulFiles = 0
            lastgamename = ''
            lastGameId = None

            for fileidx, filename in enumerate(files):

                try:
                    #Give kodi a chance to interrupt the process
                    #HACK: we should use monitor.abortRequested() or monitor.waitForAbort()
                    #but for some reason only xbmc.abortRequested returns True
                    if monitor.abortRequested() or xbmc.abortRequested:
                        log.info("Kodi requests abort. Cancel Update.")
                        break

                    log.info("Scraping for %s" % filename)
                    gamenameFromFile = romCollection.getGamenameFromFilename(filename)

                    # check if we are handling one of the additional disks of a multi rom game
                    isMultiRomGame = (gamenameFromFile == lastgamename)
                    lastgamename = gamenameFromFile

                    if isMultiRomGame:
                        # Add this entry as a file under the game ID and move on
                        log.info("Detected %s as a multirom game (previous game was %s)" % (filename, lastgamename))
                        if lastGameId is None:
                            log.error("Game detected as multi rom game, but lastGameId is None.")
                            continue
                        fileType = FileType()
                        fileType.id, fileType.name, fileType.parent = 0, "rcb_rom", "game"
                        self.insertFile(filename, lastGameId, fileType, None, None, None)
                        self.gdb.commit()
                        del fileType
                        continue

                    log.info("Start scraping info for game: %s" % gamenameFromFile)

                    continueUpdate = self._gui.writeMsg(progDialogRCHeader,
                                                        util.localize(32123) + ": " + gamenameFromFile, "", fileidx + 1)
                    if not continueUpdate:
                        log.info("Game import canceled by user")
                        break

                    # check if this file already exists in DB
                    continueUpdate, isUpdate, gameId = self.checkRomfileAlreadyExists(filename, enableFullReimport)
                    if not continueUpdate:
                        continue

#.........这里部分代码省略.........
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:103,代码来源:dbupdate.py

示例12: launchEmu

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
	def launchEmu(self, gdb, gui, gameId, config, listitem):
		log.info("Begin launcher.launchEmu")

		gameRow = Game(gdb).getObjectById(gameId)
		if gameRow is None:
			log.error("Game with id %s could not be found in database" % gameId)
			return

		try:
			self.romCollection = config.romCollections[str(gameRow[util.GAME_romCollectionId])]
		except KeyError:
			log.error("Cannot get rom collection with id: " + str(gameRow[util.GAME_romCollectionId]))
			gui.writeMsg(util.localize(32034))
			return

		gui.writeMsg(util.localize(32163) + " " + gameRow[util.ROW_NAME])

		# Remember viewstate
		gui.saveViewState(False)

		cmd = ""
		precmd = ""
		postcmd = ""

		filenameRows = File(gdb).getRomsByGameId(gameRow[util.ROW_ID])
		log.info("files for current game: " + str(filenameRows))

		cmd, precmd, postcmd, roms = self.__buildCmd(gui, filenameRows, gameRow, False)

		if not self.romCollection.useBuiltinEmulator:
			if cmd == '':
				log.info("No cmd created. Game will not be launched.")
				return
			if precmd.strip() == '' or precmd.strip() == 'call':
				log.info("No precmd created.")

			if postcmd.strip() == '' or postcmd.strip() == 'call':
				log.info("No postcmd created.")

			# solo mode
			if self.romCollection.useEmuSolo:

				self.__copyLauncherScriptsToUserdata()

				# communicate with service via settings
				__addon__.setSetting(util.SETTING_RCB_LAUNCHONSTARTUP, 'true')

				# invoke script file that kills xbmc before launching the emulator
				basePath = os.path.join(util.getAddonDataPath(), 'scriptfiles')

				if self.env == "win32":
					if __addon__.getSetting(util.SETTING_RCB_USEVBINSOLOMODE).lower() == 'true':
						# There is a problem with quotes passed as argument to windows command shell. This only works with "call"
						# use vb script to restart xbmc
						cmd = 'call \"' + os.path.join(basePath,
													   'applaunch-vbs.bat') + '\" ' + cmd
					else:
						# There is a problem with quotes passed as argument to windows command shell. This only works with "call"
						cmd = 'call \"' + os.path.join(basePath, 'applaunch.bat') + '\" ' + cmd
				else:
					cmd = os.path.join(basePath, 'applaunch.sh ') + cmd
			else:
				# use call to support paths with whitespaces
				if self.env == "win32":
					cmd = 'call ' + cmd

		# update LaunchCount
		launchCount = gameRow[util.GAME_launchCount]
		Game(gdb).update(('launchCount',), (launchCount + 1,), gameRow[util.ROW_ID], True)
		gdb.commit()

		log.info("cmd: " + cmd)
		log.info("precmd: " + precmd)
		log.info("postcmd: " + postcmd)

		try:
			self.__launchNonXbox(cmd, gameRow, precmd, postcmd, roms, gui, listitem)

			gui.writeMsg("")

		except Exception, (exc):
			log.error("Error while launching emu: " + str(exc))
			gui.writeMsg(util.localize(32035) + ": " + str(exc))
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:85,代码来源:launcher.py

示例13: str

# 需要导入模块: from util import Logutil [as 别名]
# 或者: from util.Logutil import error [as 别名]
					fname, ext = os.path.splitext(f)
					if(ext not in ('.sav', '.xml', '.png')):
						xbmcvfs.delete(os.path.join(tempDir, f))
		except Exception, (exc):
			log.error("Error deleting files after launch emu: " + str(exc))
			gui.writeMsg(util.localize(32036) + ": " + str(exc))

		roms = []

		log.info("Treating file as a compressed archive")
		compressed = True

		try:
			names = self.__getNames(filext, rom)
		except Exception, (exc):
			log.error("Error handling compressed file: " + str(exc))
			return []

		if names is None:
			log.error("Error handling compressed file")
			return []

		chosenROM = -1

		# check if we should handle multiple roms
		match = False
		if self.romCollection.diskPrefix != '':
			match = re.search(self.romCollection.diskPrefix.lower(), str(names).lower())

		if '%I%' in emuParams and match:
			log.info("Loading %d archives" % len(names))
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:33,代码来源:launcher.py


注:本文中的util.Logutil.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。