smashed updated
This commit is contained in:
1 parent
77921ba6a8
commit
1da0b26320
14 files changed
+321
-96
No files matched your search
@@ -1,4 +1,3 @@
|
||||
import html
|
||||
from sqlalchemy import and_, select
|
||||
from app.core.models.node_storage import StoredContent
|
||||
from app.core.models.content.user_content import UserContent, UserAction
|
||||
@@ -26,7 +25,6 @@ class PlayerTemplates:
|
||||
text = ""
|
||||
content_metadata_json = {}
|
||||
description_block = ""
|
||||
status_hint = ""
|
||||
if content:
|
||||
assert content.type.startswith('onchain/content'), "Invalid nodeStorage content type"
|
||||
cd_log = f"Content (SHA256: {content.hash}), Encrypted: {content.encrypted}, TelegramCID: {content.telegram_cid}. "
|
||||
@@ -114,9 +112,6 @@ class PlayerTemplates:
|
||||
if encrypted_content_row:
|
||||
break
|
||||
|
||||
if not local_content:
|
||||
status_hint = self.user.translated('p_playerContext_contentNotReady')
|
||||
|
||||
description = (content_metadata_json.get('description') or '').strip()
|
||||
encrypted_description = (encrypted_content_row.description or '').strip() if encrypted_content_row and encrypted_content_row.description else ''
|
||||
if not description and encrypted_description:
|
||||
@@ -124,18 +119,24 @@ class PlayerTemplates:
|
||||
if description:
|
||||
description_block = f"{description}\n"
|
||||
|
||||
title = (
|
||||
content_metadata_json.get('name')
|
||||
or (encrypted_content_row.title if encrypted_content_row and encrypted_content_row.title else None)
|
||||
or (local_content.filename if local_content else None)
|
||||
or (content.filename if content else None)
|
||||
or content.cid.serialize_v2()
|
||||
)
|
||||
|
||||
status_block = f"{status_hint}\n" if status_hint else ""
|
||||
metadata_title = content_metadata_json.get('title') or content_metadata_json.get('name')
|
||||
if not metadata_title:
|
||||
metadata_title = (
|
||||
(encrypted_content_row.title if encrypted_content_row and encrypted_content_row.title else None)
|
||||
or (local_content.filename if local_content else None)
|
||||
or (content.filename if content else None)
|
||||
or content.cid.serialize_v2()
|
||||
)
|
||||
metadata_artist = content_metadata_json.get('artist')
|
||||
if metadata_artist in ('', None):
|
||||
metadata_artist = None
|
||||
if not metadata_artist:
|
||||
encrypted_artist = getattr(encrypted_content_row, 'artist', None)
|
||||
metadata_artist = encrypted_artist if encrypted_artist else metadata_artist
|
||||
title = f"{metadata_artist} – {metadata_title}" if metadata_artist else metadata_title
|
||||
|
||||
text = f"""<b>{title}</b>
|
||||
{description_block}{status_block}Этот контент был загружен в MY
|
||||
{description_block}Этот контент был загружен в MY
|
||||
\t/ p2p content market /
|
||||
<blockquote><a href="{content_share_link['url']}">🔴 «открыть в MY»</a></blockquote>"""
|
||||
|
||||
@@ -152,16 +153,7 @@ class PlayerTemplates:
|
||||
)
|
||||
)).scalars().all()
|
||||
|
||||
if not local_content:
|
||||
if not processing_messages:
|
||||
notice = f"Контент «{html.escape(title)}» обрабатывается. Как только всё будет готово, отправим полную публикацию."
|
||||
await self.send_message(
|
||||
notice,
|
||||
message_type='content/processing',
|
||||
message_meta={'content_id': content.id},
|
||||
content_id=content.id,
|
||||
)
|
||||
else:
|
||||
if local_content and processing_messages:
|
||||
for msg in processing_messages:
|
||||
await self.delete_message(msg.message_id)
|
||||
|
||||
|
||||
Reference in new issue
Block a user