mirror of
https://github.com/holll/teledown.git
synced 2025-01-07 03:07:03 +08:00
优化模块导入,不使用上传功能时可以不安装相应模块
This commit is contained in:
parent
5180a3bb60
commit
28ccb632e3
@ -1,7 +1,7 @@
|
||||
demoji
|
||||
pandas
|
||||
telethon
|
||||
moviepy
|
||||
Pillow
|
||||
cryptg
|
||||
tqdm
|
||||
urllib3==1.26.6
|
||||
|
||||
|
2
requirements_upload.txt
Normal file
2
requirements_upload.txt
Normal file
@ -0,0 +1,2 @@
|
||||
moviepy
|
||||
Pillow
|
@ -7,10 +7,7 @@ from io import BytesIO
|
||||
from typing import Union
|
||||
|
||||
import demoji
|
||||
import magic
|
||||
import pandas as pd
|
||||
from PIL import Image
|
||||
from moviepy.video.io.VideoFileClip import VideoFileClip
|
||||
from telethon import TelegramClient
|
||||
from telethon.tl import types
|
||||
|
||||
@ -201,6 +198,8 @@ def get_all_files(path):
|
||||
|
||||
|
||||
def GetThumb(file_path: str) -> bytes:
|
||||
from PIL import Image
|
||||
from moviepy.video.io.VideoFileClip import VideoFileClip
|
||||
# 打开视频文件并获取第一帧图像
|
||||
with VideoFileClip(file_path) as video:
|
||||
# 获取视频中指定时间的图像
|
||||
@ -233,6 +232,7 @@ def str2join(*args) -> str:
|
||||
|
||||
|
||||
def get_filetype(path: str) -> str:
|
||||
import magic
|
||||
magic_obj = magic.Magic(mime=True)
|
||||
with open(path, 'rb') as f:
|
||||
file_content = f.read(1024)
|
||||
|
Loading…
Reference in New Issue
Block a user