def set_gameclient(self): log.info("set_gameclient") if not helper.isRetroPlayerSupported(): log.info( "This RetroPlayer branch does not support selecting gameclients." ) return if self.selectedGame is None or self.gameRow is None: xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32015), util.localize(32014)) return #HACK: use alternateGameCmd to store gameclient information origGameClient = self.selectedGame.getProperty('alternateGameCmd') gameclient = '' romCollectionId = self.selectedGame.getProperty('romCollectionId') romCollection = self.gui.config.romCollections[str(romCollectionId)] success, selectedcore = helper.selectlibretrocore(romCollection.name) if success: gameclient = selectedcore else: log.info("No libretro core was chosen. Won't update game command.") return if gameclient != origGameClient: log.info("Updating game '{0}' with gameclient '{1}'".format( self.selectedGame.getLabel(), gameclient)) Game(self.gui.gdb).update(('alternateGameCmd', ), (gameclient, ), self.selectedGame.getProperty('gameId'), True) self.gui.gdb.commit()
def onInit(self): log.info("onInit Edit Rom Collection") # Rom Collections self.addItemsToList(CONTROL_LIST_ROMCOLLECTIONS, self.gui.config.getRomCollectionNames()) log.info("build imagePlacing list") self.imagePlacingList = [] imagePlacingRows = self.gui.config.tree.findall('ImagePlacing/fileTypeFor') for imagePlacing in imagePlacingRows: log.info("add image placing: {0}".format(imagePlacing.attrib.get('name'))) option = imagePlacing.attrib.get('name') # HACK: remove all video options from config if option.upper().find('VIDEO') >= 0: continue try: option = config.imagePlacingDict[option] except IndexError: pass self.imagePlacingList.append(option) self.addItemsToList(CONTROL_LIST_IMAGEPLACING_MAIN, self.imagePlacingList) self.addItemsToList(CONTROL_LIST_IMAGEPLACING_INFO, self.imagePlacingList) if not helper.isRetroPlayerSupported(): for ctrl_id in [CONTROL_BUTTON_USERETROPLAYER, CONTROL_BUTTON_GAMECLIENT]: try: control = self.getControlById(ctrl_id) control.setEnabled(False) control.setVisible(False) except AttributeError: pass self.updateRomCollectionControls()
def onInit(self): Logutil.log('onInit Edit Rom Collection', util.LOG_LEVEL_INFO) #Rom Collections Logutil.log('build rom collection list', util.LOG_LEVEL_INFO) romCollectionList = [] for rcId in self.romCollections.keys(): romCollection = self.romCollections[rcId] romCollectionList.append(romCollection.name) self.addItemsToList(CONTROL_LIST_ROMCOLLECTIONS, romCollectionList) Logutil.log('build scraper lists', util.LOG_LEVEL_INFO) self.availableScrapers = self.getAvailableScrapers(False) self.addItemsToList(CONTROL_LIST_SCRAPER1, self.availableScrapers) self.addItemsToList(CONTROL_LIST_SCRAPER2, self.availableScrapers) self.addItemsToList(CONTROL_LIST_SCRAPER3, self.availableScrapers) Logutil.log('build imagePlacing list', util.LOG_LEVEL_INFO) self.imagePlacingList = [] imagePlacingRows = self.gui.config.tree.findall( 'ImagePlacing/fileTypeFor') for imagePlacing in imagePlacingRows: Logutil.log( 'add image placing: ' + str(imagePlacing.attrib.get('name')), util.LOG_LEVEL_INFO) option = imagePlacing.attrib.get('name') #HACK: remove all video options from config if (option.upper().find('VIDEO') >= 0): continue try: option = config.imagePlacingDict[option] except: pass self.imagePlacingList.append(option) self.addItemsToList(CONTROL_LIST_IMAGEPLACING_MAIN, self.imagePlacingList) self.addItemsToList(CONTROL_LIST_IMAGEPLACING_INFO, self.imagePlacingList) if (not helper.isRetroPlayerSupported()): control = self.getControlById(CONTROL_BUTTON_USERETROPLAYER) if (control): control.setEnabled(False) control.setVisible(False) control = self.getControlById(CONTROL_BUTTON_GAMECLIENT) if (control): control.setEnabled(False) control.setVisible(False) elif (not helper.retroPlayerSupportsPythonIntegration()): control = self.getControlById(CONTROL_BUTTON_GAMECLIENT) if (control): control.setEnabled(False) control.setVisible(False) self.updateRomCollectionControls()
def __init__(self, *args, **kwargs): log.info("init ContextMenu") self.gui = kwargs["gui"] self.selectedGame = self.gui.getSelectedItem() game_favorites_option = util.localize(32507) # Add Game To Favorites selection_favorites_option = util.localize( 32508) # Add Selection To Favorites if self.selectedGame is not None: if self.selectedGame.getProperty('isfavorite') == '1': game_favorites_option = util.localize( 32133) # Remove Game From Favorites selection_favorites_option = util.localize( 32134) # Remove Selection From Favorites options = [ util.localize(32501), # Rescrape selected Game util.localize(32502), # Rescrape Selection util.localize(32506), # Edit Game Command game_favorites_option, selection_favorites_option, util.localize(32510) # Delete Game ] # add set gameclient option if helper.isRetroPlayerSupported(): log.info("RetroPlayer is supported: add option set Gameclient") options.append(util.localize(32514)) # Set Gameclient (per Game) dialog = xbmcgui.Dialog() choice = dialog.contextmenu(options) log.info("Selected option from Context Menu: %s" % choice) if choice < 0: return if choice == 0: self.rescrape_game() elif choice == 1: self.rescrape_selection() elif choice == 2: self.edit_game_command() elif choice == 3: self.gui.set_isfavorite_for_game(self.selectedGame) elif choice == 4: self.gui.set_isfavorite_for_selection(self.selectedGame) elif choice == 5: self.delete_game() elif choice == 6: self.set_gameclient()
def onInit(self): Logutil.log('onInit Edit Rom Collection', util.LOG_LEVEL_INFO) #Rom Collections Logutil.log('build rom collection list', util.LOG_LEVEL_INFO) romCollectionList = [] for rcId in self.romCollections.keys(): romCollection = self.romCollections[rcId] romCollectionList.append(romCollection.name) self.addItemsToList(CONTROL_LIST_ROMCOLLECTIONS, romCollectionList) Logutil.log('build scraper lists', util.LOG_LEVEL_INFO) self.availableScrapers = self.getAvailableScrapers(False) self.addItemsToList(CONTROL_LIST_SCRAPER1, self.availableScrapers) self.addItemsToList(CONTROL_LIST_SCRAPER2, self.availableScrapers) self.addItemsToList(CONTROL_LIST_SCRAPER3, self.availableScrapers) Logutil.log('build imagePlacing list', util.LOG_LEVEL_INFO) self.imagePlacingList = [] imagePlacingRows = self.gui.config.tree.findall('ImagePlacing/fileTypeFor') for imagePlacing in imagePlacingRows: Logutil.log('add image placing: ' +str(imagePlacing.attrib.get('name')), util.LOG_LEVEL_INFO) option = imagePlacing.attrib.get('name') #HACK: remove all video options from config if(option.upper().find('VIDEO') >= 0): continue try: option = config.imagePlacingDict[option] except: pass self.imagePlacingList.append(option) self.addItemsToList(CONTROL_LIST_IMAGEPLACING_MAIN, self.imagePlacingList) self.addItemsToList(CONTROL_LIST_IMAGEPLACING_INFO, self.imagePlacingList) if(not helper.isRetroPlayerSupported()): control = self.getControlById(CONTROL_BUTTON_USERETROPLAYER) if(control): control.setEnabled(False) control.setVisible(False) control = self.getControlById(CONTROL_BUTTON_GAMECLIENT) if(control): control.setEnabled(False) control.setVisible(False) elif(not helper.retroPlayerSupportsPythonIntegration()): control = self.getControlById(CONTROL_BUTTON_GAMECLIENT) if(control): control.setEnabled(False) control.setVisible(False) self.updateRomCollectionControls()
def onInit(self): log.info("onInit ContextMenu") self.selectedGame = self.gui.getSelectedItem() # Set mark favorite text if self.selectedGame is not None: if self.selectedGame.getProperty('isfavorite') == '1': buttonMarkFavorite = self.getControlById(CONTROL_BUTTON_SETFAVORITE_GAME) if buttonMarkFavorite is not None: buttonMarkFavorite.setLabel(util.localize(32133)) buttonMarkFavorite = self.getControlById(CONTROL_BUTTON_SETFAVORITE_SELECTION) if buttonMarkFavorite is not None: buttonMarkFavorite.setLabel(util.localize(32134)) # Hide Set Gameclient option if not helper.isRetroPlayerSupported(): control = self.getControlById(5224) control.setVisible(False) control.setEnabled(False)
def onInit(self): log.info("onInit Edit Rom Collection") # Rom Collections self.addItemsToList(CONTROL_LIST_ROMCOLLECTIONS, self.gui.config.getRomCollectionNames()) log.info("build scraper lists") self.availableScrapers = self.getAvailableScrapers() self.addItemsToList(CONTROL_LIST_SCRAPER1, self.availableScrapers) log.info("build imagePlacing list") self.imagePlacingList = [] imagePlacingRows = self.gui.config.tree.findall('ImagePlacing/fileTypeFor') for imagePlacing in imagePlacingRows: log.info("add image placing: {0}".format(imagePlacing.attrib.get('name'))) option = imagePlacing.attrib.get('name') # HACK: remove all video options from config if option.upper().find('VIDEO') >= 0: continue try: option = config.imagePlacingDict[option] except IndexError: pass self.imagePlacingList.append(option) self.addItemsToList(CONTROL_LIST_IMAGEPLACING_MAIN, self.imagePlacingList) self.addItemsToList(CONTROL_LIST_IMAGEPLACING_INFO, self.imagePlacingList) if not helper.isRetroPlayerSupported(): for ctrl_id in [CONTROL_BUTTON_USERETROPLAYER, CONTROL_BUTTON_GAMECLIENT]: try: control = self.getControlById(ctrl_id) control.setEnabled(False) control.setVisible(False) except AttributeError: pass self.updateRomCollectionControls()
def addRomCollections(self, id, configObj, consoleList, isUpdate): romCollections = {} dialog = xbmcgui.Dialog() #scraping scenario scenarioIndex = dialog.select(util.localize(32173), [util.localize(32174), util.localize(32175)]) Logutil.log('scenarioIndex: ' +str(scenarioIndex), util.LOG_LEVEL_INFO) if(scenarioIndex == -1): del dialog Logutil.log('No scenario selected. Action canceled.', util.LOG_LEVEL_INFO) return False, romCollections autoconfig = EmulatorAutoconfig(util.getEmuAutoConfigPath()) while True: fileTypeList, errorMsg = self.buildMediaTypeList(configObj, isUpdate) romCollection = RomCollection() #console platformIndex = dialog.select(util.localize(32176), consoleList) Logutil.log('platformIndex: ' +str(platformIndex), util.LOG_LEVEL_INFO) if(platformIndex == -1): Logutil.log('No Platform selected. Action canceled.', util.LOG_LEVEL_INFO) break else: console = consoleList[platformIndex] if(console =='Other'): keyboard = xbmc.Keyboard() keyboard.setHeading(util.localize(32177)) keyboard.doModal() if (keyboard.isConfirmed()): console = keyboard.getText() Logutil.log('Platform entered manually: ' +console, util.LOG_LEVEL_INFO) else: Logutil.log('No Platform entered. Action canceled.', util.LOG_LEVEL_INFO) break else: consoleList.remove(console) Logutil.log('selected platform: ' +console, util.LOG_LEVEL_INFO) romCollection.name = console romCollection.id = id id = id +1 #check if we have general RetroPlayer support if(helper.isRetroPlayerSupported()): supportsRetroPlayer = True #if we have full python integration we can also check if specific platform supports RetroPlayer if(helper.retroPlayerSupportsPythonIntegration()): supportsRetroPlayer = False success, installedAddons = helper.readLibretroCores("all", True, romCollection.name) if(success and len(installedAddons) > 0): supportsRetroPlayer = True else: success, installedAddons = helper.readLibretroCores("uninstalled", False, romCollection.name) if(success and len(installedAddons) > 0): supportsRetroPlayer = True if(supportsRetroPlayer): retValue = dialog.yesno(util.localize(32999), util.localize(32198)) if(retValue == True): romCollection.useBuiltinEmulator = True #only ask for emulator and params if we don't use builtin emulator if(not romCollection.useBuiltinEmulator): #maybe there is autoconfig support preconfiguredEmulator = None #emulator #xbox games on xbox will be launched directly if (os.environ.get( "OS", "xbox" ) == "xbox" and romCollection.name == 'Xbox'): romCollection.emulatorCmd = '%ROM%' Logutil.log('emuCmd set to "%ROM%" on Xbox.', util.LOG_LEVEL_INFO) #check for standalone games elif (romCollection.name == 'Linux' or romCollection.name == 'Macintosh' or romCollection.name == 'Windows'): romCollection.emulatorCmd = '"%ROM%"' Logutil.log('emuCmd set to "%ROM%" for standalone games.', util.LOG_LEVEL_INFO) else: #TODO: Windows and Linux support #xbmc.getCondVisibility('System.Platform.Windows') #xbmc.getCondVisibility('System.Platform.Linux') if(xbmc.getCondVisibility('System.Platform.Android')): Logutil.log('Running on Android. Trying to find emulator per autoconfig.', util.LOG_LEVEL_INFO) emulators = autoconfig.findEmulators('Android', romCollection.name, True) emulist = [] for emulator in emulators: if(emulator.isInstalled): emulist.append(util.localize(32202) %emulator.name) else: emulist.append(emulator.name) if(len(emulist) > 0): emuIndex = dialog.select(util.localize(32203), emulist) Logutil.log('emuIndex: ' +str(emuIndex), util.LOG_LEVEL_INFO) if(emuIndex == -1): Logutil.log('No Emulator selected.', util.LOG_LEVEL_INFO) else: preconfiguredEmulator = emulators[emuIndex] if(preconfiguredEmulator): romCollection.emulatorCmd = preconfiguredEmulator.emuCmd else: consolePath = dialog.browse(1, util.localize(32178) %console, 'files') Logutil.log('consolePath: ' +str(consolePath), util.LOG_LEVEL_INFO) if(consolePath == ''): Logutil.log('No consolePath selected. Action canceled.', util.LOG_LEVEL_INFO) break romCollection.emulatorCmd = consolePath #params #on xbox we will create .cut files without params if (os.environ.get( "OS", "xbox" ) == "xbox"): romCollection.emulatorParams = '' Logutil.log('emuParams set to "" on Xbox.', util.LOG_LEVEL_INFO) elif (romCollection.name == 'Linux' or romCollection.name == 'Macintosh' or romCollection.name == 'Windows'): romCollection.emulatorParams = '' Logutil.log('emuParams set to "" for standalone games.', util.LOG_LEVEL_INFO) else: defaultParams = '"%ROM%"' if(preconfiguredEmulator): defaultParams = preconfiguredEmulator.emuParams keyboard = xbmc.Keyboard() keyboard.setDefault(defaultParams) keyboard.setHeading(util.localize(32179)) keyboard.doModal() if (keyboard.isConfirmed()): emuParams = keyboard.getText() Logutil.log('emuParams: ' +str(emuParams), util.LOG_LEVEL_INFO) else: Logutil.log('No emuParams selected. Action canceled.', util.LOG_LEVEL_INFO) break romCollection.emulatorParams = emuParams #roms romPath = dialog.browse(0, util.localize(32180) %console, 'files') if(romPath == ''): Logutil.log('No romPath selected. Action canceled.', util.LOG_LEVEL_INFO) break #TODO: find out how to deal with non-ascii characters try: unicode(romPath) except: Logutil.log("RCB can't acces your Rom Path. Make sure it does not contain any non-ascii characters.", util.LOG_LEVEL_INFO) xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32041), errorMsg) break #filemask #xbox games always use default.xbe as executable if (os.environ.get( "OS", "xbox" ) == "xbox" and romCollection.name == 'Xbox'): Logutil.log('filemask "default.xbe" for Xbox games on Xbox.', util.LOG_LEVEL_INFO) romPathComplete = util.joinPath(romPath, 'default.xbe') romCollection.romPaths = [] romCollection.romPaths.append(romPathComplete) else: keyboard = xbmc.Keyboard() keyboard.setHeading(util.localize(32181)) keyboard.doModal() if (keyboard.isConfirmed()): fileMaskInput = keyboard.getText() Logutil.log('fileMask: ' +str(fileMaskInput), util.LOG_LEVEL_INFO) fileMasks = fileMaskInput.split(',') romCollection.romPaths = [] for fileMask in fileMasks: romPathComplete = util.joinPath(romPath, fileMask.strip()) romCollection.romPaths.append(romPathComplete) else: Logutil.log('No fileMask selected. Action canceled.', util.LOG_LEVEL_INFO) break if (os.environ.get( "OS", "xbox" ) == "xbox"): romCollection.xboxCreateShortcut = True romCollection.xboxCreateShortcutAddRomfile = True romCollection.xboxCreateShortcutUseShortGamename = False #TODO use flags for complete platform list (not only xbox) if(romCollection.name == 'Xbox'): romCollection.useFoldernameAsGamename = True romCollection.searchGameByCRC = False romCollection.maxFolderDepth = 1 if(scenarioIndex == 0): artworkPath = dialog.browse(0, util.localize(32193) %console, 'files', '', False, False, romPath) Logutil.log('artworkPath: ' +str(artworkPath), util.LOG_LEVEL_INFO) #TODO: find out how to deal with non-ascii characters try: unicode(artworkPath) except: Logutil.log("RCB can't acces your artwork path. Make sure it does not contain any non-ascii characters.", util.LOG_LEVEL_INFO) xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32042), errorMsg) break if(artworkPath == ''): Logutil.log('No artworkPath selected. Action canceled.', util.LOG_LEVEL_INFO) break romCollection.descFilePerGame= True #mediaPaths romCollection.mediaPaths = [] if(romCollection.name == 'MAME'): romCollection.mediaPaths.append(self.createMediaPath('boxfront', artworkPath, scenarioIndex)) romCollection.mediaPaths.append(self.createMediaPath('action', artworkPath, scenarioIndex)) romCollection.mediaPaths.append(self.createMediaPath('title', artworkPath, scenarioIndex)) romCollection.mediaPaths.append(self.createMediaPath('cabinet', artworkPath, scenarioIndex)) romCollection.mediaPaths.append(self.createMediaPath('marquee', artworkPath, scenarioIndex)) else: romCollection.mediaPaths.append(self.createMediaPath('boxfront', artworkPath, scenarioIndex)) romCollection.mediaPaths.append(self.createMediaPath('boxback', artworkPath, scenarioIndex)) romCollection.mediaPaths.append(self.createMediaPath('cartridge', artworkPath, scenarioIndex)) romCollection.mediaPaths.append(self.createMediaPath('screenshot', artworkPath, scenarioIndex)) romCollection.mediaPaths.append(self.createMediaPath('fanart', artworkPath, scenarioIndex)) #other MAME specific properties if(romCollection.name == 'MAME'): romCollection.imagePlacingMain = ImagePlacing() romCollection.imagePlacingMain.name = 'gameinfomamecabinet' #MAME zip files contain several files but they must be passed to the emu as zip file romCollection.doNotExtractZipFiles = True #create MAWS scraper site = Site() site.name = 'maws.mameworld.info' scrapers = [] scraper = Scraper() scraper.parseInstruction = '06 - maws.xml' scraper.source = 'http://maws.mameworld.info/maws/romset/%GAME%' scrapers.append(scraper) site.scrapers = scrapers romCollection.scraperSites = [] romCollection.scraperSites.append(site) else: if(romCollection.name == 'MAME'): romCollection.imagePlacingMain = ImagePlacing() romCollection.imagePlacingMain.name = 'gameinfomamecabinet' #MAME zip files contain several files but they must be passed to the emu as zip file romCollection.doNotExtractZipFiles = True romCollection.mediaPaths = [] lastArtworkPath = '' while True: fileTypeIndex = dialog.select(util.localize(32183), fileTypeList) Logutil.log('fileTypeIndex: ' +str(fileTypeIndex), util.LOG_LEVEL_INFO) if(fileTypeIndex == -1): Logutil.log('No fileTypeIndex selected.', util.LOG_LEVEL_INFO) break fileType = fileTypeList[fileTypeIndex] fileTypeList.remove(fileType) if(lastArtworkPath == ''): artworkPath = dialog.browse(0, util.localize(32182) %(console, fileType), 'files', '', False, False, romPath) else: artworkPath = dialog.browse(0, util.localize(32182) %(console, fileType), 'files', '', False, False, lastArtworkPath) try: unicode(artworkPath) except: Logutil.log("RCB can't acces your artwork path. Make sure it does not contain any non-ascii characters.", util.LOG_LEVEL_INFO) xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32042), errorMsg) break lastArtworkPath = artworkPath Logutil.log('artworkPath: ' +str(artworkPath), util.LOG_LEVEL_INFO) if(artworkPath == ''): Logutil.log('No artworkPath selected.', util.LOG_LEVEL_INFO) break romCollection.mediaPaths.append(self.createMediaPath(fileType, artworkPath, scenarioIndex)) retValue = dialog.yesno(util.localize(32999), util.localize(32184)) if(retValue == False): break descIndex = dialog.select(util.localize(32185), [util.localize(32186), util.localize(32187), util.localize(32188)]) Logutil.log('descIndex: ' +str(descIndex), util.LOG_LEVEL_INFO) if(descIndex == -1): Logutil.log('No descIndex selected. Action canceled.', util.LOG_LEVEL_INFO) break romCollection.descFilePerGame = (descIndex != 1) if(descIndex == 2): #leave scraperSites empty - they will be filled in configwriter pass else: descPath = '' if(romCollection.descFilePerGame): #get path pathValue = dialog.browse(0, util.localize(32189) %console, 'files') if(pathValue == ''): break #get file mask keyboard = xbmc.Keyboard() keyboard.setHeading(util.localize(32190)) keyboard.setDefault('%GAME%.txt') keyboard.doModal() if (keyboard.isConfirmed()): filemask = keyboard.getText() descPath = util.joinPath(pathValue, filemask.strip()) else: descPath = dialog.browse(1, util.localize(32189) %console, 'files', '', False, False, lastArtworkPath) Logutil.log('descPath: ' +str(descPath), util.LOG_LEVEL_INFO) if(descPath == ''): Logutil.log('No descPath selected. Action canceled.', util.LOG_LEVEL_INFO) break parserPath = dialog.browse(1, util.localize(32191) %console, 'files', '', False, False, descPath) Logutil.log('parserPath: ' +str(parserPath), util.LOG_LEVEL_INFO) if(parserPath == ''): Logutil.log('No parserPath selected. Action canceled.', util.LOG_LEVEL_INFO) break #create scraper site = Site() site.name = console site.descFilePerGame = (descIndex == 0) site.searchGameByCRC = True scrapers = [] scraper = Scraper() scraper.parseInstruction = parserPath scraper.source = descPath scraper.encoding = 'iso-8859-1' scrapers.append(scraper) site.scrapers = scrapers romCollection.scraperSites = [] romCollection.scraperSites.append(site) romCollections[romCollection.id] = romCollection retValue = dialog.yesno(util.localize(32999), util.localize(32192)) if(retValue == False): break del dialog return True, romCollections
def addRomCollections(self, id, configObj, consoleList, isUpdate): romCollections = {} dialog = xbmcgui.Dialog() #scraping scenario scenarioIndex = dialog.select( util.localize(32173), [util.localize(32174), util.localize(32175)]) Logutil.log('scenarioIndex: ' + str(scenarioIndex), util.LOG_LEVEL_INFO) if (scenarioIndex == -1): del dialog Logutil.log('No scenario selected. Action canceled.', util.LOG_LEVEL_INFO) return False, romCollections autoconfig = EmulatorAutoconfig(util.getEmuAutoConfigPath()) while True: fileTypeList, errorMsg = self.buildMediaTypeList( configObj, isUpdate) romCollection = RomCollection() #console platformIndex = dialog.select(util.localize(32176), consoleList) Logutil.log('platformIndex: ' + str(platformIndex), util.LOG_LEVEL_INFO) if (platformIndex == -1): Logutil.log('No Platform selected. Action canceled.', util.LOG_LEVEL_INFO) break else: console = consoleList[platformIndex] if (console == 'Other'): keyboard = xbmc.Keyboard() keyboard.setHeading(util.localize(32177)) keyboard.doModal() if (keyboard.isConfirmed()): console = keyboard.getText() Logutil.log('Platform entered manually: ' + console, util.LOG_LEVEL_INFO) else: Logutil.log('No Platform entered. Action canceled.', util.LOG_LEVEL_INFO) break else: consoleList.remove(console) Logutil.log('selected platform: ' + console, util.LOG_LEVEL_INFO) romCollection.name = console romCollection.id = id id = id + 1 #check if we have general RetroPlayer support if (helper.isRetroPlayerSupported()): supportsRetroPlayer = True #if we have full python integration we can also check if specific platform supports RetroPlayer if (helper.retroPlayerSupportsPythonIntegration()): supportsRetroPlayer = False success, installedAddons = helper.readLibretroCores( "all", True, romCollection.name) if (success and len(installedAddons) > 0): supportsRetroPlayer = True else: success, installedAddons = helper.readLibretroCores( "uninstalled", False, romCollection.name) if (success and len(installedAddons) > 0): supportsRetroPlayer = True if (supportsRetroPlayer): retValue = dialog.yesno(util.localize(32999), util.localize(32198)) if (retValue == True): romCollection.useBuiltinEmulator = True #only ask for emulator and params if we don't use builtin emulator if (not romCollection.useBuiltinEmulator): #maybe there is autoconfig support preconfiguredEmulator = None #emulator #xbox games on xbox will be launched directly if (os.environ.get("OS", "xbox") == "xbox" and romCollection.name == 'Xbox'): romCollection.emulatorCmd = '%ROM%' Logutil.log('emuCmd set to "%ROM%" on Xbox.', util.LOG_LEVEL_INFO) #check for standalone games elif (romCollection.name == 'Linux' or romCollection.name == 'Macintosh' or romCollection.name == 'Windows'): romCollection.emulatorCmd = '"%ROM%"' Logutil.log('emuCmd set to "%ROM%" for standalone games.', util.LOG_LEVEL_INFO) else: #TODO: Windows and Linux support #xbmc.getCondVisibility('System.Platform.Windows') #xbmc.getCondVisibility('System.Platform.Linux') if (xbmc.getCondVisibility('System.Platform.Android')): Logutil.log( 'Running on Android. Trying to find emulator per autoconfig.', util.LOG_LEVEL_INFO) emulators = autoconfig.findEmulators( 'Android', romCollection.name, True) emulist = [] for emulator in emulators: if (emulator.isInstalled): emulist.append( util.localize(32202) % emulator.name) else: emulist.append(emulator.name) if (len(emulist) > 0): emuIndex = dialog.select(util.localize(32203), emulist) Logutil.log('emuIndex: ' + str(emuIndex), util.LOG_LEVEL_INFO) if (emuIndex == -1): Logutil.log('No Emulator selected.', util.LOG_LEVEL_INFO) else: preconfiguredEmulator = emulators[emuIndex] if (preconfiguredEmulator): romCollection.emulatorCmd = preconfiguredEmulator.emuCmd else: consolePath = dialog.browse( 1, util.localize(32178) % console, 'files') Logutil.log('consolePath: ' + str(consolePath), util.LOG_LEVEL_INFO) if (consolePath == ''): Logutil.log( 'No consolePath selected. Action canceled.', util.LOG_LEVEL_INFO) break romCollection.emulatorCmd = consolePath #params #on xbox we will create .cut files without params if (os.environ.get("OS", "xbox") == "xbox"): romCollection.emulatorParams = '' Logutil.log('emuParams set to "" on Xbox.', util.LOG_LEVEL_INFO) elif (romCollection.name == 'Linux' or romCollection.name == 'Macintosh' or romCollection.name == 'Windows'): romCollection.emulatorParams = '' Logutil.log('emuParams set to "" for standalone games.', util.LOG_LEVEL_INFO) else: defaultParams = '"%ROM%"' if (preconfiguredEmulator): defaultParams = preconfiguredEmulator.emuParams keyboard = xbmc.Keyboard() keyboard.setDefault(defaultParams) keyboard.setHeading(util.localize(32179)) keyboard.doModal() if (keyboard.isConfirmed()): emuParams = keyboard.getText() Logutil.log('emuParams: ' + str(emuParams), util.LOG_LEVEL_INFO) else: Logutil.log('No emuParams selected. Action canceled.', util.LOG_LEVEL_INFO) break romCollection.emulatorParams = emuParams #roms romPath = dialog.browse(0, util.localize(32180) % console, 'files') if (romPath == ''): Logutil.log('No romPath selected. Action canceled.', util.LOG_LEVEL_INFO) break #TODO: find out how to deal with non-ascii characters try: unicode(romPath) except: Logutil.log( "RCB can't acces your Rom Path. Make sure it does not contain any non-ascii characters.", util.LOG_LEVEL_INFO) xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32041), errorMsg) break #filemask #xbox games always use default.xbe as executable if (os.environ.get("OS", "xbox") == "xbox" and romCollection.name == 'Xbox'): Logutil.log('filemask "default.xbe" for Xbox games on Xbox.', util.LOG_LEVEL_INFO) romPathComplete = util.joinPath(romPath, 'default.xbe') romCollection.romPaths = [] romCollection.romPaths.append(romPathComplete) else: keyboard = xbmc.Keyboard() keyboard.setHeading(util.localize(32181)) keyboard.doModal() if (keyboard.isConfirmed()): fileMaskInput = keyboard.getText() Logutil.log('fileMask: ' + str(fileMaskInput), util.LOG_LEVEL_INFO) fileMasks = fileMaskInput.split(',') romCollection.romPaths = [] for fileMask in fileMasks: romPathComplete = util.joinPath( romPath, fileMask.strip()) romCollection.romPaths.append(romPathComplete) else: Logutil.log('No fileMask selected. Action canceled.', util.LOG_LEVEL_INFO) break if (os.environ.get("OS", "xbox") == "xbox"): romCollection.xboxCreateShortcut = True romCollection.xboxCreateShortcutAddRomfile = True romCollection.xboxCreateShortcutUseShortGamename = False #TODO use flags for complete platform list (not only xbox) if (romCollection.name == 'Xbox'): romCollection.useFoldernameAsGamename = True romCollection.searchGameByCRC = False romCollection.maxFolderDepth = 1 if (scenarioIndex == 0): artworkPath = dialog.browse(0, util.localize(32193) % console, 'files', '', False, False, romPath) Logutil.log('artworkPath: ' + str(artworkPath), util.LOG_LEVEL_INFO) #TODO: find out how to deal with non-ascii characters try: unicode(artworkPath) except: Logutil.log( "RCB can't acces your artwork path. Make sure it does not contain any non-ascii characters.", util.LOG_LEVEL_INFO) xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32042), errorMsg) break if (artworkPath == ''): Logutil.log('No artworkPath selected. Action canceled.', util.LOG_LEVEL_INFO) break romCollection.descFilePerGame = True #mediaPaths romCollection.mediaPaths = [] if (romCollection.name == 'MAME'): romCollection.mediaPaths.append( self.createMediaPath('boxfront', artworkPath, scenarioIndex)) romCollection.mediaPaths.append( self.createMediaPath('action', artworkPath, scenarioIndex)) romCollection.mediaPaths.append( self.createMediaPath('title', artworkPath, scenarioIndex)) romCollection.mediaPaths.append( self.createMediaPath('cabinet', artworkPath, scenarioIndex)) romCollection.mediaPaths.append( self.createMediaPath('marquee', artworkPath, scenarioIndex)) else: romCollection.mediaPaths.append( self.createMediaPath('boxfront', artworkPath, scenarioIndex)) romCollection.mediaPaths.append( self.createMediaPath('boxback', artworkPath, scenarioIndex)) romCollection.mediaPaths.append( self.createMediaPath('cartridge', artworkPath, scenarioIndex)) romCollection.mediaPaths.append( self.createMediaPath('screenshot', artworkPath, scenarioIndex)) romCollection.mediaPaths.append( self.createMediaPath('fanart', artworkPath, scenarioIndex)) #other MAME specific properties if (romCollection.name == 'MAME'): romCollection.imagePlacingMain = ImagePlacing() romCollection.imagePlacingMain.name = 'gameinfomamecabinet' #MAME zip files contain several files but they must be passed to the emu as zip file romCollection.doNotExtractZipFiles = True #create MAWS scraper site = Site() site.name = 'maws.mameworld.info' scrapers = [] scraper = Scraper() scraper.parseInstruction = '06 - maws.xml' scraper.source = 'http://maws.mameworld.info/maws/romset/%GAME%' scrapers.append(scraper) site.scrapers = scrapers romCollection.scraperSites = [] romCollection.scraperSites.append(site) else: if (romCollection.name == 'MAME'): romCollection.imagePlacingMain = ImagePlacing() romCollection.imagePlacingMain.name = 'gameinfomamecabinet' #MAME zip files contain several files but they must be passed to the emu as zip file romCollection.doNotExtractZipFiles = True romCollection.mediaPaths = [] lastArtworkPath = '' while True: fileTypeIndex = dialog.select(util.localize(32183), fileTypeList) Logutil.log('fileTypeIndex: ' + str(fileTypeIndex), util.LOG_LEVEL_INFO) if (fileTypeIndex == -1): Logutil.log('No fileTypeIndex selected.', util.LOG_LEVEL_INFO) break fileType = fileTypeList[fileTypeIndex] fileTypeList.remove(fileType) if (lastArtworkPath == ''): artworkPath = dialog.browse( 0, util.localize(32182) % (console, fileType), 'files', '', False, False, romPath) else: artworkPath = dialog.browse( 0, util.localize(32182) % (console, fileType), 'files', '', False, False, lastArtworkPath) try: unicode(artworkPath) except: Logutil.log( "RCB can't acces your artwork path. Make sure it does not contain any non-ascii characters.", util.LOG_LEVEL_INFO) xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32042), errorMsg) break lastArtworkPath = artworkPath Logutil.log('artworkPath: ' + str(artworkPath), util.LOG_LEVEL_INFO) if (artworkPath == ''): Logutil.log('No artworkPath selected.', util.LOG_LEVEL_INFO) break romCollection.mediaPaths.append( self.createMediaPath(fileType, artworkPath, scenarioIndex)) retValue = dialog.yesno(util.localize(32999), util.localize(32184)) if (retValue == False): break descIndex = dialog.select(util.localize(32185), [ util.localize(32186), util.localize(32187), util.localize(32188) ]) Logutil.log('descIndex: ' + str(descIndex), util.LOG_LEVEL_INFO) if (descIndex == -1): Logutil.log('No descIndex selected. Action canceled.', util.LOG_LEVEL_INFO) break romCollection.descFilePerGame = (descIndex != 1) if (descIndex == 2): #leave scraperSites empty - they will be filled in configwriter pass else: descPath = '' if (romCollection.descFilePerGame): #get path pathValue = dialog.browse( 0, util.localize(32189) % console, 'files') if (pathValue == ''): break #get file mask keyboard = xbmc.Keyboard() keyboard.setHeading(util.localize(32190)) keyboard.setDefault('%GAME%.txt') keyboard.doModal() if (keyboard.isConfirmed()): filemask = keyboard.getText() descPath = util.joinPath(pathValue, filemask.strip()) else: descPath = dialog.browse( 1, util.localize(32189) % console, 'files', '', False, False, lastArtworkPath) Logutil.log('descPath: ' + str(descPath), util.LOG_LEVEL_INFO) if (descPath == ''): Logutil.log('No descPath selected. Action canceled.', util.LOG_LEVEL_INFO) break parserPath = dialog.browse(1, util.localize(32191) % console, 'files', '', False, False, descPath) Logutil.log('parserPath: ' + str(parserPath), util.LOG_LEVEL_INFO) if (parserPath == ''): Logutil.log('No parserPath selected. Action canceled.', util.LOG_LEVEL_INFO) break #create scraper site = Site() site.name = console site.descFilePerGame = (descIndex == 0) site.searchGameByCRC = True scrapers = [] scraper = Scraper() scraper.parseInstruction = parserPath scraper.source = descPath scraper.encoding = 'iso-8859-1' scrapers.append(scraper) site.scrapers = scrapers romCollection.scraperSites = [] romCollection.scraperSites.append(site) romCollections[romCollection.id] = romCollection retValue = dialog.yesno(util.localize(32999), util.localize(32192)) if (retValue == False): break del dialog return True, romCollections
def addRomCollections(self, rcId, configObj, consoleList, isUpdate): romCollections = {} dialog = xbmcgui.Dialog() # Scraping scenario - game descriptions and artwork retrieved from online or available locally scenarioIndex = dialog.select( util.localize(32173), [util.localize(32174), util.localize(32175), util.localize(32207)]) log.info("scenarioIndex: " + str(scenarioIndex)) if scenarioIndex == -1: del dialog log.info("No scenario selected. Action canceled.") return False, romCollections autoconfig = EmulatorAutoconfig(util.getEmuAutoConfigPath()) while True: fileTypeList, errorMsg = self.buildMediaTypeList( configObj, isUpdate) romCollection = RomCollection() if (errorMsg): log.warn("Error building Media Type List: {0}" % errorMsg) break # Console platformIndex = dialog.select(util.localize(32176), consoleList) log.info("platformIndex: " + str(platformIndex)) if platformIndex == -1: log.info("No Platform selected. Action canceled.") break console = consoleList[platformIndex] if console == 'Other': console = self.promptOtherConsoleName() if console == '': break else: consoleList.remove(console) log.info("Selected platform: " + console) romCollection.name = console romCollection.id = rcId rcId = rcId + 1 # Check if we have general RetroPlayer support if helper.isRetroPlayerSupported(): #32198 = Use RetroPlayer to launch games? romCollection.useBuiltinEmulator = bool( dialog.yesno(util.SCRIPTNAME, util.localize(32198))) # Only ask for emulator and params if we don't use builtin emulator if not romCollection.useBuiltinEmulator: # Maybe there is autoconfig support preconfiguredEmulator = None # Emulator if romCollection.name in ['Linux', 'Macintosh', 'Windows']: # Check for standalone games romCollection.emulatorCmd = '"%ROM%"' log.info("emuCmd set to '%ROM%' for standalone games.") else: emulist = [] log.info( u'Running on {0}. Trying to find emulator per autoconfig.' .format(util.current_os)) emulators = autoconfig.findEmulators( util.current_os, romCollection.name, True) for emulator in emulators: if emulator.isInstalled: emulist.append( util.localize(32202) % emulator.name) else: emulist.append(emulator.name) # Ask the user which one they want if len(emulist) > 0: try: emuIndex = dialog.select(util.localize(32203), emulist) if emuIndex >= 0: preconfiguredEmulator = emulators[emuIndex] except IndexError: log.info("No Emulator selected.") preconfiguredEmulator = None if preconfiguredEmulator: romCollection.emulatorCmd = preconfiguredEmulator.emuCmd else: consolePath = dialog.browse( 1, util.localize(32178) % console, 'files') Logutil.log('consolePath: ' + str(consolePath), util.LOG_LEVEL_INFO) if consolePath == '': log.info( "No consolePath selected. Action canceled.") break romCollection.emulatorCmd = consolePath # Set emulator parameters if romCollection.name in ['Linux', 'Macintosh', 'Windows']: romCollection.emulatorParams = '' log.info("emuParams set to " " for standalone games.") else: if preconfiguredEmulator: defaultParams = preconfiguredEmulator.emuParams else: defaultParams = '"%ROM%"' romCollection.emulatorParams = self.promptEmulatorParams( defaultParams) # Prompt for rompath romPath = self.promptRomPath(console) if romPath == '': log.info("No romPath selected. Action canceled.") break # Filemask fileMasks = self.promptEmulatorFileMasks() if fileMasks == []: break romCollection.romPaths = [] for fileMask in fileMasks: romCollection.romPaths.append( util.joinPath(romPath, fileMask.strip())) # Specific MAME settings if romCollection.name == 'MAME': romCollection.imagePlacingMain = ImagePlacing() romCollection.imagePlacingMain.name = 'gameinfomamecabinet' # MAME zip files contain several files but they must be passed to the emu as zip file romCollection.doNotExtractZipFiles = True if scenarioIndex == RETRIEVE_INFO_ONLINE_ARTWORK_ONLINE: # Prompt for artwork path artworkPath = self.promptArtworkPath(console, romPath) if artworkPath == '': log.info("No artworkPath selected. Action canceled.") break romCollection.descFilePerGame = True # Media Paths romCollection.mediaPaths = [] if romCollection.name == 'MAME': mediaTypes = [ 'boxfront', 'action', 'title', 'cabinet', 'marquee', 'clearlogo', 'gameplay' ] else: mediaTypes = [ 'boxfront', 'boxback', 'cartridge', 'screenshot', 'fanart', 'clearlogo', 'gameplay' ] for t in mediaTypes: romCollection.mediaPaths.append( self.createMediaPath(t, artworkPath, scenarioIndex)) else: romCollection.mediaPaths = [] # Default to looking in the romPath for the first artwork path lastArtworkPath = romPath while True: # Prompt the user for which artwork type we are selecting fileTypeIndex = dialog.select(util.localize(32183), fileTypeList) if fileTypeIndex == -1: log.info("No fileTypeIndex selected.") break fileType = fileTypeList[fileTypeIndex] fileTypeList.remove(fileType) # Prompt user for path for existing artwork artworkPath = util.convertToUnicodeString( dialog.browse( 0, util.localize(32182) % (console, fileType), 'files', '', False, False, lastArtworkPath)) log.debug(u"artworkPath selected: {0}".format(artworkPath)) if artworkPath == '': log.info("No artworkPath selected.") break lastArtworkPath = artworkPath romCollection.mediaPaths.append( self.createMediaPath(fileType, artworkPath, scenarioIndex)) # Ask to add another artwork path #32184 = Do you want to add another Artwork Path? if not dialog.yesno(util.SCRIPTNAME, util.localize(32184)): break #not used atm as we don't have any offline scrapers with descfile per game """ # Ask user for source of game descriptions (description file per game or for all games) descIndex = dialog.select(util.localize(32185), [util.localize(32186), util.localize(32187)]) log.debug("descIndex: " + str(descIndex)) if descIndex == -1: log.info("No descIndex selected. Action canceled.") break romCollection.descFilePerGame = (descIndex != GAME_DESCRIPTION_SINGLE_FILE) """ if scenarioIndex == RETRIEVE_INFO_LOCAL_ARTWORK_LOCAL: offline_scrapers = AbstractScraper( ).get_available_offline_scrapers(console) scraperIndex = dialog.select(util.localize(32206), offline_scrapers) if scraperIndex == -1: log.info("No Scraper type selected. Action canceled.") break selectedscraper = offline_scrapers[scraperIndex] log.info("Selected scraper = {0}".format(selectedscraper)) #not used atm as we don't have any offline scrapers with descfile per game """ if romCollection.descFilePerGame: # Assume the files are in a single directory with the mask %GAME%.txt # Prompt the user for the path pathValue = dialog.browse(0, util.localize(32189) % console, 'files') if pathValue == '': break # Prompt the user for the description file mask filemask = xbmcgui.Dialog().input(util.localize(32190), defaultt='%GAME%.xml', type=xbmcgui.INPUT_ALPHANUM) descPath = util.joinPath(pathValue, filemask.strip()) else: """ descPath = dialog.browse(1, util.localize(32189) % console, 'files', '', False, False, lastArtworkPath) log.info("descPath: " + str(descPath)) if descPath == '': log.info("No descPath selected. Action canceled.") break # Create scraper site = Site(name=selectedscraper, path=descPath, default=True) romCollection.scraperSites = [site] log.debug("Created new rom collection: {0}".format(romCollection)) romCollections[romCollection.id] = romCollection # Ask the user if they want to add another rom collection #32192 = Do you want to add another Rom Collection? if not dialog.yesno(util.SCRIPTNAME, util.localize(32192)): break del dialog return True, romCollections
def onClick(self, controlID): if controlID == 5101: # Close window button self.close() elif controlID == 5110: # Import games self.close() self.gui.updateDB() elif controlID == 5121: # Rescrape single games self.close() if self.selectedGame is None: xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32013), util.localize(32014)) return romCollectionId = self.selectedGame.getProperty('romCollectionId') romCollection = self.gui.config.romCollections[str(romCollectionId)] files = File(self.gui.gdb).getRomsByGameId(self.selectedGame.getProperty('gameId')) filename = files[0][0] romCollection.romPaths = (filename,) romCollections = {} romCollections[romCollection.id] = romCollection self.gui.rescrapeGames(romCollections) elif controlID == 5122: # Rescrape selection self.close() romCollections = {} listSize = self.gui.getListSize() for i in range(0, listSize): listItem = self.gui.getListItem(i) romCollectionId = listItem.getProperty('romCollectionId') try: romCollection = romCollections[str(romCollectionId)] except: romCollection = self.gui.config.romCollections[str(romCollectionId)] romCollection.romPaths = [] files = File(self.gui.gdb).getRomsByGameId(listItem.getProperty('gameId')) try: filename = files[0][0] romCollection.romPaths.append(filename) romCollections[romCollection.id] = romCollection except: log.info("Error getting filename for romCollectionId: {0}".format(romCollectionId)) self.gui.rescrapeGames(romCollections) #self.gui.updateDB() elif controlID == 5111: # Add Rom Collection self.close() statusOk, errorMsg = wizardconfigxml.ConfigXmlWizard().addRomCollection(self.gui.config) if statusOk is False: xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32001), errorMsg) log.info("Error updating config.xml: {0}".format(errorMsg)) return #update self.config statusOk, errorMsg = self.gui.config.readXml() if statusOk is False: xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32002), errorMsg) log.info("Error reading config.xml: {0}".format(errorMsg)) return #import Games self.gui.updateDB() elif controlID == 5112: # Edit Rom Collection self.close() constructorParam = "720p" editRCdialog = dialogeditromcollection.EditRomCollectionDialog("script-RCB-editromcollection.xml", util.getAddonInstallPath(), util.getConfiguredSkin(), constructorParam, gui=self.gui) del editRCdialog self.gui.config = Config(None) self.gui.config.readXml() elif controlID == 5113: # Edit Game Command self.close() if(self.selectedGame == None): xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32015), util.localize(32014)) return origCommand = self.selectedGame.getProperty('gameCmd') command = xbmcgui.Dialog().input(util.localize(32135), defaultt=origCommand, type=xbmcgui.INPUT_ALPHANUM) if command != origCommand: log.info("Updating game '{0}' with command '{1}'".format(self.selectedGame.getLabel(), command)) Game(self.gui.gdb).update(('gameCmd',), (command,), self.selectedGame.getProperty('gameId'), True) self.gui.gdb.commit() elif controlID == 5118: # (Un)Mark as Favorite self.close() if self.selectedGame is None: xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32016), util.localize(32014)) return isFavorite = '1' if self.selectedGame.getProperty('isfavorite') == '1': isFavorite = '0' log.info("Updating game '{0}' set isFavorite = {1}".format(self.selectedGame.getLabel(), isFavorite)) Game(self.gui.gdb).update(('isfavorite',), (isFavorite,), self.selectedGame.getProperty('gameId'), True) self.gui.gdb.commit() if isFavorite == '0': isFavorite = '' self.selectedGame.setProperty('isfavorite', str(isFavorite)) elif controlID == 5119: # (Un)Mark as Favorite self.close() if self.selectedGame is None: xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32016), util.localize(32014)) return isFavorite = '1' if self.selectedGame.getProperty('isfavorite') == '1': isFavorite = '0' listSize = self.gui.getListSize() for i in range(0, listSize): listItem = self.gui.getListItem(i) log.info("Updating game '{0}' set isfavorite = {1}".format(listItem.getLabel(), isFavorite)) Game(self.gui.gdb).update(('isfavorite',), (isFavorite,), listItem.getProperty('gameId'), True) listItem.setProperty('isfavorite', str(isFavorite)) self.gui.gdb.commit() #HACK: removing favorites does not update the UI. So do it manually. if isFavorite == 0: self.gui.loadViewState() elif controlID == 5120: # Export nfo files self.close() nfowriter.NfoWriter().exportLibrary(self.gui.gdb, self.gui.config.romCollections) elif controlID == 5114: # Delete Rom self.close() pos = self.gui.getCurrentListPosition() if pos == -1: xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32017), util.localize(32018)) return dialog = xbmcgui.Dialog() if dialog.yesno(util.localize(32510), util.localize(32136)): gameID = self.selectedGame.getProperty('gameId') self.gui.deleteGame(gameID) self.gui.showGames() if pos > 0: pos = pos - 1 self.gui.setFilterSelection(self.gui.CONTROL_GAMES_GROUP_START, pos) else: self.gui.setFilterSelection(self.gui.CONTROL_GAMES_GROUP_START, 0) elif controlID == 5115: # Remove Rom Collection self.close() constructorParam = "720p" removeRCDialog = dialogdeleteromcollection.RemoveRCDialog("script-RCB-removeRC.xml", util.getAddonInstallPath(), util.getConfiguredSkin(), constructorParam, gui=self.gui) rDelStat = removeRCDialog.getDeleteStatus() if rDelStat: selectedRCId = removeRCDialog.getSelectedRCId() rcDelStat = removeRCDialog.getRCDeleteStatus() self.gui.deleteRCGames(selectedRCId, rcDelStat, rDelStat) del removeRCDialog elif controlID == 5116: # Clean DB self.close() self.gui.cleanDB() elif controlID == 5223: # Open Settings self.close() self.gui.Settings.openSettings() elif controlID == 5224: # Set gameclient self.close() if not helper.isRetroPlayerSupported(): log.info("This RetroPlayer branch does not support selecting gameclients.") return if self.selectedGame is None or self.gameRow is None: xbmcgui.Dialog().ok(util.SCRIPTNAME, util.localize(32015), util.localize(32014)) return #HACK: use alternateGameCmd to store gameclient information origGameClient = self.selectedGame.getProperty('alternateGameCmd') gameclient = '' romCollectionId = self.selectedGame.getProperty('romCollectionId') romCollection = self.gui.config.romCollections[str(romCollectionId)] success, selectedcore = helper.selectlibretrocore(romCollection.name) if success: gameclient = selectedcore else: log.info("No libretro core was chosen. Won't update game command.") return if gameclient != origGameClient: log.info("Updating game '{0}' with gameclient '{1}'".format(self.selectedGame.getLabel(), gameclient)) Game(self.gui.gdb).update(('alternateGameCmd',), (gameclient,), self.selectedGame.getProperty('gameId'), True) self.gui.gdb.commit()