fix meta
This commit is contained in:
parent
fa6f27a9ce
commit
a31a40e690
|
|
@ -95,8 +95,8 @@ async def s_api_v1_content_view(request, content_address: str):
|
||||||
invoice_url = None
|
invoice_url = None
|
||||||
try:
|
try:
|
||||||
invoice_url = await Bot(token=CLIENT_TELEGRAM_API_KEY).create_invoice_link(
|
invoice_url = await Bot(token=CLIENT_TELEGRAM_API_KEY).create_invoice_link(
|
||||||
'Lifetime access to content',
|
'Неограниченный доступ к контенту',
|
||||||
'You will receive NFT with lifetime access to content',
|
'Неограниченный доступ к контенту',
|
||||||
invoice_id, "XTR",
|
invoice_id, "XTR",
|
||||||
[
|
[
|
||||||
types.LabeledPrice(label='Lifetime access', amount=stars_cost),
|
types.LabeledPrice(label='Lifetime access', amount=stars_cost),
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
|
||||||
|
|
||||||
# Upload preview of decrypted content (limit to 30 seconds)
|
# Upload preview of decrypted content (limit to 30 seconds)
|
||||||
if content_type_declared in ('audio', 'video'):
|
if content_type_declared in ('audio', 'video'):
|
||||||
if True or not decrypted_content.meta.get('telegram_file_cache_preview'):
|
if not decrypted_content.meta.get('telegram_file_cache_preview'):
|
||||||
try:
|
try:
|
||||||
# Construct URL for trimmed preview using decrypted content
|
# Construct URL for trimmed preview using decrypted content
|
||||||
preview_content = db_session.query(StoredContent).filter_by(
|
preview_content = db_session.query(StoredContent).filter_by(
|
||||||
|
|
@ -174,7 +174,7 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
|
||||||
|
|
||||||
content_share_link = {
|
content_share_link = {
|
||||||
'text': user.translated('p_shareLinkContext').format(title=' – '.join(audio_title)),
|
'text': user.translated('p_shareLinkContext').format(title=' – '.join(audio_title)),
|
||||||
'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}/content?startapp=C{content.cid.serialize_v2()}"
|
'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}/content?startapp={content.cid.serialize_v2()}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create inline query result using decrypted content's file_id
|
# Create inline query result using decrypted content's file_id
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,11 @@ async def convert_loop(memory):
|
||||||
if wallet_owner_connection:
|
if wallet_owner_connection:
|
||||||
wallet_owner_user = wallet_owner_connection.user
|
wallet_owner_user = wallet_owner_connection.user
|
||||||
wallet_owner_bot = Wrapped_CBotChat(memory._client_telegram_bot, chat_id=wallet_owner_user.telegram_id, user=wallet_owner_user, db_session=session)
|
wallet_owner_bot = Wrapped_CBotChat(memory._client_telegram_bot, chat_id=wallet_owner_user.telegram_id, user=wallet_owner_user, db_session=session)
|
||||||
unprocessed_encrypted_content.meta['upload_notify_msg_id'] = await wallet_owner_bot.send_content(session, unprocessed_encrypted_content)
|
unprocessed_encrypted_content.meta = {
|
||||||
|
**unprocessed_encrypted_content.meta,
|
||||||
|
'upload_notify_msg_id': await wallet_owner_bot.send_content(session, unprocessed_encrypted_content)
|
||||||
|
}
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
async def main_fn(memory):
|
async def main_fn(memory):
|
||||||
|
|
|
||||||
|
|
@ -247,8 +247,10 @@ async def indexer_loop(memory, platform_found: bool, seqno: int) -> [bool, int]:
|
||||||
return platform_found, seqno
|
return platform_found, seqno
|
||||||
|
|
||||||
encrypted_stored_content.updated = datetime.now()
|
encrypted_stored_content.updated = datetime.now()
|
||||||
if encrypted_stored_content.meta != item_metadata_packed:
|
encrypted_stored_content.meta = {
|
||||||
encrypted_stored_content.meta = item_metadata_packed
|
**encrypted_stored_content.meta,
|
||||||
|
**item_metadata_packed
|
||||||
|
}
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
return platform_found, seqno
|
return platform_found, seqno
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class PlayerTemplates:
|
||||||
|
|
||||||
content_share_link = {
|
content_share_link = {
|
||||||
'text': self.user.translated('p_shareLinkContext').format(title=content_metadata_json.get('name', "")),
|
'text': self.user.translated('p_shareLinkContext').format(title=content_metadata_json.get('name', "")),
|
||||||
'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}/content?startapp=C{content.cid.serialize_v2()}"
|
'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}/content?startapp={content.cid.serialize_v2()}"
|
||||||
}
|
}
|
||||||
|
|
||||||
preview_content = db_session.query(StoredContent).filter(
|
preview_content = db_session.query(StoredContent).filter(
|
||||||
|
|
@ -207,18 +207,19 @@ class PlayerTemplates:
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.bot_id == 1:
|
if self.bot_id == 1:
|
||||||
if content_type == 'audio':
|
if content.type == 'onchain/content':
|
||||||
content.meta = {
|
if content_type == 'audio':
|
||||||
**content.meta,
|
content.meta = {
|
||||||
'telegram_file_cache': r.audio.file_id,
|
**content.meta,
|
||||||
}
|
'telegram_file_cache': r.audio.file_id,
|
||||||
elif content_type == 'video':
|
}
|
||||||
content.meta = {
|
elif content_type == 'video':
|
||||||
**content.meta,
|
content.meta = {
|
||||||
'telegram_file_cache': r.video.file_id,
|
**content.meta,
|
||||||
}
|
'telegram_file_cache': r.video.file_id,
|
||||||
|
}
|
||||||
|
|
||||||
self.db_session.commit()
|
self.db_session.commit()
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue