mirror of
https://github.com/chibicitiberiu/ytsm.git
synced 2024-02-24 05:43:31 +00:00
Fixed bug where videos are checked multiple times during synchronization. Fixed some errors when manually managing videos.
This commit is contained in:
parent
2ae41efb9e
commit
d1c3700c02
@ -69,7 +69,7 @@ class SynchronizeJob(Job):
|
|||||||
batch_ids = [video.video_id for video in batch]
|
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')}
|
||||||
|
|
||||||
for video in itertools.chain(work_vids, self.__new_vids):
|
for video in batch:
|
||||||
self.progress_advance(1, "Updating video " + video.name)
|
self.progress_advance(1, "Updating video " + video.name)
|
||||||
self.check_video_deleted(video)
|
self.check_video_deleted(video)
|
||||||
self.fetch_missing_thumbnails(video)
|
self.fetch_missing_thumbnails(video)
|
||||||
|
@ -228,27 +228,27 @@ class Video(models.Model):
|
|||||||
for file in self.get_files():
|
for file in self.get_files():
|
||||||
mime, _ = mimetypes.guess_type(file)
|
mime, _ = mimetypes.guess_type(file)
|
||||||
if mime is not None and mime.startswith('video/'):
|
if mime is not None and mime.startswith('video/'):
|
||||||
return (file, mime)
|
return file, mime
|
||||||
|
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
def delete_files(self):
|
def delete_files(self):
|
||||||
if self.downloaded_path is not None:
|
if self.downloaded_path is not None:
|
||||||
from YtManagerApp.management.jobs.delete_video import schedule_delete_video
|
from YtManagerApp.management.jobs.delete_video import DeleteVideoJob
|
||||||
from YtManagerApp.management.appconfig import appconfig
|
from YtManagerApp.management.appconfig import appconfig
|
||||||
from YtManagerApp.management.jobs.synchronize import schedule_synchronize_now_subscription
|
from YtManagerApp.management.jobs.synchronize import SynchronizeJob
|
||||||
|
|
||||||
schedule_delete_video(self)
|
DeleteVideoJob.schedule(self)
|
||||||
|
|
||||||
# Mark watched?
|
# Mark watched?
|
||||||
if self.subscription.user.preferences['mark_deleted_as_watched']:
|
if self.subscription.user.preferences['mark_deleted_as_watched']:
|
||||||
self.watched = True
|
self.watched = True
|
||||||
schedule_synchronize_now_subscription(self.subscription)
|
SynchronizeJob.schedule_now_for_subscription(self.subscription)
|
||||||
|
|
||||||
def download(self):
|
def download(self):
|
||||||
if not self.downloaded_path:
|
if not self.downloaded_path:
|
||||||
from YtManagerApp.management.jobs.download_video import schedule_download_video
|
from YtManagerApp.management.jobs.download_video import DownloadVideoJob
|
||||||
schedule_download_video(self)
|
DownloadVideoJob.schedule(self)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
@ -298,4 +298,3 @@ class JobMessage(models.Model):
|
|||||||
message = models.CharField(max_length=1024, null=False, default="")
|
message = models.CharField(max_length=1024, null=False, default="")
|
||||||
level = models.IntegerField(choices=JOB_MESSAGE_LEVELS, null=False, default=0)
|
level = models.IntegerField(choices=JOB_MESSAGE_LEVELS, null=False, default=0)
|
||||||
suppress_notification = models.BooleanField(null=False, default=False)
|
suppress_notification = models.BooleanField(null=False, default=False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user