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

Issues with total_playtime.lua #1

Closed
Kayizoku opened this issue Aug 6, 2021 · 8 comments
Closed

Issues with total_playtime.lua #1

Kayizoku opened this issue Aug 6, 2021 · 8 comments

Comments

@Kayizoku
Copy link

Kayizoku commented Aug 6, 2021

I am unable to get the following script to work. I have already installed FFmpeg and it's functioning through CMD and everything. I would really like the ability to be able to see the total duration of my playlist and was wondering if you could lend me a hand, so I can use it. I've already tried pasting the script into my script folder to no avail. I have tried several bindings too. My system is running Windows 10 if that's any help. Thank you in advance. Looking forward to hearing from you.

@oltodosel
Copy link
Owner

oltodosel commented Aug 6, 2021

Edit this line to your config path.

saved_probed_filename = '~/.config/mpv/scripts/total_playtime.list'

If this does not help, open mpv in command line and see what errors the script gives when its called.

@Kayizoku
Copy link
Author

Kayizoku commented Aug 6, 2021

Thank you for fast reply. I tried to link it to my path as intended for windows but it didn't work. Here is the log

PS C:\Users\tayya> mpv C:\Users\tayya\AppData\Roaming\mpv\scripts\total_playtime.lua
Invalid value for option audio-display: attachment
Valid values are:
no
embedded-first
external-first
Error parsing option audio-display (option parameter could not be parsed)
C:\Users\tayya\AppData\Roaming/mpv/mpv.conf:50: setting option audio-display='attachment' failed.
Option vf-remove: item label @ivtc not found.
Option vf-remove: item label @deinterlace not found.
Option vf-remove: item label @warpsharp not found.
Option vf-remove: item label @warpsharp not found.
Option vf-remove: item label @warpsharp_legacy not found.
Option vf-remove: item label @frameinfo not found.
Option vf-remove: item label @simulcast not found.
cplayer: Can't load unknown script: C:\Users\tayya\AppData\Roaming/mpv/scripts/reload.lua.bak
cplayer: Cannot find main.* for any supported scripting backend in: C:\Users\tayya\AppData\Roaming/mpv/scripts/Deletetotal_playtime:
total_playtime: stack traceback:
total_playtime: [C]: at 0x7ff7bac815f0
autosub:
autosub: stack traceback:
autosub: [C]: at 0x7ff7bac815f0
total_playtime: Lua error: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/to..."]:8: invalid escape sequence near ''C:'
autosub: Lua error: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/au..."]:6: invalid escape sequence near ''C:'auto_profiles: Applying auto profile: nonsimulcast-autoprofile
cplayer: Option vf-remove: item label @simulcast not found.
cplayer: Failed to recognize file format.
cplayer:
timelogger:
timelogger: stack traceback:
timelogger: mp.defaults:510: in function 'call_event_handlers'
timelogger: mp.defaults:555: in function 'dispatch_events'
timelogger: mp.defaults:503: in function mp.defaults:502
timelogger: [C]: at 0x7ff7bac83400
timelogger: [C]: at 0x7ff7bac815f0
cplayer: Exiting... (Errors when loading file)
timelogger: Lua error: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/ti..."]:64: attempt to perform arithmetic on global 'totaltime' (a nil value)
toggle_pip:
toggle_pip: stack traceback:
toggle_pip: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/to..."]:37: in function 'restore_properties'
toggle_pip: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/to..."]:27: in function 'handler'
toggle_pip: mp.defaults:510: in function 'call_event_handlers'
toggle_pip: mp.defaults:555: in function 'dispatch_events'
toggle_pip: mp.defaults:503: in function mp.defaults:502
toggle_pip: [C]: at 0x7ff7bac83400
toggle_pip: [C]: at 0x7ff7bac815f0
toggle_pip: Lua error: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/to..."]:37: bad argument #2 to 'set_property' (string expected, got nil)

@oltodosel
Copy link
Owner

total_playtime: Lua error: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/to..."]:8: invalid escape sequence near ''C:'

You somehow messed up with editing the config at line 8. Copy it here.

@Kayizoku
Copy link
Author

Kayizoku commented Aug 6, 2021

Here you go. This is the line you wanted?
saved_probed_filename = "C:\Users\tayya\AppData\Roaming\mpv\scripts\total_playtime.list"

@oltodosel
Copy link
Owner

Double all back slashes in the path: \ -> \\

@Kayizoku
Copy link
Author

Kayizoku commented Aug 6, 2021

I did that just now: saved_probed_filename = "C:\Users\tayya\AppData\Roaming\mpv\scripts\total_playtime.list". Is this right? Sadly, it didn't work. Imgur: https://i.imgur.com/OTUlwFV.png. I pasted in the new log

PS C:\Users\tayya> mpv C:\Users\tayya\AppData\Roaming\mpv\scripts\total_playtime.lua
Option vf-remove: item label @ivtc not found.
Option vf-remove: item label @deinterlace not found.
Option vf-remove: item label @warpsharp not found.
Option vf-remove: item label @warpsharp not found.
Option vf-remove: item label @warpsharp_legacy not found.
Option vf-remove: item label @frameinfo not found.
Option vf-remove: item label @simulcast not found.
total_playtime:
total_playtime: stack traceback:
total_playtime: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/to..."]:12: in main chunk
total_playtime: [C]: at 0x7ff7bac83400
total_playtime: [C]: at 0x7ff7bac815f0
autosub:
autosub: stack traceback:
autosub: [C]: at 0x7ff7bac815f0
total_playtime: Lua error: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/to..."]:12: bad argument #2 to 'gsub' (string/function/table expected)
autosub: Lua error: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/au..."]:6: invalid escape sequence near ''C:'
auto_profiles: Applying auto profile: nonsimulcast-autoprofile
cplayer: Option vf-remove: item label @simulcast not found.
cplayer: Failed to recognize file format.
cplayer:
timelogger:
timelogger: stack traceback:
timelogger: mp.defaults:510: in function 'call_event_handlers'
timelogger: mp.defaults:555: in function 'dispatch_events'
timelogger: mp.defaults:503: in function mp.defaults:502
timelogger: [C]: at 0x7ff7bac83400
timelogger: [C]: at 0x7ff7bac815f0
cplayer: Exiting... (Errors when loading file)
timelogger: Lua error: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/ti..."]:64: attempt to perform arithmetic on global 'totaltime' (a nil value)
toggle_pip:
toggle_pip: stack traceback:
toggle_pip: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/to..."]:37: in function 'restore_properties'
toggle_pip: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/to..."]:27: in function 'handler'
toggle_pip: mp.defaults:510: in function 'call_event_handlers'
toggle_pip: mp.defaults:555: in function 'dispatch_events'
toggle_pip: mp.defaults:503: in function mp.defaults:502
toggle_pip: [C]: at 0x7ff7bac83400
toggle_pip: [C]: at 0x7ff7bac815f0
toggle_pip: Lua error: [string "C:\Users\tayya\AppData\Roaming/mpv/scripts/to..."]:37: bad argument #2 to 'set_property' (string expected, got nil)

@oltodosel
Copy link
Owner

I've no idea then.

Redownload the script anew, I've just made a small change.
Then switch save_probed = true to save_probed = false
This way the script will not save anything, but should be able to calculate time nonetheless.

@Kayizoku
Copy link
Author

Kayizoku commented Aug 6, 2021

I was able to do it now. I had to set the os.getenv(''HOME') ---> os.getenv('APPDATA') for it to be able to calculate and log it. Thank you for your help. Its working now

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

2 participants