Merge pull request #87 from cyberjacob/watch-all-videos

Allow watching of all videos in a channel, folder, or other view sequentially
This commit is contained in:
chibicitiberiu
2019-11-30 12:42:52 +02:00
committed by GitHub
6 changed files with 148 additions and 13 deletions

View File

@ -74,7 +74,10 @@ class SynchronizeJob(Job):
if _ENABLE_UPDATE_STATS:
batch_ids = [video.video_id for video in batch]
video_stats = {v.id: v for v in self.__api.videos(batch_ids, part='id,statistics')}
video_stats = {v.id: v for v in self.__api.videos(batch_ids, part='id,statistics,contentDetails')}
else:
batch_ids = [video.video_id for video in filter(lambda video: video.duration == 0, batch)]
video_stats = {v.id: v for v in self.__api.videos(batch_ids, part='id,statistics,contentDetails')}
for video in batch:
self.progress_advance(1, "Updating video " + video.name)
@ -167,6 +170,7 @@ class SynchronizeJob(Job):
video.rating = yt_video.n_likes / (yt_video.n_likes + yt_video.n_dislikes)
video.views = yt_video.n_views
video.duration = yt_video.duration.total_seconds()
video.save()
@staticmethod