|
|
|
@ -211,7 +211,7 @@ class FilesystemScanner:
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.all_downloaded = self.get_all_downloaded()
|
|
|
|
|
self.all_indexed = self.get_all_indexed()
|
|
|
|
|
self.missmatch = None
|
|
|
|
|
self.mismatch = None
|
|
|
|
|
self.to_rename = None
|
|
|
|
|
self.to_index = None
|
|
|
|
|
self.to_delete = None
|
|
|
|
@ -296,7 +296,7 @@ class FilesystemScanner:
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
self.missmatch = to_fix
|
|
|
|
|
self.mismatch = to_fix
|
|
|
|
|
self.to_rename = to_rename
|
|
|
|
|
|
|
|
|
|
def rename_files(self):
|
|
|
|
@ -307,11 +307,11 @@ class FilesystemScanner:
|
|
|
|
|
new_path = os.path.join(self.VIDEOS, channel, expected_filename)
|
|
|
|
|
os.rename(old_path, new_path)
|
|
|
|
|
|
|
|
|
|
def send_missmatch_bulk(self):
|
|
|
|
|
def send_mismatch_bulk(self):
|
|
|
|
|
""" build bulk update """
|
|
|
|
|
bulk_list = []
|
|
|
|
|
for video_missmatch in self.missmatch:
|
|
|
|
|
youtube_id, media_url = video_missmatch
|
|
|
|
|
for video_mismatch in self.mismatch:
|
|
|
|
|
youtube_id, media_url = video_mismatch
|
|
|
|
|
action = {"update": {"_id": youtube_id, "_index": 'ta_video'}}
|
|
|
|
|
source = {"doc": {"media_url": media_url}}
|
|
|
|
|
bulk_list.append(json.dumps(action))
|
|
|
|
@ -454,8 +454,8 @@ def scan_filesystem():
|
|
|
|
|
filesystem_handler.list_comarison()
|
|
|
|
|
if filesystem_handler.to_rename:
|
|
|
|
|
filesystem_handler.rename_files()
|
|
|
|
|
if filesystem_handler.missmatch:
|
|
|
|
|
filesystem_handler.send_missmatch_bulk()
|
|
|
|
|
if filesystem_handler.mismatch:
|
|
|
|
|
filesystem_handler.send_mismatch_bulk()
|
|
|
|
|
if filesystem_handler.to_delete:
|
|
|
|
|
filesystem_handler.delete_from_index()
|
|
|
|
|
if filesystem_handler.to_index:
|
|
|
|
|