def addRomCollection(self, configObj): Logutil.log("Begin addRomCollection", util.LOG_LEVEL_INFO) consoleList = sorted(WebScraper().consoleDict.keys()) new_id = 1 rcIds = configObj.romCollections.keys() rcIds.sort() #read existing rom collection ids and names for rcId in rcIds: #remove already configured consoles from the list if configObj.romCollections[rcId].name in consoleList: consoleList.remove(configObj.romCollections[rcId].name) #find highest id if int(rcId) > int(new_id): new_id = rcId new_id = int(new_id) + 1 # Add new rom collections success, romCollections = self.addRomCollections(new_id, configObj, consoleList, True) if not success: log.info("Action canceled. Config.xml will not be written") return False, util.localize(32172) # Update config file configWriter = ConfigXmlWriter(False) success, message = configWriter.writeRomCollections(romCollections, False) #create artwork directories for all rom collections helper.createArtworkDirectories(romCollections) log.info("End addRomCollection") return success, message
def createConfigXml(self, configFile): rcId = 1 #FIXME TODO move console dict to correct place consoleList = sorted(WebScraper().consoleDict.keys()) success, romCollections = self.addRomCollections(rcId, None, consoleList, False) if(not success): log.info("Action canceled. Config.xml will not be written") return False, util.localize(32172) configWriter = ConfigXmlWriter(True) success, message = configWriter.writeRomCollections(romCollections, False) return success, message