fix converting mp4

This commit is contained in:
user 2025-02-05 11:23:27 +03:00
parent 9adc4c2bd0
commit 2a97a9914d
3 changed files with 6 additions and 4 deletions

View File

@ -211,7 +211,7 @@ async def s_api_v1_storage_get(request, file_hash=None):
elif content_type == 'video': elif content_type == 'video':
# Build a temp path for the video # Build a temp path for the video
tempfile_path += "_mp4" + (f"_{seconds_limit}" if seconds_limit else "") tempfile_path += "_mp4" + (f"_{seconds_limit}" if seconds_limit else "") + ".mp4"
if not os.path.exists(tempfile_path): if not os.path.exists(tempfile_path):
try: try:
# Use ffmpeg to cut or convert to mp4 # Use ffmpeg to cut or convert to mp4

View File

@ -134,8 +134,8 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
if content_type_declared == 'audio': if content_type_declared == 'audio':
content_list.append( content_list.append(
types.InlineQueryResultAudio( types.InlineQueryResultAudio(
id=f"NC_{content.id}", id=f"NC_{content.id}_{int(datetime.now().timestamp() // 60)}",
audio_url=decrypted_content.web_url + '?seconds_limit=30', audio_url=encrypted_content.meta['telegram_file_cache'],
title=title, title=title,
performer=performer, performer=performer,
caption=hashtags_str + user.translated('p_playerContext_preview'), caption=hashtags_str + user.translated('p_playerContext_preview'),
@ -159,7 +159,7 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
elif content_type_declared == 'video': elif content_type_declared == 'video':
content_list.append( content_list.append(
types.InlineQueryResultCachedVideo( types.InlineQueryResultCachedVideo(
id=f"NC_{content.id}", id=f"NC_{content.id}_{int(datetime.now().timestamp() // 60)}",
video_file_id=encrypted_content.meta['telegram_file_cache'], video_file_id=encrypted_content.meta['telegram_file_cache'],
title=title, title=title,
caption=hashtags_str + user.translated('p_playerContext_preview'), caption=hashtags_str + user.translated('p_playerContext_preview'),

View File

@ -128,6 +128,8 @@ class PlayerTemplates:
inline_keyboard_array = [] inline_keyboard_array = []
extra_buttons = [] extra_buttons = []
else: else:
text = ' '.join([f"#{_h}" for _h in content_metadata_json.get('hashtags', [])]).strip()
user_wallet_address = self.user.wallet_address(self.db_session) user_wallet_address = self.user.wallet_address(self.db_session)
have_access = ( have_access = (
(content.owner_address == user_wallet_address) (content.owner_address == user_wallet_address)