mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-19 15:25:51 +00:00
running codespell #15
This commit is contained in:
parent
eafda731c9
commit
cbedfe2acb
@ -72,7 +72,7 @@ class PendingList:
|
|||||||
elif isinstance(video, tuple):
|
elif isinstance(video, tuple):
|
||||||
youtube_id = video[0]
|
youtube_id = video[0]
|
||||||
if youtube_id in all_downloaded:
|
if youtube_id in all_downloaded:
|
||||||
# skip already downlaoded
|
# skip already downloaded
|
||||||
continue
|
continue
|
||||||
video = self.get_youtube_details(youtube_id)
|
video = self.get_youtube_details(youtube_id)
|
||||||
# skip on download error
|
# skip on download error
|
||||||
|
@ -108,7 +108,7 @@ def get_lock(lock_key):
|
|||||||
|
|
||||||
def monitor_cache_dir(cache_dir):
|
def monitor_cache_dir(cache_dir):
|
||||||
"""
|
"""
|
||||||
look at download cache dir directly as alterative progress info
|
look at download cache dir directly as alternative progress info
|
||||||
"""
|
"""
|
||||||
dl_cache = os.path.join(cache_dir, 'download')
|
dl_cache = os.path.join(cache_dir, 'download')
|
||||||
cache_file = os.listdir(dl_cache)
|
cache_file = os.listdir(dl_cache)
|
||||||
|
@ -216,7 +216,7 @@ class YoutubeChannel:
|
|||||||
|
|
||||||
|
|
||||||
class YoutubeVideo:
|
class YoutubeVideo:
|
||||||
""" represents a signle youtube video """
|
""" represents a single youtube video """
|
||||||
|
|
||||||
CONFIG = AppConfig().config
|
CONFIG = AppConfig().config
|
||||||
ES_URL = CONFIG['application']['es_url']
|
ES_URL = CONFIG['application']['es_url']
|
||||||
|
@ -436,7 +436,7 @@ class ElasticBackup:
|
|||||||
return file_content
|
return file_content
|
||||||
|
|
||||||
def write_es_json(self, file_content, index_name):
|
def write_es_json(self, file_content, index_name):
|
||||||
""" write nd json file for es _bulk API to disk """
|
""" write nd-json file for es _bulk API to disk """
|
||||||
cache_dir = self.config['application']['cache_dir']
|
cache_dir = self.config['application']['cache_dir']
|
||||||
file_name = f'es_{index_name}-{self.timestamp}.json'
|
file_name = f'es_{index_name}-{self.timestamp}.json'
|
||||||
file_path = os.path.join(cache_dir, 'backup', file_name)
|
file_path = os.path.join(cache_dir, 'backup', file_name)
|
||||||
|
@ -211,7 +211,7 @@ class FilesystemScanner:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.all_downloaded = self.get_all_downloaded()
|
self.all_downloaded = self.get_all_downloaded()
|
||||||
self.all_indexed = self.get_all_indexed()
|
self.all_indexed = self.get_all_indexed()
|
||||||
self.missmatch = None
|
self.mismatch = None
|
||||||
self.to_rename = None
|
self.to_rename = None
|
||||||
self.to_index = None
|
self.to_index = None
|
||||||
self.to_delete = None
|
self.to_delete = None
|
||||||
@ -296,7 +296,7 @@ class FilesystemScanner:
|
|||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
self.missmatch = to_fix
|
self.mismatch = to_fix
|
||||||
self.to_rename = to_rename
|
self.to_rename = to_rename
|
||||||
|
|
||||||
def rename_files(self):
|
def rename_files(self):
|
||||||
@ -307,11 +307,11 @@ class FilesystemScanner:
|
|||||||
new_path = os.path.join(self.VIDEOS, channel, expected_filename)
|
new_path = os.path.join(self.VIDEOS, channel, expected_filename)
|
||||||
os.rename(old_path, new_path)
|
os.rename(old_path, new_path)
|
||||||
|
|
||||||
def send_missmatch_bulk(self):
|
def send_mismatch_bulk(self):
|
||||||
""" build bulk update """
|
""" build bulk update """
|
||||||
bulk_list = []
|
bulk_list = []
|
||||||
for video_missmatch in self.missmatch:
|
for video_mismatch in self.mismatch:
|
||||||
youtube_id, media_url = video_missmatch
|
youtube_id, media_url = video_mismatch
|
||||||
action = {"update": {"_id": youtube_id, "_index": 'ta_video'}}
|
action = {"update": {"_id": youtube_id, "_index": 'ta_video'}}
|
||||||
source = {"doc": {"media_url": media_url}}
|
source = {"doc": {"media_url": media_url}}
|
||||||
bulk_list.append(json.dumps(action))
|
bulk_list.append(json.dumps(action))
|
||||||
@ -454,8 +454,8 @@ def scan_filesystem():
|
|||||||
filesystem_handler.list_comarison()
|
filesystem_handler.list_comarison()
|
||||||
if filesystem_handler.to_rename:
|
if filesystem_handler.to_rename:
|
||||||
filesystem_handler.rename_files()
|
filesystem_handler.rename_files()
|
||||||
if filesystem_handler.missmatch:
|
if filesystem_handler.mismatch:
|
||||||
filesystem_handler.send_missmatch_bulk()
|
filesystem_handler.send_mismatch_bulk()
|
||||||
if filesystem_handler.to_delete:
|
if filesystem_handler.to_delete:
|
||||||
filesystem_handler.delete_from_index()
|
filesystem_handler.delete_from_index()
|
||||||
if filesystem_handler.to_index:
|
if filesystem_handler.to_index:
|
||||||
|
@ -72,7 +72,7 @@ class SearchHandler:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def vid_cache_link(hit):
|
def vid_cache_link(hit):
|
||||||
""" download thumbnails into chache """
|
""" download thumbnails into cache """
|
||||||
vid_thumb = hit['source']['vid_thumb_url']
|
vid_thumb = hit['source']['vid_thumb_url']
|
||||||
youtube_id = hit['source']['youtube_id']
|
youtube_id = hit['source']['youtube_id']
|
||||||
channel_id_hit = hit['source']['channel']['channel_id']
|
channel_id_hit = hit['source']['channel']['channel_id']
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<h2>Color scheme</h2>
|
<h2>Color scheme</h2>
|
||||||
<div class="settings-item">
|
<div class="settings-item">
|
||||||
<p>Current color scheme: <span class="settings-current">{{ config.application.colors }}</span></p>
|
<p>Current color scheme: <span class="settings-current">{{ config.application.colors }}</span></p>
|
||||||
<i>Select yout prefered color scheme between dark and light mode.</i><br>
|
<i>Select yout preferred color scheme between dark and light mode.</i><br>
|
||||||
<select name="application.colors" id="application.colors">
|
<select name="application.colors" id="application.colors">
|
||||||
<option value="" disabled selected> -- change color scheme -- </option>
|
<option value="" disabled selected> -- change color scheme -- </option>
|
||||||
<option value="dark">dark mode</option>
|
<option value="dark">dark mode</option>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Functionality:
|
Functionality:
|
||||||
- all views for home app
|
- all views for home app
|
||||||
- process post data recieved from frontend via ajax
|
- process post data received from frontend via ajax
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
@ -220,7 +220,7 @@ class DownloadView(View):
|
|||||||
|
|
||||||
|
|
||||||
class ChannelIdView(View):
|
class ChannelIdView(View):
|
||||||
""" resolves to /chanel/<channel-id>/
|
""" resolves to /channel/<channel-id>/
|
||||||
display single channel page from channel_id
|
display single channel page from channel_id
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user