From 2a97a9914d557ec5f4c6504946c335121ecbcfd8 Mon Sep 17 00:00:00 2001 From: user Date: Wed, 5 Feb 2025 11:23:27 +0300 Subject: [PATCH] fix converting mp4 --- app/api/routes/node_storage.py | 2 +- app/client_bot/routers/content.py | 6 +++--- app/core/models/_telegram/templates/player.py | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/api/routes/node_storage.py b/app/api/routes/node_storage.py index 1e1cb38..ae0427a 100644 --- a/app/api/routes/node_storage.py +++ b/app/api/routes/node_storage.py @@ -211,7 +211,7 @@ async def s_api_v1_storage_get(request, file_hash=None): elif content_type == '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): try: # Use ffmpeg to cut or convert to mp4 diff --git a/app/client_bot/routers/content.py b/app/client_bot/routers/content.py index 352f75a..21b8023 100644 --- a/app/client_bot/routers/content.py +++ b/app/client_bot/routers/content.py @@ -134,8 +134,8 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use if content_type_declared == 'audio': content_list.append( types.InlineQueryResultAudio( - id=f"NC_{content.id}", - audio_url=decrypted_content.web_url + '?seconds_limit=30', + id=f"NC_{content.id}_{int(datetime.now().timestamp() // 60)}", + audio_url=encrypted_content.meta['telegram_file_cache'], title=title, performer=performer, 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': content_list.append( 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'], title=title, caption=hashtags_str + user.translated('p_playerContext_preview'), diff --git a/app/core/models/_telegram/templates/player.py b/app/core/models/_telegram/templates/player.py index 0265688..eaed78e 100644 --- a/app/core/models/_telegram/templates/player.py +++ b/app/core/models/_telegram/templates/player.py @@ -128,6 +128,8 @@ class PlayerTemplates: inline_keyboard_array = [] extra_buttons = [] else: + text = ' '.join([f"#{_h}" for _h in content_metadata_json.get('hashtags', [])]).strip() + user_wallet_address = self.user.wallet_address(self.db_session) have_access = ( (content.owner_address == user_wallet_address)