Add custom archive directory as configuration option.

This commit is contained in:
Marco Rossi 2017-08-20 17:37:49 +02:00
parent 0a75dee583
commit 17d07239f0
4 changed files with 11 additions and 7 deletions

View file

@ -13,6 +13,7 @@ from index import dump_index
from fetch import dump_website
from config import (
ARCHIVE_PERMISSIONS,
ARCHIVE_DIR,
ANSI,
check_dependencies,
)
@ -46,11 +47,11 @@ def create_archive(export_file, service=None, resume=None):
print('[X] No links found in {}, is it a {} export file?'.format(export_file, service))
raise SystemExit(1)
if not os.path.exists(service):
os.makedirs(service)
if not os.path.exists(os.path.join(ARCHIVE_DIR, service)):
os.makedirs(os.path.join(ARCHIVE_DIR, service))
if not os.path.exists(os.path.join(service, 'archive')):
os.makedirs(os.path.join(service, 'archive'))
if not os.path.exists(os.path.join(ARCHIVE_DIR, service, 'archive')):
os.makedirs(os.path.join(ARCHIVE_DIR, service, 'archive'))
dump_index(links, service)
check_dependencies()