yeref 0.24.27__py3-none-any.whl → 0.24.28__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
yeref/yeref.py
CHANGED
@@ -15569,6 +15569,11 @@ async def upd_user_data_main(data, web_app_init_data, BASE_P, BOT_TOKEN_E18B, re
|
|
15569
15569
|
USER_VARS['USER_SIG'] = usr_sig
|
15570
15570
|
USER_VARS['USER_ISPREMIUM'] = is_premium
|
15571
15571
|
lz = USER_VARS.get('USER_LZ', 'en')
|
15572
|
+
|
15573
|
+
if USER_VARS['USER_DT'] == '':
|
15574
|
+
USER_VARS['USER_DT'] = datetime.now(timezone.utc).strftime("%d-%m-%Y_%H-%M-%S")
|
15575
|
+
# if utm != '':
|
15576
|
+
# USER_VARS['USER_UTM'] = utm
|
15572
15577
|
# endregion
|
15573
15578
|
|
15574
15579
|
# region tx
|
@@ -15977,6 +15982,9 @@ async def post_save(bot, data_user, data_web, MEDIA_D, BASE_P, KEYS_JSON, PROJEC
|
|
15977
15982
|
print(f"--------------------------------------------------------")
|
15978
15983
|
print(f"after {POST_MEDIA=}")
|
15979
15984
|
|
15985
|
+
if PROJECT_USERNAME == 'FereyPostBot' and POST_TYPE in ['voice', 'audio'] and 'filev_id' not in POST_MEDIA[0]:
|
15986
|
+
asyncio.create_task(convert_to_vinyl(bot, chat_id, ENT_TID, MEDIA_D, EXTRA_D, POST_MEDIA))
|
15987
|
+
|
15980
15988
|
# region pay
|
15981
15989
|
for button in POST_BUTTONS:
|
15982
15990
|
try:
|
@@ -17581,6 +17589,45 @@ async def pst_inline(chat_id, POST_TID, data_bot, BASE_P, PROJECT_USERNAME, is_m
|
|
17581
17589
|
await asyncio.sleep(round(random.uniform(1, 2), 2))
|
17582
17590
|
finally:
|
17583
17591
|
return result
|
17592
|
+
|
17593
|
+
|
17594
|
+
async def convert_to_vinyl(bot, chat_id, ENT_TID, POST_TID, MEDIA_D, EXTRA_D, POST_MEDIA, BASE_P):
|
17595
|
+
full_file_name = os.path.join(MEDIA_D, str(ENT_TID), POST_MEDIA[0]['file_name'])
|
17596
|
+
file_name_video = full_file_name[: full_file_name.rfind('.')] + '.mp4'
|
17597
|
+
try:
|
17598
|
+
file = await bot.get_file(POST_MEDIA[0]['file_id'])
|
17599
|
+
await bot.download_file(file.file_path, full_file_name)
|
17600
|
+
print(f"{full_file_name=} dl ok..")
|
17601
|
+
|
17602
|
+
vinyl_file = os.path.join(EXTRA_D, 'vinyl.mp4')
|
17603
|
+
print(f"Итоговый путь для нового видео с заменённым звуком {file_name_video=}")
|
17604
|
+
|
17605
|
+
audio_clip = AudioFileClip(full_file_name)
|
17606
|
+
if audio_clip.duration > 59: audio_clip = audio_clip.subclipped(0, 59)
|
17607
|
+
target_duration = 59 if audio_clip.duration > 59 else audio_clip.duration
|
17608
|
+
print(f"{target_duration=}")
|
17609
|
+
|
17610
|
+
video_template = VideoFileClip(vinyl_file)
|
17611
|
+
video_template = video_template.subclipped(0, target_duration)
|
17612
|
+
video_with_audio = video_template.with_audio(audio_clip)
|
17613
|
+
video_with_audio.write_videofile(file_name_video, codec="libx264", audio_codec="aac", fps=24)
|
17614
|
+
print(f"{file_name_video=} write_videofile ok..")
|
17615
|
+
|
17616
|
+
r = await bot.send_video_note(chat_id=chat_id, video_note=types.FSInputFile(file_name_video))
|
17617
|
+
await bot.delete_message(chat_id, r.message_id)
|
17618
|
+
|
17619
|
+
if r.video_note:
|
17620
|
+
print(f"{r.video_note.file_id=}")
|
17621
|
+
POST_MEDIA[0]['filev_id'] = r.video_note.file_id
|
17622
|
+
|
17623
|
+
sql = f"UPDATE USER_{chat_id}.POST SET POST_MEDIA=$1 WHERE POST_TID=$2"
|
17624
|
+
await db_change_pg(sql, (json.dumps(POST_MEDIA, ensure_ascii=False), POST_TID,), BASE_P)
|
17625
|
+
except Exception as e:
|
17626
|
+
logger.info(log_ % str(e))
|
17627
|
+
await asyncio.sleep(round(random.uniform(1, 2), 2))
|
17628
|
+
finally:
|
17629
|
+
if os.path.exists(full_file_name): os.remove(full_file_name)
|
17630
|
+
if os.path.exists(file_name_video): os.remove(file_name_video)
|
17584
17631
|
# endregion
|
17585
17632
|
|
17586
17633
|
|
@@ -0,0 +1,8 @@
|
|
1
|
+
yeref/__init__.py,sha256=Qpv3o6Xa78VdLcsSRmctGtpnYE9btpAkCekgGhgJyXM,49
|
2
|
+
yeref/l_.py,sha256=LMX_olmJwq-tgoALJCnhV_fGrL_i_43yBLkLIcEVqGo,1176743
|
3
|
+
yeref/tonweb.js,sha256=Jf6aFOQ1OIY4q7fINYz-m5LsI3seMus124M5SYYZmtE,443659
|
4
|
+
yeref/yeref.py,sha256=yGrIAWvIBhy1PuwKn5fdSKpL3GbvZ2xMzVKmgrPqWVc,1021571
|
5
|
+
yeref-0.24.28.dist-info/METADATA,sha256=4Ue09_m-KIRZZN6h5dd1qlFyhT50u0LUPjPvBnFQuDo,119
|
6
|
+
yeref-0.24.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
+
yeref-0.24.28.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
|
8
|
+
yeref-0.24.28.dist-info/RECORD,,
|
yeref-0.24.27.dist-info/RECORD
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
yeref/__init__.py,sha256=Qpv3o6Xa78VdLcsSRmctGtpnYE9btpAkCekgGhgJyXM,49
|
2
|
-
yeref/l_.py,sha256=LMX_olmJwq-tgoALJCnhV_fGrL_i_43yBLkLIcEVqGo,1176743
|
3
|
-
yeref/tonweb.js,sha256=Jf6aFOQ1OIY4q7fINYz-m5LsI3seMus124M5SYYZmtE,443659
|
4
|
-
yeref/yeref.py,sha256=ybHiJXKxGof5qMLOiqglh5zzEFHueE0zsw2Sl7CENqk,1019173
|
5
|
-
yeref-0.24.27.dist-info/METADATA,sha256=vkpsB1-YHt_HCkeRVuA_REmaroVosoom9woCHxZT4oI,119
|
6
|
-
yeref-0.24.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
yeref-0.24.27.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
|
8
|
-
yeref-0.24.27.dist-info/RECORD,,
|
File without changes
|
File without changes
|