Преглед на файлове

check data folder on startup

Nick Sweeting преди 6 години
родител
ревизия
6e5a77e1ad
променени са 3 файла, в които са добавени 6 реда и са изтрити 2 реда
  1. 1 0
      archivebox/legacy/config.py
  2. 4 1
      archivebox/legacy/main.py
  3. 1 1
      archivebox/legacy/schema.py

+ 1 - 0
archivebox/legacy/config.py

@@ -428,6 +428,7 @@ def check_dependencies() -> None:
         stderr('{red}[X] Missing some required dependencies.{reset}'.format(**ANSI))
         raise SystemExit(1)
         
+def check_data_folder() -> None:
     if HAS_INVALID_DB:
         stderr('{red}[X] No archive data found in:{reset} {}'.format(OUTPUT_DIR, **ANSI))
         stderr('    Are you running archivebox in the right folder?')

+ 4 - 1
archivebox/legacy/main.py

@@ -12,10 +12,10 @@ from .index import (
 )
 from .archive_methods import archive_link
 from .config import (
-    ANSI,
     ONLY_NEW,
     OUTPUT_DIR,
     check_dependencies,
+    check_data_folder,
 )
 from .logs import (
     log_archiving_started,
@@ -33,6 +33,7 @@ def update_archive_data(import_path: Optional[str]=None, resume: Optional[float]
     """The main ArchiveBox entrancepoint. Everything starts here."""
 
     check_dependencies()
+    check_data_folder()
 
     # Step 1: Load list of links from the existing index
     #         merge in and dedupe new links from import_path
@@ -107,6 +108,8 @@ def remove_archive_links(filter_patterns: List[str], filter_type: str='exact',
                          yes: bool=False, delete: bool=False) -> List[Link]:
     
     check_dependencies()
+    check_data_folder()
+
     log_list_started(filter_patterns, filter_type)
     timer = TimedProgress(360, prefix='      ')
     try:

+ 1 - 1
archivebox/legacy/schema.py

@@ -69,7 +69,7 @@ class ArchiveResult:
 
         cols = cols or self.field_names()
         return separator.join(
-            to_json(getattr(self, col), indent=False).ljust(ljust)
+            to_json(getattr(self, col), indent=None).ljust(ljust)
             for col in cols
         )