Check if file was previously downloaded
This commit is contained in:
parent
dd6464de5d
commit
d0552f9e67
18
mvw-dl.py
18
mvw-dl.py
@ -639,6 +639,24 @@ def get_content_length(
|
||||
return 0
|
||||
|
||||
|
||||
def is_already_downloaded(
|
||||
show: type_def.mvw_json_response.Show,
|
||||
state_file_abs_path: str,
|
||||
show_name: str) -> bool:
|
||||
|
||||
with open(state_file_abs_path, "r") as state_file:
|
||||
try:
|
||||
json_state = json.load(state_file)
|
||||
for log_entry in json_state:
|
||||
for log_data in [key for key in log_entry]:
|
||||
if show.topic == log_entry[log_data]["topic"] and show.title == log_entry[log_data]["title"]:
|
||||
log.debug(f"""Show "{show_name}" already downloaded, won't queue""")
|
||||
return True
|
||||
except json.JSONDecodeError:
|
||||
return False
|
||||
return False
|
||||
|
||||
|
||||
def download_media(
|
||||
section_name: str,
|
||||
config_obj: configparser.ConfigParser(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user