Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

命令行调用问题 #115

Closed
lsq opened this issue Aug 26, 2024 · 8 comments
Closed

命令行调用问题 #115

lsq opened this issue Aug 26, 2024 · 8 comments

Comments

@lsq
Copy link

lsq commented Aug 26, 2024

image

第一个问题:

这里提示Get-Hash不能识别;

第二个问题:

image
当系统路径中的lua5.4优先使用,会出现调用错误;如果把系统中scoop安装的lua5.4 uninstall,问题不复现,这个要怎么设置mpv调用自己目录下的lua

@Gerome100
Copy link

image
I have a similar problem but I have to say that I use the English branch

@zhongfly
Copy link

I have a similar problem but I have to say that I use the English branch

Because that script need luasocket, but shinchiro's build don't have it.Download mpv from https://github.com/dyphire/mpv-winbuild/releases

@verygoodlee
Copy link
Contributor

识别不了 Get-FileHash 可能是powershell版本低于5,但是也不应该啊,powershell4是win8.1时代的东西了,win10内置的就是5了,执行下powershell $PSVersionTable.PSVersion检查版本

@dyphire
Copy link
Owner

dyphire commented Aug 27, 2024

第一个问题:

这里提示Get-Hash不能识别;

识别不了 Get-FileHash 可能是powershell版本低于5,但是也不应该啊,powershell4是win8.1时代的东西了,win10内置的就是5了,执行下powershell $PSVersionTable.PSVersion检查版本

问题出在这里:

path = utils.join_path(mp.get_property('working-directory'), path)

history-bookmark.lua 代码中使用了 utils.join_path 来获取绝对路径,而 utils.join_path 无法正确处理和组合类似./../这样的相对路径,它能接受的相对路径形式是mpv test.mkvmpv subdir\test.mkv
仅针对.\的简单修复方式,..\不可能得到修复,应该也没人在播放器中这么用:

path = utils.join_path(mp.get_property('working-directory'), path:gusb('^%.[\\/]',''))

当系统路径中的lua5.4优先使用,会出现调用错误;如果把系统中scoop安装的lua5.4 uninstall,问题不复现,这个要怎么设置mpv调用自己目录下的lua

依赖问题自行解决,这是 mpv 的问题,和此配置无关

dyphire added a commit that referenced this issue Aug 27, 2024
修复 history-bookmark.lua 脚本无法正确处理`./`形式相对路径的错误
另见 #115
@verygoodlee
Copy link
Contributor

normalize-path可以解决,但这个命令是近几个月才引入的,旧版本用不了

local utils = require('mp.utils')
print(mp.command_native({'normalize-path', utils.join_path('D:\\dir', '..\\a.mp4')}))
print(mp.command_native({'normalize-path', utils.join_path('D:\\', '.\\a.mp4')}))

输出
image

甚至可以不用手动拼working-directory mp.command_native({'normalize-path', '.\\a.mp4'}) 会自动把工作目录拼上

dyphire added a commit that referenced this issue Aug 27, 2024
修复相对路径的转换,规范化路径
另见 #115
dyphire added a commit that referenced this issue Aug 27, 2024
修复相对路径的转换,规范化路径
另见 #115
@dyphire
Copy link
Owner

dyphire commented Aug 27, 2024

在提交 d3e1942 中为较新的 mpv 使用 normalize-path 命令处理路径

@dyphire dyphire closed this as completed Aug 27, 2024
dyphire added a commit that referenced this issue Aug 27, 2024
修复相对路径的转换,规范化路径
另见 #115
@Tony15246
Copy link

@dyphire 大佬,我今天在处理这个issue的时候,发现normalize函数里这一行好像写错了方法名,不小心把gsub写成了gusb

path = utils.join_path(mp.get_property('working-directory'), path:gusb('^%.[\\/]',''))

我粗略搜索了一下,mpv-config项目在以下地方好像都有此问题

[scripts/history-bookmark.lua](

path = mp.utils.join_path(directory, path:gusb('^%.[\\/]',''))
)

[scripts/recentmenu.lua](

path = mp.utils.join_path(directory, path:gusb('^%.[\\/]',''))
)

[scripts/simplehistory.lua](

path = mp.utils.join_path(directory, path:gusb('^%.[\\/]',''))
)

[scripts/simplebookmark.lua](

path = mp.utils.join_path(directory, path:gusb('^%.[\\/]',''))
)

[scripts/smartcopypaste_II.lua](

path = mp.utils.join_path(directory, path:gusb('^%.[\\/]',''))
)

[scripts/playlistmanager.lua](

path = mp.utils.join_path(directory, path:gusb('^%.[\\/]',''))
)

@dyphire
Copy link
Owner

dyphire commented Oct 14, 2024

@dyphire 大佬,我今天在处理这个issue的时候,发现normalize函数里这一行好像写错了方法名,不小心把gsub写成了gusb

path = utils.join_path(mp.get_property('working-directory'), path:gusb('^%.[\\/]',''))

我粗略搜索了一下,mpv-config项目在以下地方好像都有此问题

看到你那个提交后我才发现,本地修了还没推。是之前的提交 edcc335 引入的错误

dyphire added a commit that referenced this issue Oct 14, 2024
dyphire added a commit that referenced this issue Oct 15, 2024
dyphire added a commit that referenced this issue Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants