From fe60012cfc04a96fc92be3a357b96efaeee15111 Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 20 Apr 2025 22:12:53 -0400 Subject: [PATCH] Add `metadata_dumps` function --- tubesync/sync/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index e8ae8867..8a065f4e 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -1104,6 +1104,11 @@ class Media(models.Model): return self.metadata is not None + def metadata_dumps(self, arg_dict=dict()): + data = arg_dict or self.new_metadata.with_formats + return json.dumps(data, separators=(',', ':'), default=json_serial) + + def metadata_loads(self, arg_str='{}'): data = json.loads(arg_str) or self.loaded_metadata return self.ingest_metadata(data)