mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-12 05:08:28 +03:00
Basic docs structure for RTD
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
"""
|
||||
Acts as a container for metadata and media objects associated with an archived item.
|
||||
|
||||
Key Functionalities:
|
||||
- Store and retrieve metadata and associated media.
|
||||
- Merge metadata objects with conflict resolution.
|
||||
- Validate properties like URLs and timestamps.
|
||||
- Manage and deduplicate media objects.
|
||||
- Support for flexible metadata querying and appending.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
import hashlib
|
||||
@@ -25,7 +35,11 @@ class Metadata:
|
||||
|
||||
def merge(self: Metadata, right: Metadata, overwrite_left=True) -> Metadata:
|
||||
"""
|
||||
merges two Metadata instances, will overwrite according to overwrite_left flag
|
||||
Merges another `Metadata` instance into this one.
|
||||
|
||||
Conflicts are resolved based on the `overwrite_left` flag:
|
||||
- If `True`, this instance's values are overwritten by `right`.
|
||||
- If `False`, the inverse applies.
|
||||
"""
|
||||
if not right: return self
|
||||
if overwrite_left:
|
||||
@@ -191,4 +205,4 @@ class Metadata:
|
||||
for r in results[1:]:
|
||||
if len(r.media) > len(most_complete.media): most_complete = r
|
||||
elif len(r.media) == len(most_complete.media) and len(r.metadata) > len(most_complete.metadata): most_complete = r
|
||||
return most_complete
|
||||
return most_complete
|
||||
|
||||
Reference in New Issue
Block a user