added archive.manual.log

This commit is contained in:
ArabCoders 2024-10-31 23:35:26 +03:00
parent d0198ccd78
commit f76e9b8f77
2 changed files with 14 additions and 0 deletions

View file

@ -18,6 +18,7 @@ class Config:
temp_path: str = '{download_path}'
temp_keep: bool = False
db_file: str = '{config_path}/ytptube.db'
manual_archive: str = '{config_path}/archive.manual.log'
url_host: str = ''
url_prefix: str = ''

View file

@ -664,6 +664,19 @@ class Main:
with open(file, 'a') as f:
f.write(f"{idDict['archive_id']}\n")
manual_archive = self.config.manual_archive
if manual_archive:
previouslyArchived = False
with open(manual_archive, 'r') as f:
for line in f.readlines():
if idDict['archive_id'] in line:
previouslyArchived = True
break
if not previouslyArchived:
with open(manual_archive, 'a') as f:
f.write(f"{idDict['archive_id']} - at: {datetime.now().isoformat()}\n")
LOG.info(f'Archiving item: {data["url"]=}')
@self.sio.event()