mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-12 21:28:29 +03:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
345e03e916 |
@@ -7,8 +7,6 @@ from dataclasses_json import dataclass_json, config
|
|||||||
import datetime
|
import datetime
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from dateutil.parser import parse as parse_dt
|
from dateutil.parser import parse as parse_dt
|
||||||
from loguru import logger
|
|
||||||
|
|
||||||
from .media import Media
|
from .media import Media
|
||||||
from .context import ArchivingContext
|
from .context import ArchivingContext
|
||||||
|
|
||||||
@@ -108,15 +106,10 @@ class Metadata:
|
|||||||
def get_timestamp(self, utc=True, iso=True) -> datetime.datetime:
|
def get_timestamp(self, utc=True, iso=True) -> datetime.datetime:
|
||||||
ts = self.get("timestamp")
|
ts = self.get("timestamp")
|
||||||
if not ts: return
|
if not ts: return
|
||||||
try:
|
if type(ts) == float: ts = datetime.datetime.fromtimestamp(ts)
|
||||||
if type(ts) == str: ts = datetime.datetime.fromisoformat(ts)
|
if utc: ts = ts.replace(tzinfo=datetime.timezone.utc)
|
||||||
if type(ts) == float: ts = datetime.datetime.fromtimestamp(ts)
|
if iso: return ts.isoformat()
|
||||||
if utc: ts = ts.replace(tzinfo=datetime.timezone.utc)
|
return ts
|
||||||
if iso: return ts.isoformat()
|
|
||||||
return ts
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Unable to parse timestamp {ts}: {e}")
|
|
||||||
return
|
|
||||||
|
|
||||||
def add_media(self, media: Media, id: str = None) -> Metadata:
|
def add_media(self, media: Media, id: str = None) -> Metadata:
|
||||||
# adds a new media, optionally including an id
|
# adds a new media, optionally including an id
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class AAApiDb(Database):
|
|||||||
self.allow_rearchive = bool(self.allow_rearchive)
|
self.allow_rearchive = bool(self.allow_rearchive)
|
||||||
self.store_results = bool(self.store_results)
|
self.store_results = bool(self.store_results)
|
||||||
self.assert_valid_string("api_endpoint")
|
self.assert_valid_string("api_endpoint")
|
||||||
|
self.assert_valid_string("api_secret")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def configs() -> dict:
|
def configs() -> dict:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ _MAJOR = "0"
|
|||||||
_MINOR = "7"
|
_MINOR = "7"
|
||||||
# On main and in a nightly release the patch should be one ahead of the last
|
# On main and in a nightly release the patch should be one ahead of the last
|
||||||
# released build.
|
# released build.
|
||||||
_PATCH = "10"
|
_PATCH = "7"
|
||||||
# This is mainly for nightly builds which have the suffix ".dev$DATE". See
|
# This is mainly for nightly builds which have the suffix ".dev$DATE". See
|
||||||
# https://semver.org/#is-v123-a-semantic-version for the semantics.
|
# https://semver.org/#is-v123-a-semantic-version for the semantics.
|
||||||
_SUFFIX = ""
|
_SUFFIX = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user