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

Show the total time for the entire playlist? #5

Open
Kayizoku opened this issue Jan 22, 2022 · 4 comments
Open

Show the total time for the entire playlist? #5

Kayizoku opened this issue Jan 22, 2022 · 4 comments

Comments

@Kayizoku
Copy link

I would like to press a hotkey and then it calculates the whole playlist and shows the time it would take to watch the playlist in the same manner as before. It recalculates when playback is sped up. Of course, this would be with a different hotkey. Any thoughts about that?

@mustaqimM
Copy link
Owner

@Kayizoku I don't think that there's an exposed function that the mpv api provides to do this, but one way is using other programmes. Could be something like this with ffprobe:

fd -e mkv -x ffprobe -i {} -show_entries format=duration -v quiet -of csv="p=0" | awk '{total = total + $1}END{print total}'

@Kayizoku
Copy link
Author

Kayizoku commented Feb 6, 2022

@Kayizoku I don't think that there's an exposed function that the mpv api provides to do this, but one way is using other programmes. Could be something like this with ffprobe:

fd -e mkv -x ffprobe -i {} -show_entries format=duration -v quiet -of csv="p=0" | awk '{total = total + $1}END{print total}'

Thank you, could you show me a demonstration and how to use it as a script or on a hotkey? I would greatly appreciate the help :)

@mustaqimM
Copy link
Owner

The snippet accounts for all files in a folder. So it's not exactly what you wanted since you'd need to keep track of the current position in the playlist which is provided by mp.get_property("playlist"); the current file will have an index of 1. What's needed is get and add all playback time after index 1 to the end of the list of files that it returns. Sorry, I don't have time currently but search to see how to run external processes with lua

@Kayizoku
Copy link
Author

Kayizoku commented Feb 7, 2022

The snippet accounts for all files in a folder. So it's not exactly what you wanted since you'd need to keep track of the current position in the playlist which is provided by mp.get_property("playlist"); the current file will have an index of 1. What's needed is get and add all playback time after index 1 to the end of the list of files that it returns. Sorry, I don't have time currently but search to see how to run external processes with lua

No worries, I appreciate the help. Would love to see it in the script too. But might try to tinker with it myself. We'll see :)

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