support video
This commit is contained in:
1 parent
96bfa4de97
commit
ba27d3fdbf
2 files changed
+84
-11
No files matched your search
@@ -87,6 +87,37 @@ class PlayerTemplates:
|
||||
'text': self.user.translated('openContractPage_button'),
|
||||
'url': f"https://tonscan.org/address/{content_meta['item_address']}"
|
||||
}])
|
||||
elif content_type == 'video':
|
||||
# Processing video
|
||||
video_title = content_metadata_json.get('name', "")
|
||||
template_kwargs['video'] = URLInputFile(local_content_url)
|
||||
template_kwargs['caption'] = video_title
|
||||
template_kwargs['protect_content'] = True
|
||||
|
||||
if cover_content:
|
||||
# Add thumbnail if cover content is available
|
||||
template_kwargs['thumbnail'] = URLInputFile(cover_content.web_url)
|
||||
|
||||
if self.bot_id == 1:
|
||||
# Buttons for sharing and opening in app
|
||||
inline_keyboard_array.append([{
|
||||
'text': self.user.translated('shareTrack_button'),
|
||||
'switch_inline_query': f"C{content.cid.serialize_v2()}",
|
||||
}])
|
||||
inline_keyboard_array.append([{
|
||||
'text': self.user.translated('openTrackInApp_button'),
|
||||
'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}/content?startapp={content.cid.serialize_v2()}"
|
||||
}])
|
||||
else:
|
||||
# Buttons for viewing as a client and opening contract
|
||||
inline_keyboard_array.append([{
|
||||
'text': self.user.translated('viewTrackAsClient_button'),
|
||||
'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}?start=C{content.cid.serialize_v2()}"
|
||||
}])
|
||||
inline_keyboard_array.append([{
|
||||
'text': self.user.translated('openContractPage_button'),
|
||||
'url': f"https://tonscan.org/address/{content_meta['item_address']}"
|
||||
}])
|
||||
else:
|
||||
local_content = None
|
||||
|
||||
@@ -104,7 +135,12 @@ class PlayerTemplates:
|
||||
or bool(self.db_session.query(UserContent).filter_by(owner_address=user_wallet_address, status='active', content_id=content.id).first())
|
||||
)
|
||||
if not have_access:
|
||||
template_kwargs['audio'] = URLInputFile(local_content_url + '?seconds_limit=30')
|
||||
if content_type == 'audio':
|
||||
# Restrict audio to 30 seconds if user does not have access
|
||||
template_kwargs['audio'] = URLInputFile(local_content_url + '?seconds_limit=30')
|
||||
elif content_type == 'video':
|
||||
# Restrict video to 30 seconds if user does not have access
|
||||
template_kwargs['video'] = URLInputFile(local_content_url + '?seconds_limit=30')
|
||||
|
||||
make_log("TG-Player", f"Send content {content_type} ({content_encoding}) to chat {self._chat_id}. {cd_log}")
|
||||
for kmsg in self.db_session.query(KnownTelegramMessage).filter_by(
|
||||
|
||||
Reference in new issue
Block a user