示例#1
0
 def __init__(self, url, parent=None):
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     
     self.connect(self.pushButtonSpeichern, QtCore.SIGNAL("clicked()"), self.accept)
     self.connect(self.pushButtonAnzeigen, QtCore.SIGNAL("clicked()"), self.anzeigen)
     self.connect(self.pushButtonLoeschen, QtCore.SIGNAL("clicked()"), self.loeschen)
     
     self.url = url
     
     zu_lesen = "SELECT * FROM pordb_bookmarks ORDER BY z"
     lese_func = DBLesen(self, zu_lesen)
     res = DBLesen.get_data(lese_func)
     row = 0
     self.tableWidgetBookmarks.clearContents()
     self.tableWidgetBookmarks.setRowCount(len(res))
     self.tableWidgetBookmarks.setColumnCount(2)
     for i in res:
         column = 0
         for j in i:
             newitem = QtGui.QTableWidgetItem(str(j))
             self.tableWidgetBookmarks.setItem(row, column, newitem)
             column += 1
         row += 1
     self.tableWidgetBookmarks.setAlternatingRowColors(True)
     self.tableWidgetBookmarks.resizeColumnsToContents()
     self.tableWidgetBookmarks.resizeRowsToContents()
示例#2
0
	def __init__(self, comboBoxNation, nation_fuellen, parent=None):
		QtGui.QDialog.__init__(self)
		self.setupUi(self)
		
		self.connect(self.pushButtonLandSpeichern, QtCore.SIGNAL("clicked()"), self.onSpeichern)
		self.connect(self.pushButtonLandAbbrechen, QtCore.SIGNAL("clicked()"), self.close)
		
		self.nation_fuellen = nation_fuellen
		
		zu_lesen = "select * from pordb_iso_land order by land"
		lese_func = DBLesen(self, zu_lesen)
		res = DBLesen.get_data(lese_func)
		row = 0
		self.tableWidgetLaender.clear()
		self.tableWidgetLaender.setRowCount(len(res) + 1)
		for i in res:
			column = 0
			for j in i:
				if j:
					newitem = QtGui.QTableWidgetItem(j.strip())
				else:
					newitem = QtGui.QTableWidgetItem(" ")
				self.tableWidgetLaender.setItem(row, column, newitem)
				column += 1
			row += 1
		self.tableWidgetLaender.setHorizontalHeaderLabels(["ISO Code", self.trUtf8("Country"), self.trUtf8("active"), self.trUtf8("Nationality")])
		self.tableWidgetLaender.setAlternatingRowColors(True)
		self.tableWidgetLaender.resizeColumnsToContents()
		self.tableWidgetLaender.resizeRowsToContents()
示例#3
0
 def __init__(self, parent=None):
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     
     self.maximum = QtCore.QDate.currentDate()
     self.minimum = QtCore.QDate.fromString("20000101", "yyyyMMdd")
     self.dateEditDarstellerSucheAb.setDateRange(self.minimum, self.maximum)
     self.dateEditDarstellerSucheBis.setDateRange(self.minimum, self.maximum)
     self.dateEditDarstellerSucheBis.setDate(self.maximum)
     
     self.connect(self.pushButtonSuchen, QtCore.SIGNAL("clicked()"), self.accept)
     self.connect(self.pushButtonCancel, QtCore.SIGNAL("clicked()"), self.close)
     self.connect(self.pushButtonRefresh, QtCore.SIGNAL("clicked()"), self.onRefresh)
     
     # Combobox für Nation füllen
     zu_lesen = "SELECT * FROM pordb_iso_land WHERE aktiv = %s ORDER BY land"
     lese_func = DBLesen(self, zu_lesen, "x")
     res = DBLesen.get_data(lese_func)
     self.comboBoxDarstellerSucheNation.addItem("")
     for i in res:
         text = '%2s %-50s' % (i[0], i[1])
         bild = os.path.join(os.curdir, "pypordb", i[0] + ".svg")
         icon = QtGui.QIcon()
         icon.addFile(bild, QtCore.QSize(16, 16), QtGui.QIcon.Normal, QtGui.QIcon.Off)
         self.comboBoxDarstellerSucheNation.addItem(icon, text)
示例#4
0
 def darsteller_sortieren(self, darsteller):
     darsteller_m = []
     darsteller_w = []
     defekt_schalter = False
     for i in darsteller:
         if i:
             if i == "Defekt":
                 defekt_schalter = True
             zu_lesen = "SELECT sex FROM pordb_darsteller WHERE darsteller = %s"
             self.lese_func = DBLesen(self, zu_lesen, i.strip().replace("''''", "''").title()) # 2nd replace when coming from actor renaming function
             res = DBLesen.get_data(self.lese_func)
             try:
                 sex = res[0][0]
                 try:
                     if sex == "w":
                         darsteller_w.append(i.strip().title())
                     else:
                         darsteller_m.append(i.strip().title())
                 except:
                     pass
             except:
                 pass
     darsteller_w.sort()
     darsteller_m.sort()
     darsteller_liste = darsteller_w + darsteller_m
     if defekt_schalter:
         darsteller_liste.append("Defekt")
     return darsteller_liste
示例#5
0
	def __init__(self, parent=None):
		QtGui.QDialog.__init__(self)
		self.setupUi(self)
		
		self.connect(self.pushButtonLandSpeichern, QtCore.SIGNAL("clicked()"), self.onSpeichern)
		self.connect(self.pushButtonLandAbbrechen, QtCore.SIGNAL("clicked()"), self.close)
		
		zu_lesen = "select * from pordb_suchbegriffe order by suchbegriff"
		lese_func = DBLesen(self, zu_lesen)
		res = DBLesen.get_data(lese_func)
		row = 0
		self.tableWidgetSuche.clear()
		self.tableWidgetSuche.setRowCount(len(res) + 2)
		for i in res:
			column = 0
			for j in i:
				if j:
					newitem = QtGui.QTableWidgetItem(j.strip())
				else:
					newitem = QtGui.QTableWidgetItem(" ")
				self.tableWidgetSuche.setItem(row, column, newitem)
				column += 1
			row += 1
		self.tableWidgetSuche.setHorizontalHeaderLabels([self.trUtf8("Search terms"), self.trUtf8("Alternative")])
		self.tableWidgetSuche.setAlternatingRowColors(True)
		self.tableWidgetSuche.resizeColumnsToContents()
		self.tableWidgetSuche.resizeRowsToContents()
 def pseudo_uebernehmen(self, name, zu_erfassen):
     pseudos = str(self.lineEditPseudo.text()).title().split(", ")
     pseudos = set(pseudos)
     for i in pseudos:
         if i and i.strip() != name.title().strip():
             res = []
             zu_lesen = "SELECT darsteller FROM pordb_darsteller WHERE darsteller = %s"
             self.lese_func = DBLesen(self, zu_lesen, i.strip().title())
             res = DBLesen.get_data(self.lese_func)
             if res:
                 messageBox = QtGui.QMessageBox()
                 messageBox.addButton(self.trUtf8("Yes"), QtGui.QMessageBox.AcceptRole)
                 messageBox.addButton(self.trUtf8("No"), QtGui.QMessageBox.RejectRole)
                 messageBox.setWindowTitle(i.strip().replace("'", "''").title() +self.trUtf8(": There is another actor in the database with this name."))
                 messageBox.setIcon(QtGui.QMessageBox.Question)
                 messageBox.setText(self.trUtf8("Do you want to add/change the actor anyway?"))
                 message = messageBox.exec_()
                 if message != 0:
                     return False
             checkpseudo = CheckPseudos(i.strip().title(), name.strip().title())
             check = CheckPseudos.check(checkpseudo)
             werte = []
             werte.append(i.strip().title())
             werte.append(name.strip().title())
             befehl = "INSERT INTO pordb_pseudo (pseudo, darsteller) VALUES (%s, %s)"
             if check and befehl not in zu_erfassen:
                 zu_erfassen.append([befehl, werte])
     return True
示例#7
0
	def darsteller_sortieren(self, darsteller):
		darsteller_m = []
		darsteller_w = []
		defekt_schalter = False
		for i in darsteller:
			if i:
				if i == "Defekt":
					defekt_schalter = True
				zu_lesen = "select sex from pordb_darsteller where darsteller = '" + i.strip().replace("'", "''").title() + "'"
				# When coming from actor renaming function
				zu_lesen = zu_lesen.replace("''''", "''")
				self.lese_func = DBLesen(self, zu_lesen)
				res = DBLesen.get_data(self.lese_func)
				try:
					sex = res[0][0]
					try:
						if sex == "w":
							darsteller_w.append(i.strip().title())
						else:
							darsteller_m.append(i.strip().title())
					except:
						pass
				except:
					pass
		darsteller_w.sort()
		darsteller_m.sort()
		darsteller_liste = darsteller_w + darsteller_m
		if defekt_schalter:
			darsteller_liste.append("Defekt")
		return darsteller_liste
示例#8
0
 def __init__(self, device_fuellen, parent=None):
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     
     self.connect(self.pushButtonSpeichern, QtCore.SIGNAL("clicked()"), self.accept)
     self.connect(self.pushButtonAbbrechen, QtCore.SIGNAL("clicked()"), self.close)
     
     self.device_fuellen = device_fuellen
     
     zu_lesen = "SELECT * FROM pordb_mpg_verzeichnisse ORDER BY dir"
     lese_func = DBLesen(self, zu_lesen)
     res = DBLesen.get_data(lese_func)
     row = 0
     self.tableWidget.clear()
     self.tableWidget.setRowCount(len(res) + 1)
     for i in res:
         column = 0
         for j in i:
             if j:
                 newitem = QtGui.QTableWidgetItem(j.strip())
             else:
                 newitem = QtGui.QTableWidgetItem(" ")
             self.tableWidget.setItem(row, column, newitem)
         row += 1
     newitem = QtGui.QTableWidgetItem("")
     self.tableWidget.setItem(row, 0, newitem)
     self.tableWidget.setCurrentItem(newitem)
     self.tableWidget.setFocus()
     self.tableWidget.editItem(self.tableWidget.currentItem())            
     self.tableWidget.setHorizontalHeaderLabels([self.trUtf8("Device")])
     self.tableWidget.setAlternatingRowColors(True)
     self.tableWidget.resizeColumnsToContents()
     self.tableWidget.resizeRowsToContents()
示例#9
0
	def onCoverOriginalAlt(self):
		zu_lesen = "SELECT * FROM pordb_vid_neu"
		lese_func = DBLesen(self, zu_lesen)
		res = DBLesen.get_data(lese_func)
		if res[0][3]:
			self.lineEditDateiname.setText(res[0][3].decode("utf-8"))
		self.pushButtonCover.setFocus()
示例#10
0
 def __init__(self, parent=None):
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     
     self.connect(self.pushButtonSearch, QtCore.SIGNAL("clicked()"), self.onSearch)
     self.connect(self.pushButtonGo, QtCore.SIGNAL("clicked()"), self.onGo)
     self.connect(self.pushButtonAbbrechen, QtCore.SIGNAL("clicked()"), self.close)
     self.connect(self.pushButtonClear, QtCore.SIGNAL("clicked()"), self.onClear)
     
     self.row = 0
     self.column = 0
     self.zu_lesen = None
     self.werte = None
     self.tableWidgetHistory.setAlternatingRowColors(True)
     self.tableWidgetHistory.clearContents()
     self.lineEditSearch.setFocus()
     
     self.zu_lesen = "SELECT * FROM pordb_history ORDER BY time DESC"
     self.lese_func = DBLesen(self, self.zu_lesen)
     self.res = DBLesen.get_data(self.lese_func)
     res = DBLesen.get_data(self.lese_func)
     self.tableWidgetHistory.setRowCount(len(self.res))
     for i in self.res:
         # Checkbox
         newitem = QtGui.QTableWidgetItem()
         newitem.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable)
         newitem.setCheckState(QtCore.Qt.Unchecked)
         self.tableWidgetHistory.setItem(self.row, self.column, newitem)
         # Befehl
         self.column += 1
         newitem = QtGui.QTableWidgetItem(i[0])
         self.tableWidgetHistory.setItem(self.row, self.column, newitem)
         # Time
         self.column += 1
         newitem = QtGui.QTableWidgetItem(str(i[1]))
         self.tableWidgetHistory.setItem(self.row, self.column, newitem)
         self.column = 0
         self.row += 1
     self.tableWidgetHistory.resizeColumnsToContents()
     
     self.labelLines.setText(str(len(self.res)))
示例#11
0
 def onClear(self):
     zu_lesen = "SELECT * FROM pordb_history ORDER BY time DESC LIMIT 50"
     lese_func = DBLesen(self, zu_lesen)
     res = DBLesen.get_data(lese_func)
     if res:
         werte = []
         zu_erfassen = []
         werte.append(str(res[-1][-1]))
         zu_erfassen.append(["DELETE FROM pordb_history WHERE time < %s", werte])
         update_func = DBUpdate(self, zu_erfassen)
         DBUpdate.update_data(update_func)
         
     self.close()
	def __init__(self, darsteller, parent=None):
		QtGui.QDialog.__init__(self)
		self.setupUi(self)
		self.darsteller = darsteller
		
		self.connect(self.pushButtonDarstellerneuSpeichern, QtCore.SIGNAL("clicked()"), self.accept)
		self.connect(self.pushButtonDarstellerneuCancel, QtCore.SIGNAL("clicked()"), self.close)
		
		self.setWindowTitle(self.trUtf8("Actor ") +self.darsteller + self.trUtf8(" will be added"))
		# Combobox für Nation füllen
		zu_lesen = "select * from pordb_iso_land where aktiv = 'x' order by land"
		lese_func = DBLesen(self, zu_lesen)
		res = DBLesen.get_data(lese_func)
		for i in res:
			text = '%2s %-50s' % (i[0], i[1])
			self.comboBoxDarstellerneuNation.addItem(text)
示例#13
0
    def darsteller_addieren (self, darsteller, fehler_index):
        messageBox = QtGui.QMessageBox()
        messageBox.addButton(self.trUtf8("Yes, image exists"), QtGui.QMessageBox.AcceptRole)
        messageBox.addButton(self.trUtf8("Yes, no image"), QtGui.QMessageBox.YesRole)
        messageBox.addButton(self.trUtf8("No, correct entry"), QtGui.QMessageBox.RejectRole)
        messageBox.setWindowTitle(darsteller[fehler_index] +self.trUtf8(" does not exist"))
        messageBox.setIcon(QtGui.QMessageBox.Question)
        messageBox.setText(self.trUtf8("Do you want to add this actor?"))
        message = messageBox.exec_()
        if message == 2:
            korrekt = DarstellerKorrigieren(self.lineEditNeuDarsteller.text())
            korrekt.exec_()
            try:
                self.lineEditNeuDarsteller.setText(korrekt.darsteller)
            except:
                pass
            return

        neuer_darsteller = NeueingabeDarsteller(darsteller[fehler_index])
        neuer_darsteller.exec_()
        if message == 0:
            actor_file = False
            while not actor_file:
                self.file = QtGui.QFileDialog.getOpenFileName(self, self.trUtf8("Image of the actor ") +darsteller[fehler_index] +": " +self.trUtf8("please select one"), self.verzeichnis, self.trUtf8("Image files (*.jpg *.jpeg *.png);;all files (*.*)"))
                if self.file:
                    if self.file == self.bilddatei:
                        message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Selected image is the one which should be added to the database. Please select another one."))
                        continue
                    else:
                        bild = QtGui.QImage(self.file)
                        if bild.width() > size_darsteller.width() or bild.height() > size_darsteller.height():
                            message = QtGui.QMessageBox.warning(self, self.trUtf8("Caution! "), self.trUtf8("Image of the actor is very big"))
                        zu_lesen = "SELECT sex FROM pordb_darsteller WHERE darsteller = %s"
                        self.lese_func = DBLesen(self, zu_lesen, darsteller[fehler_index].strip())
                        res = DBLesen.get_data(self.lese_func)
                        extension = os.path.splitext(str(self.file))[-1].lower()
                        if extension == '.jpeg':
                            extension = '.jpg'
                        try:
                            sex = res[0][0]
                            newfilename = os.path.join(self.verzeichnis_thumbs, "darsteller_" + sex, darsteller[fehler_index].strip().replace(" ", "_").replace("'", "_apostroph_").lower() + extension.strip())
                            os.rename(self.file, newfilename)
                        except:
                            pass
                        actor_file = True
示例#14
0
	def darsteller_pruefen(self, darsteller_liste):
		darsteller = darsteller_liste.split(", ")
		fehler = 0
		k = -1
		for i in darsteller:
			k += 1
			if i and i <> "Defekt":
				zu_lesen = "select sex from pordb_darsteller where darsteller = '" +i.replace("'", "''").strip().title() +"'"
				self.lese_func = DBLesen(self, zu_lesen)
				res = DBLesen.get_data(self.lese_func)
				if not res:
					fehler = 1
				for j in xrange(0, k):
					if i == darsteller[j]:
						fehler = 2
						break
				if fehler:
					break
		return (darsteller, fehler, k)
示例#15
0
 def __init__(self, comboBoxNation, nation_fuellen, parent=None):
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     
     self.connect(self.pushButtonLandSpeichern, QtCore.SIGNAL("clicked()"), self.onSpeichern)
     self.connect(self.pushButtonLandAbbrechen, QtCore.SIGNAL("clicked()"), self.close)
     
     self.nation_fuellen = nation_fuellen
     
     zu_lesen = "SELECT * FROM pordb_iso_land ORDER BY land"
     lese_func = DBLesen(self, zu_lesen)
     res = DBLesen.get_data(lese_func)
     row = 0
     self.tableWidgetLaender.clear()
     self.tableWidgetLaender.setRowCount(len(res) + 1)
     for i in res:
         column = 0
         for j in i:
             if j:
                 if column == 0:
                     bild = os.path.join(os.curdir, "pypordb", i[0] + ".svg")
                     icon = QtGui.QIcon()
                     icon.addFile(bild, QtCore.QSize(24, 24), QtGui.QIcon.Normal, QtGui.QIcon.Off)
                     newitem = QtGui.QTableWidgetItem(icon, "")
                     self.tableWidgetLaender.setItem(row, column, newitem)
                     column += 1
                     newitem = QtGui.QTableWidgetItem(j.strip())
                 else:
                     newitem = QtGui.QTableWidgetItem(j.strip())
             else:
                 newitem = QtGui.QTableWidgetItem(" ")
             self.tableWidgetLaender.setItem(row, column, newitem)
             column += 1
         row += 1
     newitem = QtGui.QTableWidgetItem("")
     self.tableWidgetLaender.setItem(row, 1, newitem)
     self.tableWidgetLaender.setCurrentItem(newitem)
     self.tableWidgetLaender.setFocus()
     self.tableWidgetLaender.editItem(self.tableWidgetLaender.currentItem())          
     self.tableWidgetLaender.setHorizontalHeaderLabels([self.trUtf8("Flag"), "ISO Code", self.trUtf8("Country"), self.trUtf8("active"), self.trUtf8("Nationality")])
     self.tableWidgetLaender.setAlternatingRowColors(True)
     self.tableWidgetLaender.resizeColumnsToContents()
     self.tableWidgetLaender.resizeRowsToContents()
示例#16
0
	def __init__(self, darsteller, verzeichnis):
		QtGui.QDialog.__init__(self)
		self.setupUi(self)
		self.connect(self.pushButtonOk, QtCore.SIGNAL("clicked()"), self.close)
		
		self.darsteller = darsteller
		self.verzeichnis = verzeichnis
		
		settings = QtCore.QSettings()
		window_size = settings.value("ActorDetails/Size", QtCore.QVariant(QtCore.QSize(600, 500))).toSize()
		self.resize(window_size)
		window_position = settings.value("ActorDetails/Position", QtCore.QVariant(QtCore.QPoint(0, 0))).toPoint()
		self.move(window_position)
		
		self.pushButtonOk.setFocus()
		width = 400
		height = 600
		
		zu_lesen = "SELECT * FROM pordb_darsteller where darsteller = '" +self.darsteller +"'"
		lese_func = DBLesen(self, zu_lesen)
		res = DBLesen.get_data(lese_func)
		
		bildname = darsteller.lower().strip().replace(" ", "_").replace("'", "_apostroph_")
		bilddarsteller = verzeichnis + os.sep + "darsteller_" + res[0][1] + os.sep + bildname +".jpg"
		if not os.path.isfile(bilddarsteller):
			bilddarsteller = verzeichnis + os.sep + "darsteller_" + res[0][1] + os.sep  + bildname + ".png"
			if not os.path.isfile(bilddarsteller):
				bilddarsteller = verzeichnis + os.sep + "nichtvorhanden" + os.sep + "nicht_vorhanden.jpg"
		
		self.bildQImage = QtGui.QImage(bilddarsteller)
		self.labelBild1.setAlignment(QtCore.Qt.AlignCenter)
		image = self.bildQImage.scaled(width, height, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
		self.labelBild1.setPixmap(QtGui.QPixmap.fromImage(image))

		self.labelName.setText(self.darsteller)
		
		self.plainTextEditTattoos.setPlainText(res[0][6])
		
		if res[0][11]:
			self.textEditUrl.setPlainText(res[0][11])
		
		self.lineEditDate.setText(str(res[0][3]))
 def __init__(self, darsteller, parent=None):
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     self.darsteller = darsteller
     
     self.connect(self.pushButtonDarstellerneuSpeichern, QtCore.SIGNAL("clicked()"), self.accept)
     self.connect(self.pushButtonDarstellerneuCancel, QtCore.SIGNAL("clicked()"), self.close)
     
     self.setWindowTitle(self.trUtf8("Actor ") +self.darsteller + self.trUtf8(" will be added"))
     # Combobox für Nation füllen
     zu_lesen = "SELECT * FROM pordb_iso_land WHERE aktiv = %s ORDER BY land"
     lese_func = DBLesen(self, zu_lesen, "x")
     res = DBLesen.get_data(lese_func)
     self.comboBoxDarstellerneuNation.clear()
     for i in res:
         text = '%2s %-50s' % (i[0], i[1])
         bild = os.path.join(os.curdir, "pypordb", i[0] + ".svg")
         icon = QtGui.QIcon()
         icon.addFile(bild, QtCore.QSize(16, 16), QtGui.QIcon.Normal, QtGui.QIcon.Off)
         self.comboBoxDarstellerneuNation.addItem(icon, text)
示例#18
0
 def onSuchen(self):
     self.listWidgetVideo.clear()
     vorhanden = []
     self.res_alle = []
     self.app.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
     for i in self.titel:
         if i:
             zu_lesen = "SELECT DISTINCT ON (original) * FROM pordb_vid WHERE original LIKE %s OR original LIKE %s"
             lese_func = DBLesen(self, zu_lesen, (i.title() + "  % ", i.title() + " (%"))
             res = DBLesen.get_data(lese_func)
             if res:
                 vorhanden.append("x")
                 self.res_alle.extend(res)
             else:
                 vorhanden.append(" ")
     self.label_insgesamt.setText(str(len(self.titel)))
     self.label_vorhanden.setText(str(len(self.res_alle)))
     self.listWidgetVideo.setMinimumHeight(len(self.titel) * 20)
     self.listWidgetVideo.addItems(vorhanden)
     self.app.restoreOverrideCursor()
示例#19
0
	def onSuchen(self):
		self.listWidgetVideo.clear()
		vorhanden = []
		self.res_alle = []
		self.app.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
		for i in self.titel:
			if i:
				zu_lesen = "select distinct on (original) * from pordb_vid where original like '" +i.decode("utf-8").replace("'", "''").title() +"  %' or original like '" +i.decode("utf-8").replace("'", "''").title() +" (%'"
				lese_func = DBLesen(self, zu_lesen)
				res = DBLesen.get_data(lese_func)
				if res:
					vorhanden.append("x")
					self.res_alle.extend(res)
				else:
					vorhanden.append(" ")
		self.label_insgesamt.setText(str(len(self.titel)))
		self.label_vorhanden.setText(str(len(self.res_alle)))
		self.listWidgetVideo.setMinimumHeight(len(self.titel) * 20)
		self.listWidgetVideo.addItems(vorhanden)
		self.app.restoreOverrideCursor()
示例#20
0
 def darsteller_pruefen(self, darsteller_liste):
     darstellerliste = darsteller_liste.split(",")
     darsteller = []
     for i in darstellerliste:
         darsteller.append(i.strip())
     fehler = 0
     k = -1
     for i in darsteller:
         k += 1
         if i and i != "Defekt":
             zu_lesen = "SELECT sex FROM pordb_darsteller WHERE darsteller = %s"
             self.lese_func = DBLesen(self, zu_lesen, i.strip().title())
             res = DBLesen.get_data(self.lese_func)
             if not res:
                 fehler = 1
             for j in range(0, k):
                 if i == darsteller[j]:
                     fehler = 2
                     break
             if fehler:
                 break
     return (darsteller, fehler, k)
	def onSuchen(self):
		suchbegriff = str(self.lineEditFilter.text())
		zu_lesen = "select darsteller from pordb_darsteller where darsteller like '%" +suchbegriff  +"%'"
		if self.comboBoxGeschlecht.currentText() == self.trUtf8("Male"):
			zu_lesen += " and sex = 'm'"
		elif self.comboBoxGeschlecht.currentText() == self.trUtf8("Female"):
			zu_lesen += " and sex = 'w'"
		self.comboBoxGeschlecht.setCurrentIndex(0)
		zu_lesen += " order by darsteller"
		lese_func = DBLesen(self, zu_lesen)
		res = DBLesen.get_data(lese_func)
		self.tableWidgetDarstellerGefunden.setColumnCount(1)
		self.tableWidgetDarstellerGefunden.clear()
		self.tableWidgetDarstellerGefunden.setRowCount(len(res))
		j = 0
		for i in res:
			newitem = QtGui.QTableWidgetItem(i[0])
			self.tableWidgetDarstellerGefunden.setItem(j, 0, newitem)
			j += 1
		self.tableWidgetDarstellerGefunden.setAlternatingRowColors(True)
		self.tableWidgetDarstellerGefunden.resizeColumnsToContents()
		self.tableWidgetDarstellerGefunden.resizeRowsToContents()
示例#22
0
 def __init__(self, cover, verzeichnis_original, original=None, parent=None):
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     self.cover = cover
     self.original = original
     self.verzeichnis_original = verzeichnis_original
     self.filename = None
     self.originaldatei = None
     
     self.connect(self.pushButtonCoverOriginalAlt, QtCore.SIGNAL("clicked()"), self.onCoverOriginalAlt)
     self.connect(self.pushButtonCover, QtCore.SIGNAL("clicked()"), self.accept)
     self.connect(self.pushButtonCancel, QtCore.SIGNAL("clicked()"), self.close)
     
     self.pushButtonCover.setFocus()
     width = 280
     height = 366
     self.bildQImage = QtGui.QImage(cover[0])
     self.labelBild1.setAlignment(QtCore.Qt.AlignTop)
     image = self.bildQImage.scaled(width, height, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
     self.labelBild1.setPixmap(QtGui.QPixmap.fromImage(image))
     self.labelBilddatei1.setText(cover[0])
     self.labelSize1.setText(str(self.bildQImage.width()) +"x" +str(self.bildQImage.height()))
     
     self.bildQImage = QtGui.QImage(cover[1])
     self.labelBild2.setAlignment(QtCore.Qt.AlignTop)
     image = self.bildQImage.scaled(width, height, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
     self.labelBild2.setPixmap(QtGui.QPixmap.fromImage(image))
     self.labelBilddatei2.setText(cover[1])
     self.labelSize2.setText(str(self.bildQImage.width()) +"x" +str(self.bildQImage.height()))
     
     zu_lesen = "SELECT * FROM pordb_vid_neu"
     self.lese_func = DBLesen(self, zu_lesen)
     self.res_vid_neu = DBLesen.get_data(self.lese_func)
     if self.res_vid_neu[0][3]:
         self.labelOriginal.setText(self.res_vid_neu[0][3])        
     
     self.radioButtonBild1.setChecked(True)
     self.lineEditDateiname.setFocus()
	def pseudo_uebernehmen(self, name, zu_erfassen):
		pseudos = unicode(self.lineEditPseudo.text()).title().split(", ")
		pseudos = (set(pseudos))
		for i in pseudos:
			if i and i != name.title().strip():
				res = []
				zu_lesen = "select darsteller from pordb_darsteller where darsteller = '" +i.strip().replace("'", "''").title() +"'"
				self.lese_func = DBLesen(self, zu_lesen)
				res = DBLesen.get_data(self.lese_func)
				if res:
					messageBox = QtGui.QMessageBox()
					messageBox.addButton(self.trUtf8("Yes"), QtGui.QMessageBox.AcceptRole)
					messageBox.addButton(self.trUtf8("No"), QtGui.QMessageBox.RejectRole)
					messageBox.setWindowTitle(i.strip().replace("'", "''").title() +self.trUtf8(": There is another actor in the database with this name."))
					messageBox.setIcon(QtGui.QMessageBox.Question)
					messageBox.setText(self.trUtf8("Do you want to add/change the actor anyway?"))
					message = messageBox.exec_()
					if message == 0:
						zu_erfassen.append("insert into pordb_pseudo (pseudo, darsteller) values ('" +i.strip().title().replace("'", "''") +"', '" +name.strip().title().replace("'", "''") +"')")
					else:
						return False
				else:
					zu_erfassen.append("insert into pordb_pseudo (pseudo, darsteller) values ('" +i.strip().title().replace("'", "''") +"', '" +name.strip().title().replace("'", "''") +"')")
		return True
	def onUebernehmen(self):
		if self.lineEditGeschlecht.text() != 'm' and self.lineEditGeschlecht.text() != 'w':
			message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Invalid gender"))
			self.app.restoreOverrideCursor()
		if self.checkBoxName.isChecked():
			zu_lesen = "select * from pordb_darsteller where darsteller = '" +unicode(self.lineEditName.text()).replace("'", "''").title().encode("utf-8") +"'"
		else:
			zu_lesen = "select * from pordb_darsteller where darsteller = '" +self.name.strip().title().replace("'", "''") +"'"
		self.lese_func = DBLesen(self, zu_lesen)
		res = DBLesen.get_data(self.lese_func)
		zu_erfassen = []
		
		# Darsteller existiert noch nicht
		if not res:
			messageBox = QtGui.QMessageBox()
			messageBox.addButton(self.trUtf8("Yes"), QtGui.QMessageBox.AcceptRole)
			messageBox.addButton(self.trUtf8("No"), QtGui.QMessageBox.RejectRole)
			messageBox.setWindowTitle(self.trUtf8("Actor ") +self.name.decode("utf-8").strip() +self.trUtf8(" not yet in database"))
			messageBox.setIcon(QtGui.QMessageBox.Question)
			messageBox.setText(self.trUtf8("Should the actor be created?"))
			message = messageBox.exec_()
			if message == 0:
				if str(self.labelGeboren.text()).strip() == "-":
					geboren = "0001-01-01"
				else:
					geboren = str(self.labelGeboren.text())
				datum = str(time.localtime()[0]) + '-' + str(time.localtime()[1]) + '-' + str(time.localtime()[2])
				name = unicode(self.lineEditName.text())
				zu_erfassen_zw = "INSERT into pordb_darsteller VALUES ('" 
				zu_erfassen_zw += name.title().replace("'", "''") 
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += str(self.lineEditGeschlecht.text()) 
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += str(0) 
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += datum 
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += str(self.lineEditHaare.text()).lower() 
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += str(self.lineEditLand.text()).upper()[0:2] 
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += unicode(self.lineEditTattos.text()).replace("'", "''") 
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += str(self.lineEditEthnic.text()).lower()
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += str(0) 
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += geboren 
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += str(self.filme) 
				zu_erfassen_zw += "', '" 
				zu_erfassen_zw += unicode(self.url).replace("'", "''")
				zu_erfassen_zw += "', '" +str(self.aktiv_von_int) +"', '" +str(self.aktiv_bis_int) +"', '" +datum +"')"
				zu_erfassen.append(zu_erfassen_zw)
				action = None
				if self.checkBoxPseudo.isChecked():
					action = self.pseudo_uebernehmen(name, zu_erfassen)
					if not action: 
						return
				extension = os.path.splitext(str(self.verz +os.sep +self.bild))[-1].lower()
				if extension == ".jpeg":
					extension = ".jpg"
				if extension <> ".gif":
					newfilename = self.verzeichnis_thumbs +os.sep +"darsteller_" +str(self.lineEditGeschlecht.text()) +os.sep +name.strip().replace("'", "_apostroph_").replace(" ", "_").lower() + extension
					os.rename(self.verz +os.sep +self.bild, newfilename.encode("utf-8"))
			else:
				self.close()
		# Darsteller existiert bereits
		else:
			if self.checkBoxBild.isChecked():
				extension = os.path.splitext(str(self.verz +os.sep +self.bild))[-1].lower()
				if extension == ".jpeg":
					extension = ".jpg"
				if extension <> ".gif":
					if self.checkBoxName.isChecked():
						newfilename = self.verzeichnis_thumbs +os.sep +"darsteller_" +self.lineEditGeschlecht.text() +os.sep +unicode(self.lineEditName.text()).strip().replace("'", "_apostroph_").replace(" ", "_").lower().encode("utf-8") + extension
					else:
						newfilename = self.verzeichnis_thumbs +os.sep +"darsteller_" +self.lineEditGeschlecht.text() +os.sep +unicode(self.name).strip().replace("'", "_apostroph_").replace(" ", "_").lower().encode("utf-8") + extension
					os.rename(self.verz +os.sep +self.bild, newfilename)
			else:
				try:
					os.remove(self.verz +os.sep +self.bild)
				except:
					pass
			if self.checkBoxGeboren.isChecked():
				if str(self.labelGeboren.text()).strip() == "-":
					if res[0][9] and res[0][9] != '0001-01-01':
						pass
					else:
						zu_erfassen.append("update pordb_darsteller set geboren = '0001-01-01' where darsteller = '" +res[0][0].replace("'", "''") +"'")
				else:
					zu_erfassen.append("update pordb_darsteller set geboren = '" +str(self.labelGeboren.text()) +"' where darsteller = '" +res[0][0].replace("'", "''") +"'")
			if self.checkBoxLand.isChecked() and str(self.lineEditLand.text()):
				zu_erfassen.append("update pordb_darsteller set nation = '" +str(self.lineEditLand.text()).upper() +"' where darsteller = '" +res[0][0].replace("'", "''") +"'")
			if self.checkBoxEthnic.isChecked():
				zu_erfassen.append("update pordb_darsteller set ethnic = '" +str(self.lineEditEthnic.text()).lower() +"' where darsteller = '" +res[0][0].replace("'", "''") +"'")
			if self.checkBoxHaare.isChecked():
				zu_erfassen.append("update pordb_darsteller set haarfarbe = '" +str(self.lineEditHaare.text()).lower() +"' where darsteller = '" +res[0][0].replace("'", "''") +"'")
			if self.checkBoxTattos.isChecked() and unicode(self.lineEditTattos.text()):
				if len((self.lineEditTattos.text())) > 500:
					message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Too many characters in tattos (") +str(len((self.lineEditTattos.text()))) +")")
					return
				zu_erfassen.append("update pordb_darsteller set tattoo = '" +unicode(self.lineEditTattos.text()).replace("'", "''") +"' where darsteller = '" +res[0][0].replace("'", "''") +"'")
			zu_erfassen.append("update pordb_darsteller set filme = '" +str(self.filme) +"' where darsteller = '" +res[0][0].replace("'", "''") +"'")
			zu_erfassen.append("update pordb_darsteller set url = '" +self.url.replace("'", "''") +"' where darsteller = '" +res[0][0].replace("'", "''") +"'")
			zu_erfassen.append("update pordb_darsteller set aktivvon = '" +str(self.aktiv_von_int) +"' where darsteller = '" +res[0][0].replace("'", "''") +"'")
			zu_erfassen.append("update pordb_darsteller set aktivbis = '" +str(self.aktiv_bis_int) +"' where darsteller = '" +res[0][0].replace("'", "''") +"'")
			if self.checkBoxPseudo.isChecked():
				zu_erfassen.append("delete from pordb_pseudo where darsteller = '" +res[0][0].replace("'", "''") + "'")
				action = self.pseudo_uebernehmen(res[0][0], zu_erfassen)
				if not action: 
					return
				
			datum = str(time.localtime()[0]) + '-' + str(time.localtime()[1]) + '-' + str(time.localtime()[2])
			zu_erfassen.append("update pordb_darsteller set besuch = '" +datum +"' where darsteller = '" +res[0][0].replace("'", "''") +"'")
				
		if zu_erfassen:
			update_func = DBUpdate(self, zu_erfassen)
			DBUpdate.update_data(update_func)
		self.close()
示例#25
0
 def __init__(self, verzeichnis, verzeichnis_original, verzeichnis_thumbs, verzeichnis_trash, verzeichnis_cover, video):
     
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     
     self.verzeichnis = verzeichnis
     self.verzeichnis_original = verzeichnis_original
     self.verzeichnis_thumbs = verzeichnis_thumbs
     self.verzeichnis_trash = verzeichnis_trash
     self.verzeichnis_cover = verzeichnis_cover
     self.video = video
     
     self.connect(self.pushButtonCancel, QtCore.SIGNAL("clicked()"), self.close)
     self.connect(self.pushButtonOK, QtCore.SIGNAL("clicked()"), self.accept)
     
     self.imagesize = 200
     self.complete_size = QtCore.QSize(self.imagesize, self.imagesize)
     
     settings = QtCore.QSettings()
     window_size = settings.value("ShowIafdData/Size", QtCore.QSize(600, 500))
     self.resize(window_size)
     window_position = settings.value("ShowIafdData/Position", QtCore.QPoint(0, 0))
     self.move(window_position)
     
     self.graphicsView.setAlignment(QtCore.Qt.AlignLeft)
     self.scene = QtGui.QGraphicsScene()
     self.left_margin = 20
     
     self.font = QtGui.QFont()
     
     # set imagefiles from working directory
     self.populate_from_working_directory()
     
     # set original title
     self.font.setBold(True)
     textitem = QtGui.QGraphicsTextItem(self.video[0])
     textitem.setPos(0, self.y_pos)
     textitem.setFont(self.font)
     self.scene.addItem(textitem)
     self.y_pos += 40
     
     # set alternate titles
     for i, wert in enumerate(self.video[1]):
         alt_title = wert
         textitem = QtGui.QGraphicsTextItem(alt_title)
         textitem.setPos(self.x_pos, self.y_pos)
         self.scene.addItem(textitem)
         self.y_pos += 30
         
     # set scene and actors
     for i, wert in enumerate(self.video[2]): 
         for j, wert1 in enumerate(wert):
             darsteller_liste = wert1.split(", ")
             image_shown = False
             max_height = 0
             for k, wert2 in enumerate(darsteller_liste):
                 textitem = QtGui.QGraphicsTextItem(wert2)
                 if wert1.startswith("Scene "):
                     self.y_pos += 30
                     self.font.setBold(True)
                     textitem.setFont(self.font)
                     textitem.setPos(self.x_pos, self.y_pos)
                     self.scene.addItem(textitem)
                     self.y_pos += 30
                 elif wert2:
                     zu_lesen = "SELECT * from pordb_darsteller WHERE darsteller = %s"
                     lese_func = DBLesen(self, zu_lesen, wert2.title())
                     res = DBLesen.get_data(lese_func)
                     if res:
                         bilddatei = self.getBilddatei(res[0][0], res[0][1])
                     else:
                         bilddatei = self.getBilddatei(wert2.replace("'", "_apostroph_").title())
                     pixmap = QtGui.QPixmap(bilddatei).scaled(QtCore.QSize(self.complete_size),QtCore.Qt.KeepAspectRatio)
                     if pixmap.height() > max_height:
                         max_height = pixmap.height()
                     pixmapitem = QtGui.QGraphicsPixmapItem(pixmap)
                     pixmapitem.setPos(0, 20)
                     itemgroup = self.scene.createItemGroup([textitem, pixmapitem])
                     itemgroup.setPos(self.x_pos, self.y_pos)
                     itemgroup.setData(1, wert2)
                     itemgroup.setFlag(QtGui.QGraphicsItem.ItemIsSelectable)
                     self.x_pos += self.imagesize + 20
                     image_shown = True
             self.x_pos = self.left_margin
             if image_shown:
                 self.y_pos += max_height + 20
         
     self.graphicsView.setScene(self.scene)
     self.graphicsView.centerOn(0, 0)
 def __init__(self, app, url, darstellerseite, verzeichnis_thumbs, name = None):
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     
     self.connect(self.pushButtonUebernehmen, QtCore.SIGNAL("clicked()"), self.onUebernehmen)
     self.connect(self.pushButtonRemoveBrackets, QtCore.SIGNAL("clicked()"), self.onRemoveBrackets)
     self.connect(self.pushButtonCancel, QtCore.SIGNAL("clicked()"), self.onClose)
     
     self.darstellerseite = str(darstellerseite)
     self.app = app
     self.url = url
     self.verzeichnis_thumbs = verzeichnis_thumbs
     if name:
         self.name = name.strip()
     else:
         self.name = None
         
     # Combobox für Nation füllen
     zu_lesen = "SELECT * FROM pordb_iso_land WHERE aktiv = %s ORDER BY land"
     lese_func = DBLesen(self, zu_lesen, "x")
     res_iso_land = DBLesen.get_data(lese_func)
     self.comboBoxNation.clear()
     for i in res_iso_land:
         text = '%2s %-50s' % (i[0], i[1])
         bild = os.path.join(os.curdir, "pypordb", i[0] + ".svg")
         icon = QtGui.QIcon()
         icon.addFile(bild, QtCore.QSize(16, 16), QtGui.QIcon.Normal, QtGui.QIcon.Off)
         self.comboBoxNation.addItem(icon, text)
     
     self.app.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
     
     monate = {"January":"01", "February":"02", "March":"03", "April":"04", "May":"05", "June":"06", "July":"07", "August":"08", "September":"09", "October":"10", "November":"11", "December":"12", }
     haarfarben = {"Brown":"br", "Brown/Light Brown":"br", "Dark Brown":"br", "Light Brown":"br", "Black":"s", "Red":"r", "Blond":"bl", "Honey Blond":"bl", "Dark Blond":"bl", "Dirty Blond":"bl", "Sandy Blond":"bl", "Strawberry Blond":"bl", "Auburn":"r"}
     ethniticies = {"Caucasian": "w", "Black": "s", "Asian": "a", "Latin": "l"}
     
     actordata = ActorData(self.darstellerseite)
     
     # Darsteller Name
     self.name_iafd = ActorData.actor_name(actordata)
     if not self.name_iafd:
         self.app.restoreOverrideCursor()
         message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("This site seams not to be an actor site of the IAFD"))
         return
     if self.name and self.name.lower() != self.name_iafd.lower():
         self.app.restoreOverrideCursor()
         message = QtGui.QMessageBox.warning(self, self.trUtf8("Warning "), self.trUtf8("Actors name in \nPorDB --> ({0}) \ndiffers from actors name in the \nIAFD --> ({1}).\nMaybe you should rename the actor in PorDB.").format(self.name, self.name_iafd))
     if not self.name:
         self.name = self.name_iafd
     self.labelName.setText(self.name)
     self.lineEditName.setText(self.name)
         
     # Darsteller Bild
     self.bild = ActorData.actor_image(actordata)
     if not self.bild:
         self.app.restoreOverrideCursor()
         message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("This site seams not to be an actor site of the IAFD"))
         return
     url = self.bild
     self.verz = self.verzeichnis_thumbs
     urllib.request._urlopener=urllib.request.URLopener()
     urllib.request.URLopener.version="Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)"
     urllib.request.FancyURLopener.prompt_user_passwd = lambda self, host, realm: (None, None)
     while True:
         try:
             bild=urllib.request.urlretrieve(url, os.path.join(self.verz, os.path.basename(self.bild)))
             break
         except:
             pass
     bild = QtGui.QPixmap(os.path.join(self.verz, os.path.basename(self.bild)))
     self.labelBild.setPixmap(bild)
         
     # Darsteller Geschlecht
     self.geschlecht = ActorData.actor_sex(actordata)
     if not self.bild:
         self.app.restoreOverrideCursor()
         message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("This site seams not to be an actor site of the IAFD"))
         return
     if self.geschlecht:
         self.lineEditGeschlecht.setText(self.geschlecht)
     
     # Darsteller Pseudonyme
     self.pseudonyme = ActorData.actor_alias(actordata)
     self.lineEditPseudo.setText(self.pseudonyme)
 
     # Darsteller Land
     self.land = ActorData.actor_country(actordata)
     if self.land == "No data":
         self.checkBoxLand.setCheckState(QtCore.Qt.Unchecked)
         self.comboBoxNation.setCurrentIndex(-1)
     else:
         gefunden = False
         for i, wert in enumerate(res_iso_land):
             if wert[3].strip() == self.land:
                 gefunden = True
                 break
         if not gefunden:
             i = -1
         self.comboBoxNation.setCurrentIndex(i)
         self.checkBoxLand.setCheckState(QtCore.Qt.Checked)
             
     # Actor birthplace
     self.birthplace = ActorData.actor_birthplace(actordata)
     if self.birthplace == "No data":
         self.birthplace = ""
     self.labelBirthplace.setText(self.birthplace)
     
     # Darsteller Ethnic
     self.ethnic = ActorData.actor_ethnic(actordata)
     self.labelEthnic.setText(self.ethnic)
     if self.ethnic == "No data":
         self.ethnic = ""
         self.checkBoxEthnic.setCheckState(QtCore.Qt.Unchecked)
     else:
         ethnic = ethniticies.get(self.ethnic, self.trUtf8("not available"))
         if ethnic != self.trUtf8("not available"):
             self.ethnic = ethnic
             self.checkBoxEthnic.setCheckState(QtCore.Qt.Checked)
     self.comboBoxEthnic.setCurrentIndex(self.comboBoxEthnic.findText(self.ethnic))
     
     # Darsteller Haarfarbe
     self.haare = ActorData.actor_hair(actordata)
     self.labelHaare.setText(self.haare)
     if self.haare == "No data":
         self.haare = ""
         self.checkBoxHaare.setCheckState(QtCore.Qt.Unchecked)
     else:
         haarfarbe = haarfarben.get(self.haare, self.trUtf8("not available"))
         if haarfarbe != self.trUtf8("not available"):
             self.haare = haarfarbe
             self.checkBoxHaare.setCheckState(QtCore.Qt.Checked)
     self.comboBoxHaare.setCurrentIndex(self.comboBoxHaare.findText(self.haare))
     
     # Darsteller Tattoos
     self.tattoos = ActorData.actor_tattoos(actordata)
     if self.tattoos.lower() == "none":
         self.lineEditTattos.setText("-")
         self.checkBoxTattos.setCheckState(QtCore.Qt.Checked)
     elif self.tattoos.lower() == "no data":
         self.lineEditTattos.setText("")
         self.checkBoxTattos.setCheckState(QtCore.Qt.Unchecked)
     else:
         self.lineEditTattos.setText(self.tattoos)
         self.checkBoxTattos.setCheckState(QtCore.Qt.Checked)
         
     # Darsteller Geboren
     self.geboren = ActorData.actor_born(actordata)
     monat = monate.get(self.geboren[0:self.geboren.find(" ")], self.trUtf8("not available"))
     if monat != self.trUtf8("not available"):
         tag = self.geboren[self.geboren.find(" ")+1:self.geboren.find(",")]
         jahr = self.geboren[self.geboren.find(", ")+2:]
         self.geboren = jahr +"-" + monat + "-" + tag
         self.labelGeboren.setText(self.geboren)
     else:
         self.geboren = 0
         self.labelGeboren.setText("-")
     
     # Darsteller Anzahl Filme
     self.filme = ActorData.actor_movies(actordata)
     
     # Darsteller aktiv von / bis
     self.aktiv_von, self.aktiv_bis = ActorData.actor_activ(actordata)
     
     self.checkBoxPseudo.setCheckState(QtCore.Qt.Checked)
     self.checkBoxGeboren.setCheckState(QtCore.Qt.Checked)
     
     self.app.restoreOverrideCursor()
 def onUebernehmen(self):
     if self.lineEditGeschlecht.text() != 'm' and self.lineEditGeschlecht.text() != 'w':
         message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Invalid gender"))
         self.app.restoreOverrideCursor()
         self.lineEditGeschlecht.setReadOnly(False)
         self.lineEditGeschlecht.setFocus()
         return
     zu_lesen = "SELECT * FROM pordb_darsteller WHERE darsteller = %s"
     if self.checkBoxName.isChecked():
         self.name = str(self.lineEditName.text())
     wert = self.name.strip().title()
     self.lese_func = DBLesen(self, zu_lesen, wert)
     res = DBLesen.get_data(self.lese_func)
     zu_erfassen = []
     
     # Darsteller existiert noch nicht
     if not res:
         messageBox = QtGui.QMessageBox()
         messageBox.addButton(self.trUtf8("Yes"), QtGui.QMessageBox.AcceptRole)
         messageBox.addButton(self.trUtf8("No"), QtGui.QMessageBox.RejectRole)
         messageBox.setWindowTitle(self.trUtf8("Actor ") +self.name.strip() +self.trUtf8(" not yet in database"))
         messageBox.setIcon(QtGui.QMessageBox.Question)
         messageBox.setText(self.trUtf8("Should the actor be created?"))
         message = messageBox.exec_()
         if message == 0:
             if str(self.labelGeboren.text()).strip() == "-":
                 geboren = "0001-01-01"
             else:
                 geboren = str(self.labelGeboren.text())
             datum = str(time.localtime()[0]) + '-' + str(time.localtime()[1]) + '-' + str(time.localtime()[2])
             name = str(self.lineEditName.text())
             werte = []
             werte.append(name.title())
             werte.append(str(self.lineEditGeschlecht.text()))
             werte.append(str(0))
             werte.append(datum)
             werte.append(str(self.comboBoxHaare.currentText()))
             werte.append(str(self.comboBoxNation.currentText())[0:2])
             werte.append(str(self.lineEditTattos.text()))
             werte.append(str(self.comboBoxEthnic.currentText()))
             werte.append(str(0))
             werte.append(geboren)
             werte.append(str(self.filme))
             werte.append(str(self.url))
             werte.append(str(self.aktiv_von))
             werte.append(str(self.aktiv_bis))
             werte.append(datum)
             zu_erfassen.append(["INSERT INTO pordb_darsteller VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", werte])
             action = None
             if self.checkBoxPseudo.isChecked():
                 action = self.pseudo_uebernehmen(name, zu_erfassen)
                 if not action: 
                     return
             extension = os.path.splitext(os.path.join(self.verz, self.bild))[-1].lower()
             if extension == ".jpeg":
                 extension = ".jpg"
             if extension != ".gif":
                 newfilename = os.path.join(self.verzeichnis_thumbs, "darsteller_" + str(self.lineEditGeschlecht.text()), name.strip().replace("'", "_apostroph_").replace(" ", "_").lower() + extension)
                 os.rename(os.path.join(self.verz, os.path.basename(self.bild)), newfilename)
         else:
             self.onClose()
     # Darsteller existiert bereits
     else:
         if self.checkBoxBild.isChecked():
             extension = os.path.splitext(os.path.join(self.verz + self.bild))[-1].lower()
             if extension == ".jpeg":
                 extension = ".jpg"
             if extension != ".gif":
                 if self.checkBoxName.isChecked():
                     newfilename = os.path.join(self.verzeichnis_thumbs, "darsteller_" + self.lineEditGeschlecht.text(), str(self.lineEditName.text()).strip().replace("'", "_apostroph_").replace(" ", "_").lower() + extension)
                 else:
                     newfilename = os.path.join(self.verzeichnis_thumbs, "darsteller_" + self.lineEditGeschlecht.text(), str(self.name).strip().replace("'", "_apostroph_").replace(" ", "_").lower() + extension)
                 os.rename(os.path.join(self.verz, os.path.basename(self.bild)), newfilename)
         else:
             try:
                 os.remove(os.path.join(self.verz, os.path.basename(self.bild)))
             except:
                 pass
         if self.checkBoxGeboren.isChecked():
             if str(self.labelGeboren.text()).strip() == "-":
                 if res[0][9] and res[0][9] != '0001-01-01':
                     pass
                 else:
                     werte = []
                     werte.append(res[0][0])
                     zu_erfassen.append(["UPDATE pordb_darsteller SET geboren = '0001-01-01' WHERE darsteller = %s", werte])
             else:
                 werte = []
                 werte.append(str(self.labelGeboren.text()))
                 werte.append(res[0][0])
                 zu_erfassen.append(["UPDATE pordb_darsteller SET geboren = %s WHERE darsteller = %s", werte])
         if self.checkBoxLand.isChecked() and str(self.comboBoxNation.currentText()):
             werte = []
             werte.append(str(self.comboBoxNation.currentText())[0:2])
             werte.append(res[0][0])
             zu_erfassen.append(["UPDATE pordb_darsteller SET nation = %s WHERE darsteller = %s", werte])
         if self.checkBoxEthnic.isChecked():
             werte = []
             werte.append(str(self.comboBoxEthnic.currentText()))
             werte.append(res[0][0])
             zu_erfassen.append(["UPDATE pordb_darsteller SET ethnic = %s WHERE darsteller = %s", werte])
         if self.checkBoxHaare.isChecked():
             werte = []
             werte.append(str(self.comboBoxHaare.currentText()))
             werte.append(res[0][0])
             zu_erfassen.append(["UPDATE pordb_darsteller SET haarfarbe = %s WHERE darsteller = %s", werte])
         if self.checkBoxTattos.isChecked() and str(self.lineEditTattos.text()):
             if len((self.lineEditTattos.text())) > 500:
                 message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Too many characters in tattos (") +str(len((self.lineEditTattos.text()))) +")")
                 return
             werte = []
             werte.append(str(self.lineEditTattos.text()))
             werte.append(res[0][0])
             zu_erfassen.append(["UPDATE pordb_darsteller SET tattoo = %s WHERE darsteller = %s", werte])
         werte = []
         werte.append(str(self.filme))
         werte.append(res[0][0])
         zu_erfassen.append(["UPDATE pordb_darsteller SET filme = %s WHERE darsteller = %s", werte])
         werte = []
         werte.append(self.url)
         werte.append(res[0][0])
         zu_erfassen.append(["UPDATE pordb_darsteller SET url = %s WHERE darsteller = %s", werte])
         werte = []
         werte.append(str(self.aktiv_von))
         werte.append(res[0][0])
         zu_erfassen.append(["UPDATE pordb_darsteller SET aktivvon = %s WHERE darsteller = %s", werte])
         werte = []
         werte.append(str(self.aktiv_bis))
         werte.append(res[0][0])
         zu_erfassen.append(["UPDATE pordb_darsteller SET aktivbis = %s WHERE darsteller = %s", werte])
         if self.checkBoxPseudo.isChecked():
             action = self.pseudo_uebernehmen(res[0][0], zu_erfassen)
             if not action: 
                 return
             
         datum = str(time.localtime()[0]) + '-' + str(time.localtime()[1]) + '-' + str(time.localtime()[2])
         werte = []
         werte.append(datum)
         werte.append(res[0][0])
         zu_erfassen.append(["UPDATE pordb_darsteller SET besuch = %s WHERE darsteller = %s", werte])
             
     if zu_erfassen:
         update_func = DBUpdate(self, zu_erfassen)
         DBUpdate.update_data(update_func)
     self.onClose()
示例#28
0
    def onDelete(self):
        if self.undo:
            self.close()
            return
        darsteller_liste = self.darsteller.strip().split(", ")
        zu_erfassen = []
        for i in darsteller_liste:
            if i:
                werte = []
                werte.append(i)
                zu_erfassen.append(["UPDATE pordb_darsteller SET anzahl = anzahl - 1 WHERE darsteller = %s", werte])
        # Daten für undo sichern
        zu_lesen = "SELECT * FROM pordb_vid WHERE cd = %s AND bild = %s"
        self.lese_func = DBLesen(self, zu_lesen, (str(self.cd), self.bild))
        res = DBLesen.get_data(self.lese_func)

        # Dateien in Trash Verzeichnis löschen
        dateiliste = os.listdir(self.verzeichnis_trash)
        for datei in dateiliste:
            if datei.find("pypordb_bildalt") == -1:
                os.remove(self.verzeichnis_trash + '/' + datei)

        # Bild in Trash Verzeichnis verschieben
        if not os.path.exists(self.verzeichnis_trash):
            os.mkdir(self.verzeichnis_trash)
        filename = os.path.join(self.verzeichnis_thumbs, "cd" + str(self.cd), self.bild.strip())
        cover = None
        if not os.path.exists(filename):
            filename = os.path.join(self.verzeichnis_cover, self.bild.strip())
            cover = "x"
        newfilename = os.path.join(self.verzeichnis_trash, self.bild.strip())
        if os.path.exists(filename):
            os.rename(filename, newfilename)

        # Textdatei erstellen mit alten Daten
        textdatei = open(os.path.join(self.verzeichnis_trash, self.bild[-2] + ".txt"), "w")
        zaehler = 0
        for i in res:
            for j in i:
                try:
                    textdatei.write(j.encode("utf-8").rstrip() +"\n")
                except:
                    textdatei.write(str(j).rstrip() +"\n")
        if cover:
            textdatei.write("COVER" +"\n")
        textdatei.close()

        werte = []
        werte.append(str(self.cd))
        werte.append(self.bild.strip())
        zu_erfassen.append(["DELETE FROM pordb_vid WHERE cd = %s AND bild = %s", werte])
        werte = []
        werte.append(str(self.cd))
        werte.append(self.bild.strip())
        zu_erfassen.append(["DELETE FROM pordb_partner WHERE cd = %s AND bild = %s", werte])
        
        update_func = DBUpdate(self, zu_erfassen)
        DBUpdate.update_data(update_func)
        
        zu_erfassen = []
        for i in darsteller_liste:
            if i:
                zu_lesen = "SELECT DISTINCT ON (partner) partner FROM pordb_partner WHERE darsteller = %s"
                self.lese_func = DBLesen(self, zu_lesen, i)
                res1 = DBLesen.get_data(self.lese_func)
                werte = []
                werte.append(len(res1))
                werte.append(i)
                zu_erfassen.append(["UPDATE pordb_darsteller SET partner = %s WHERE darsteller = %s", werte])
        if zu_erfassen:
            update_func = DBUpdate(self, zu_erfassen)
            DBUpdate.update_data(update_func)
        
        self.close()
示例#29
0
 def __init__(self, verzeichnis, verzeichnis_original, verzeichnis_thumbs, verzeichnis_trash, verzeichnis_cover, bilddatei, titel=None, darsteller=None, cd=None, bild=None, gesehen=None, original=None, cs=None, vorhanden=None, remarks=None, stars=None, cover=None, undo=None, cover_anlegen=None, original_weitere=None, original_cover = None, high_definition = None, access_from_iafd = None):
     
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     self.bilddatei = bilddatei
     self.titel = titel
     self.darsteller = darsteller
     self.cd = cd
     self.bild = bild
     self.gesehen = gesehen
     self.original = original
     self.cs = cs
     self.vorhanden = vorhanden
     self.stars = stars
     self.remarks = remarks
     self.undo = undo
     self.cover = cover
     self.cover_anlegen = cover_anlegen
     self.cover_austauschen = 0
     self.original_weitere = original_weitere
     self.verzeichnis = verzeichnis
     self.verzeichnis_original = verzeichnis_original 
     self.verzeichnis_thumbs = verzeichnis_thumbs 
     self.verzeichnis_trash = verzeichnis_trash 
     self.verzeichnis_cover = verzeichnis_cover
     self.original_cover = original_cover
     self.high_definition = high_definition
     self.access_from_iafd = access_from_iafd
     self.icon_starred = QtGui.QIcon()
     self.icon_starred.addPixmap(QtGui.QPixmap("pypordb/starred.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
     self.icon_nonstarred = QtGui.QIcon()
     self.icon_nonstarred.addPixmap(QtGui.QPixmap("pypordb/non-starred.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
     self.set_stars = stars
     
     self.connect(self.pushButtonNeuOK, QtCore.SIGNAL("clicked()"), self.accept)
     self.connect(self.pushButtonNeuCancel, QtCore.SIGNAL("clicked()"), self.close)
     self.connect(self.pushButtonNeuDelete, QtCore.SIGNAL("clicked()"), self.onDelete)
     self.connect(self.pushButtonOriginal, QtCore.SIGNAL("clicked()"), self.onOriginal)
     self.connect(self.pushButtonOriginalAlt, QtCore.SIGNAL("clicked()"), self.onOriginalAlt)
     self.connect(self.pushButtonAddYear, QtCore.SIGNAL("clicked()"), self.onAddYear)
     self.connect(self.pushButtonStar1, QtCore.SIGNAL("clicked()"), self.onStar1)
     self.connect(self.pushButtonStar2, QtCore.SIGNAL("clicked()"), self.onStar2)
     self.connect(self.pushButtonStar3, QtCore.SIGNAL("clicked()"), self.onStar3)
     self.connect(self.pushButtonStar4, QtCore.SIGNAL("clicked()"), self.onStar4)
     self.connect(self.pushButtonStar5, QtCore.SIGNAL("clicked()"), self.onStar5)
     self.connect(self.pushButtonClearRating, QtCore.SIGNAL("clicked()"), self.onClearRating)
     self.connect(self.listWidgetW, QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.onDarstelleruebernehmen)
     self.connect(self.listWidgetM, QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.onDarstelleruebernehmen)
     self.connect(self.pushButtonNeuDarstelleruebernehmen, QtCore.SIGNAL("clicked()"), self.onDarstelleruebernehmen)
     self.connect(self.pushButtonBildloeschen, QtCore.SIGNAL("clicked()"), self.onBildloeschen)
     self.connect(self.pushButtonVerz, QtCore.SIGNAL("clicked()"), self.onVerzeichnisWechseln)
     self.connect(self.pushButtonBildbeschneiden, QtCore.SIGNAL("clicked()"), self.onBildbeschneiden)
     
     self.pushButtonNeuOK.setDefault(True)
     
     settings = QtCore.QSettings()
     window_size = settings.value("Neueingabe/Size", QtCore.QSize(600, 500))
     self.resize(window_size)
     window_position = settings.value("Neueingabe/Position", QtCore.QPoint(0, 0))
     self.move(window_position)
     
     # populate combox for years
     today = datetime.date.today()
     self.comboBoxYear.clear()
     for i in range(today.year + 1, 1899, -1):
         self.comboBoxYear.addItem(str(i))
     self.comboBoxYear.setCurrentIndex(1)
     
     # set default position for cropping images
     self.positionX = 0
     self.positionY = 0
     
     zu_lesen = "SELECT * FROM pordb_vid_neu"
     self.lese_func = DBLesen(self, zu_lesen)
     self.res_vid_neu = DBLesen.get_data(self.lese_func)
     if self.res_vid_neu[0][3]:
         self.labelOriginal.setText(self.res_vid_neu[0][3])
     
     zu_lesen = "SELECT * FROM pordb_darsteller100 ORDER BY darsteller"
     self.lese_func = DBLesen(self, zu_lesen)
     res = DBLesen.get_data(self.lese_func)
     res.sort()
     res.reverse()
     darsteller_m = []
     darsteller_w = []
     for i in res:
         zu_lesen = "SELECT sex FROM pordb_darsteller WHERE darsteller = %s"
         self.lese_func = DBLesen(self, zu_lesen, tuple(i)[1].rstrip())
         res2 = DBLesen.get_data(self.lese_func)
         try:
             if res2 [0][0] == "w":
                 darsteller_w.append(tuple (i)[1].rstrip())
             else:
                 darsteller_m.append(tuple (i)[1].rstrip())
         except:
             pass
     darsteller_w.sort()
     darsteller_m.sort()
     self.listWidgetM.clear()
     self.listWidgetW.clear()
     initial = ' '
     for i in darsteller_w:
         newitem = QtGui.QListWidgetItem(i)
         if i[0] != initial:
             initial = i[0]
             newitem.setTextColor(QtGui.QColor('red'))
         else:
             newitem.setTextColor(QtGui.QColor('black'))
         self.listWidgetW.addItem(newitem)
     initial = ' '
     for i in darsteller_m:
         newitem = QtGui.QListWidgetItem(i)
         if i[0] != initial:
             initial = i[0]
             newitem.setTextColor(QtGui.QColor('red'))
         else:
             newitem.setTextColor(QtGui.QColor('black'))
         self.listWidgetM.addItem(newitem)
         
     self.bilddarstellen()
     
     if self.titel:
         self.korrektur = True
         self.lineEditNeuTitel.setText(self.titel.strip())
         self.lineEditNeuDarsteller.setText(self.darsteller.strip())
         self.lineEditNeuCD.setText(str(self.cd))
         self.cd_alt = str(self.cd)
         self.lineEditNeuBild.setText(self.bild.strip())
         if self.gesehen == "x":
             self.radioButtonGesehenJa.setChecked(True)
         else:
             self.radioButtonGesehenNein.setChecked(True)
         self.lineEditNeuOriginal.setText(self.original.strip())
         for i in cs:
             anzahl = i[0]
             if i[1] == "f":
                 self.spinBoxF.setValue(int(anzahl))
             elif i[1] == "h":
                 self.spinBoxH.setValue(int(anzahl))
             elif i[1] == "t":
                 self.spinBoxT.setValue(int(anzahl))
             elif i[1] == "c":
                 self.spinBoxC.setValue(int(anzahl))
             elif i[1] == "x":
                 self.spinBoxX.setValue(int(anzahl))
             elif i[1] == "o":
                 self.spinBoxO.setValue(int(anzahl))
             elif i[1] == "v":
                 self.spinBoxV.setValue(int(anzahl))
             elif i[1] == "b":
                 self.spinBoxB.setValue(int(anzahl))
             elif i[1] == "a":
                 self.spinBoxA.setValue(int(anzahl))
             elif i[1] == "s":
                 self.spinBoxS.setValue(int(anzahl))
             elif i[1] == "k":
                 self.spinBoxK.setValue(int(anzahl))
         if self.vorhanden == "x":
             self.radioButtonVorhandenJa.setChecked(True)
         else:
             self.radioButtonVorhandenNein.setChecked(True)
         self.plainTextEditRemarks.setPlainText(self.remarks)
         if self.stars == 1:
             self.pushButtonStar1.setIcon(self.icon_starred)
         elif self.stars == 2:
             self.pushButtonStar1.setIcon(self.icon_starred)
             self.pushButtonStar2.setIcon(self.icon_starred)
         elif self.stars == 3:
             self.pushButtonStar1.setIcon(self.icon_starred)
             self.pushButtonStar2.setIcon(self.icon_starred)
             self.pushButtonStar3.setIcon(self.icon_starred)
         elif self.stars == 4:
             self.pushButtonStar1.setIcon(self.icon_starred)
             self.pushButtonStar2.setIcon(self.icon_starred)
             self.pushButtonStar3.setIcon(self.icon_starred)
             self.pushButtonStar4.setIcon(self.icon_starred)
         elif self.stars == 5:
             self.pushButtonStar1.setIcon(self.icon_starred)
             self.pushButtonStar2.setIcon(self.icon_starred)
             self.pushButtonStar3.setIcon(self.icon_starred)
             self.pushButtonStar4.setIcon(self.icon_starred)
             self.pushButtonStar5.setIcon(self.icon_starred)                 
         self.pushButtonBildloeschen.setEnabled(False)
         self.pushButtonBildbeschneiden.setEnabled(False)
         if self.undo:
             self.pushButtonNeuDelete.setEnabled(False)
         self.pushButtonVerz.setEnabled(False)
         if self.cover or self.original_cover:
             self.radioButtonCoverJa.setChecked(True)
             self.radioButtonCoverNein.setChecked(False)
         else:
             self.radioButtonCoverNein.setChecked(True)
             self.radioButtonCoverJa.setChecked(False)
         if self.high_definition == "0":
             self.comboBoxDefinition.setCurrentIndex(1)
         elif self.high_definition == "1":
             self.comboBoxDefinition.setCurrentIndex(2)
         elif self.high_definition == "2":
             self.comboBoxDefinition.setCurrentIndex(3)
         elif self.high_definition == "3":
             self.comboBoxDefinition.setCurrentIndex(4)
         elif self.high_definition == "9":
             self.comboBoxDefinition.setCurrentIndex(5)
         else:
             self.comboBoxDefinition.setCurrentIndex(0)
     else:
         self.korrektur = False
         if self.darsteller:
             self.lineEditNeuDarsteller.setText(self.darsteller)
         if self.original:
             self.lineEditNeuOriginal.setText(self.original.strip())
         if self.cover_anlegen:
             self.radioButtonCoverJa.setChecked(True)
             self.radioButtonCoverNein.setChecked(False)
             anfang = os.path.basename(self.bilddatei).rfind('.')
             if self.original:
                 self.lineEditNeuOriginal.setText(self.original)
             else:
                 self.lineEditNeuOriginal.setText((os.path.basename(str(self.bilddatei)))[0:anfang])
         else:
             self.radioButtonCoverJa.setChecked(False)
             self.radioButtonCoverNein.setChecked(True)
         anfang = os.path.basename(str(self.bilddatei)).rfind('.')
         self.lineEditNeuTitel.setText((os.path.basename(str(self.bilddatei)))[0:anfang])
         dateiliste = os.listdir(self.verzeichnis)
         videodatei = os.path.splitext(os.path.basename(str(self.bilddatei)))[0]
         self.lineEditNeuTitel.setFocus()
         for i in dateiliste:
             datei = os.path.splitext(i)[0]
             ext = os.path.splitext(i)[1].lower()
             if ext in videodateien: 
                 if videodatei == datei or videodatei[0:len(videodatei) -1] == datei or videodatei[0:len(videodatei) -2] == datei: 
                     self.lineEditNeuTitel.setText(os.path.basename(i))
                     self.lineEditNeuDarsteller.setFocus()
                     break
         self.lineEditNeuCD.setText(str(self.res_vid_neu[0][2]))
         self.lineEditNeuBild.setText(os.path.basename(str(self.bilddatei)))
         if self.access_from_iafd:
             self.pushButtonBildloeschen.setEnabled(False)
             self.pushButtonBildbeschneiden.setEnabled(False)
             self.pushButtonVerz.setEnabled(False)
         else:
             self.pushButtonBildloeschen.setEnabled(True)
             self.pushButtonBildbeschneiden.setEnabled(True)
             self.pushButtonVerz.setEnabled(True)
         self.pushButtonNeuDelete.setEnabled(False)
示例#30
0
    def accept(self):
        fehler = 1
        actor_added = False
        actor_adding_asked = False
        while fehler:
            darsteller, fehler, fehler_index = self.darsteller_pruefen(str(self.lineEditNeuDarsteller.text()).title())
            if fehler:
                if fehler == 1:
                    zu_lesen = "SELECT darsteller FROM pordb_pseudo WHERE pseudo = %s"
                    self.lese_func = DBLesen(self, zu_lesen, darsteller[fehler_index].title().strip())
                    res = DBLesen.get_data(self.lese_func)
                    if res:
                        messageBox = QtGui.QMessageBox()
                        messageBox.addButton(self.trUtf8("Yes"), QtGui.QMessageBox.AcceptRole)
                        messageBox.addButton(self.trUtf8("No, correct entry"), QtGui.QMessageBox.RejectRole)
                        messageBox.addButton(self.trUtf8("No, add new actor"), QtGui.QMessageBox.ActionRole)
                        messageBox.setWindowTitle(darsteller[fehler_index] +self.trUtf8(" does not exist") +self.trUtf8(", but I have found ") +res[0][0].strip() +self.trUtf8(" as alias."))
                        messageBox.setIcon(QtGui.QMessageBox.Question)
                        messageBox.setText(self.trUtf8("Do you want to take this actor instead?"))
                        messageBox.setDetailedText(darsteller[fehler_index] +self.trUtf8(" does not exist") +self.trUtf8(", but I have found ") +res[0][0].strip() +self.trUtf8(" as alias. If you want to take this actor, click on yes, else change your entry or add a new actor to the database."))
                        message = messageBox.exec_()
                        if message == 0:
                            darsteller_alt = str(self.lineEditNeuDarsteller.text()).title().strip()
                            darsteller_neu = darsteller_alt.replace(darsteller[fehler_index].strip(), str(res[0][0]).strip())
                            try:
                                self.lineEditNeuDarsteller.setText(darsteller_neu)
                            except:
                                pass
                            return
                        elif message == 2:
                            self.darsteller_addieren(darsteller, fehler_index)
                            actor_added = True
                elif fehler == 2:
                    message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("You have entered some actors twice, please correct"))
                    return
                if actor_adding_asked:
                    return
                if not actor_added:
                    self.darsteller_addieren(darsteller, fehler_index)
                    actor_adding_asked = True
        titel = self.lineEditNeuTitel.text()
        if darsteller:
            darsteller = self.darsteller_sortieren(darsteller)
        if self.checkBoxUninteressant.isChecked():
            darsteller.append("(Uninteressant)")
        try:
            cd = int(self.lineEditNeuCD.text())
        except:
            message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("CD is not a number"))
            return
        bild = self.lineEditNeuBild.text()

        if not self.radioButtonVorhandenJa.isChecked() and not self.radioButtonVorhandenNein.isChecked():
            message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Please mark whether movie is available"))
            return
        if self.radioButtonVorhandenJa.isChecked():
            vorhanden = "x"
        else:
            vorhanden = ""

        if not self.radioButtonGesehenNein.isChecked() and not self.radioButtonGesehenJa.isChecked():
            message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Please mark whether movie has been watched"))
            return
        if self.radioButtonGesehenNein.isChecked():
            gesehen = " "
        else:
            gesehen = "x"
            
        try:
            original = str(self.lineEditNeuOriginal.text()).title().split()
        except:
            message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Error: original title has invalid characters"))
            return
        
        # get rid of double spaces
        original = " ".join(original)

        if len(original) > 256:
            message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Error, original title is longer than 256 characters."))
            return
        if not self.radioButtonCoverJa.isChecked() and not self.radioButtonCoverNein.isChecked():
            message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Please check if image file is a cover"))
            return
        if self.radioButtonVorhandenJa.isChecked() and self.comboBoxDefinition.currentIndex() == 0 and not self.cover_austauschen:
            message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Please select a resolution"))
            return
        if self.radioButtonVorhandenNein.isChecked() and self.comboBoxDefinition.currentIndex() != 0:
            message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Video is not in stock: resolution deleted"))
            self.comboBoxDefinition.setCurrentIndex(0)
        zu_erfassen = []
        if self.korrektur and not self.undo:
            darsteller_liste = self.darsteller.strip().split(", ")
            if not darsteller_liste[0]:
                darsteller_liste = []
            for i in darsteller_liste:
                werte = []
                werte.append(i)
                zu_erfassen.append(["UPDATE pordb_darsteller SET anzahl = anzahl - 1 WHERE darsteller = %s", werte])
            if not self.radioButtonCoverJa.isChecked():
                bilddatei_alt = os.path.join(self.verzeichnis_thumbs, "cd" + str(self.cd_alt), str(bild).rstrip())
                if str(cd) != self.cd_alt:
                    bilddatei_neu = os.path.join(self.verzeichnis_thumbs, "cd" + str(cd), str(bild).rstrip())
                    os.renames(bilddatei_alt, bilddatei_neu)
                else:
                    if self.bilddatei != bilddatei_alt:
                        bilddatei = QtGui.QImage(self.bilddatei).scaled(size, QtCore.Qt.KeepAspectRatio)
                        if bilddatei.save(bilddatei_alt):
                            os.remove(self.bilddatei)
                        else:
                            message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Error saving image file"))
                            return
            werte = []
            werte.append(self.cd_alt)
            werte.append(bild)
            zu_erfassen.append(["DELETE FROM pordb_partner WHERE cd = %s AND bild = %s", werte])
            werte = []
            werte.append(titel)
            werte.append(", ".join(darsteller))
            werte.append(cd)
            werte.append(bild)
            werte.append(gesehen)
            werte.append(original)
            zu_erfassen_zw = "UPDATE pordb_vid SET titel = %s, darsteller = %s, cd = %s, bild = %s, gesehen = %s, original = %s, csf = %s, csh = %s, cst = %s, csc = %s, csx = %s, cso = %s, csv = %s, csb = %s, csa = %s, css = %s, csk = %s, hd = %s, vorhanden = %s, remarks = %s, stars = %s WHERE cd = %s AND bild = %s"
            if self.spinBoxF.value() > 0:
                werte.append(self.spinBoxF.value())
                self.spinBoxK.setValue(0)
            else:
                werte.append(0)
            if self.spinBoxH.value() > 0:
                werte.append(self.spinBoxH.value())
                self.spinBoxK.setValue(0)
            else:
                werte.append(0)
            if self.spinBoxT.value() > 0:
                werte.append(self.spinBoxT.value())
                self.spinBoxK.setValue(0)
            else:
                werte.append(0)
            if self.spinBoxC.value() > 0:
                werte.append(self.spinBoxC.value())
                self.spinBoxK.setValue(0)
            else:
                werte.append(0)
            if self.spinBoxX.value() > 0:
                werte.append(self.spinBoxX.value())
                self.spinBoxK.setValue(0)
            else:
                werte.append(0)
            if self.spinBoxO.value() > 0:
                werte.append(self.spinBoxO.value())
                self.spinBoxK.setValue(0)
            else:
                werte.append(0)
            if self.spinBoxV.value() > 0:
                werte.append(self.spinBoxV.value())
                self.spinBoxK.setValue(0)
            else:
                werte.append(0)
            if self.spinBoxB.value() > 0:
                werte.append(self.spinBoxB.value())
                self.spinBoxK.setValue(0)
            else:
                werte.append(0)
            if self.spinBoxA.value() > 0:
                werte.append(self.spinBoxA.value())
                self.spinBoxK.setValue(0)
            else:
                werte.append(0)
            if self.spinBoxS.value() > 0:
                werte.append(self.spinBoxS.value())
                self.spinBoxK.setValue(0)
            else:
                werte.append(0)
            if self.spinBoxK.value() > 0:
                werte.append(self.spinBoxK.value())
            else:
                werte.append(0)
            if self.comboBoxDefinition.currentIndex() == 0:
                werte.append(None)
            elif self.comboBoxDefinition.currentIndex() == 1:
                werte.append("0")
            elif self.comboBoxDefinition.currentIndex() == 2:
                werte.append("1")
            elif self.comboBoxDefinition.currentIndex() == 3:
                werte.append("2")
            elif self.comboBoxDefinition.currentIndex() == 4:
                werte.append("3")
            elif self.comboBoxDefinition.currentIndex() == 5:
                werte.append("9")
            werte.append(vorhanden)
            werte.append(self.plainTextEditRemarks.toPlainText())
            werte.append(self.set_stars)
            werte.append(self.cd_alt)
            werte.append(bild)
            if self.radioButtonCoverJa.isChecked() and self.cover_austauschen:
                if os.path.exists(os.path.join(self.verzeichnis_thumbs, "cd" + str(self.cd_alt), bild.rstrip())):
                    # Bild war Thumbnail im CD Verzeichnis -> dieses löschen und neues im Cover Verzeichnis anlegen
                    os.remove(os.path.join(self.verzeichnis_thumbs, "cd" + str(self.cd_alt), bild.rstrip()))
                    os.rename(self.bilddatei, os.path.join(self.verzeichnis_cover, self.bild.strip()))
                else:
                    os.rename(self.bilddatei, os.path.join(self.verzeichnis_cover, self.bild.strip()))
        else:
            if self.radioButtonCoverJa.isChecked() and not original:
                message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("When adding a cover you must also enter a movie title"))
                return
            if self.undo:
                bilddatei = QtGui.QImage(os.path.join(self.verzeichnis_trash, bild))
            else:
                if self.radioButtonCoverJa.isChecked():
                    bilddatei = QtGui.QImage(os.path.join(self.verzeichnis, bild))
                else:
                    bilddatei = QtGui.QImage(os.path.join(self.verzeichnis, bild)).scaled(size, QtCore.Qt.KeepAspectRatio)
            if self.radioButtonCoverJa.isChecked():
                newfilename = os.path.join(self.verzeichnis_cover, bild)
            else:
                newfilename = os.path.join(self.verzeichnis_thumbs, "cd" +str(cd), bild)
            # hier klappt noch etwas nicht richtig mit den Partnern, wenn len>256
            if len(bild) > 256 or os.path.exists(newfilename):
                neue_bilddatei = BilddateiUmbenennen(newfilename)
                if neue_bilddatei.exec_():
                    try:
                        bild_alt = os.path.join(self.verzeichnis, bild)
                        bild_neu = os.path.join(self.verzeichnis, neue_bilddatei.lineEditDateiname.text())
                        os.rename(bild_alt, bild_neu)
                        newfilename = os.path.join(os.path.dirname(newfilename), neue_bilddatei.lineEditDateiname.text())
                        bild = neue_bilddatei.lineEditDateiname.text()
                        titel = str(bild.split('.')[0])
                    except:
                        message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Error on renaming image file"))
                        return
                else:
                    return
            else:
                if not os.path.exists(os.path.dirname(newfilename)):
                    os.mkdir(os.path.dirname(newfilename))
            if bilddatei.save(newfilename):
                if not self.undo:
                    os.remove(os.path.join(self.verzeichnis, str(bild)))
            else:
                message = QtGui.QMessageBox.critical(self, self.trUtf8("Error "), self.trUtf8("Error saving image file"))
                return
            werte = []
            werte.append("pordb_vid_primkey_seq")
            zu_lesen = "SELECT nextval(%s)"
            self.lese_func = DBLesen(self, zu_lesen, werte)
            res = DBLesen.get_data(self.lese_func)
            werte = []
            werte.append(titel)
            werte.append(", ".join(darsteller))
            werte.append(cd)
            werte.append(bild)
            werte.append(gesehen)
            werte.append(original)
            werte.append("")
            werte.append(vorhanden)
            werte.append(res[0][0])
            zu_erfassen_zw = "INSERT INTO pordb_vid VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
            if self.spinBoxF.value() > 0:
                cs = self.spinBoxF.value()
            else:
                cs = 0
            werte.append(cs)
            
            if self.spinBoxH.value() > 0:
                cs = self.spinBoxH.value()
            else:
                cs = 0
            werte.append(cs)
            
            if self.spinBoxT.value() > 0:
                cs = self.spinBoxT.value()
            else:
                cs = 0
            werte.append(cs)
            
            if self.spinBoxC.value() > 0:
                cs = self.spinBoxC.value()
            else:
                cs = 0
            werte.append(cs)
            
            if self.spinBoxX.value() > 0:
                cs = self.spinBoxX.value()
            else:
                cs = 0
            werte.append(cs)
            
            if self.spinBoxO.value() > 0:
                cs = self.spinBoxO.value()
            else:
                cs = 0
            werte.append(cs)
            
            if self.spinBoxV.value() > 0:
                cs = self.spinBoxV.value()
            else:
                cs = 0
            werte.append(cs)
            
            if self.spinBoxB.value() > 0:
                cs = self.spinBoxB.value()
            else:
                cs = 0
            werte.append(cs)
            
            if self.spinBoxA.value() > 0:
                cs = self.spinBoxA.value()
            else:
                cs = 0
            werte.append(cs)
            
            if self.spinBoxS.value() > 0:
                cs = self.spinBoxS.value()
            else:
                cs = 0
            werte.append(cs)
            
            if self.spinBoxK.value() > 0:
                cs = self.spinBoxK.value()
            else:
                cs = 0
            werte.append(cs)
                
            if self.comboBoxDefinition.currentIndex() == 0:
                werte.append(None)
            elif self.comboBoxDefinition.currentIndex() == 1:
                werte.append("0")
            elif self.comboBoxDefinition.currentIndex() == 2:
                werte.append("1")
            elif self.comboBoxDefinition.currentIndex() == 3:
                werte.append("2")
            elif self.comboBoxDefinition.currentIndex() == 4:
                werte.append("3")
            elif self.comboBoxDefinition.currentIndex() == 5:
                werte.append("9")
                
            werte.append(self.plainTextEditRemarks.toPlainText())
            werte.append(self.set_stars)
            
        zu_erfassen.append([zu_erfassen_zw, werte])
            
        for i in darsteller:
            if i.lstrip() == "" or i.lstrip() == "?":
                continue
            werte = []
            werte.append(i)
            zu_erfassen.append(["UPDATE pordb_darsteller SET anzahl = anzahl + 1 WHERE darsteller = %s", werte])
            if i == "" or i == "?" or i == "(Uninteressant)" or i == "(Komplett)" or i == "(Schlechte Qualitaet)":
                continue
            zu_erfassen.append(["DELETE FROM pordb_darsteller100 WHERE darsteller = %s", werte])
            zu_erfassen.append(["INSERT INTO pordb_darsteller100 (darsteller) VALUES (%s)", werte])
            
            partner_zaehler = 0
            if i.strip() != "(Uninteressant)" and i.strip() != "Defekt":
                zu_lesen = "SELECT sex FROM pordb_darsteller WHERE darsteller = %s"
                self.lese_func = DBLesen(self, zu_lesen, i)
                res = DBLesen.get_data(self.lese_func)
                geschlecht = res[0][0]
                for j in darsteller:
                    if j.strip() != "(Uninteressant)" and j.strip() != "Defekt" and i != j:
                        zu_lesen = "SELECT sex FROM pordb_darsteller WHERE darsteller = %s"
                        self.lese_func = DBLesen(self, zu_lesen, j)
                        res2 = DBLesen.get_data(self.lese_func)
                        geschlecht2 = res2[0][0]
                        if geschlecht != geschlecht2:
                            werte = []
                            werte.append(i)
                            werte.append(j)
                            werte.append(cd)
                            werte.append(bild)
                            zu_erfassen.append(["INSERT INTO pordb_partner VALUES (%s, %s, %s, %s)", werte])
                            zu_lesen = "SELECT darsteller FROM pordb_partner WHERE darsteller = %s AND partner = %s"
                            self.lese_func = DBLesen(self, zu_lesen, (i, j))
                            res3 = DBLesen.get_data(self.lese_func)
                            if not res3:
                                partner_zaehler += 1
                            
            if partner_zaehler > 0:
                werte = []
                werte.append(partner_zaehler)
                werte.append(i)
                zu_erfassen.append(["UPDATE pordb_darsteller SET partner = partner + %s WHERE darsteller = %s", werte])
                
        zu_lesen = "SELECT * FROM pordb_darsteller100"
        self.lese_func = DBLesen(self, zu_lesen)
        res1 = DBLesen.get_data(self.lese_func)
        anzahl_loeschen = len(res1) - 200
        if anzahl_loeschen > 0:
            res1.sort()
            for zaehler in range(anzahl_loeschen):
                werte = []
                werte.append(str(res1[zaehler][0]))
                zu_erfassen.append(["DELETE FROM pordb_darsteller100 WHERE nr = %s", werte])
        if not self.korrektur:
            werte = []
            werte.append(titel)
            werte.append(", ".join(darsteller))
            werte.append(cd)
            werte.append(original)
            zu_erfassen.append(["UPDATE pordb_vid_neu SET titel = %s, darsteller = %s, cd = %s, original = %s", werte])
        
        update_func = DBUpdate(self, zu_erfassen)
        DBUpdate.update_data(update_func)
        
        if self.original_weitere:
            zu_erfassen = []
            if self.korrektur:
                zu_lesen = "SELECT primkey FROM pordb_vid WHERE cd = %s AND bild = %s"
                self.lese_func = DBLesen(self, zu_lesen, (str(self.cd_alt), str(bild)))
                curr_key = DBLesen.get_data(self.lese_func)
                werte = []
                werte.append(str(curr_key[0][0]))
                zu_erfassen.append(["DELETE FROM pordb_original WHERE foreign_key_pordb_vid = %s", werte])
            else:
                zu_lesen = "SELECT primkey FROM pordb_vid WHERE cd = %s AND bild = %s"
                self.lese_func = DBLesen(self, zu_lesen, (str(cd), bild))
                curr_key = DBLesen.get_data(self.lese_func)
            for i in self.original_weitere:
                if i:
                    if type(i) == str:
                        werte = []
                        werte.append(i.title())
                        werte.append(str(curr_key[0][0]))
                        zu_erfassen.append(["INSERT INTO pordb_original (original, foreign_key_pordb_vid) VALUES (%s, %s)", werte])
                    else:
                        werte = []
                        werte.append(i.decode().title())
                        werte.append(str(curr_key[0][0]))
                        zu_erfassen.append(["INSERT INTO pordb_original (original, foreign_key_pordb_vid) VALUES (%s, %s)", werte])
                    
            update_func = DBUpdate(self, zu_erfassen)
            DBUpdate.update_data(update_func)
        
        self.close()
        QtGui.QDialog.accept(self)