本文整理汇总了Python中video.Video.number方法的典型用法代码示例。如果您正苦于以下问题:Python Video.number方法的具体用法?Python Video.number怎么用?Python Video.number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类video.Video
的用法示例。
在下文中一共展示了Video.number方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: autoAd
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import number [as 别名]
def autoAd(self, dir):
# Find all files in the dir
files = listFiles(os.path.join(settings.MEDIA_DIR, dir))
# Now sort the files alphabetically
files.sort()
# Get rid of files that don't have a media extension
temp = []
for file in files:
found = False
for extension in settings.SERIES_AUTOFIND_EXTENSIONS:
if file.endswith("." + extension):
found = True
if found:
temp.append(file)
files = temp
# Now make video objects for remaining files
self.videos = []
for file in files:
newVideo = Video()
newVideo.path = os.path.join(dir, file)
newVideo.number = files.index(file)
self.ads.append(newVideo)
示例2: auto
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import number [as 别名]
def auto(self, dir):
# Find all files in the dir
files = listFiles(os.path.join(settings.MEDIA_DIR, dir))
# Now sort the files alphabetically
files.sort()
# Check for pickle file
temp = files
for file in files:
# Check if this file is the pickle file.
if file == ".pickle":
# Load this file
self.pickle = pickle.load(open(os.path.join(settings.MEDIA_DIR, dir, ".pickle"), "rb"))
temp.remove(file)
files = temp
# Get rid of files that don't have a media extension
temp = []
for file in files:
found = False
for extension in self.extensions:
if file.endswith("." + extension):
found = True
if found:
temp.append(file)
files = temp
# Now make video objects for remaining files
self.videos = []
for file in files:
newVideo = Video()
newVideo.path = os.path.join(dir, file)
newVideo.number = files.index(file)
# While we are here, we can check if there are any subs for this video
if "subs" in listDirs(os.path.join(settings.MEDIA_DIR, dir)):
for sub in listFiles(os.path.join(settings.MEDIA_DIR, dir, "subs")):
# Check if any of these subs match the video
if sub.split(".")[0] == file.split(".")[0]:
# Cool, this file has some subtitles
newVideo.sub_path = os.path.join(settings.MEDIA_DIR, dir, "subs", sub)
self.videos.append(newVideo)
# Make this dir our new path
self.path = os.path.join(settings.MEDIA_DIR, dir)
# Make sure we note how many files there were.
self.pickle.num = len(self.videos)