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


Python FileUtils.getMimeType方法代码示例

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


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

示例1: __init__

# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getMimeType [as 别名]
 def __init__(self, _filePath, _isOpenDetailsOnNewWindow):
     try:
         if uni.getBoolValue("isForceOpenWithDefaultApplication"):
             _path = fu.checkSource(_filePath)
             Execute.openWith([_path])
         else:
             _path = fu.checkSource(_filePath, "file", False)
             if _path is not None:
                 isOpened = False
                 mtype = fu.getMimeType(_path)
                 if mtype[0] is not None:
                     if mtype[0].split("/")[0] == "text":
                         TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
                         isOpened = True
                     elif mtype[0].split("/")[0] == "audio":
                         if Taggers.getTagger(True) is not None:
                             MusicDetails.MusicDetails(_path, _isOpenDetailsOnNewWindow)
                             isOpened = True
                     elif mtype[0].split("/")[0] == "image":
                         ImageDetails.ImageDetails(_path, "file", _isOpenDetailsOnNewWindow)
                         isOpened = True
                     elif fu.isBinary(_path) is False:
                         TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
                         isOpened = True
                 else:
                     if fu.isBinary(_path) is False:
                         TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
                         isOpened = True
                 if isOpened is False:
                     if uni.getBoolValue("isOpenWithDefaultApplication"):
                         Execute.openWith([_path])
                     else:
                         Dialogs.showError(translate("Details", "File Is Not Supported"),
                                           str(translate("Details",
                                                         "\"%s\" couldn't opened. This file is not supported.")) % Organizer.getLink(
                                               str(_path)))
             elif fu.isDir(_filePath):
                 if uni.getBoolValue("isOpenWithDefaultApplication"):
                     Execute.openWith([_filePath])
                 else:
                     Dialogs.showError(translate("Details", "Directories Is Not Supported"),
                                       str(translate("Details",
                                                     "\"%s\" couldn't opened. Directories is not supported to show details.")) % Organizer.getLink(
                                           str(_filePath)))
             else:
                 Dialogs.showError(translate("Details", "File Is Not Exist"),
                                   str(translate("Details",
                                                 "\"%s\" couldn't opened. This file is not exist.")) % Organizer.getLink(
                                       str(_filePath)))
     except:
         answer = Dialogs.askSpecial(translate("Details", "File Couldn't Opened"),
                                     str(translate("Details",
                                                   "\"%s\" couldn't opened. This file may is not supported. <br>If you think this is a bug, please report us.")) % Organizer.getLink(
                                         str(_filePath)),
                                     translate("QuickMake", "Report This Bug"), translate("QuickMake", "OK"), None)
         if answer == translate("QuickMake", "Report This Bug"):
             ReportBug.ReportBug()
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:59,代码来源:__init__.py

示例2: addImage

# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getMimeType [as 别名]
 def addImage(self, _imageType, _imagePath, _description):
     self.isSave = True
     imageData = fu.readFromBinaryFile(_imagePath)
     mimeType = fu.getMimeType(_imagePath)[0]
     self.tags.add(id3.APIC(encoding=3, mime=mimeType, type=int(_imageType),
                                        desc=uni.trUnicode(_description), data=imageData))
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:8,代码来源:mutagenTagger.py

示例3: addImage

# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getMimeType [as 别名]
 def addImage(self, _imageType, _imagePath, _description):
     self.isSave = True
     imageData = fu.readFromBinaryFile(_imagePath)
     mimeType = fu.getMimeType(_imagePath)[0]
     self.tag.images.set(int(_imageType), imageData, mimeType, uni.trUnicode(_description))
开发者ID:supermurat,项目名称:hamsi-manager,代码行数:7,代码来源:EyeD3Tagger.py


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