Eisa01 / mpv-scripts

This repository contain scripts I have made for mpv media player...
BSD 2-Clause "Simplified" License
507 stars 35 forks source link

SimpleBookmark: Total duration for videos that are bookmarked - Feature Request #40

Closed Kayizoku closed 2 years ago

Kayizoku commented 2 years ago

I had the same idea as from this issue https://github.com/Eisa01/mpv-scripts/issues/34, but with a different application for SimpleBookmark script. Instead of logging time, it calculates everything that gets bookmarked and shows you the total time at the top it will take to complete the bookmarked elements. I thought it would be really neat and a nice way to see how much time it will take for you to go through the priority list with a total calculation, so you can plan your watch list more comfortably.

Eisa01 commented 2 years ago

It seems useful, but this is currently not possible because I'm not logging the video length in the log file.

To add that it's a lot of work, and probably all users will need to delete their log file and replace it with one that has duration.

If you have more useful use cases for the length, do let me know in this thread and if it's worth it by then, I'll see what i can do

Kayizoku commented 2 years ago

It seems useful, but this is currently not possible because I'm not logging the video length in the log file.

To add that it's a lot of work, and probably all users will need to delete their log file and replace it with one that has a duration.

If you have more useful use cases for the length, do let me know in this thread and if it's worth it by then, I'll see what i can do

I see, but do you need to log time for each of the files as similar in SimpleHistory? That would definitely be a headache to get around. since you'd have to do it manually for each of the files. That's why could you not just calculate the complete duration based on the elements on the bookmarked list than at the top have a section that says: total_time = 4.24 hours or something?

Basically, if I understand correctly, right now it logs time-based on how much the video is played, but we need the whole duration already from the get-go, so there should be no need to log time separately anymore, but just get the whole duration and log it to the variable the second a new element gets bookmarked. Instead of having a time variable for each element on the logger. So, the total duration for SimpleBookmark should be static and not dynamically change at all depending on what's being played. It should only need to recalculate if elements get removed from the list or if they get added. Otherwise, it should be fixed.

That's what I am thinking, but I am not so clear about the logic. So, I apologize in advance if it makes no sense or is harder to implement.

Eisa01 commented 2 years ago

I see, but do you need to log time for each of the files as similar in SimpleHistory? That would definitely be a headache to get around. since you'd have to do it manually for each of the files. That's why could you not just calculate the complete duration based on the elements on the bookmarked list than at the top have a section that says: total_time = 4.24 hours or something?

No, that's actually possible. You can add the calculated time like SimpleHistory but I didn't add it by default to SimpleBookmark. In SimpleBookmark.conf change from: header_text=🔖 Bookmarks [%cursor/%total] %prefilter%filter%afterfilter%presearch%search%aftersearch to: header_text=🔖 Bookmarks [%cursor/%total] %prelistduration%listduration%afterlistduration%prefilter%filter%afterfilter%presearch%search%aftersearch That should do it.

Basically, if I understand correctly, right now it logs time-based on how much the video is played, but we need the whole duration already from the get-go, so there should be no need to log time separately anymore, but just get the whole duration and log it to the variable the second a new element gets bookmarked. Instead of having a time variable for each element on the logger. So, the total duration for SimpleBookmark should be static and not dynamically change at all depending on what's being played. It should only need to recalculate if elements get removed from the list or if they get added. Otherwise, it should be fixed.

The dynamic time is needed as well as the static which is the video duration, it's not that hard to add but because I'm parsing the log file, if I add new additions, i need to modify the parser a little. I might do it actually, having the time in the log file can be quite useful

Kayizoku commented 2 years ago

I didn't expect my uncertain viewpoint to open doors to a possible solution. I am glad I decided to share it with you :)

It would be a really neat addition to an already awesome script no doubt.

Eisa01 commented 2 years ago

Hi, it is done now as part of the new release. https://github.com/Eisa01/mpv-scripts/releases However, you will need to delete your old log file and use the new one generated from the new script.

Modify the conf file for SimpleBookmark The option to show the total for the remaining time for bookmarks in the header: header_text=🔖 Bookmarks [%cursor%/%total%]%prehighlight%%highlight%%afterhighlight%%prelistremaining%%listremaining%%afterlistremaining%%prefilter%%filter%%afterfilter%%presort%%sort%%aftersort%%presearch%%search%%aftersearch%

You can also change the items in the list to show remaining time instead of reached time if you want: text_time_type=remaining