本文整理汇总了Python中fsgs.FSGSDirectories.FSGSDirectories.get_titles_dirs方法的典型用法代码示例。如果您正苦于以下问题:Python FSGSDirectories.get_titles_dirs方法的具体用法?Python FSGSDirectories.get_titles_dirs怎么用?Python FSGSDirectories.get_titles_dirs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fsgs.FSGSDirectories.FSGSDirectories
的用法示例。
在下文中一共展示了FSGSDirectories.get_titles_dirs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_screenshot_path
# 需要导入模块: from fsgs.FSGSDirectories import FSGSDirectories [as 别名]
# 或者: from fsgs.FSGSDirectories.FSGSDirectories import get_titles_dirs [as 别名]
def get_screenshot_path(self, number):
if number == 0:
sha1 = LauncherConfig.get("title_sha1")
else:
sha1 = LauncherConfig.get("screen{0}_sha1".format(number))
if sha1:
return "sha1:" + sha1
if number == 0:
path = self.get_override_path("title_image")
else:
path = self.get_override_path("screen{0}_image".format(number))
if path and os.path.exists(path):
return path
if self.uuid:
if number == 0:
name = "title.png"
else:
name = "screen{0}.png".format(number)
paths = FSGSDirectories.get_images_dirs()
for dir_ in paths:
p = os.path.join(dir_, self.platform, "Images",
self.uuid[:2], self.uuid, name)
if os.path.exists(p):
return p
p = os.path.join(dir_, self.platform, "Thumbnails",
self.uuid[:2], self.uuid, name)
if os.path.exists(p):
return p
letter = self.get_letter(self.name)
if not letter:
return None
name = self.name
if number == 0:
override_dir = LauncherConfig.get("titles_dir")
if override_dir:
paths = [Paths.expand_path(override_dir)]
else:
paths = FSGSDirectories.get_titles_dirs()
else:
override_dir = LauncherConfig.get("screenshots_dir")
if override_dir:
paths = [Paths.expand_path(override_dir)]
else:
paths = FSGSDirectories.get_screenshots_dirs()
if number >= 2:
name = "{0}_{1}".format(name, number)
for dir_ in paths:
path = os.path.join(dir_, letter, name + ".png")
if os.path.exists(path):
return path
path = os.path.join(dir_, letter, name + ".gif")
if os.path.exists(path):
return path
path = os.path.join(dir_, name + ".png")
if os.path.exists(path):
return path
path = os.path.join(dir_, letter, name + ".gif")
if os.path.exists(path):
return path
return None