From 379e95bf8a178986e84c31ebff4e80db54635353 Mon Sep 17 00:00:00 2001 From: thsrite Date: Wed, 15 Feb 2023 15:21:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=94=9F=E6=88=90=E7=BC=A9=E7=95=A5?= =?UTF-8?q?=E5=9B=BE=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF?= =?UTF-8?q?ffmpeg=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/media/scraper.py | 13 +++++++------ check_config.py | 3 ++- config/config.yaml | 2 ++ web/templates/setting/basic.html | 21 ++++++++++++++++++++- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/app/media/scraper.py b/app/media/scraper.py index ebb5faa6..28be3702 100644 --- a/app/media/scraper.py +++ b/app/media/scraper.py @@ -475,12 +475,13 @@ class Scraper: if episode_image: self.__save_image(episode_image, episode_thumb) else: - # 从视频文件生成缩略图 - video_path = os.path.join(dir_path, file_name + file_ext) - log.info(f"【Scraper】正在生成缩略图:{video_path} ...") - FfmpegHelper().get_thumb_image_from_video(video_path=video_path, - image_path=episode_thumb) - log.info(f"【Scraper】缩略图生成完成:{episode_thumb}") + # 开启ffmpeg,则从视频文件生成缩略图 + if scraper_tv_pic.get("episode_thumb_ffmpeg"): + video_path = os.path.join(dir_path, file_name + file_ext) + log.info(f"【Scraper】正在生成缩略图:{video_path} ...") + FfmpegHelper().get_thumb_image_from_video(video_path=video_path, + image_path=episode_thumb) + log.info(f"【Scraper】缩略图生成完成:{episode_thumb}") except Exception as e: ExceptionUtils.exception_traceback(e) diff --git a/check_config.py b/check_config.py index 0accfb11..90f933a2 100644 --- a/check_config.py +++ b/check_config.py @@ -276,7 +276,8 @@ def update_config(): "season_poster": True, "season_banner": True, "season_thumb": True, - "episode_thumb": False} + "episode_thumb": False, + "episode_thumb_ffmpeg": False} } overwrite_cofig = True diff --git a/config/config.yaml b/config/config.yaml index b3ed9b1a..9a4eaf93 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -167,6 +167,8 @@ scraper_pic: season_thumb: true # 集 episode_thumb: false + # 开启后,读取视频文件生成缩略图 + episode_thumb_ffmpeg: false # 【配置文件夹监控】:文件夹内容发生变化时自动识别转移 sync: diff --git a/web/templates/setting/basic.html b/web/templates/setting/basic.html index 61db988c..ca04e5df 100644 --- a/web/templates/setting/basic.html +++ b/web/templates/setting/basic.html @@ -996,12 +996,22 @@
+ @@ -1140,4 +1150,13 @@ $("#modal-user-script").modal("hide"); } + // 选中电视剧-集图片thumb,显示ffmpeg + function open_ffmpeg_div(){ + if ($("#modal_episode_thumb_ffmpeg").css('display') == 'none'){ + $("#modal_episode_thumb_ffmpeg").css('display','block'); + }else{ + $("#modal_episode_thumb_ffmpeg").css('display','none'); + $("input[id='scraper_pic.tv.episode_thumb_ffmpeg']").prop("checked", false); + } + } From 83799261b79ded8a5fd0e1a24079e045e7154ef1 Mon Sep 17 00:00:00 2001 From: thsrite <806089486@qq.com> Date: Wed, 15 Feb 2023 23:04:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E5=A2=9E=E5=8A=A0=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=AE=BE=E7=BD=AE=EF=BC=8C=E9=99=90=E5=88=B6?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=82=B9=E5=87=BB=E4=BA=A4=E4=BA=92=E8=8F=9C?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/conf/moduleconf.py | 8 ++++++++ web/main.py | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/app/conf/moduleconf.py b/app/conf/moduleconf.py index 6109e0b1..0b497141 100644 --- a/app/conf/moduleconf.py +++ b/app/conf/moduleconf.py @@ -157,6 +157,14 @@ class ModuleConf(object): "tooltip": "需要交互功能时才需要填写,在微信企业应用管理后台-接收消息设置页面生成,填入完成后重启本应用,然后再在微信页面输入地址确定", "type": "text", "placeholder": "API接收消息EncodingAESKey" + }, + "adminUser": { + "id": "wechat_adminUser", + "required": False, + "title": "AdminUser", + "tooltip": "需要交互功能时才需要填写,可执行交互菜单命令的用户名,为空则不限制,多个;号分割。可在企业微信后台查看成员的Account ID", + "type": "text", + "placeholder": "可执行交互菜单的用户名" } } }, diff --git a/web/main.py b/web/main.py index 57c9d275..886a5ee2 100644 --- a/web/main.py +++ b/web/main.py @@ -1268,6 +1268,10 @@ def wechat(): # 解析消息内容 content = "" if msg_type == "event": + # 校验用户有权限执行交互命令 + if conf.get("adminUser") and not any(user_id == admin_user for admin_user in str(conf.get("adminUser")).split(";")): + Message().send_channel_msg(channel=SearchType.WX, title="用户无权限执行菜单命令", user_id=user_id) + return make_response(content, 200) # 事件消息 event_key = DomUtils.tag_value(root_node, "EventKey") if event_key: