Fix temporary file removal again

This commit is contained in:
Cadence Ember 2021-04-03 14:57:51 +13:00
parent 20fa40dd3d
commit fe04a4dbd6
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
1 changed files with 6 additions and 1 deletions

View File

@ -4,7 +4,12 @@ def get_created_files(id):
if id[0] == "-": if id[0] == "-":
id = "_" + id[1:] # youtube-dl changes - to _ at the start, presumably to not accidentally trigger switches with * in shell id = "_" + id[1:] # youtube-dl changes - to _ at the start, presumably to not accidentally trigger switches with * in shell
id += "_" id += "_"
trim_id = id.lstrip("-_")
# youtube-dl thinks it's a really good idea to do this, for some reason.
trim_id = id.lstrip("_")
if trim_id.startswith("-"):
trim_id = "_" + trim_id[len("-"):]
return (f for f in os.listdir() if f.startswith(id) or f.startswith(trim_id)) return (f for f in os.listdir() if f.startswith(id) or f.startswith(trim_id))
def clean_up_temp_files(id): def clean_up_temp_files(id):