mirror of
https://github.com/EDeev/mospoly-helper.git
synced 2026-06-15 19:11:11 +03:00
update
This commit is contained in:
parent
64824a520e
commit
71a592e833
18 changed files with 14 additions and 28 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -56,12 +56,10 @@ async def add_cabinet(msg: Message) -> None:
|
|||
user_dict = jsn.read_json()
|
||||
edu_keys = list(user_dict.keys())
|
||||
|
||||
if ((cab[0] == "м" and len(cab) == 5 and "mi" == edu_keys[0]) or
|
||||
(cab[:2] == "ав" and len(cab) == 6 and "av" == edu_keys[0]) or
|
||||
(cab[:2] == "пк" and len(cab) == 6 and "pk" == edu_keys[0]) or
|
||||
(cab[:2] == "пр" and len(cab) == 6 and "pr" == edu_keys[0]) or
|
||||
if ((cab[0] == "м" and "mi" == edu_keys[0]) or (cab[:2] == "ав" and "av" == edu_keys[0]) or
|
||||
(cab[:2] == "пк" and "pk" == edu_keys[0]) or (cab[:2] == "пр" and "pr" == edu_keys[0]) or
|
||||
(cab[0] in ["а", "б", "в", "н", "нд"] and "bs" == edu_keys[0])):
|
||||
lst_routes = get_routes(edu_keys[0], cab)
|
||||
lst_routes = await get_routes(edu_keys[0], cab)
|
||||
|
||||
if lst_routes:
|
||||
user_dict[edu_keys[0]] = lst_routes
|
||||
|
|
@ -94,7 +92,7 @@ async def var_button(call: CallbackQuery) -> None:
|
|||
if os.path.exists(f"../data/cache/{lst_routes[-1][21:].replace('.mp4', '-all.mp4')}"):
|
||||
path = f"../data/cache/{lst_routes[-1][21:].replace('.mp4', '-all.mp4')}"
|
||||
else:
|
||||
path = make_full_clip(lst_routes)
|
||||
path = await make_full_clip(lst_routes)
|
||||
if not path:
|
||||
await msg.edit_text("Данного маршрута в нашей базе пока нет, извините за неудобство, можете написать "
|
||||
"желаемые маршруты на почту <a href='mailto:support@new-devs.ru' >support@new-devs.ru</a>")
|
||||
|
|
@ -103,7 +101,7 @@ async def var_button(call: CallbackQuery) -> None:
|
|||
if os.path.exists(f"../data/cache/{lst_routes[-1][21:].replace('.mp4', '-small.mp4')}"):
|
||||
path = f"../data/cache/{lst_routes[-1][21:].replace('.mp4', '-small.mp4')}"
|
||||
else:
|
||||
path = make_full_clip(lst_routes[1:])
|
||||
path = await make_full_clip(lst_routes[1:])
|
||||
if not path:
|
||||
await msg.edit_text("Данного маршрута в нашей базе пока нет, извините за неудобство, можете написать "
|
||||
"желаемые маршруты на почту <a href='mailto:support@new-devs.ru' >support@new-devs.ru</a>")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
from moviepy import VideoFileClip, concatenate_videoclips
|
||||
import os
|
||||
|
||||
def get_routes(id_building: str, id_cab: str, other=False):
|
||||
import os, asyncio
|
||||
|
||||
async def get_routes(id_building: str, id_cab: str, other=False):
|
||||
if other:
|
||||
id_cab = id_cab.replace('-', "")
|
||||
building=id_cab[0]
|
||||
|
|
@ -13,15 +12,13 @@ def get_routes(id_building: str, id_cab: str, other=False):
|
|||
|
||||
|
||||
match id_building:
|
||||
#авbfnn
|
||||
case "av":
|
||||
building = id_cab[2]
|
||||
floor = id_cab[3]
|
||||
cab_num = id_cab[4:]
|
||||
corp_route = f"../videos/{id_building}/buildings/{id_building}-{building}b.mp4"
|
||||
floor_route = f"../videos/{id_building}/floors/{id_building}-{building}b-0{floor}f.mp4"
|
||||
cab_route = f"../videos/{id_building}/offices/{id_building}-{building}b-0{floor}f-0{building}{floor}{cab_num}c.mp4"
|
||||
|
||||
cab_route = f"../videos/{id_building}/offices/{id_building}-{building}b-0{floor}f-{(building + floor + cab_num).zfill(5)}c.mp4"
|
||||
return [corp_route, floor_route, cab_route]
|
||||
|
||||
case "mi":
|
||||
|
|
@ -30,8 +27,7 @@ def get_routes(id_building: str, id_cab: str, other=False):
|
|||
cab_num = id_cab[3:]
|
||||
corp_route = f"../videos/{id_building}/buildings/{id_building}-{building}b.mp4"
|
||||
floor_route = f"../videos/{id_building}/floors/{id_building}-{building}b-0{floor}f.mp4"
|
||||
cab_route = f"../videos/{id_building}/offices/{id_building}-{building}b-0{floor}f-0{building}{floor}{cab_num}c.mp4"
|
||||
|
||||
cab_route = f"../videos/{id_building}/offices/{id_building}-{building}b-0{floor}f-{(building + floor + cab_num).zfill(5)}c.mp4"
|
||||
return [corp_route, floor_route, cab_route]
|
||||
|
||||
case "pk":
|
||||
|
|
@ -40,8 +36,7 @@ def get_routes(id_building: str, id_cab: str, other=False):
|
|||
cab_num = id_cab[4:]
|
||||
corp_route = f"../videos/{id_building}/buildings/{id_building}-{building}b.mp4"
|
||||
floor_route = f"../videos/{id_building}/floors/{id_building}-{building}b-0{floor}f.mp4"
|
||||
cab_route = f"../videos/{id_building}/offices/{id_building}-{building}b-0{floor}f-0{building}{floor}{cab_num}c.mp4"
|
||||
|
||||
cab_route = f"../videos/{id_building}/offices/{id_building}-{building}b-0{floor}f-{(building + floor + cab_num).zfill(5)}c.mp4"
|
||||
return [corp_route, floor_route, cab_route]
|
||||
|
||||
case "pr":
|
||||
|
|
@ -50,13 +45,9 @@ def get_routes(id_building: str, id_cab: str, other=False):
|
|||
cab_num = id_cab[4:]
|
||||
corp_route = f"../videos/{id_building}/buildings/{id_building}-{building}b.mp4"
|
||||
floor_route = f"../videos/{id_building}/floors/{id_building}-{building}b-0{floor}f.mp4"
|
||||
cab_route = f"../videos/{id_building}/offices/{id_building}-{building}b-0{floor}f-0{building}{floor}{cab_num}c.mp4"
|
||||
|
||||
cab_route = f"../videos/{id_building}/offices/{id_building}-{building}b-0{floor}f-{(building + floor + cab_num).zfill(5)}c.mp4"
|
||||
return [corp_route, floor_route, cab_route]
|
||||
|
||||
|
||||
#id_building: bs
|
||||
#id_cab: bfnn
|
||||
case "bs":
|
||||
id_cab= id_cab.replace('-',"")
|
||||
building = id_cab[0]
|
||||
|
|
@ -65,13 +56,13 @@ def get_routes(id_building: str, id_cab: str, other=False):
|
|||
corp_route = f"../videos/{id_building}/buildings/{id_building}-{building}b.mp4"
|
||||
floor_route = f"../videos/{id_building}/floors/{id_building}-{building}b-0{floor}f.mp4"
|
||||
cab_route = f"../videos/{id_building}/offices/{id_building}-{building}b-0{floor}f-0{building}{floor}{cab_num}c.mp4"
|
||||
|
||||
return [corp_route, floor_route, cab_route]
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def make_full_clip(paths):
|
||||
|
||||
async def make_full_clip(paths):
|
||||
|
||||
if not all(os.path.exists(path) for path in paths):
|
||||
print("Некоторые файлы не найдены")
|
||||
|
|
@ -82,8 +73,7 @@ def make_full_clip(paths):
|
|||
full_clip = concatenate_videoclips(clips) # cклеиваем все клипы
|
||||
|
||||
full_clip = full_clip.without_audio() # удаляем звук
|
||||
full_clip = full_clip.time_transform(lambda t: t * 2).with_duration(full_clip.duration / 2) # ускоряем в 1.5 раз
|
||||
full_clip = full_clip.resized(height=512)
|
||||
full_clip = full_clip.time_transform(lambda t: t * 2).with_duration(full_clip.duration / 2) # ускоряем в 2 раз
|
||||
|
||||
full_clip_name = f"{paths[-1][21:].replace('.mp4', '')}-{'all' if len(paths) == 3 else 'small'}.mp4" # генерируем рандомный 5-ти значный ключ
|
||||
|
||||
|
|
|
|||
BIN
src/data/cache/av-4b-04f-04401c-all.mp4
vendored
BIN
src/data/cache/av-4b-04f-04401c-all.mp4
vendored
Binary file not shown.
BIN
src/data/cache/av-4b-04f-04401c-small.mp4
vendored
BIN
src/data/cache/av-4b-04f-04401c-small.mp4
vendored
Binary file not shown.
BIN
src/data/cache/av-4b-04f-04412c-all.mp4
vendored
BIN
src/data/cache/av-4b-04f-04412c-all.mp4
vendored
Binary file not shown.
BIN
src/data/cache/av-4b-04f-04412c-small.mp4
vendored
BIN
src/data/cache/av-4b-04f-04412c-small.mp4
vendored
Binary file not shown.
BIN
src/data/cache/pr-2b-03f-02306c-small.mp4
vendored
BIN
src/data/cache/pr-2b-03f-02306c-small.mp4
vendored
Binary file not shown.
BIN
src/data/cache/pr-2b-04f-02402c-all.mp4
vendored
BIN
src/data/cache/pr-2b-04f-02402c-all.mp4
vendored
Binary file not shown.
BIN
src/data/cache/pr-2b-04f-02402c-small.mp4
vendored
BIN
src/data/cache/pr-2b-04f-02402c-small.mp4
vendored
Binary file not shown.
BIN
src/data/cache/pr-2b-06f-02608c-all.mp4
vendored
BIN
src/data/cache/pr-2b-06f-02608c-all.mp4
vendored
Binary file not shown.
BIN
src/data/cache/pr-2b-08f-02811c-all.mp4
vendored
BIN
src/data/cache/pr-2b-08f-02811c-all.mp4
vendored
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
{"pr": ["../videos/pr/buildings/pr-2b.mp4", "../videos/pr/floors/pr-2b-03f.mp4", "../videos/pr/offices/pr-2b-03f-02306c.mp4"]}
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"pr": ["../videos/pr/buildings/pr-2b.mp4", "../videos/pr/floors/pr-2b-04f.mp4", "../videos/pr/offices/pr-2b-04f-02402c.mp4"]}
|
||||
Loading…
Add table
Reference in a new issue