吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 349|回复: 8
上一主题 下一主题
收起左侧

[其他原创] PotPlayer视频播放速度控制

[复制链接]
跳转到指定楼层
楼主
汇成河流 发表于 2026-5-23 06:53 回帖奖励
本帖最后由 汇成河流 于 2026-5-23 20:19 编辑

需要先安装AutoHotkey


在PotPlayer界面中按ASDFGHJKL;即可修改对应倍数,首次使用需先按A然后按Z。对应倍数可直接在编辑框中修改。PotPlayer的进程名需要为:PotPlayerMini64.exe 也可是完美解码。右键记事本打开最底部的ASDFGHJKL;可修改控制快捷键,编辑框中的快捷键只修改显示。
不会和播放器原有的ASDFGHJKL;快捷键冲突。
[C] 纯文本查看 复制代码
#Requires AutoHotkey v2.0
#SingleInstance Force

; ========== 配置文件 ==========
ConfigFile := A_ScriptDir . "\PotPlayerSpeed.ini"

; ========== 默认配置 ==========
DefaultKeys := ["A", "S", "D", "F", "G", "H", "J", "K", "L", ";"]
DefaultSpeeds := [1.0, 1.2, 1.5, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]

Global Keys := DefaultKeys.Clone()
Global Speeds := DefaultSpeeds.Clone()

; ========== 速度追踪(每次打开脚本都是1.0)==========
Global CurrentSpeed := 1.0
Global AutoSaveTimer := 0

; ========== 辅助函数 ==========
RoundOne(num)
{
    return Round(num, 1)
}

; ========== 加载配置(只加载按键和速度设置,不加载当前速度)==========
LoadConfig()

; ========== GUI界面 ==========
MyGui := Gui(, "PotPlayer 速度控制器")
MyGui.SetFont("s10", "Segoe UI")

MyGui.Add("Text", "xm y10 w50", "按键")
MyGui.Add("Text", "x+10 w70", "倍数")
MyGui.Add("Text", "x+10 w40", "")

KeyEdits := []
SpeedEdits := []

Loop 10
{
    yPos := 40 + (A_Index - 1) * 32
    currentKey := Keys[A_Index]
    currentSpeed := RoundOne(Speeds[A_Index])
    
    keyCtrl := MyGui.Add("Edit", "xm y" yPos " w50 center", currentKey)
    keyCtrl.OnEvent("Change", KeyChanged)
    KeyEdits.Push(keyCtrl)
    
    speedCtrl := MyGui.Add("Edit", "x+10 y" yPos " w70", currentSpeed)
    speedCtrl.OnEvent("Change", SpeedChanged)
    MyGui.Add("Text", "x+10 y" yPos " w40", "倍速")
    
    SpeedEdits.Push(speedCtrl)
}

MyGui.Add("Text", "xm y362 w260 0x7")
MyGui.Add("Text", "xm y382 w40", "当前:")
CurrentDisplay := MyGui.Add("Text", "x+10 y380 w60 center 0x200", "1.0x")
CurrentDisplay.SetFont("s12 bold")

SaveBtn := MyGui.Add("Button", "x+20 y377 w70", "保存")
SaveBtn.OnEvent("Click", (*) => SaveConfig())

ResetBtn := MyGui.Add("Button", "x+10 y377 w70", "重置")
ResetBtn.OnEvent("Click", (*) => ResetToDefault())

MyGui.Show("w280 h432")

; ========== 按键修改 ==========
KeyChanged(ctrl, *)
{
    global Keys, KeyEdits, AutoSaveTimer
    
    index := 0
    Loop 10
    {
        if (KeyEdits[A_Index] == ctrl)
        {
            index := A_Index
            break
        }
    }
    if (index == 0)
        return
    
    newKey := ctrl.Value
    if (newKey == "")
        return
    
    newKey := SubStr(StrUpper(newKey), 1, 1)
    
    ; 检查冲突
    Loop 10
    {
        if (A_Index != index and Keys[A_Index] == newKey)
        {
            ctrl.Value := Keys[index]
            return
        }
    }
    
    Keys[index] := newKey
    ctrl.Value := newKey
    
    if (AutoSaveTimer)
        SetTimer(AutoSaveTimer, 0)
    AutoSaveTimer := SetTimer(SaveConfig, -2000)
}

; ========== 速度修改 ==========
SpeedChanged(ctrl, *)
{
    global Speeds, SpeedEdits, AutoSaveTimer
    
    index := 0
    Loop 10
    {
        if (SpeedEdits[A_Index] == ctrl)
        {
            index := A_Index
            break
        }
    }
    if (index == 0)
        return
    
    editValue := ctrl.Value
    if (editValue == "")
        return
    
    newVal := RoundOne(Float(editValue))
    if (newVal < 0.2)
        newVal := 0.2
    if (newVal > 16.0)
        newVal := 16.0
    
    Speeds[index] := newVal
    ctrl.Value := newVal
    
    if (AutoSaveTimer)
        SetTimer(AutoSaveTimer, 0)
    AutoSaveTimer := SetTimer(SaveConfig, -2000)
}

; ========== 保存 ==========
SaveConfig()
{
    global Keys, Speeds, AutoSaveTimer
    
    if (AutoSaveTimer)
    {
        SetTimer(AutoSaveTimer, 0)
        AutoSaveTimer := 0
    }
    
    IniWrite(Keys[1], ConfigFile, "Keys", "Key1")
    IniWrite(Keys[2], ConfigFile, "Keys", "Key2")
    IniWrite(Keys[3], ConfigFile, "Keys", "Key3")
    IniWrite(Keys[4], ConfigFile, "Keys", "Key4")
    IniWrite(Keys[5], ConfigFile, "Keys", "Key5")
    IniWrite(Keys[6], ConfigFile, "Keys", "Key6")
    IniWrite(Keys[7], ConfigFile, "Keys", "Key7")
    IniWrite(Keys[8], ConfigFile, "Keys", "Key8")
    IniWrite(Keys[9], ConfigFile, "Keys", "Key9")
    IniWrite(Keys[10], ConfigFile, "Keys", "Key10")
    
    IniWrite(RoundOne(Speeds[1]), ConfigFile, "Speeds", "Speed1")
    IniWrite(RoundOne(Speeds[2]), ConfigFile, "Speeds", "Speed2")
    IniWrite(RoundOne(Speeds[3]), ConfigFile, "Speeds", "Speed3")
    IniWrite(RoundOne(Speeds[4]), ConfigFile, "Speeds", "Speed4")
    IniWrite(RoundOne(Speeds[5]), ConfigFile, "Speeds", "Speed5")
    IniWrite(RoundOne(Speeds[6]), ConfigFile, "Speeds", "Speed6")
    IniWrite(RoundOne(Speeds[7]), ConfigFile, "Speeds", "Speed7")
    IniWrite(RoundOne(Speeds[8]), ConfigFile, "Speeds", "Speed8")
    IniWrite(RoundOne(Speeds[9]), ConfigFile, "Speeds", "Speed9")
    IniWrite(RoundOne(Speeds[10]), ConfigFile, "Speeds", "Speed10")
}

; ========== 加载(只加载按键和速度数值,CurrentSpeed始终为1)==========
LoadConfig()
{
    global Keys, Speeds, DefaultKeys, DefaultSpeeds
    
    Loop 10
    {
        savedKey := IniRead(ConfigFile, "Keys", "Key" . A_Index, DefaultKeys[A_Index])
        Keys[A_Index] := (savedKey != "") ? SubStr(StrUpper(savedKey), 1, 1) : DefaultKeys[A_Index]
        
        savedSpeed := IniRead(ConfigFile, "Speeds", "Speed" . A_Index, DefaultSpeeds[A_Index])
        Speeds[A_Index] := IsNumber(savedSpeed) ? RoundOne(Float(savedSpeed)) : DefaultSpeeds[A_Index]
    }
    
    ; CurrentSpeed 不保存,每次打开都是 1.0
}

; ========== 重置 ==========
ResetToDefault()
{
    global Keys, Speeds, DefaultKeys, DefaultSpeeds, KeyEdits, SpeedEdits
    
    Loop 10
    {
        Keys[A_Index] := DefaultKeys[A_Index]
        Speeds[A_Index] := DefaultSpeeds[A_Index]
        KeyEdits[A_Index].Value := Keys[A_Index]
        SpeedEdits[A_Index].Value := Speeds[A_Index]
    }
    SaveConfig()
}

; ========== 速度函数 ==========
SetSpeed(presetIndex)
{
    global Speeds, CurrentSpeed, CurrentDisplay
    
    target := Speeds[presetIndex]
    if (target == CurrentSpeed)
        return
    
    diff := target - CurrentSpeed
    steps := Round(diff / 0.1)
    
    if (steps > 0)
    {
        Loop steps
        {
            Send("c")
        }
    }
    else if (steps < 0)
    {
        Loop -steps
        {
            Send("x")
        }
    }
    
    CurrentSpeed := target
    CurrentDisplay.Value := RoundOne(target) . "x"
}

; ========== 热键 ==========
#HotIf WinActive("ahk_class PotPlayer64 ahk_exe PotPlayerMini64.exe")

$A::SetSpeed(1)
$S::SetSpeed(2)
$D::SetSpeed(3)
$F::SetSpeed(4)
$G::SetSpeed(5)
$H::SetSpeed(6)
$J::SetSpeed(7)
$K::SetSpeed(8)
$L::SetSpeed(9)
$;::SetSpeed(10)
#HotIf


免费评分

参与人数 1吾爱币 +1 收起 理由
xouou + 1 自带快捷键:x ,c

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

来自 8#
 楼主| 汇成河流 发表于 2026-5-23 15:20 |楼主
BilboBaggins 发表于 2026-5-23 14:50
楼上正解,自带加速不变音

自带的只能在两个速度之间切换,而且其中一个必须是1倍数,我这个可以在4个速度之间切换,4个速度可以是任何速度,如果要超过0.2到4之外的倍数,删掉这些代码即可
    if (newVal < 0.2)
        newVal := 0.2
    if (newVal > 4.0)
        newVal := 4.0
沙发
知心 发表于 2026-5-23 11:39
3#
pwd 发表于 2026-5-23 12:08
4#
maya123 发表于 2026-5-23 12:36
这功能potplayer不是自带的吗?试试ZXC这几个键位
5#
webmarksman 发表于 2026-5-23 12:47
这个控制很不错哦,好想试试。
6#
a0532a 发表于 2026-5-23 13:09
软件自带  何必折腾    X是减速  C是加速  Z是回位
7#
BilboBaggins 发表于 2026-5-23 14:50
楼上正解,自带加速不变音
9#
iSummer999 发表于 2026-5-23 15:55
人家自带这个功能
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - 52pojie.cn ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2026-5-24 07:52

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表