Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if(self.releaseId):
personRole = PersonRole()
if(self.role != ''):
personRole.name = self.role
personRole.insert(gdb, allowUpdate)
#TODO: handle persons without role
#insert link between release, person and role
linkReleasePersonRole = LinkReleasePersonRole()
linkReleasePersonRole.releaseId = self.releaseId
linkReleasePersonRole.personId = self.id
linkReleasePersonRole.roleId = personRole.id
linkReleasePersonRole.insert(gdb, allowUpdate)
for fileTypeName in self.mediaFiles.keys():
fileType = FileType()
fileType.name = fileTypeName
fileType.insert(gdb)
file = File()
file.name = self.mediaFiles[fileTypeName]
file.parentId = self.id
file.fileTypeId = fileType.id
file.insert(gdb)
def getCachedFiles(gdb, fileType, parentId, fileDict):
Logutil.log("File.getCachedFiles", util.LOG_LEVEL_DEBUG)
Logutil.log("fileType: %s" %str(fileType), util.LOG_LEVEL_DEBUG)
fileType = FileType.getCachedFileType(gdb, fileType)
if(parentId == None or fileType == None):
return None
key = '%i;%i' %(parentId, int(fileType.id))
try:
files = fileDict[key]
except:
files = None
if(files == None):
Logutil.log("file == None in getCachedFiles", util.LOG_LEVEL_DEBUG)
return files
def insert(self, gdb, allowUpdate):
if(self.name == ''):
return
obj = Company.getCompanyByName(gdb, self.name)
if(obj.id):
self.id = obj.id
if(allowUpdate):
self.updateAllColumns(gdb, False)
else:
self.id = DataBaseObject.insert(gdb, self)
for fileTypeName in self.mediaFiles.keys():
fileType = FileType()
fileType.name = fileTypeName
fileType.insert(gdb)
file = File()
file.name = self.mediaFiles[fileTypeName]
file.parentId = self.id
file.fileTypeId = fileType.id
file.insert(gdb)
self.yearId = year.id
#store self
if(self.id):
if(allowUpdate):
self.updateAllColumns(gdb, False)
else:
self.id = DataBaseObject.insert(gdb, self)
#store children that require releaseId
for person in self.persons:
person.releaseId = self.id
person.insert(gdb, allowUpdate)
for fileTypeName in self.mediaFiles.keys():
fileType = FileType()
fileType.name = fileTypeName
fileType.insert(gdb)
file = File()
file.name = self.mediaFiles[fileTypeName]
file.parentId = self.id
file.fileTypeId = fileType.id
file.insert(gdb)
def insert(self, gdb, allowUpdate):
if(self.name == ''):
return
platform = Platform.getPlatformByName(gdb, self.name)
if(platform.id):
self.id = platform.id
if(allowUpdate):
self.updateAllColumns(gdb, False)
else:
self.id = DataBaseObject.insert(gdb, self)
for fileTypeName in self.mediaFiles.keys():
fileType = FileType()
fileType.name = fileTypeName
fileType.insert(gdb)
file = File()
file.name = self.mediaFiles[fileTypeName]
file.parentId = self.id
file.fileTypeId = fileType.id
file.insert(gdb)
def getFileDictForGamelist(gdb):
# 0 = cacheAll
if(File.fileDictForGameList != None):
return File.fileDictForGameList
else:
#TODO: get list of file types
fileType = FileType.getCachedFileType(gdb, 'boxfront')
files = File.getFilesForGamelist(gdb, (str(fileType.id),))
if(files == None):
Logutil.log("fileRows == None in getFileDictForGamelist", util.LOG_LEVEL_WARNING)
return None
File.fileDictForGameList = File.cacheFiles(files)
return File.fileDictForGameList