当前位置: 首页>>代码示例>>Python>>正文


Python Organizer.getCorrectedFileSize方法代码示例

本文整理汇总了Python中Core.Organizer.getCorrectedFileSize方法的典型用法代码示例。如果您正苦于以下问题:Python Organizer.getCorrectedFileSize方法的具体用法?Python Organizer.getCorrectedFileSize怎么用?Python Organizer.getCorrectedFileSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core.Organizer的用法示例。


在下文中一共展示了Organizer.getCorrectedFileSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: refreshTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getCorrectedFileSize [as 别名]
    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
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:62,代码来源:FolderTable.py

示例2: refreshTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getCorrectedFileSize [as 别名]

#.........这里部分代码省略.........
                                                    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
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:104,代码来源:AmarokCopyTable.py

示例3: refreshTable

# 需要导入模块: from Core import Organizer [as 别名]
# 或者: from Core.Organizer import getCorrectedFileSize [as 别名]
    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"]))

#.........这里部分代码省略.........
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:103,代码来源:SubFolderMusicTable.py


注:本文中的Core.Organizer.getCorrectedFileSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。