mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-25 13:10:15 +00:00
moove limit_count functionality into VideoDownload class to avoid having to reload the celery worker on config change
This commit is contained in:
parent
97819318da
commit
641698c350
@ -375,6 +375,10 @@ class VideoDownloader:
|
||||
|
||||
def download_list(self):
|
||||
""" download the list of youtube_ids """
|
||||
limit_count = self.config['downloads']['limit_count']
|
||||
if limit_count:
|
||||
self.youtube_id_list = self.youtube_id_list[:limit_count]
|
||||
|
||||
for youtube_id in self.youtube_id_list:
|
||||
try:
|
||||
self.dl_single_vid(youtube_id)
|
||||
|
@ -17,7 +17,6 @@ from home.src.config import AppConfig
|
||||
|
||||
|
||||
CONFIG = AppConfig().config
|
||||
LIMIT_COUNT = CONFIG['downloads']['limit_count']
|
||||
REDIS_HOST = CONFIG['application']['REDIS_HOST']
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'home.settings')
|
||||
@ -41,12 +40,8 @@ def download_pending():
|
||||
""" download latest pending videos """
|
||||
pending_handler = PendingList()
|
||||
pending_vids = pending_handler.get_all_pending()[0]
|
||||
pending = [i['youtube_id'] for i in pending_vids]
|
||||
pending.reverse()
|
||||
if LIMIT_COUNT:
|
||||
to_download = pending[:LIMIT_COUNT]
|
||||
else:
|
||||
to_download = pending
|
||||
to_download = [i['youtube_id'] for i in pending_vids]
|
||||
to_download.reverse()
|
||||
if to_download:
|
||||
download_handler = VideoDownloader(to_download)
|
||||
download_handler.download_list()
|
||||
|
Loading…
Reference in New Issue
Block a user