-
This commit is contained in:
33
README.md
33
README.md
@@ -49,6 +49,39 @@ class Script
|
||||
}
|
||||
```
|
||||
|
||||
### Python Scripting
|
||||
|
||||
A simple Python script located at: C:\Users\user\AppData\Roaming\mpv\scripts
|
||||
|
||||
```
|
||||
# when seeking displays position and
|
||||
# duration like so: 70:00 / 80:00
|
||||
# which is different from mpv which
|
||||
# uses 01:10:00 / 01:20:00
|
||||
|
||||
import math
|
||||
|
||||
def seek():
|
||||
mp.commandv('show-text',
|
||||
format(mp.get_property_number("time-pos")) + " / " + format(mp.get_property_number("duration")))
|
||||
|
||||
def format(f):
|
||||
sec = round(f)
|
||||
|
||||
if sec < 0:
|
||||
sec = 0
|
||||
|
||||
pos_min_floor = math.floor(sec / 60)
|
||||
sec_rest = sec - pos_min_floor * 60
|
||||
return add_zero(pos_min_floor) + ":" + add_zero(sec_rest)
|
||||
|
||||
def add_zero(val):
|
||||
val = round(val)
|
||||
return "" + str(int(val)) if (val > 9) else "0" + str(int(val))
|
||||
|
||||
mp.register_event("seek", seek) # or use: mp.Seek += seek
|
||||
```
|
||||
|
||||
### Changes
|
||||
|
||||
### 1.1
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
k script-message mpv.net show-keys #menu: K ; Settings > Show Keys
|
||||
c script-message mpv.net open-config-folder #menu: C ; Settings > Open Config Folder
|
||||
|
||||
i show-progress ; script-message mpv.net show-info #menu: I ; Tools | Info
|
||||
i script-message mpv.net show-info #menu: I ; Tools | Info
|
||||
t script-binding stats/display-stats #menu: T ; Tools > Show Statistics
|
||||
T script-binding stats/display-stats-toggle #menu: Shift+T ; Tools > Toggle Statistics
|
||||
_ ignore #menu: _ ; Tools > -
|
||||
|
||||
Reference in New Issue
Block a user