mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-24 05:56:37 +00:00
Better result when Media.new_metadata
does not exist
This commit is contained in:
parent
4902503504
commit
050a60c0c6
@ -1115,7 +1115,12 @@ class Media(models.Model):
|
|||||||
|
|
||||||
def metadata_dumps(self, arg_dict=dict()):
|
def metadata_dumps(self, arg_dict=dict()):
|
||||||
from common.utils import json_serial
|
from common.utils import json_serial
|
||||||
data = arg_dict or self.new_metadata.with_formats
|
fallback = dict()
|
||||||
|
try:
|
||||||
|
fallback.update(self.new_metadata.with_formats)
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
pass
|
||||||
|
data = arg_dict or fallback
|
||||||
return json.dumps(data, separators=(',', ':'), default=json_serial)
|
return json.dumps(data, separators=(',', ':'), default=json_serial)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user