本文整理汇总了Python中threading.Timer.deamon方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.deamon方法的具体用法?Python Timer.deamon怎么用?Python Timer.deamon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类threading.Timer
的用法示例。
在下文中一共展示了Timer.deamon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_new_videos
# 需要导入模块: from threading import Timer [as 别名]
# 或者: from threading.Timer import deamon [as 别名]
def get_new_videos(self):
self.get_videos_in_playlist(self.playlistId)
for video_id in list(self.difference):
title = self.new_videos[video_id]
try:
self.download_video(title, video_id)
self.convert_to_mp3(title)
if self.config.get('video', 1) == 0:
self.delete_video(title)
if not self.old_playlist[self.playlistId]:
self.old_playlist[self.playlistId] = []
self.old_playlist[self.playlistId].append(video_id)
except Exception as e:
self.send_to_output("An error occurred when processing video with id: " + video_id)
self.send_to_output(e)
with open('playlist.json', 'w') as outfile:
json.dump(self.old_playlist, outfile)
#t = Timer(self.config.get('poll', 3600.0), self.get_new_videos)
t = Timer(10, self.get_new_videos)
t.deamon = True
t.start()