Exemple #1
0
 def changeFile(self, _filePath, _isNew=False):
     self.fileValues = fu.readTextFile(_filePath, uni.MySettings["fileSystemEncoding"])
     self.setWindowTitle(str(fu.getBaseName(self.fileValues["path"])))
     if self.pnlClearable is not None:
         clearAllChildren(self.pnlClearable, True)
     self.pnlClearable = MWidget()
     self.vblMain.insertWidget(0, self.pnlClearable, 20)
     vblClearable = MVBoxLayout(self.pnlClearable)
     self.infoLabels["path"] = MLabel(self.labels[0])
     self.infoLabels["content"] = MLabel(self.labels[1])
     dirPath = fu.getDirName(self.fileValues["path"])
     baseName = fu.getBaseName(self.fileValues["path"])
     self.infoValues["path"] = MLineEdit(str(fu.joinPath(dirPath, Organizer.emend(baseName, "file"))))
     self.infoValues["content"] = MPlainTextEdit(
         str(Organizer.emend(self.fileValues["content"], "text", False, True)))
     self.infoValues["content"].setLineWrapMode(MPlainTextEdit.NoWrap)
     self.sourceCharSet = MComboBox()
     self.sourceCharSet.addItems(uni.getCharSets())
     self.sourceCharSet.setCurrentIndex(self.sourceCharSet.findText(uni.MySettings["fileSystemEncoding"]))
     MObject.connect(self.sourceCharSet, SIGNAL("currentIndexChanged(int)"), self.sourceCharSetChanged)
     HBOXs = []
     HBOXs.append(MHBoxLayout())
     HBOXs[-1].addWidget(self.infoLabels["path"])
     HBOXs[-1].addWidget(self.infoValues["path"])
     HBOXs[-1].addWidget(self.sourceCharSet)
     for hbox in HBOXs:
         vblClearable.addLayout(hbox)
     vblClearable.addWidget(self.infoLabels["content"])
     vblClearable.addWidget(self.infoValues["content"])
    def refreshTable(self, _path):
        self.values = []
        fileAndDirectoryNames = fu.readDirectory(_path, "fileAndDirectory",
                                                 uni.getBoolValue("isShowHiddensInFolderTable"))
        allItemNumber = len(fileAndDirectoryNames)
        uni.startThreadAction()
        baseNameOfDirectory = fu.getBaseName(_path)
        rowNo = 0
        self.setRowCount(allItemNumber)
        for baseName in fileAndDirectoryNames:
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isReadableFileOrDir(fu.joinPath(_path, baseName), False, True):
                        details = fu.getExtendedDetails(fu.joinPath(_path, baseName))
                        content = {}
                        content["path"] = fu.joinPath(_path, baseName)
                        content["baseNameOfDirectory"] = baseNameOfDirectory
                        content["baseName"] = baseName
                        content.update(details)
                        self.values.append(content)

                        newBaseNameOfDirectory = Organizer.emend(content["baseNameOfDirectory"], "directory")
                        self.createItem(rowNo, "baseNameOfDirectory", newBaseNameOfDirectory,
                                        content["baseNameOfDirectory"])

                        newBaseName = Organizer.emend(content["baseName"], fu.getObjectType(self.values[rowNo]["path"]))
                        self.createItem(rowNo, "baseName", newBaseName, content["baseName"])

                        self.createItem(rowNo, "size", Organizer.getCorrectedFileSize(content["size"]))

                        self.createItem(rowNo, "lastAccessed", Organizer.getCorrectedTime(content["lastAccessed"]))

                        self.createItem(rowNo, "lastModified", Organizer.getCorrectedTime(content["lastModified"]))

                        self.createItem(rowNo, "lastMetadataChanged",
                                        Organizer.getCorrectedTime(content["lastMetadataChanged"]))

                        if not uni.isWindows:
                            self.createItem(rowNo, "accessRights", content["accessRights"])

                            self.createItem(rowNo, "userIDOfOwner", content["userIDOfOwner"])

                            self.createItem(rowNo, "groupIDOfOwner", content["groupIDOfOwner"])

                            self.createItem(rowNo, "numberOfHardLinks", content["numberOfHardLinks"])

                        rowNo += 1
                    else:
                        allItemNumber -= 1
                except:
                    ReportBug.ReportBug()
                    allItemNumber -= 1
            else:
                allItemNumber = rowNo
            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
Exemple #3
0
 def emendDirectoryWithContents(self):
     try:
         _path = self.checkSource(str(QuickMakeParameters[1]), "directory")
         if _path is not None:
             if uni.getBoolValue("isShowQuickMakeWindow"):
                 newEmendedName = str(self.leNewValue.text())
             else:
                 newEmendedName = Organizer.emend(_path, fu.getObjectType(_path))
             fu.activateSmartCheckIcon()
             oldFileName = _path
             newDirName = fu.moveOrChange(oldFileName, newEmendedName, "directory")
             if newDirName != oldFileName:
                 fileAndDirectoryNames = fu.readDirectory(newDirName, "fileAndDirectory")
                 for fileAndDirs in fileAndDirectoryNames:
                     objectType = fu.getObjectType(fu.joinPath(newDirName, fileAndDirs))
                     fu.moveOrChange(fu.joinPath(newDirName, fileAndDirs),
                                     fu.joinPath(newDirName, Organizer.emend(fileAndDirs, objectType)), objectType)
                 if uni.isActiveDirectoryCover and uni.getBoolValue(
                     "isActiveAutoMakeIconToDirectory") and uni.getBoolValue(
                     "isAutoMakeIconToDirectoryWhenFileMove"):
                     fu.checkIcon(newDirName)
                 if fu.isDir(newDirName):
                     fu.completeSmartCheckIcon()
                 Dialogs.show(translate("QuickMake", "Directory And Contents Emended"),
                              str(translate("QuickMake",
                                            "\"%s\" is emended based on the criteria you set.This directory is \"%s\" now.")) %
                              (Organizer.getLink(_path), Organizer.getLink(newDirName)))
         self.close()
     except:
         ReportBug.ReportBug()
 def correctTable(self):
     for rowNo in range(self.rowCount()):
         for coloumKey in self.getWritableColumnKeys():
             coloumNo = self.getColumnNoFromKey(coloumKey)
             if self.isChangeableItem(rowNo, coloumKey):
                 if coloumKey == "baseNameOfDirectory":
                     newString = Organizer.emend(str(self.item(rowNo, coloumNo).text()), "directory")
                 else:
                     newString = Organizer.emend(str(self.item(rowNo, coloumNo).text()), "file")
                 self.item(rowNo, coloumNo).setText(str(newString))
 def correctTable(self):
     for rowNo in range(self.rowCount()):
         for coloumKey in self.getWritableColumnKeys():
             coloumNo = self.getColumnNoFromKey(coloumKey)
             if self.isChangeableItem(rowNo, coloumKey):
                 newString = None
                 if coloumKey == "correctedArtist":
                     newString = Organizer.emend(str(self.item(rowNo, coloumNo).text()))
                 self.item(rowNo, coloumNo).setText(str(newString))
Exemple #6
0
    def createWindow(self, _actionName, _makeThisAction, _isShowEmendWidgets):
        from Options import OptionsForm

        newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys
        wOptionsPanel = OptionsForm.OptionsForm(None, QuickMakeParameters[0], None, newOrChangedKeys)
        if MyDialogType == "MDialog":
            if isActivePyKDE4:
                self.setButtons(MyDialog.NoDefault)
        elif MyDialogType == "MMainWindow":
            self.setObjectName("Packager")
            setMainWindow(self)
        self.setWindowTitle(_actionName)
        pnlMain = MWidget(self)
        vblMain = MVBoxLayout(pnlMain)
        pnlInfo = MWidget()
        vblInfo = MVBoxLayout(pnlInfo)
        vblInfo.addStretch(3)
        if _isShowEmendWidgets:
            lblOldValue = MLabel(translate("QuickMake", "Old Value : "))
            lblNewValue = MLabel(translate("QuickMake", "New Value : "))
            leOldValue = MLineEdit(str(fu.getRealPath(QuickMakeParameters[1])))
            leOldValue.setEnabled(False)
            self.leNewValue = MLineEdit(str(Organizer.emend(fu.getRealPath(QuickMakeParameters[1]),
                                                            fu.getObjectType(fu.getRealPath(QuickMakeParameters[1])))))
            vblInfo.addWidget(lblOldValue)
            vblInfo.addWidget(leOldValue)
            vblInfo.addWidget(lblNewValue)
            vblInfo.addWidget(self.leNewValue)
        else:
            lblValue = MLabel(translate("QuickMake", "Value : "))
            leValue = MLineEdit(str(fu.getRealPath(QuickMakeParameters[1])))
            leValue.setEnabled(False)
            vblInfo.addWidget(lblValue)
            vblInfo.addWidget(leValue)
        vblInfo.addStretch(3)
        pbtnApply = MPushButton(_actionName)
        pbtnClose = MPushButton(translate("QuickMake", "Cancel"))
        MObject.connect(pbtnApply, SIGNAL("clicked()"), _makeThisAction)
        MObject.connect(pbtnClose, SIGNAL("clicked()"), self.close)
        tabwTabs = MTabWidget()
        tabwTabs.addTab(pnlInfo, translate("QuickMake", "Quick Make"))
        tabwTabs.addTab(wOptionsPanel, translate("QuickMake", "Quick Make Options"))
        vblMain.addWidget(tabwTabs)
        hblBox = MHBoxLayout()
        hblBox.addWidget(pbtnClose, 2)
        hblBox.addWidget(pbtnApply, 3)
        vblInfo.addLayout(hblBox)
        if MyDialogType == "MDialog":
            if isActivePyKDE4:
                self.setMainWidget(pnlMain)
            else:
                self.setLayout(vblMain)
        elif MyDialogType == "MMainWindow":
            self.setCentralWidget(pnlMain)
            moveToCenter(self)
        self.setMinimumSize(450, 350)
 def fillValues(self):
     filePath = str(self.leFilePath.text())
     if fu.isFile(filePath) and fu.isReadableFileOrDir(filePath):
         self.fileValues = fu.readTextFile(filePath, str(self.sourceCharSet.currentText()))
         self.pteFileContent.setPlainText(str(Organizer.emend(self.fileValues["content"], "text", False, True)))
         self.isChangeSourceCharSetChanged = True
         self.pbtnSave.setEnabled(True)
     else:
         self.isChangeSourceCharSetChanged = False
         self.pbtnSave.setEnabled(False)
Exemple #8
0
 def sourceCharSetChanged(self):
     try:
         self.fileValues = fu.readTextFile(self.fileValues["path"], str(self.sourceCharSet.currentText()))
         self.infoValues["content"].setPlainText(
             str(Organizer.emend(self.fileValues["content"], "text", False, True)))
     except:
         Dialogs.showError(translate("TextDetails", "Incorrect File Encoding"),
                           str(translate("TextDetails",
                                         "File can not decode by \"%s\" codec.<br>Please select another file encoding type.")
                           ) % str(self.sourceCharSet.currentText()))
Exemple #9
0
 def fillValues(self):
     filePath = str(self.leFilePath.text())
     if fu.isFile(filePath) and fu.isReadableFileOrDir(filePath):
         self.fileValues = fu.readTextFile(
             filePath, str(self.sourceCharSet.currentText()))
         self.pteFileContent.setPlainText(
             str(
                 Organizer.emend(self.fileValues["content"], "text", False,
                                 True)))
         self.isChangeSourceCharSetChanged = True
         self.pbtnSave.setEnabled(True)
     else:
         self.isChangeSourceCharSetChanged = False
         self.pbtnSave.setEnabled(False)
Exemple #10
0
 def emendDirectory(self):
     try:
         _path = self.checkSource(str(QuickMakeParameters[1]), "directory")
         if _path is not None:
             if uni.getBoolValue("isShowQuickMakeWindow"):
                 newEmendedName = str(self.leNewValue.text())
             else:
                 newEmendedName = Organizer.emend(_path, fu.getObjectType(_path))
             oldFileName = _path
             newDirName = fu.moveOrChange(oldFileName, newEmendedName, "directory")
             if newDirName != oldFileName:
                 Dialogs.show(translate("QuickMake", "Directory Emended"),
                              str(translate("QuickMake",
                                            "\"%s\" is emended based on the criteria you set.This directory is \"%s\" now.")) %
                              (Organizer.getLink(_path), Organizer.getLink(newDirName)))
         self.close()
     except:
         ReportBug.ReportBug()
    def refreshTable(self, _path):
        self.values = []
        uni.startThreadAction()
        Dialogs.showState(translate("AmarokArtistTable", "Getting Values From Amarok"), 0, 1)
        if Amarok.checkAmarok():
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                artistValues = Operations.getAllArtistsValues(uni.MySettings[self.amarokFilterKeyName])
                Dialogs.showState(translate("AmarokArtistTable", "Values Are Being Processed"), 1, 1)
                isContinueThreadAction = uni.isContinueThreadAction()
                if isContinueThreadAction:
                    if artistValues is not None:
                        allItemNumber = len(artistValues)
                        self.setRowCount(allItemNumber)
                        rowNo = 0
                        for musicFileRow in artistValues:
                            isContinueThreadAction = uni.isContinueThreadAction()
                            if isContinueThreadAction:
                                try:
                                    content = {}
                                    content["id"] = musicFileRow["id"]
                                    content["currentArtist"] = musicFileRow["name"]
                                    content["correctedArtist"] = musicFileRow["name"]
                                    self.values.append(content)

                                    currentName = content["currentArtist"]
                                    self.createItem(rowNo, "currentArtist", currentName, currentName, True)

                                    newName = Organizer.emend(content["correctedArtist"])
                                    isReadOnlyNewName = (content["correctedArtist"].strip() == "")
                                    self.createItem(rowNo, "correctedArtist", newName, content["currentArtist"],
                                                    isReadOnlyNewName)
                                    rowNo += 1
                                except:
                                    ReportBug.ReportBug()
                                    allItemNumber -= 1
                            else:
                                allItemNumber = rowNo
                            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
                            if isContinueThreadAction is False:
                                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
 def changeArtist(self, _artistId, _isNew=False):
     self.artistId = _artistId
     self.songTableContentValues = None
     uni.startThreadAction()
     Dialogs.showState(translate("AmarokArtistDetails", "Getting Values From Amarok"), 0, 1)
     if Amarok.checkAmarok():
         isContinueThreadAction = uni.isContinueThreadAction()
         if isContinueThreadAction:
             self.artistName = Commands.getArtistName(self.artistId)
             self.songTableContentValues = Operations.getAllMusicFileValuesWithNames("", self.artistId)
             Dialogs.showState(translate("MusicDetails", "Values Are Being Processed"), 1, 1)
     uni.finishThreadAction()
     if self.songTableContentValues is None:
         self.close()
     self.setWindowTitle(str(self.artistName))
     if self.pnlClearable is not None:
         clearAllChildren(self.pnlClearable, True)
     self.pnlClearable = MWidget()
     self.vblMain.insertWidget(0, self.pnlClearable, 20)
     vblClearable = MVBoxLayout(self.pnlClearable)
     self.infoLabels["currentArtist"] = MLabel(self.labels[0])
     self.infoLabels["correctedArtist"] = MLabel(self.labels[1])
     self.infoValues["currentArtist"] = MLineEdit(str(self.artistName))
     self.infoValues["correctedArtist"] = MLineEdit(str(Organizer.emend(self.artistName)))
     self.twSongs = MTableWidget()
     self.twSongs.clear()
     self.twSongs.setColumnCount(len(self.songTableColumns))
     self.twSongs.setHorizontalHeaderLabels(self.songTableColumns)
     self.twSongs.setRowCount(len(self.songTableContentValues))
     for rowNo in range(self.twSongs.rowCount()):
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["filePath"]))
         self.twSongs.setItem(rowNo, 0, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["artist"]))
         self.twSongs.setItem(rowNo, 1, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["title"]))
         self.twSongs.setItem(rowNo, 2, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["album"]))
         self.twSongs.setItem(rowNo, 3, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["albumArtist"]))
         self.twSongs.setItem(rowNo, 4, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["trackNumber"]))
         self.twSongs.setItem(rowNo, 5, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["year"]))
         self.twSongs.setItem(rowNo, 6, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["genre"]))
         self.twSongs.setItem(rowNo, 7, item)
         item = MTableWidgetItem(str(self.songTableContentValues[rowNo]["comment"]))
         self.twSongs.setItem(rowNo, 8, item)
         for x in range(self.twSongs.columnCount()):
             self.twSongs.item(rowNo, x).setFlags(Mt.ItemIsSelectable | Mt.ItemIsEnabled)
     HBOXs = []
     HBOXs.append(MHBoxLayout())
     HBOXs[-1].addWidget(self.infoLabels["currentArtist"])
     HBOXs[-1].addWidget(self.infoValues["currentArtist"])
     HBOXs.append(MHBoxLayout())
     HBOXs[-1].addWidget(self.infoLabels["correctedArtist"])
     HBOXs[-1].addWidget(self.infoValues["correctedArtist"])
     vblInfos = MVBoxLayout()
     for hbox in HBOXs:
         vblInfos.addLayout(hbox)
     vblInfos.addWidget(self.twSongs)
     vblClearable.addLayout(vblInfos)
Exemple #13
0
    def refreshTable(self, _path):
        self.values = []
        allFilesAndDirectories = fu.readDirectoryWithSubDirectoriesThread(
            _path, int(uni.MySettings["CoversSubDirectoryDeep"]), "directory",
            uni.getBoolValue("isShowHiddensInCoverTable"))
        allItemNumber = len(allFilesAndDirectories)
        uni.startThreadAction()
        rowNo = 0
        self.setRowCount(allItemNumber)
        for dirName in allFilesAndDirectories:
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isReadableFileOrDir(
                            dirName, False, True) and fu.isReadableFileOrDir(
                                fu.joinPath(dirName, ".directory"), False,
                                True):
                        content = {}
                        content["path"] = dirName
                        content["baseNameOfDirectory"] = str(
                            str(fu.getBaseName(_path)) +
                            str(fu.getDirName(dirName)).replace(_path, ""))
                        content["baseName"] = fu.getBaseName(dirName)

                        currentCover, isCorrectedFileContent = fu.getIconFromDirectory(
                            dirName)
                        selectedName = None
                        if isCorrectedFileContent and currentCover is not None:
                            selectedName = fu.getBaseName(currentCover)
                        sourceCover = fu.getFirstImageInDirectory(
                            dirName, selectedName, False, False)
                        if currentCover is None:
                            currentCover = ""
                        if sourceCover is None:
                            sourceCover = ""
                        else:
                            sourceCover = fu.joinPath(dirName, sourceCover)
                        content["currentCover"] = (currentCover)
                        content["sourceCover"] = (sourceCover)
                        content["destinationCover"] = (sourceCover)
                        content["isCorrectedFileContent"] = (
                            isCorrectedFileContent)
                        self.values.append(content)

                        newBaseNameOfDirectory = Organizer.emend(
                            self.values[rowNo]["baseNameOfDirectory"],
                            "directory")
                        self.createItem(
                            rowNo, "baseNameOfDirectory",
                            newBaseNameOfDirectory,
                            self.values[rowNo]["baseNameOfDirectory"])

                        newBaseName = Organizer.emend(
                            self.values[rowNo]["baseName"], "directory")
                        self.createItem(rowNo, "baseName", newBaseName,
                                        self.values[rowNo]["baseName"])

                        newCurrentCover = str(
                            self.values[rowNo]["currentCover"])
                        newCurrentCover = newCurrentCover.replace(
                            self.values[rowNo]["path"], ".")
                        itemCurrentCover = self.createItem(
                            rowNo, "currentCover", newCurrentCover,
                            newCurrentCover, True)
                        if self.values[rowNo][
                                "isCorrectedFileContent"] is False:
                            itemCurrentCover.setBackground(
                                MBrush(MColor(255, 163, 163)))

                        newSourceCover = str(self.values[rowNo]["sourceCover"])
                        newSourceCover = newSourceCover.replace(
                            self.values[rowNo]["path"], ".")
                        oldSourceCover = self.values[rowNo]["currentCover"]
                        oldSourceCover = oldSourceCover.replace(
                            self.values[rowNo]["path"], ".")
                        self.createItem(rowNo, "sourceCover", newSourceCover,
                                        oldSourceCover)

                        newDestinationCover = self.values[rowNo][
                            "destinationCover"]
                        newDestinationCover = newDestinationCover.replace(
                            self.values[rowNo]["path"], ".")
                        newDestinationCover = Organizer.emend(
                            newDestinationCover, "file")
                        oldDestinationCover = self.values[rowNo][
                            "currentCover"]
                        oldDestinationCover = oldDestinationCover.replace(
                            self.values[rowNo]["path"], ".")
                        self.createItem(rowNo, "destinationCover",
                                        newDestinationCover,
                                        oldDestinationCover)
                        rowNo += 1
                    else:
                        allItemNumber -= 1
                except:
                    ReportBug.ReportBug()
                    allItemNumber -= 1
            else:
                allItemNumber = rowNo
            Dialogs.showState(translate("Tables", "Generating Table..."),
                              rowNo, allItemNumber, True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        self.setRowCount(len(
            self.values))  # In case of Non Readable Files and Canceled process
    def refreshTable(self, _path):
        self.values = []
        uni.startThreadAction()
        import Amarok

        Dialogs.showState(translate("AmarokMusicTable", "Getting Values From Amarok"), 0, 1)
        if Amarok.checkAmarok():
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                from Amarok import Operations

                directoriesAndValues = Operations.getDirectoriesAndValues(uni.MySettings[self.amarokFilterKeyName])
                Dialogs.showState(translate("AmarokMusicTable", "Values Are Being Processed"), 1, 1)
                isContinueThreadAction = uni.isContinueThreadAction()
                if isContinueThreadAction:
                    if directoriesAndValues is not None:
                        allItemNumber = len(directoriesAndValues)
                        self.setRowCount(allItemNumber)
                        rowNo = 0
                        for dirPath, dirRow in directoriesAndValues.items():
                            isContinueThreadAction = uni.isContinueThreadAction()
                            if isContinueThreadAction:
                                try:
                                    if fu.isReadableFileOrDir(dirPath, False, True) and fu.isReadableFileOrDir(
                                        fu.joinPath(dirPath, ".directory"), False, True):
                                        content = {}
                                        content["path"] = dirPath
                                        content["pathOfParentDirectory"] = fu.getDirName(dirPath)
                                        content["baseName"] = fu.getBaseName(dirPath)
                                        currentCover, isCorrectedFileContent = fu.getIconFromDirectory(dirPath)
                                        if currentCover is None:
                                            currentCover = ""
                                        content["currentCover"] = (currentCover)
                                        content["sourceCover"] = (dirRow["coverPath"][0].replace(dirPath, "."))
                                        content["destinationCover"] = ("./" + Organizer.getIconName(
                                            dirRow["artist"][0],
                                            dirRow["album"][0],
                                            dirRow["genre"][0],
                                            dirRow["year"][0]))
                                        content["flagColor"] = {}
                                        if isCorrectedFileContent is False:
                                            content["flagColor"]["currentCover"] = 255, 163, 163
                                        if fu.isFile(content["sourceCover"]) is False:
                                            content["flagColor"]["sourceCover"] = 255, 163, 163
                                        self.values.append(content)

                                        newPathOfParentDirectory = Organizer.emend(
                                            self.values[rowNo]["pathOfParentDirectory"], "directory")
                                        self.createItem(rowNo, "pathOfParentDirectory", newPathOfParentDirectory,
                                                        self.values[rowNo]["pathOfParentDirectory"])

                                        newBaseName = Organizer.emend(self.values[rowNo]["baseName"], "directory")
                                        self.createItem(rowNo, "pathOfParentDirectory", newBaseName,
                                                        self.values[rowNo]["baseName"])

                                        newCurrentCover = fu.getShortPath(self.values[rowNo]["currentCover"],
                                                                          self.values[rowNo]["path"])
                                        itemCurrentCover = self.createItem(rowNo, "currentCover", newCurrentCover,
                                                                           newCurrentCover, True)
                                        self.setItemColor(itemCurrentCover, rowNo, 2, "currentCover")

                                        newSourceCover = fu.getShortPath(self.values[rowNo]["sourceCover"],
                                                                         self.values[rowNo]["path"])
                                        itemSourceCover = self.createItem(rowNo, "sourceCover", newSourceCover,
                                                                          fu.getShortPath(
                                                                              self.values[rowNo]["currentCover"],
                                                                              self.values[rowNo]["path"]))
                                        self.setItemColor(itemSourceCover, rowNo, 3, "sourceCover")

                                        newDestinationCover = Organizer.emend(
                                            fu.getShortPath(self.values[rowNo]["destinationCover"],
                                                            self.values[rowNo]["path"]), "file")
                                        itemDestinationCover = self.createItem(rowNo, "destinationCover",
                                                                               newDestinationCover,
                                                                               fu.getShortPath(
                                                                                   self.values[rowNo]["currentCover"],
                                                                                   self.values[rowNo]["path"]))
                                        self.setItemColor(itemDestinationCover, rowNo, 4, "destinationCover")
                                        rowNo += 1
                                    else:
                                        allItemNumber -= 1
                                except:
                                    ReportBug.ReportBug()
                                    allItemNumber -= 1
                            else:
                                allItemNumber = rowNo
                            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
                            if isContinueThreadAction is False:
                                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
    def refreshTable(self, _path):
        self.values = []
        self.setColumnWidth(6, 70)
        self.setColumnWidth(7, 40)
        uni.startThreadAction()
        import Amarok

        Dialogs.showState(translate("AmarokMusicTable", "Getting Values From Amarok"), 0, 1)
        if Amarok.checkAmarok():
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                from Amarok import Operations

                musicFileValuesWithNames = Operations.getAllMusicFileValuesWithNames(
                    uni.MySettings[self.amarokFilterKeyName])
                Dialogs.showState(translate("AmarokMusicTable", "Values Are Being Processed"), 1, 1)
                isContinueThreadAction = uni.isContinueThreadAction()
                if isContinueThreadAction:
                    if musicFileValuesWithNames is not None:
                        allItemNumber = len(musicFileValuesWithNames)
                        self.setRowCount(allItemNumber)
                        rowNo = 0
                        for musicFileRow in musicFileValuesWithNames:
                            isContinueThreadAction = uni.isContinueThreadAction()
                            if isContinueThreadAction:
                                try:
                                    if (fu.isFile(musicFileRow["filePath"]) and
                                            fu.isReadableFileOrDir(musicFileRow["filePath"], False, True)):
                                        details = fu.getDetails(musicFileRow["filePath"])
                                        content = {}
                                        if Amarok.getSelectedTagSourseType("AmarokCopyTable") == "Amarok (Smart)":
                                            content["path"] = musicFileRow["filePath"]
                                            content["baseNameOfDirectory"] = fu.getBaseName(
                                                fu.getDirName(musicFileRow["filePath"]))
                                            content["baseName"] = fu.getBaseName(musicFileRow["filePath"])
                                            content["artist"] = musicFileRow["artist"]
                                            content["title"] = musicFileRow["title"]
                                            content["album"] = musicFileRow["album"]
                                            content["albumArtist"] = musicFileRow["albumArtist"]
                                            content["trackNum"] = musicFileRow["trackNumber"]
                                            content["year"] = musicFileRow["year"]
                                            content["genre"] = musicFileRow["genre"]
                                            content["firstComment"] = musicFileRow["comment"]
                                            content["firstLyrics"] = musicFileRow["lyrics"]
                                            tagger = Taggers.getTagger()
                                            try:
                                                tagger.loadFile(musicFileRow["filePath"])
                                            except:
                                                if tagger.isSupportInfo:
                                                    content["length"] = ""
                                                    content["bitrate"] = ""
                                                    content["sampleRate"] = ""
                                                    content["mode"] = ""
                                            else:
                                                if content["artist"].strip() == "":
                                                    content["artist"] = tagger.getArtist()
                                                if content["title"].strip() == "":
                                                    content["title"] = tagger.getTitle()
                                                if content["album"].strip() == "":
                                                    content["album"] = tagger.getAlbum()
                                                if content["albumArtist"].strip() == "":
                                                    content["albumArtist"] = tagger.getAlbumArtist()
                                                if str(content["trackNum"]).strip() == "":
                                                    content["trackNum"] = tagger.getTrackNum()
                                                if str(content["year"]).strip() == "":
                                                    content["year"] = tagger.getYear()
                                                if content["genre"].strip() == "":
                                                    content["genre"] = tagger.getGenre()
                                                if content["firstComment"].strip() == "":
                                                    content["firstComment"] = tagger.getFirstComment()
                                                if content["firstLyrics"].strip() == "":
                                                    content["firstLyrics"] = tagger.getFirstLyrics()
                                                if tagger.isSupportInfo:
                                                    content["length"] = tagger.getLength()
                                                    content["bitrate"] = tagger.getBitrate()
                                                    content["sampleRate"] = tagger.getSampleRate()
                                                    content["mode"] = tagger.getMode()
                                        elif Amarok.getSelectedTagSourseType("AmarokCopyTable") == "Only Amarok":
                                            content["path"] = musicFileRow["filePath"]
                                            content["baseNameOfDirectory"] = ""
                                            content["baseName"] = fu.getBaseName(musicFileRow["filePath"])
                                            content["artist"] = musicFileRow["artist"]
                                            content["title"] = musicFileRow["title"]
                                            content["album"] = musicFileRow["album"]
                                            content["albumArtist"] = musicFileRow["albumArtist"]
                                            content["trackNum"] = musicFileRow["trackNumber"]
                                            content["year"] = musicFileRow["year"]
                                            content["genre"] = musicFileRow["genre"]
                                            content["firstComment"] = musicFileRow["comment"]
                                            content["firstLyrics"] = musicFileRow["lyrics"]
                                            tagger = Taggers.getTagger()
                                            if tagger.isSupportInfo:
                                                try:
                                                    tagger.loadFile(musicFileRow["filePath"])
                                                except:
                                                    content["length"] = ""
                                                    content["bitrate"] = ""
                                                    content["sampleRate"] = ""
                                                    content["mode"] = ""
                                                else:
                                                    content["length"] = tagger.getLength()
                                                    content["bitrate"] = tagger.getBitrate()
                                                    content["sampleRate"] = tagger.getSampleRate()
                                                    content["mode"] = tagger.getMode()
                                        else:
                                            tagger = Taggers.getTagger()
                                            try:
                                                tagger.loadFile(musicFileRow["filePath"])
                                            except:
                                                Dialogs.showError(translate("FileUtils/Musics", "Incorrect Tag"),
                                                                  str(translate("FileUtils/Musics",
                                                                                "\"%s\" : this file has the incorrect tag so can't read tags.")
                                                                  ) % Organizer.getLink(musicFileRow["filePath"]))
                                            content["path"] = musicFileRow["filePath"]
                                            content["baseNameOfDirectory"] = ""
                                            content["baseName"] = fu.getBaseName(musicFileRow["filePath"])
                                            content["artist"] = tagger.getArtist()
                                            content["title"] = tagger.getTitle()
                                            content["album"] = tagger.getAlbum()
                                            content["albumArtist"] = tagger.getAlbumArtist()
                                            content["trackNum"] = tagger.getTrackNum()
                                            content["year"] = tagger.getYear()
                                            content["genre"] = tagger.getGenre()
                                            content["firstComment"] = tagger.getFirstComment()
                                            content["firstLyrics"] = tagger.getFirstLyrics()
                                            if tagger.isSupportInfo:
                                                content["length"] = tagger.getLength()
                                                content["bitrate"] = tagger.getBitrate()
                                                content["sampleRate"] = tagger.getSampleRate()
                                                content["mode"] = tagger.getMode()
                                        content["size"] = details[stat.ST_SIZE]
                                        content["lastAccessed"] = details[stat.ST_ATIME]
                                        content["lastModified"] = details[stat.ST_MTIME]
                                        content["lastMetadataChanged"] = details[stat.ST_CTIME]
                                        self.values.append(content)
                                        newBaseNameOfDirectory = Organizer.emend(
                                            self.values[rowNo]["baseNameOfDirectory"], "directory")
                                        self.createItem(rowNo, "baseNameOfDirectory", newBaseNameOfDirectory,
                                                        self.values[rowNo]["baseNameOfDirectory"])

                                        newBaseName = Organizer.emend(self.values[rowNo]["baseName"], "file")
                                        self.createItem(rowNo, "baseName", newBaseName, self.values[rowNo]["baseName"])

                                        newArtist = Organizer.emend(self.values[rowNo]["artist"])
                                        self.createItem(rowNo, "artist", newArtist, self.values[rowNo]["artist"])

                                        newTitle = Organizer.emend(self.values[rowNo]["title"])
                                        self.createItem(rowNo, "title", newTitle, self.values[rowNo]["title"])

                                        newAlbum = Organizer.emend(self.values[rowNo]["album"])
                                        self.createItem(rowNo, "album", newAlbum, self.values[rowNo]["album"])

                                        newAlbumArtist = Organizer.emend(self.values[rowNo]["albumArtist"])
                                        self.createItem(rowNo, "albumArtist", newAlbumArtist,
                                                        self.values[rowNo]["albumArtist"])

                                        newTrackNum = str(self.values[rowNo]["trackNum"])
                                        self.createItem(rowNo, "trackNum", newTrackNum, self.values[rowNo]["trackNum"])

                                        newYear = Organizer.emend(self.values[rowNo]["year"])
                                        self.createItem(rowNo, "year", newYear, self.values[rowNo]["year"])

                                        newGenre = Organizer.emend(self.values[rowNo]["genre"])
                                        self.createItem(rowNo, "genre", newGenre, self.values[rowNo]["genre"])

                                        newFirstComment = Organizer.emend(self.values[rowNo]["firstComment"])
                                        self.createItem(rowNo, "firstComment", newFirstComment,
                                                        self.values[rowNo]["firstComment"])

                                        newFirstLyrics = Organizer.emend(self.values[rowNo]["firstLyrics"])
                                        self.createItem(rowNo, "firstLyrics", newFirstLyrics,
                                                        self.values[rowNo]["firstLyrics"])

                                        if Taggers.getTagger().isSupportInfo:
                                            self.createItem(rowNo, "length", content["length"])
                                            self.createItem(rowNo, "bitrate", content["bitrate"])
                                            self.createItem(rowNo, "sampleRate", content["sampleRate"])
                                            self.createItem(rowNo, "mode", content["mode"])

                                        self.createItem(rowNo, "size", Organizer.getCorrectedFileSize(content["size"]))

                                        self.createItem(rowNo, "lastAccessed",
                                                        Organizer.getCorrectedTime(content["lastAccessed"]))

                                        self.createItem(rowNo, "lastModified",
                                                        Organizer.getCorrectedTime(content["lastModified"]))

                                        self.createItem(rowNo, "lastMetadataChanged",
                                                        Organizer.getCorrectedTime(content["lastMetadataChanged"]))

                                        rowNo += 1
                                    else:
                                        allItemNumber -= 1
                                except:
                                    ReportBug.ReportBug()
                                    allItemNumber -= 1
                            else:
                                allItemNumber = rowNo
                            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
                            if isContinueThreadAction is False:
                                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
Exemple #16
0
    def refreshTable(self, _path):
        self.values = []
        uni.startThreadAction()
        import Amarok

        Dialogs.showState(
            translate("AmarokMusicTable", "Getting Values From Amarok"), 0, 1)
        if Amarok.checkAmarok():
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                from Amarok import Operations

                directoriesAndValues = Operations.getDirectoriesAndValues(
                    uni.MySettings[self.amarokFilterKeyName])
                Dialogs.showState(
                    translate("AmarokMusicTable",
                              "Values Are Being Processed"), 1, 1)
                isContinueThreadAction = uni.isContinueThreadAction()
                if isContinueThreadAction:
                    if directoriesAndValues is not None:
                        allItemNumber = len(directoriesAndValues)
                        self.setRowCount(allItemNumber)
                        rowNo = 0
                        for dirPath, dirRow in directoriesAndValues.items():
                            isContinueThreadAction = uni.isContinueThreadAction(
                            )
                            if isContinueThreadAction:
                                try:
                                    if fu.isReadableFileOrDir(
                                            dirPath, False,
                                            True) and fu.isReadableFileOrDir(
                                                fu.joinPath(
                                                    dirPath, ".directory"),
                                                False, True):
                                        content = {}
                                        content["path"] = dirPath
                                        content[
                                            "pathOfParentDirectory"] = fu.getDirName(
                                                dirPath)
                                        content["baseName"] = fu.getBaseName(
                                            dirPath)
                                        currentCover, isCorrectedFileContent = fu.getIconFromDirectory(
                                            dirPath)
                                        if currentCover is None:
                                            currentCover = ""
                                        content["currentCover"] = (
                                            currentCover)
                                        content["sourceCover"] = (
                                            dirRow["coverPath"][0].replace(
                                                dirPath, "."))
                                        content["destinationCover"] = (
                                            "./" + Organizer.getIconName(
                                                dirRow["artist"][0],
                                                dirRow["album"][0],
                                                dirRow["genre"][0],
                                                dirRow["year"][0]))
                                        content["flagColor"] = {}
                                        if isCorrectedFileContent is False:
                                            content["flagColor"][
                                                "currentCover"] = 255, 163, 163
                                        if fu.isFile(content["sourceCover"]
                                                     ) is False:
                                            content["flagColor"][
                                                "sourceCover"] = 255, 163, 163
                                        self.values.append(content)

                                        newPathOfParentDirectory = Organizer.emend(
                                            self.values[rowNo]
                                            ["pathOfParentDirectory"],
                                            "directory")
                                        self.createItem(
                                            rowNo, "pathOfParentDirectory",
                                            newPathOfParentDirectory,
                                            self.values[rowNo]
                                            ["pathOfParentDirectory"])

                                        newBaseName = Organizer.emend(
                                            self.values[rowNo]["baseName"],
                                            "directory")
                                        self.createItem(
                                            rowNo, "pathOfParentDirectory",
                                            newBaseName,
                                            self.values[rowNo]["baseName"])

                                        newCurrentCover = fu.getShortPath(
                                            self.values[rowNo]["currentCover"],
                                            self.values[rowNo]["path"])
                                        itemCurrentCover = self.createItem(
                                            rowNo, "currentCover",
                                            newCurrentCover, newCurrentCover,
                                            True)
                                        self.setItemColor(
                                            itemCurrentCover, rowNo, 2,
                                            "currentCover")

                                        newSourceCover = fu.getShortPath(
                                            self.values[rowNo]["sourceCover"],
                                            self.values[rowNo]["path"])
                                        itemSourceCover = self.createItem(
                                            rowNo, "sourceCover",
                                            newSourceCover,
                                            fu.getShortPath(
                                                self.values[rowNo]
                                                ["currentCover"],
                                                self.values[rowNo]["path"]))
                                        self.setItemColor(
                                            itemSourceCover, rowNo, 3,
                                            "sourceCover")

                                        newDestinationCover = Organizer.emend(
                                            fu.getShortPath(
                                                self.values[rowNo]
                                                ["destinationCover"],
                                                self.values[rowNo]["path"]),
                                            "file")
                                        itemDestinationCover = self.createItem(
                                            rowNo, "destinationCover",
                                            newDestinationCover,
                                            fu.getShortPath(
                                                self.values[rowNo]
                                                ["currentCover"],
                                                self.values[rowNo]["path"]))
                                        self.setItemColor(
                                            itemDestinationCover, rowNo, 4,
                                            "destinationCover")
                                        rowNo += 1
                                    else:
                                        allItemNumber -= 1
                                except:
                                    ReportBug.ReportBug()
                                    allItemNumber -= 1
                            else:
                                allItemNumber = rowNo
                            Dialogs.showState(
                                translate("Tables", "Generating Table..."),
                                rowNo, allItemNumber, True)
                            if isContinueThreadAction is False:
                                break
        uni.finishThreadAction()
        self.setRowCount(len(
            self.values))  # In case of Non Readable Files and Canceled process
Exemple #17
0
    def changeFile(self, _filePath, _readFrom="tag"):
        self.musicFile = _filePath
        self.musicValues = None
        self.isPlayNow = MToolButton()
        self.isPlayNow.setToolTip(
            translate("MusicDetails", "Play Suddenly Music When Open"))
        self.isPlayNow.setText(translate("MusicDetails", "Play When Open"))
        self.isPlayNow.setCheckable(True)
        self.isPlayNow.setChecked(uni.getBoolValue("isPlayNow"))
        self.isGetFromAmarok = MToolButton()
        self.isGetFromAmarok.setToolTip(
            translate("MusicDetails", "Get Values From Amarok"))
        self.isGetFromAmarok.setText(
            translate("MusicDetails", "Get From Amarok"))
        self.isGetFromAmarok.setCheckable(True)
        if _readFrom.count("Amarok") > 0:
            import Amarok

            uni.startThreadAction()
            Dialogs.showState(
                translate("MusicDetails", "Getting Values From Amarok"), 0, 1)
            if Amarok.checkAmarok():
                isContinueThreadAction = uni.isContinueThreadAction()
                if isContinueThreadAction:
                    from Amarok import Operations

                    musicFileRows = Operations.getAllMusicFileValuesWithNames(
                        "filename:\"" + _filePath + "\"")
                    Dialogs.showState(
                        translate("MusicDetails",
                                  "Values Are Being Processed"), 1, 1)
                    if len(musicFileRows) > 0:
                        musicFileRow = musicFileRows[0]
                        content = {}
                        content["path"] = musicFileRow["filePath"]
                        content["baseNameOfDirectory"] = fu.getBaseName(
                            fu.getDirName(musicFileRow["filePath"]))
                        content["baseName"] = fu.getBaseName(
                            musicFileRow["filePath"])
                        content["artist"] = musicFileRow["artist"]
                        content["title"] = musicFileRow["title"]
                        content["album"] = musicFileRow["album"]
                        content["albumArtist"] = musicFileRow["albumArtist"]
                        content["trackNum"] = musicFileRow["trackNumber"]
                        content["year"] = musicFileRow["year"]
                        content["genre"] = musicFileRow["genre"]
                        content["firstComment"] = musicFileRow["comment"]
                        content["firstLyrics"] = musicFileRow["lyrics"]
                        content["images"] = []
                        if _readFrom == "Amarok (Smart)":
                            tagger = Taggers.getTagger()
                            try:
                                tagger.loadFile(musicFileRow["filePath"])
                            except:
                                pass
                            else:
                                if content["artist"].strip() == "":
                                    content["artist"] = tagger.getArtist()
                                if content["title"].strip() == "":
                                    content["title"] = tagger.getTitle()
                                if content["album"].strip() == "":
                                    content["album"] = tagger.getAlbum()
                                if content["albumArtist"].strip() == "":
                                    content[
                                        "albumArtist"] = tagger.getAlbumArtist(
                                        )
                                if str(content["trackNum"]).strip() == "":
                                    content["trackNum"] = tagger.getTrackNum()
                                if str(content["year"]).strip() == "":
                                    content["year"] = tagger.getYear()
                                if content["genre"].strip() == "":
                                    content["genre"] = tagger.getGenre()
                                if content["firstComment"].strip() == "":
                                    content[
                                        "firstComment"] = tagger.getFirstComment(
                                        )
                                if content["firstLyrics"].strip() == "":
                                    content[
                                        "firstLyrics"] = tagger.getFirstLyrics(
                                        )
                                content["images"] = tagger.getImages()
                        self.isGetFromAmarok.setChecked(True)
                        self.musicValues = content
                    else:
                        Dialogs.show(
                            translate("MusicDetails", "Not Exist In Amarok"),
                            translate(
                                "MusicDetails",
                                "This music file not exist in Amarok DB."))
            uni.finishThreadAction()
        if self.musicValues is None:
            self.isGetFromAmarok.setChecked(False)
            self.musicValues = Musics.readMusicFile(self.musicFile)
        self.setWindowTitle(str(fu.getBaseName(self.musicFile)))
        if self.pnlClearable is not None:
            clearAllChildren(self.pnlClearable, True)
        self.pnlClearable = MWidget()
        self.vblMain.insertWidget(0, self.pnlClearable, 20)
        vblClearable = MVBoxLayout(self.pnlClearable)
        self.player = MusicPlayer.MusicPlayer(self, "dialog", _filePath)
        self.infoLabels["baseNameOfDirectory"] = MLabel(self.labels[0])
        self.infoLabels["baseName"] = MLabel(self.labels[1])
        self.infoLabels["artist"] = MLabel(self.labels[2])
        self.infoLabels["title"] = MLabel(self.labels[3])
        self.infoLabels["album"] = MLabel(self.labels[4])
        self.infoLabels["albumArtist"] = MLabel(self.labels[5])
        self.infoLabels["trackNum"] = MLabel(self.labels[6])
        self.infoLabels["year"] = MLabel(self.labels[7])
        self.infoLabels["genre"] = MLabel(self.labels[8])
        self.infoValues["baseNameOfDirectory"] = MLineEdit(
            str(
                Organizer.emend(self.musicValues["baseNameOfDirectory"],
                                "directory", False)))
        self.infoValues["baseName"] = MLineEdit(
            str(Organizer.emend(self.musicValues["baseName"], "file")))
        self.infoValues["artist"] = MLineEdit(
            str(Organizer.emend(self.musicValues["artist"])))
        self.infoValues["title"] = MLineEdit(
            str(Organizer.emend(self.musicValues["title"])))
        self.infoValues["album"] = MLineEdit(
            str(Organizer.emend(self.musicValues["album"])))
        self.infoValues["albumArtist"] = MLineEdit(
            str(Organizer.emend(self.musicValues["albumArtist"])))
        self.infoValues["trackNum"] = MLineEdit(
            str(Organizer.emend(self.musicValues["trackNum"])))
        self.infoValues["year"] = MLineEdit(
            str(Organizer.emend(self.musicValues["year"])))
        self.infoValues["genre"] = MLineEdit(
            str(Organizer.emend(self.musicValues["genre"])))
        self.infoValues["firstComment"] = MPlainTextEdit(
            str(Organizer.emend(self.musicValues["firstComment"])))
        self.infoValues["firstLyrics"] = MPlainTextEdit(
            str(Organizer.emend(self.musicValues["firstLyrics"])))
        self.infoValues["firstComment"].setLineWrapMode(MPlainTextEdit.NoWrap)
        self.infoValues["firstLyrics"].setLineWrapMode(MPlainTextEdit.NoWrap)

        if Taggers.getTagger().isSupportImages:
            self.isOpenImageDetailsOnNewWindow = MCheckBox(
                translate("MusicDetails", "Show Images In New Window"))
            self.pbtnAddImage = MPushButton(translate("MusicDetails",
                                                      "Append"))
            self.pbtnDeleteImage = MPushButton(
                translate("MusicDetails", "Delete"))
            self.pbtnSaveAsImage = MPushButton(
                translate("MusicDetails", "Save As ..."))
            self.pbtnCancelAddImage = MPushButton(
                translate("MusicDetails", "Cancel"))
            self.pbtnSelectImage = MPushButton(
                translate("MusicDetails", "Choose Image"))
            MObject.connect(self.pbtnAddImage, SIGNAL("clicked()"),
                            self.addImage)
            MObject.connect(self.pbtnDeleteImage, SIGNAL("clicked()"),
                            self.deleteImage)
            MObject.connect(self.pbtnSaveAsImage, SIGNAL("clicked()"),
                            self.saveAsImage)
            MObject.connect(self.pbtnCancelAddImage, SIGNAL("clicked()"),
                            self.cancelAddImage)
            MObject.connect(self.pbtnSelectImage, SIGNAL("clicked()"),
                            self.selectImage)
            self.leImagePath = MLineEdit("")
            self.lblImagePath = MLabel(
                translate("MusicDetails", "Image Path: "))
            self.cbImageType = MComboBox()
            self.cbImageType.addItems(Taggers.getTagger().getImageTypes())
            self.lblImageType = MLabel(
                translate("MusicDetails", "Image Type: "))

            self.lstwImages = MListWidget()
            self.lstwImages.setGridSize(MSize(350, 100))
            self.lstwImages.setIconSize(MSize(98, 98))
            MObject.connect(self.lstwImages,
                            SIGNAL("doubleClicked(QModelIndex)"),
                            self.openImageDetails)
            MObject.connect(self.isGetFromAmarok, SIGNAL("toggled(bool)"),
                            self.isGetFromAmarokTiggered)
            self.lstwImages.clear()
            for image in self.musicValues["images"]:
                if len(image) == 5:
                    pixmImage = MPixmap()
                    pixmImage.loadFromData(image[3])
                    icnImage = QIcon(pixmImage)
                    icnImage.actualSize(MSize(98, 98))
                    item = MListWidgetItem(icnImage,
                                           image[1] + "\n(" + image[2] + ")")
                    item.setSizeHint(MSize(1, 100))
                    self.lstwImages.addItem(item)
        HBOXs = []
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["baseNameOfDirectory"])
        HBOXs[-1].addWidget(self.infoValues["baseNameOfDirectory"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["baseName"])
        HBOXs[-1].addWidget(self.infoValues["baseName"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["artist"])
        HBOXs[-1].addWidget(self.infoValues["artist"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["title"])
        HBOXs[-1].addWidget(self.infoValues["title"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["album"])
        HBOXs[-1].addWidget(self.infoValues["album"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["albumArtist"])
        HBOXs[-1].addWidget(self.infoValues["albumArtist"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["trackNum"])
        HBOXs[-1].addWidget(self.infoValues["trackNum"])
        HBOXs[-1].addWidget(self.infoLabels["year"])
        HBOXs[-1].addWidget(self.infoValues["year"])
        HBOXs[-1].addWidget(self.infoLabels["genre"])
        HBOXs[-1].addWidget(self.infoValues["genre"])
        vblInfos = MVBoxLayout()
        for hbox in HBOXs:
            vblInfos.addLayout(hbox)
        if Taggers.getTagger().isSupportImages:
            imageBoxs = []
            imageBoxs.append(MHBoxLayout())
            imageBoxs[0].addWidget(self.leImagePath)
            imageBoxs[0].addWidget(self.pbtnSelectImage)
            imageBoxs.append(MHBoxLayout())
            imageBoxs[1].addWidget(self.lblImageType)
            imageBoxs[1].addWidget(self.cbImageType)
            imageBoxs.append(MHBoxLayout())
            imageBoxs[2].addWidget(self.pbtnAddImage)
            imageBoxs[2].addWidget(self.pbtnDeleteImage)
            imageBoxs[2].addWidget(self.pbtnSaveAsImage)
            imageBoxs[2].addWidget(self.pbtnCancelAddImage)
            vblImages = MVBoxLayout()
            vblImages.addWidget(self.lstwImages)
            vblImages.addWidget(self.isOpenImageDetailsOnNewWindow)
            vblImages.addWidget(self.lblImagePath)
            vblImages.addLayout(imageBoxs[0])
            vblImages.addLayout(imageBoxs[1])
            vblImages.addLayout(imageBoxs[2])
        vblComments = MVBoxLayout()
        vblComments.addWidget(self.infoValues["firstComment"])
        vblLyrics = MVBoxLayout()
        vblLyrics.addWidget(self.infoValues["firstLyrics"])
        self.tabwTabs = MTabWidget(self.pnlMain)
        self.pnlComments = MWidget(self.tabwTabs)
        self.pnlComments.setLayout(vblComments)
        self.tabwTabs.addTab(self.pnlComments,
                             translate("MusicDetails", "Comments"))
        self.pnlLyrics = MWidget(self.tabwTabs)
        self.pnlLyrics.setLayout(vblLyrics)
        self.tabwTabs.addTab(self.pnlLyrics, translate("MusicDetails",
                                                       "Lyrics"))
        if Taggers.getTagger().isSupportImages:
            self.pnlImages = MWidget(self.tabwTabs)
            self.pnlImages.setLayout(vblImages)
            self.tabwTabs.addTab(self.pnlImages,
                                 translate("MusicDetails", "Images"))
            self.pbtnSelectImage.hide()
            self.leImagePath.hide()
            self.lblImagePath.hide()
            self.lblImageType.hide()
            self.cbImageType.hide()
            self.pbtnCancelAddImage.hide()
        hblPlayer = MHBoxLayout()
        vblExtraButtons = MVBoxLayout()
        hblPlayer.addWidget(self.player)
        vblExtraButtons.addWidget(self.isPlayNow)
        vblExtraButtons.addWidget(self.isGetFromAmarok)
        hblPlayer.addLayout(vblExtraButtons)
        vblClearable.addLayout(hblPlayer)
        vblClearable.addLayout(vblInfos)
        vblClearable.addWidget(self.tabwTabs)
    def refreshTable(self, _path):
        self.values = []
        self.setColumnWidth(6, 70)
        self.setColumnWidth(7, 40)
        uni.startThreadAction()
        import Amarok

        Dialogs.showState(
            translate("AmarokMusicTable", "Getting Values From Amarok"), 0, 1)
        if Amarok.checkAmarok():
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                from Amarok import Operations

                musicFileValuesWithNames = Operations.getAllMusicFileValuesWithNames(
                    uni.MySettings[self.amarokFilterKeyName])
                Dialogs.showState(
                    translate("AmarokMusicTable",
                              "Values Are Being Processed"), 1, 1)
                isContinueThreadAction = uni.isContinueThreadAction()
                if isContinueThreadAction:
                    if musicFileValuesWithNames is not None:
                        allItemNumber = len(musicFileValuesWithNames)
                        self.setRowCount(allItemNumber)
                        rowNo = 0
                        for musicFileRow in musicFileValuesWithNames:
                            isContinueThreadAction = uni.isContinueThreadAction(
                            )
                            if isContinueThreadAction:
                                try:
                                    if (fu.isFile(musicFileRow["filePath"])
                                            and fu.isReadableFileOrDir(
                                                musicFileRow["filePath"],
                                                False, True)):
                                        details = fu.getDetails(
                                            musicFileRow["filePath"])
                                        content = {}
                                        if Amarok.getSelectedTagSourseType(
                                                "AmarokMusicTable"
                                        ) == "Amarok (Smart)":
                                            content["path"] = musicFileRow[
                                                "filePath"]
                                            content[
                                                "baseNameOfDirectory"] = fu.getBaseName(
                                                    fu.getDirName(musicFileRow[
                                                        "filePath"]))
                                            content[
                                                "baseName"] = fu.getBaseName(
                                                    musicFileRow["filePath"])
                                            content["artist"] = musicFileRow[
                                                "artist"]
                                            content["title"] = musicFileRow[
                                                "title"]
                                            content["album"] = musicFileRow[
                                                "album"]
                                            content[
                                                "albumArtist"] = musicFileRow[
                                                    "albumArtist"]
                                            content["trackNum"] = musicFileRow[
                                                "trackNumber"]
                                            content["year"] = musicFileRow[
                                                "year"]
                                            content["genre"] = musicFileRow[
                                                "genre"]
                                            content[
                                                "firstComment"] = musicFileRow[
                                                    "comment"]
                                            content[
                                                "firstLyrics"] = musicFileRow[
                                                    "lyrics"]
                                            tagger = Taggers.getTagger()
                                            try:
                                                tagger.loadFile(
                                                    musicFileRow["filePath"])
                                            except:
                                                if tagger.isSupportInfo:
                                                    content["length"] = ""
                                                    content["bitrate"] = ""
                                                    content["sampleRate"] = ""
                                                    content["mode"] = ""
                                            else:
                                                if content["artist"].strip(
                                                ) == "":
                                                    content[
                                                        "artist"] = tagger.getArtist(
                                                        )
                                                if content["title"].strip(
                                                ) == "":
                                                    content[
                                                        "title"] = tagger.getTitle(
                                                        )
                                                if content["album"].strip(
                                                ) == "":
                                                    content[
                                                        "album"] = tagger.getAlbum(
                                                        )
                                                if content[
                                                        "albumArtist"].strip(
                                                        ) == "":
                                                    content[
                                                        "albumArtist"] = tagger.getAlbumArtist(
                                                        )
                                                if str(content["trackNum"]
                                                       ).strip() == "":
                                                    content[
                                                        "trackNum"] = tagger.getTrackNum(
                                                        )
                                                if str(content["year"]).strip(
                                                ) == "":
                                                    content[
                                                        "year"] = tagger.getYear(
                                                        )
                                                if content["genre"].strip(
                                                ) == "":
                                                    content[
                                                        "genre"] = tagger.getGenre(
                                                        )
                                                if content[
                                                        "firstComment"].strip(
                                                        ) == "":
                                                    content[
                                                        "firstComment"] = tagger.getFirstComment(
                                                        )
                                                if content[
                                                        "firstLyrics"].strip(
                                                        ) == "":
                                                    content[
                                                        "firstLyrics"] = tagger.getFirstLyrics(
                                                        )
                                                if tagger.isSupportInfo:
                                                    content[
                                                        "length"] = tagger.getLength(
                                                        )
                                                    content[
                                                        "bitrate"] = tagger.getBitrate(
                                                        )
                                                    content[
                                                        "sampleRate"] = tagger.getSampleRate(
                                                        )
                                                    content[
                                                        "mode"] = tagger.getMode(
                                                        )
                                        elif Amarok.getSelectedTagSourseType(
                                                "AmarokMusicTable"
                                        ) == "Only Amarok":
                                            content["path"] = musicFileRow[
                                                "filePath"]
                                            content[
                                                "baseNameOfDirectory"] = fu.getBaseName(
                                                    fu.getDirName(musicFileRow[
                                                        "filePath"]))
                                            content[
                                                "baseName"] = fu.getBaseName(
                                                    musicFileRow["filePath"])
                                            content["artist"] = musicFileRow[
                                                "artist"]
                                            content["title"] = musicFileRow[
                                                "title"]
                                            content["album"] = musicFileRow[
                                                "album"]
                                            content[
                                                "albumArtist"] = musicFileRow[
                                                    "albumArtist"]
                                            content["trackNum"] = musicFileRow[
                                                "trackNumber"]
                                            content["year"] = musicFileRow[
                                                "year"]
                                            content["genre"] = musicFileRow[
                                                "genre"]
                                            content[
                                                "firstComment"] = musicFileRow[
                                                    "comment"]
                                            content[
                                                "firstLyrics"] = musicFileRow[
                                                    "lyrics"]
                                            tagger = Taggers.getTagger()
                                            if tagger.isSupportInfo:
                                                try:
                                                    tagger.loadFile(
                                                        musicFileRow[
                                                            "filePath"])
                                                except:
                                                    content["length"] = ""
                                                    content["bitrate"] = ""
                                                    content["sampleRate"] = ""
                                                    content["mode"] = ""
                                                else:
                                                    content[
                                                        "length"] = tagger.getLength(
                                                        )
                                                    content[
                                                        "bitrate"] = tagger.getBitrate(
                                                        )
                                                    content[
                                                        "sampleRate"] = tagger.getSampleRate(
                                                        )
                                                    content[
                                                        "mode"] = tagger.getMode(
                                                        )
                                        else:
                                            tagger = Taggers.getTagger()
                                            try:
                                                tagger.loadFile(
                                                    musicFileRow["filePath"])
                                            except:
                                                Dialogs.showError(
                                                    translate(
                                                        "FileUtils/Musics",
                                                        "Incorrect Tag"),
                                                    str(
                                                        translate(
                                                            "FileUtils/Musics",
                                                            "\"%s\" : this file has the incorrect tag so can't read tags."
                                                        )) % Organizer.getLink(
                                                            musicFileRow[
                                                                "filePath"]))
                                            content["path"] = musicFileRow[
                                                "filePath"]
                                            content[
                                                "baseNameOfDirectory"] = fu.getBaseName(
                                                    fu.getDirName(musicFileRow[
                                                        "filePath"]))
                                            content[
                                                "baseName"] = fu.getBaseName(
                                                    musicFileRow["filePath"])
                                            content[
                                                "artist"] = tagger.getArtist()
                                            content["title"] = tagger.getTitle(
                                            )
                                            content["album"] = tagger.getAlbum(
                                            )
                                            content[
                                                "albumArtist"] = tagger.getAlbumArtist(
                                                )
                                            content[
                                                "trackNum"] = tagger.getTrackNum(
                                                )
                                            content["year"] = tagger.getYear()
                                            content["genre"] = tagger.getGenre(
                                            )
                                            content[
                                                "firstComment"] = tagger.getFirstComment(
                                                )
                                            content[
                                                "firstLyrics"] = tagger.getFirstLyrics(
                                                )
                                            if tagger.isSupportInfo:
                                                content[
                                                    "length"] = tagger.getLength(
                                                    )
                                                content[
                                                    "bitrate"] = tagger.getBitrate(
                                                    )
                                                content[
                                                    "sampleRate"] = tagger.getSampleRate(
                                                    )
                                                content[
                                                    "mode"] = tagger.getMode()
                                        content["size"] = details[stat.ST_SIZE]
                                        content["lastAccessed"] = details[
                                            stat.ST_ATIME]
                                        content["lastModified"] = details[
                                            stat.ST_MTIME]
                                        content[
                                            "lastMetadataChanged"] = details[
                                                stat.ST_CTIME]
                                        self.values.append(content)
                                        newBaseNameOfDirectory = Organizer.emend(
                                            self.values[rowNo]
                                            ["baseNameOfDirectory"],
                                            "directory")
                                        self.createItem(
                                            rowNo, "baseNameOfDirectory",
                                            newBaseNameOfDirectory,
                                            self.values[rowNo]
                                            ["baseNameOfDirectory"])

                                        newBaseName = Organizer.emend(
                                            self.values[rowNo]["baseName"],
                                            "file")
                                        self.createItem(
                                            rowNo, "baseName", newBaseName,
                                            self.values[rowNo]["baseName"])

                                        newArtist = Organizer.emend(
                                            self.values[rowNo]["artist"])
                                        self.createItem(
                                            rowNo, "artist", newArtist,
                                            self.values[rowNo]["artist"])

                                        newTitle = Organizer.emend(
                                            self.values[rowNo]["title"])
                                        self.createItem(
                                            rowNo, "title", newTitle,
                                            self.values[rowNo]["title"])

                                        newAlbum = Organizer.emend(
                                            self.values[rowNo]["album"])
                                        self.createItem(
                                            rowNo, "album", newAlbum,
                                            self.values[rowNo]["album"])

                                        newAlbumArtist = Organizer.emend(
                                            self.values[rowNo]["albumArtist"])
                                        self.createItem(
                                            rowNo, "albumArtist",
                                            newAlbumArtist,
                                            self.values[rowNo]["albumArtist"])

                                        newTrackNum = str(
                                            self.values[rowNo]["trackNum"])
                                        self.createItem(
                                            rowNo, "trackNum", newTrackNum,
                                            self.values[rowNo]["trackNum"])

                                        newYear = Organizer.emend(
                                            self.values[rowNo]["year"])
                                        self.createItem(
                                            rowNo, "year", newYear,
                                            self.values[rowNo]["year"])

                                        newGenre = Organizer.emend(
                                            self.values[rowNo]["genre"])
                                        self.createItem(
                                            rowNo, "genre", newGenre,
                                            self.values[rowNo]["genre"])

                                        newFirstComment = Organizer.emend(
                                            self.values[rowNo]["firstComment"])
                                        self.createItem(
                                            rowNo, "firstComment",
                                            newFirstComment,
                                            self.values[rowNo]["firstComment"])

                                        newFirstLyrics = Organizer.emend(
                                            self.values[rowNo]["firstLyrics"])
                                        self.createItem(
                                            rowNo, "firstLyrics",
                                            newFirstLyrics,
                                            self.values[rowNo]["firstLyrics"])

                                        if Taggers.getTagger().isSupportInfo:
                                            self.createItem(
                                                rowNo, "length",
                                                content["length"])
                                            self.createItem(
                                                rowNo, "bitrate",
                                                content["bitrate"])
                                            self.createItem(
                                                rowNo, "sampleRate",
                                                content["sampleRate"])
                                            self.createItem(
                                                rowNo, "mode", content["mode"])

                                        self.createItem(
                                            rowNo, "size",
                                            Organizer.getCorrectedFileSize(
                                                content["size"]))

                                        self.createItem(
                                            rowNo, "lastAccessed",
                                            Organizer.getCorrectedTime(
                                                content["lastAccessed"]))

                                        self.createItem(
                                            rowNo, "lastModified",
                                            Organizer.getCorrectedTime(
                                                content["lastModified"]))

                                        self.createItem(
                                            rowNo, "lastMetadataChanged",
                                            Organizer.getCorrectedTime(
                                                content["lastMetadataChanged"])
                                        )

                                        rowNo += 1
                                    else:
                                        allItemNumber -= 1
                                except:
                                    ReportBug.ReportBug()
                                    allItemNumber -= 1
                            else:
                                allItemNumber = rowNo
                            Dialogs.showState(
                                translate("Tables", "Generating Table..."),
                                rowNo, allItemNumber, True)
                            if isContinueThreadAction is False:
                                break
        uni.finishThreadAction()
        self.setRowCount(len(
            self.values))  # In case of Non Readable Files and Canceled process
    def refreshTable(self, _path):
        self.values = []
        allFilesAndDirectories = fu.readDirectoryWithSubDirectoriesThread(_path,
                                                                          int(uni.MySettings["CoversSubDirectoryDeep"]),
                                                                          "directory",
                                                                          uni.getBoolValue("isShowHiddensInCoverTable"))
        allItemNumber = len(allFilesAndDirectories)
        uni.startThreadAction()
        rowNo = 0
        self.setRowCount(allItemNumber)
        for dirName in allFilesAndDirectories:
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isReadableFileOrDir(dirName, False, True) and fu.isReadableFileOrDir(
                        fu.joinPath(dirName, ".directory"), False, True):
                        content = {}
                        content["path"] = dirName
                        content["baseNameOfDirectory"] = str(str(fu.getBaseName(_path)) +
                                                             str(fu.getDirName(dirName)).replace(_path, ""))
                        content["baseName"] = fu.getBaseName(dirName)

                        currentCover, isCorrectedFileContent = fu.getIconFromDirectory(dirName)
                        selectedName = None
                        if isCorrectedFileContent and currentCover is not None:
                            selectedName = fu.getBaseName(currentCover)
                        sourceCover = fu.getFirstImageInDirectory(dirName, selectedName, False, False)
                        if currentCover is None:
                            currentCover = ""
                        if sourceCover is None:
                            sourceCover = ""
                        else:
                            sourceCover = fu.joinPath(dirName, sourceCover)
                        content["currentCover"] = (currentCover)
                        content["sourceCover"] = (sourceCover)
                        content["destinationCover"] = (sourceCover)
                        content["isCorrectedFileContent"] = (isCorrectedFileContent)
                        self.values.append(content)

                        newBaseNameOfDirectory = Organizer.emend(self.values[rowNo]["baseNameOfDirectory"],
                                                                 "directory")
                        self.createItem(rowNo, "baseNameOfDirectory", newBaseNameOfDirectory,
                                        self.values[rowNo]["baseNameOfDirectory"])

                        newBaseName = Organizer.emend(self.values[rowNo]["baseName"], "directory")
                        self.createItem(rowNo, "baseName", newBaseName, self.values[rowNo]["baseName"])

                        newCurrentCover = str(self.values[rowNo]["currentCover"])
                        newCurrentCover = newCurrentCover.replace(self.values[rowNo]["path"], ".")
                        itemCurrentCover = self.createItem(rowNo, "currentCover", newCurrentCover, newCurrentCover,
                                                           True)
                        if self.values[rowNo]["isCorrectedFileContent"] is False:
                            itemCurrentCover.setBackground(MBrush(MColor(255, 163, 163)))

                        newSourceCover = str(self.values[rowNo]["sourceCover"])
                        newSourceCover = newSourceCover.replace(self.values[rowNo]["path"], ".")
                        oldSourceCover = self.values[rowNo]["currentCover"]
                        oldSourceCover = oldSourceCover.replace(self.values[rowNo]["path"], ".")
                        self.createItem(rowNo, "sourceCover", newSourceCover, oldSourceCover)

                        newDestinationCover = self.values[rowNo]["destinationCover"]
                        newDestinationCover = newDestinationCover.replace(self.values[rowNo]["path"], ".")
                        newDestinationCover = Organizer.emend(newDestinationCover, "file")
                        oldDestinationCover = self.values[rowNo]["currentCover"]
                        oldDestinationCover = oldDestinationCover.replace(self.values[rowNo]["path"], ".")
                        self.createItem(rowNo, "destinationCover", newDestinationCover, oldDestinationCover)
                        rowNo += 1
                    else:
                        allItemNumber -= 1
                except:
                    ReportBug.ReportBug()
                    allItemNumber -= 1
            else:
                allItemNumber = rowNo
            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
    def refreshTable(self, _path):
        self.values = []
        self.setColumnWidth(6, 70)
        self.setColumnWidth(7, 40)
        musicFileNames = fu.readDirectoryWithSubDirectoriesThread(_path,
                                                                  int(uni.MySettings["subDirectoryDeep"]), "music",
                                                                  uni.getBoolValue(
                                                                      "isShowHiddensInSubFolderMusicTable"))
        isCanNoncompatible = False
        allItemNumber = len(musicFileNames)
        uni.startThreadAction()
        rowNo = 0
        self.setRowCount(allItemNumber)
        for filePath in musicFileNames:
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isReadableFileOrDir(filePath, False, True):
                        tagger = Taggers.getTagger()
                        try:
                            tagger.loadFile(filePath)
                        except:
                            Dialogs.showError(translate("FileUtils/Musics", "Incorrect Tag"),
                                              str(translate("FileUtils/Musics",
                                                            "\"%s\" : this file has the incorrect tag so can't read tags.")
                                              ) % Organizer.getLink(filePath))
                        if tagger.isAvailableFile() is False:
                            isCanNoncompatible = True
                        details = fu.getDetails(filePath)
                        content = {}
                        content["path"] = filePath
                        content["baseNameOfDirectory"] = str(
                            str(fu.getBaseName(_path)) + str(fu.getDirName(filePath)).replace(_path, ""))
                        content["baseName"] = fu.getBaseName(filePath)
                        content["artist"] = tagger.getArtist()
                        content["title"] = tagger.getTitle()
                        content["album"] = tagger.getAlbum()
                        content["albumArtist"] = tagger.getAlbumArtist()
                        content["trackNum"] = tagger.getTrackNum()
                        content["year"] = tagger.getYear()
                        content["genre"] = tagger.getGenre()
                        content["firstComment"] = tagger.getFirstComment()
                        content["firstLyrics"] = tagger.getFirstLyrics()
                        if tagger.isSupportInfo:
                            content["length"] = tagger.getLength()
                            content["bitrate"] = tagger.getBitrate()
                            content["sampleRate"] = tagger.getSampleRate()
                            content["mode"] = tagger.getMode()
                        content["size"] = details[stat.ST_SIZE]
                        content["lastAccessed"] = details[stat.ST_ATIME]
                        content["lastModified"] = details[stat.ST_MTIME]
                        content["lastMetadataChanged"] = details[stat.ST_CTIME]
                        self.values.append(content)

                        newBaseNameOfDirectory = Organizer.emend(self.values[rowNo]["baseNameOfDirectory"], "directory")
                        self.createItem(rowNo, "baseNameOfDirectory", newBaseNameOfDirectory,
                                        self.values[rowNo]["baseNameOfDirectory"])

                        newBaseName = Organizer.emend(self.values[rowNo]["baseName"], "file")
                        self.createItem(rowNo, "baseName", newBaseName, self.values[rowNo]["baseName"])

                        newArtist = Organizer.emend(self.values[rowNo]["artist"])
                        self.createItem(rowNo, "artist", newArtist, self.values[rowNo]["artist"])

                        newTitle = Organizer.emend(self.values[rowNo]["title"])
                        self.createItem(rowNo, "title", newTitle, self.values[rowNo]["title"])

                        newAlbum = Organizer.emend(self.values[rowNo]["album"])
                        self.createItem(rowNo, "album", newAlbum, self.values[rowNo]["album"])

                        newAlbumArtist = Organizer.emend(self.values[rowNo]["albumArtist"])
                        self.createItem(rowNo, "albumArtist", newAlbumArtist, self.values[rowNo]["albumArtist"])

                        newTrackNum = str(self.values[rowNo]["trackNum"])
                        self.createItem(rowNo, "trackNum", newTrackNum, self.values[rowNo]["trackNum"])

                        newYear = Organizer.emend(self.values[rowNo]["year"])
                        self.createItem(rowNo, "year", newYear, self.values[rowNo]["year"])

                        newGenre = Organizer.emend(self.values[rowNo]["genre"])
                        self.createItem(rowNo, "genre", newGenre, self.values[rowNo]["genre"])

                        newFirstComment = Organizer.emend(self.values[rowNo]["firstComment"])
                        self.createItem(rowNo, "firstComment", newFirstComment, self.values[rowNo]["firstComment"])

                        newFirstLyrics = Organizer.emend(self.values[rowNo]["firstLyrics"])
                        self.createItem(rowNo, "firstLyrics", newFirstLyrics, self.values[rowNo]["firstLyrics"])

                        if tagger.isSupportInfo:
                            self.createItem(rowNo, "length", content["length"])
                            self.createItem(rowNo, "bitrate", content["bitrate"])
                            self.createItem(rowNo, "sampleRate", content["sampleRate"])
                            self.createItem(rowNo, "mode", content["mode"])

                        self.createItem(rowNo, "size", Organizer.getCorrectedFileSize(content["size"]))

                        self.createItem(rowNo, "lastAccessed", Organizer.getCorrectedTime(content["lastAccessed"]))

                        self.createItem(rowNo, "lastModified", Organizer.getCorrectedTime(content["lastModified"]))

                        self.createItem(rowNo, "lastMetadataChanged",
                                        Organizer.getCorrectedTime(content["lastMetadataChanged"]))

                        rowNo += 1
                    else:
                        allItemNumber -= 1
                except:
                    ReportBug.ReportBug()
                    allItemNumber -= 1
            else:
                allItemNumber = rowNo
            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
        if isCanNoncompatible:
            Dialogs.show(translate("FileUtils/Musics", "Possible ID3 Mismatch"),
                         translate("FileUtils/Musics",
                                   "Some of the files presented in the table may not support ID3 technology.<br>Please check the files and make sure they support ID3 information before proceeding."))
    def changeFile(self, _filePath, _readFrom="tag"):
        self.musicFile = _filePath
        self.musicValues = None
        self.isPlayNow = MToolButton()
        self.isPlayNow.setToolTip(translate("MusicDetails", "Play Suddenly Music When Open"))
        self.isPlayNow.setText(translate("MusicDetails", "Play When Open"))
        self.isPlayNow.setCheckable(True)
        self.isPlayNow.setChecked(uni.getBoolValue("isPlayNow"))
        self.isGetFromAmarok = MToolButton()
        self.isGetFromAmarok.setToolTip(translate("MusicDetails", "Get Values From Amarok"))
        self.isGetFromAmarok.setText(translate("MusicDetails", "Get From Amarok"))
        self.isGetFromAmarok.setCheckable(True)
        if _readFrom.count("Amarok") > 0:
            import Amarok

            uni.startThreadAction()
            Dialogs.showState(translate("MusicDetails", "Getting Values From Amarok"), 0, 1)
            if Amarok.checkAmarok():
                isContinueThreadAction = uni.isContinueThreadAction()
                if isContinueThreadAction:
                    from Amarok import Operations

                    musicFileRows = Operations.getAllMusicFileValuesWithNames("filename:\"" + _filePath + "\"")
                    Dialogs.showState(translate("MusicDetails", "Values Are Being Processed"), 1, 1)
                    if len(musicFileRows)>0:
                        musicFileRow = musicFileRows[0]
                        content = {}
                        content["path"] = musicFileRow["filePath"]
                        content["baseNameOfDirectory"] = fu.getBaseName(
                            fu.getDirName(musicFileRow["filePath"]))
                        content["baseName"] = fu.getBaseName(musicFileRow["filePath"])
                        content["artist"] = musicFileRow["artist"]
                        content["title"] = musicFileRow["title"]
                        content["album"] = musicFileRow["album"]
                        content["albumArtist"] = musicFileRow["albumArtist"]
                        content["trackNum"] = musicFileRow["trackNumber"]
                        content["year"] = musicFileRow["year"]
                        content["genre"] = musicFileRow["genre"]
                        content["firstComment"] = musicFileRow["comment"]
                        content["firstLyrics"] = musicFileRow["lyrics"]
                        content["images"] = []
                        if _readFrom == "Amarok (Smart)":
                            tagger = Taggers.getTagger()
                            try:
                                tagger.loadFile(musicFileRow["filePath"])
                            except:
                                pass
                            else:
                                if content["artist"].strip() == "":
                                    content["artist"] = tagger.getArtist()
                                if content["title"].strip() == "":
                                    content["title"] = tagger.getTitle()
                                if content["album"].strip() == "":
                                    content["album"] = tagger.getAlbum()
                                if content["albumArtist"].strip() == "":
                                    content["albumArtist"] = tagger.getAlbumArtist()
                                if str(content["trackNum"]).strip() == "":
                                    content["trackNum"] = tagger.getTrackNum()
                                if str(content["year"]).strip() == "":
                                    content["year"] = tagger.getYear()
                                if content["genre"].strip() == "":
                                    content["genre"] = tagger.getGenre()
                                if content["firstComment"].strip() == "":
                                    content["firstComment"] = tagger.getFirstComment()
                                if content["firstLyrics"].strip() == "":
                                    content["firstLyrics"] = tagger.getFirstLyrics()
                                content["images"] = tagger.getImages()
                        self.isGetFromAmarok.setChecked(True)
                        self.musicValues = content
                    else:
                        Dialogs.show(translate("MusicDetails", "Not Exist In Amarok"),
                                     translate("MusicDetails", "This music file not exist in Amarok DB."))
            uni.finishThreadAction()
        if self.musicValues is None:
            self.isGetFromAmarok.setChecked(False)
            self.musicValues = Musics.readMusicFile(self.musicFile)
        self.setWindowTitle(str(fu.getBaseName(self.musicFile)))
        if self.pnlClearable is not None:
            clearAllChildren(self.pnlClearable, True)
        self.pnlClearable = MWidget()
        self.vblMain.insertWidget(0, self.pnlClearable, 20)
        vblClearable = MVBoxLayout(self.pnlClearable)
        self.player = MusicPlayer.MusicPlayer(self, "dialog", _filePath)
        self.infoLabels["baseNameOfDirectory"] = MLabel(self.labels[0])
        self.infoLabels["baseName"] = MLabel(self.labels[1])
        self.infoLabels["artist"] = MLabel(self.labels[2])
        self.infoLabels["title"] = MLabel(self.labels[3])
        self.infoLabels["album"] = MLabel(self.labels[4])
        self.infoLabels["albumArtist"] = MLabel(self.labels[5])
        self.infoLabels["trackNum"] = MLabel(self.labels[6])
        self.infoLabels["year"] = MLabel(self.labels[7])
        self.infoLabels["genre"] = MLabel(self.labels[8])
        self.infoValues["baseNameOfDirectory"] = MLineEdit(
            str(Organizer.emend(self.musicValues["baseNameOfDirectory"], "directory", False)))
        self.infoValues["baseName"] = MLineEdit(str(Organizer.emend(self.musicValues["baseName"], "file")))
        self.infoValues["artist"] = MLineEdit(str(Organizer.emend(self.musicValues["artist"])))
        self.infoValues["title"] = MLineEdit(str(Organizer.emend(self.musicValues["title"])))
        self.infoValues["album"] = MLineEdit(str(Organizer.emend(self.musicValues["album"])))
        self.infoValues["albumArtist"] = MLineEdit(str(Organizer.emend(self.musicValues["albumArtist"])))
        self.infoValues["trackNum"] = MLineEdit(str(Organizer.emend(self.musicValues["trackNum"])))
        self.infoValues["year"] = MLineEdit(str(Organizer.emend(self.musicValues["year"])))
        self.infoValues["genre"] = MLineEdit(str(Organizer.emend(self.musicValues["genre"])))
        self.infoValues["firstComment"] = MPlainTextEdit(str(Organizer.emend(self.musicValues["firstComment"])))
        self.infoValues["firstLyrics"] = MPlainTextEdit(str(Organizer.emend(self.musicValues["firstLyrics"])))
        self.infoValues["firstComment"].setLineWrapMode(MPlainTextEdit.NoWrap)
        self.infoValues["firstLyrics"].setLineWrapMode(MPlainTextEdit.NoWrap)

        if Taggers.getTagger().isSupportImages:
            self.isOpenImageDetailsOnNewWindow = MCheckBox(translate("MusicDetails", "Show Images In New Window"))
            self.pbtnAddImage = MPushButton(translate("MusicDetails", "Append"))
            self.pbtnDeleteImage = MPushButton(translate("MusicDetails", "Delete"))
            self.pbtnSaveAsImage = MPushButton(translate("MusicDetails", "Save As ..."))
            self.pbtnCancelAddImage = MPushButton(translate("MusicDetails", "Cancel"))
            self.pbtnSelectImage = MPushButton(translate("MusicDetails", "Choose Image"))
            MObject.connect(self.pbtnAddImage, SIGNAL("clicked()"), self.addImage)
            MObject.connect(self.pbtnDeleteImage, SIGNAL("clicked()"), self.deleteImage)
            MObject.connect(self.pbtnSaveAsImage, SIGNAL("clicked()"), self.saveAsImage)
            MObject.connect(self.pbtnCancelAddImage, SIGNAL("clicked()"), self.cancelAddImage)
            MObject.connect(self.pbtnSelectImage, SIGNAL("clicked()"), self.selectImage)
            self.leImagePath = MLineEdit("")
            self.lblImagePath = MLabel(translate("MusicDetails", "Image Path: "))
            self.cbImageType = MComboBox()
            self.cbImageType.addItems(Taggers.getTagger().getImageTypes())
            self.lblImageType = MLabel(translate("MusicDetails", "Image Type: "))

            self.lstwImages = MListWidget()
            self.lstwImages.setGridSize(MSize(350, 100))
            self.lstwImages.setIconSize(MSize(98, 98))
            MObject.connect(self.lstwImages, SIGNAL("doubleClicked(QModelIndex)"), self.openImageDetails)
            MObject.connect(self.isGetFromAmarok, SIGNAL("toggled(bool)"), self.isGetFromAmarokTiggered)
            self.lstwImages.clear()
            for image in self.musicValues["images"]:
                if len(image) == 5:
                    pixmImage = MPixmap()
                    pixmImage.loadFromData(image[3])
                    icnImage = QIcon(pixmImage)
                    icnImage.actualSize(MSize(98, 98))
                    item = MListWidgetItem(icnImage, image[1] + "\n(" + image[2] + ")")
                    item.setSizeHint(MSize(1, 100))
                    self.lstwImages.addItem(item)
        HBOXs = []
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["baseNameOfDirectory"])
        HBOXs[-1].addWidget(self.infoValues["baseNameOfDirectory"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["baseName"])
        HBOXs[-1].addWidget(self.infoValues["baseName"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["artist"])
        HBOXs[-1].addWidget(self.infoValues["artist"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["title"])
        HBOXs[-1].addWidget(self.infoValues["title"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["album"])
        HBOXs[-1].addWidget(self.infoValues["album"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["albumArtist"])
        HBOXs[-1].addWidget(self.infoValues["albumArtist"])
        HBOXs.append(MHBoxLayout())
        HBOXs[-1].addWidget(self.infoLabels["trackNum"])
        HBOXs[-1].addWidget(self.infoValues["trackNum"])
        HBOXs[-1].addWidget(self.infoLabels["year"])
        HBOXs[-1].addWidget(self.infoValues["year"])
        HBOXs[-1].addWidget(self.infoLabels["genre"])
        HBOXs[-1].addWidget(self.infoValues["genre"])
        vblInfos = MVBoxLayout()
        for hbox in HBOXs:
            vblInfos.addLayout(hbox)
        if Taggers.getTagger().isSupportImages:
            imageBoxs = []
            imageBoxs.append(MHBoxLayout())
            imageBoxs[0].addWidget(self.leImagePath)
            imageBoxs[0].addWidget(self.pbtnSelectImage)
            imageBoxs.append(MHBoxLayout())
            imageBoxs[1].addWidget(self.lblImageType)
            imageBoxs[1].addWidget(self.cbImageType)
            imageBoxs.append(MHBoxLayout())
            imageBoxs[2].addWidget(self.pbtnAddImage)
            imageBoxs[2].addWidget(self.pbtnDeleteImage)
            imageBoxs[2].addWidget(self.pbtnSaveAsImage)
            imageBoxs[2].addWidget(self.pbtnCancelAddImage)
            vblImages = MVBoxLayout()
            vblImages.addWidget(self.lstwImages)
            vblImages.addWidget(self.isOpenImageDetailsOnNewWindow)
            vblImages.addWidget(self.lblImagePath)
            vblImages.addLayout(imageBoxs[0])
            vblImages.addLayout(imageBoxs[1])
            vblImages.addLayout(imageBoxs[2])
        vblComments = MVBoxLayout()
        vblComments.addWidget(self.infoValues["firstComment"])
        vblLyrics = MVBoxLayout()
        vblLyrics.addWidget(self.infoValues["firstLyrics"])
        self.tabwTabs = MTabWidget(self.pnlMain)
        self.pnlComments = MWidget(self.tabwTabs)
        self.pnlComments.setLayout(vblComments)
        self.tabwTabs.addTab(self.pnlComments, translate("MusicDetails", "Comments"))
        self.pnlLyrics = MWidget(self.tabwTabs)
        self.pnlLyrics.setLayout(vblLyrics)
        self.tabwTabs.addTab(self.pnlLyrics, translate("MusicDetails", "Lyrics"))
        if Taggers.getTagger().isSupportImages:
            self.pnlImages = MWidget(self.tabwTabs)
            self.pnlImages.setLayout(vblImages)
            self.tabwTabs.addTab(self.pnlImages, translate("MusicDetails", "Images"))
            self.pbtnSelectImage.hide()
            self.leImagePath.hide()
            self.lblImagePath.hide()
            self.lblImageType.hide()
            self.cbImageType.hide()
            self.pbtnCancelAddImage.hide()
        hblPlayer = MHBoxLayout()
        vblExtraButtons = MVBoxLayout()
        hblPlayer.addWidget(self.player)
        vblExtraButtons.addWidget(self.isPlayNow)
        vblExtraButtons.addWidget(self.isGetFromAmarok)
        hblPlayer.addLayout(vblExtraButtons)
        vblClearable.addLayout(hblPlayer)
        vblClearable.addLayout(vblInfos)
        vblClearable.addWidget(self.tabwTabs)
 def apply(self):
     self.checkCompleters()
     self.reFillCompleters()
     getMainTable().createHistoryPoint()
     actionCommand = self.getActionCommand()
     spliterIndex = actionCommand.index("~||~")
     leftKeys = actionCommand[:spliterIndex]
     rightKeys = actionCommand[spliterIndex + 1:]
     leftColumnKeys = []
     rightColumnKeys = []
     getMainTable().isAskShowHiddenColumn = True
     if len(leftKeys) > 0 and len(rightKeys) > 0:
         for objectNameAndPoint in leftKeys:
             leftColumnKeys.append(objectNameAndPoint)
         for objectNameAndPoint in rightKeys:
             objectNameAndPointList = objectNameAndPoint.split("~|~")
             objectName = objectNameAndPointList[0]
             if getMainTable().checkReadOnlyColumn(objectName):
                 rightColumnKeys.append(objectNameAndPoint)
     if len(leftColumnKeys) > 0 and len(rightColumnKeys) > 0:
         for rowNo in range(getMainTable().rowCount()):
             sourceString = ""
             sourceList = []
             sourceListLogical = []
             for no, objectNameAndPoint in enumerate(leftColumnKeys):
                 objectNameAndPointList = objectNameAndPoint.split("~|~")
                 objectName = objectNameAndPointList[0]
                 point = ""
                 if len(objectNameAndPointList) > 1:
                     point = objectNameAndPointList[1]
                 if objectName.find("Concatenate") == -1:
                     columnNo = getMainTable().tableColumnsKey.index(objectName)
                     valueOfField = str(getMainTable().item(rowNo, columnNo).text())
                     if objectName == "baseName":
                         valueOfField, ext = fu.getFileNameParts(valueOfField)
                     sourceString += valueOfField
                     sourceList.append(valueOfField)
                     if point != "":
                         sourceListLogical += valueOfField.split(point)
                     else:
                         sourceListLogical.append(valueOfField)
                     nextPoint = ""
                     if leftColumnKeys[-1] != objectNameAndPoint:
                         nextObjectNameAndPoint = leftColumnKeys[no + 1]
                         nextObjectNameAndPointList = nextObjectNameAndPoint.split("~|~")
                         nextObjectName = nextObjectNameAndPointList[0]
                         if len(nextObjectNameAndPointList) > 1:
                             nextPoint = nextObjectNameAndPointList[1]
                         if nextObjectName.find("Concatenate") == -1:
                             sourceString += "-"
                         else:
                             sourceString += nextPoint
                 else:
                     pass
             for no, objectNameAndPoint in enumerate(rightColumnKeys):
                 objectNameAndPointList = objectNameAndPoint.split("~|~")
                 columnKey = objectNameAndPointList[0]
                 columnNo = getMainTable().getColumnNoFromKey(columnKey)
                 if getMainTable().checkHiddenColumn(columnKey) is False:
                     continue
                 if getMainTable().isChangeableItem(rowNo, columnKey):
                     newString = ""
                     if len(rightColumnKeys) == 1:
                         newString = sourceString
                     elif len(sourceList) == len(rightColumnKeys):
                         newString = sourceList[no]
                     elif len(sourceListLogical) >= len(rightColumnKeys):
                         newString = sourceListLogical[no]
                     elif len(sourceListLogical) > no:
                         newString = sourceListLogical[no]
                     newString = Organizer.emend(newString)
                     if newString != "":
                         if self.specialTools.btChange.isChecked():
                             pass
                         elif self.specialTools.tbAddToBefore.isChecked():
                             newString += str(getMainTable().item(rowNo, columnNo).text())
                         elif self.specialTools.tbAddToAfter.isChecked():
                             newString = str(getMainTable().item(rowNo, columnNo).text()) + newString
                         getMainTable().item(rowNo, columnNo).setText(str(newString.strip()))
    def refreshTable(self, _path):
        self.values = []
        allFilesAndDirectories = fu.readDirectoryWithSubDirectoriesThread(_path,
                                                                          int(uni.MySettings["subDirectoryDeep"]),
                                                                          "file", uni.getBoolValue(
                "isShowHiddensInSubFolderTable"))
        allItemNumber = len(allFilesAndDirectories)
        uni.startThreadAction()
        rowNo = 0
        self.setRowCount(allItemNumber)
        for baseName in allFilesAndDirectories:
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isReadableFileOrDir(baseName, False, True):
                        details = fu.getExtendedDetails(fu.joinPath(_path, baseName))
                        content = {}
                        content["path"] = baseName
                        content["baseNameOfDirectory"] = str(
                            str(fu.getBaseName(_path)) + str(fu.getDirName(baseName)).replace(_path, ""))
                        content["baseName"] = fu.getBaseName(baseName)
                        content.update(details)
                        self.values.append(content)

                        newBaseNameOfDirectory = Organizer.emend(content["baseNameOfDirectory"], "directory")
                        self.createItem(rowNo, "baseNameOfDirectory", newBaseNameOfDirectory,
                                        content["baseNameOfDirectory"])

                        newBaseName = Organizer.emend(content["baseName"], "file")
                        self.createItem(rowNo, "baseName", newBaseName, content["baseName"])

                        self.createItem(rowNo, "size", Organizer.getCorrectedFileSize(content["size"]))

                        self.createItem(rowNo, "lastAccessed", Organizer.getCorrectedTime(content["lastAccessed"]))

                        self.createItem(rowNo, "lastModified", Organizer.getCorrectedTime(content["lastModified"]))

                        self.createItem(rowNo, "lastMetadataChanged",
                                        Organizer.getCorrectedTime(content["lastMetadataChanged"]))

                        if not uni.isWindows:
                            self.createItem(rowNo, "accessRights", content["accessRights"])

                            self.createItem(rowNo, "userIDOfOwner", content["userIDOfOwner"])

                            self.createItem(rowNo, "groupIDOfOwner", content["groupIDOfOwner"])

                            self.createItem(rowNo, "numberOfHardLinks", content["numberOfHardLinks"])

                        rowNo += 1
                    else:
                        allItemNumber -= 1
                except:
                    ReportBug.ReportBug()
                    allItemNumber -= 1
            else:
                allItemNumber = rowNo
            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
Exemple #24
0
    def refreshTable(self, _path):
        self.values = []
        self.setColumnWidth(6, 70)
        self.setColumnWidth(7, 40)
        musicFileNames = fu.readDirectory(_path, "music", uni.getBoolValue("isShowHiddensInMusicTable"))
        isCanNoncompatible = False
        allItemNumber = len(musicFileNames)
        uni.startThreadAction()
        baseNameOfDirectory = fu.getBaseName(_path)
        rowNo = 0
        self.setRowCount(allItemNumber)
        for baseName in musicFileNames:
            isContinueThreadAction = uni.isContinueThreadAction()
            if isContinueThreadAction:
                try:
                    if fu.isReadableFileOrDir(fu.joinPath(_path, baseName), False, True):
                        tagger = Taggers.getTagger()
                        try:
                            tagger.loadFile(fu.joinPath(_path, baseName))
                        except:
                            Dialogs.showError(translate("FileUtils/Musics", "Incorrect Tag"),
                                              str(translate("FileUtils/Musics",
                                                            "\"%s\" : this file has the incorrect tag so can't read tags.")
                                              ) % Organizer.getLink(fu.joinPath(_path, baseName)))
                        if tagger.isAvailableFile() is False:
                            isCanNoncompatible = True
                        details = fu.getDetails(fu.joinPath(_path, baseName))
                        content = {}
                        content["path"] = fu.joinPath(_path, baseName)
                        content["baseNameOfDirectory"] = baseNameOfDirectory
                        content["baseName"] = baseName
                        content["artist"] = tagger.getArtist()
                        content["title"] = tagger.getTitle()
                        content["album"] = tagger.getAlbum()
                        content["albumArtist"] = tagger.getAlbumArtist()
                        content["trackNum"] = tagger.getTrackNum()
                        content["year"] = tagger.getYear()
                        content["genre"] = tagger.getGenre()
                        content["firstComment"] = tagger.getFirstComment()
                        content["firstLyrics"] = tagger.getFirstLyrics()
                        if tagger.isSupportInfo:
                            content["length"] = tagger.getLength()
                            content["bitrate"] = tagger.getBitrate()
                            content["sampleRate"] = tagger.getSampleRate()
                            content["mode"] = tagger.getMode()
                        content["size"] = details[stat.ST_SIZE]
                        content["lastAccessed"] = details[stat.ST_ATIME]
                        content["lastModified"] = details[stat.ST_MTIME]
                        content["lastMetadataChanged"] = details[stat.ST_CTIME]
                        self.values.append(content)
                        newBaseNameOfDirectory = Organizer.emend(self.values[rowNo]["baseNameOfDirectory"], "directory")
                        self.createItem(rowNo, "baseNameOfDirectory", newBaseNameOfDirectory,
                                        self.values[rowNo]["baseNameOfDirectory"])

                        newBaseName = Organizer.emend(self.values[rowNo]["baseName"], "file")
                        self.createItem(rowNo, "baseName", newBaseName, self.values[rowNo]["baseName"])

                        newArtist = Organizer.emend(self.values[rowNo]["artist"])
                        self.createItem(rowNo, "artist", newArtist, self.values[rowNo]["artist"])

                        newTitle = Organizer.emend(self.values[rowNo]["title"])
                        self.createItem(rowNo, "title", newTitle, self.values[rowNo]["title"])

                        newAlbum = Organizer.emend(self.values[rowNo]["album"])
                        self.createItem(rowNo, "album", newAlbum, self.values[rowNo]["album"])

                        newAlbumArtist = Organizer.emend(self.values[rowNo]["albumArtist"])
                        self.createItem(rowNo, "albumArtist", newAlbumArtist, self.values[rowNo]["albumArtist"])

                        newTrackNum = str(self.values[rowNo]["trackNum"])
                        self.createItem(rowNo, "trackNum", newTrackNum, self.values[rowNo]["trackNum"])

                        newYear = Organizer.emend(self.values[rowNo]["year"])
                        self.createItem(rowNo, "year", newYear, self.values[rowNo]["year"])

                        newGenre = Organizer.emend(self.values[rowNo]["genre"])
                        self.createItem(rowNo, "genre", newGenre, self.values[rowNo]["genre"])

                        newFirstComment = Organizer.emend(self.values[rowNo]["firstComment"])
                        self.createItem(rowNo, "firstComment", newFirstComment, self.values[rowNo]["firstComment"])

                        newFirstLyrics = Organizer.emend(self.values[rowNo]["firstLyrics"])
                        self.createItem(rowNo, "firstLyrics", newFirstLyrics, self.values[rowNo]["firstLyrics"])

                        if tagger.isSupportInfo:
                            self.createItem(rowNo, "length", content["length"])
                            self.createItem(rowNo, "bitrate", content["bitrate"])
                            self.createItem(rowNo, "sampleRate", content["sampleRate"])
                            self.createItem(rowNo, "mode", content["mode"])

                        self.createItem(rowNo, "size", Organizer.getCorrectedFileSize(content["size"]))

                        self.createItem(rowNo, "lastAccessed", Organizer.getCorrectedTime(content["lastAccessed"]))

                        self.createItem(rowNo, "lastModified", Organizer.getCorrectedTime(content["lastModified"]))

                        self.createItem(rowNo, "lastMetadataChanged",
                                        Organizer.getCorrectedTime(content["lastMetadataChanged"]))

                        rowNo += 1
                    else:
                        allItemNumber -= 1
                except:
                    ReportBug.ReportBug()
                    allItemNumber -= 1
            else:
                allItemNumber = rowNo
            Dialogs.showState(translate("Tables", "Generating Table..."), rowNo, allItemNumber, True)
            if isContinueThreadAction is False:
                break
        uni.finishThreadAction()
        self.setRowCount(len(self.values))  # In case of Non Readable Files and Canceled process
        if isCanNoncompatible:
            Dialogs.show(translate("FileUtils/Musics", "Possible ID3 Mismatch"),
                         translate("FileUtils/Musics",
                                   "Some of the files presented in the table may not support ID3 technology.<br>Please check the files and make sure they support ID3 information before proceeding."))