purchase notify, fix preview

This commit is contained in:
user committed 2025-02-05 13:06:30 +03:00
1 parent 21a83cf5b8
commit 4d15211344
3 files changed
+26 -2

No files matched your search

+8
View File
@@ -1,3 +1,4 @@
import json
from base58 import b58decode
from sqlalchemy import Column, BigInteger, Integer, String, ForeignKey, DateTime, JSON, Boolean
from sqlalchemy.orm import relationship
@@ -139,6 +140,13 @@ class StoredContent(AlchemyBase, AudioContentMixin):
"created": spec_field_created,
"updated": spec_field_updated,
}
def metadata_json(self, db_session):
metadata_cid = self.meta.get('metadata_cid')
if metadata_cid:
metadata_content = StoredContent.from_cid(db_session, metadata_cid)
with open(metadata_content.filepath, 'r') as f:
return json.loads(f.read())
@classmethod
def from_cid(cls, db_session, content_id):