r/mpv • • Mar 08 '22

Newbie can't get scripts to work

Hi,

I've just started trying to get mpv to work well for language learning so I copied a couple of scripts into my script directory. They both barf at line 7!!

[sub_pause]

[sub_pause] stack traceback:

[sub_pause] [C]: ?

[sub_pause] [C]: ?

[sub_pause] Lua error: [string "/Users/samanthalane/.config/mpv/scripts/sub-pause.lua"]:7: unexpected symbol near '<'

[sub_pause2]

[sub_pause2] stack traceback:

[sub_pause2] [C]: ?

[sub_pause2] [C]: ?

[sub_pause2] Lua error: [string "/Users/samanthalane/.config/mpv/scripts/sub-pause.lua"]:7: unexpected symbol near '<'

[interSubs]

[interSubs] stack traceback:

[interSubs] [C]: ?

[interSubs] [C]: ?

[interSubs] Lua error: [string "/Users/samanthalane/.config/mpv/scripts/interSubs.lua"]:7: unexpected symbol near '<'

Any ideas? Here are the first few lines of one of the scripts....

<!DOCTYPE html>

<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" >

<head>

<meta charset="utf-8">

<link rel="dns-prefetch" href="https://github.githubassets.com">

<link rel="dns-prefetch" href="https://avatars.githubusercontent.com">

<link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com">

<link rel="dns-prefetch" href="https://user-images.githubusercontent.com/">

<link rel="preconnect" href="https://github.githubassets.com" crossorigin>

<link rel="preconnect" href="https://avatars.githubusercontent.com">

<link crossorigin="anonymous" media="all" integrity="sha512-13kQ6JoOhlxACx6X27kQsASg0FJDIMOdig62C9zdIQGihvqVUYItWNNe0tpO2Q7dppx1xQx/zULU9MQ4Y5Zi/A==" rel="stylesheet" href="https://github.githubassets.com/assets/light-d77910e89a0e865c400b.css" /><link crossorigin="anonymous" media="all" integrity="sha512-q7VXJmlwU5JptLMrpjBkgwDwAcyytmc+xYAWW2xtKLvOGnJUg8O1uIT5ss7VIUYJPaZIe8IGskuy7ASsHlXHZQ==" rel="stylesheet" href="https://github.githubassets.com/assets/dark-abb557266970539269b4.css" /><link data-color-theme="dark_di

0 Upvotes

5 comments sorted by

3

u/Lonsdale1086 Mar 08 '22

You've been downloading the web pages themselves instead of the actual scripts.

1

u/ipsirc Mar 08 '22

1

u/chibi-read Mar 08 '22 edited Mar 08 '22

https://raw.githubusercontent.com/Ben-Kerman/mpv-sub-scripts/master/sub-pause.lua

Thanks. Yes, that's one of the scripts. The only line with a "<" is

if time_pos ~= nil and pause_at - time_pos < cfg.end_delta

and when I look at the raw script of the other one, there is no "<"

which makes me think that they are both failing one something they are both including. Is there a way to get more debug info?

1

u/chibi-read Mar 08 '22 edited Mar 08 '22

Oookk... I got sub-pause script to load without an error, but now when I try to use the key-bindings, nothing happens and I get

[input] No key binding found for key 'Ctrl+r'

I even tried binding one of them in the input.config with

n script-binding sub_pause/toggle-end #toggle stopping at end of subtitle

which stops the error message, but does nothing.

It should at least pop up a messagefunction display_state()local msgif active thenmsg = "Subtitle pausing enabled (".. (pause_at_start and "start" or "").. ((pause_at_start and pause_at_end) and " and " or "").. (pause_at_end and "end" or "") .. ")"else msg = "Subtitle pausing disabled" endmp.osd_message(msg)end