Eisa01 / mpv-scripts

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

Add a functionality for when last accessed date and time is for a played file logged in history #50

Open Kayizoku opened 2 years ago

Kayizoku commented 2 years ago

The title is self-explanatory. I want to know when I accessed a file last time. Thought it would be another cool addition to an already great script set

Eisa01 commented 2 years ago

I believe giving users customization options of how the list is displayed will solve this issue (similar to heading customization options). It is a lot of work to provide these options, perhaps one day when I am working on doing major update for LogManager inside the scripts.

Kayizoku commented 2 years ago

Yup, my thoughts exactly. So take your time. I'll be looking forward to all future updates :)

Eisa01 commented 1 year ago

Hi @Kayizoku, the changes are done in 2044e4397320943f38960d1b99cf4d0c59808a4b, however it is for SimpleBookmark, I will later migrate it to the other scripts.

The update is very big, I changed tons of things. Along with the update this issue is resolved, you can add any date format to the list (you must update both lua script and conf). in list_content_text you can simply add %dt% to add the date and time exactly how it is added.

Very simple example: list_content_text = '%number%. %dt% %name%%0_duration%%duration%%0_keybind%%keybind%%0_group%%group%%1_group%'

Example utilizing only "dt_"format%"%" (partially backward compatible with old dates saves in log) list_content_text = '%number%. (%dt_%x% %dt_%H%:%dt_%M%) %name%%0_duration%%duration%%0_keybind%%keybind%%0_group%%group%%1_group%'

Advanced example utilizes both 0dt variables and %dt"format%"%. formatting (fully backward compatibile with old date formatting saved in log files)

list_content_text = '%number%.%0_dt%%dt_%x%%1_dt%%dt_%H%%2_dt%%dt_%M%%3_dt% %path%%0_duration%%duration%%0_keybind%%keybind%%0_group%%group%%1_group%'

list_content_variables=[ ["0_duration", " 🕒 "], ["0_keybind", " ⌨ "], ["0_group", " 🖿 "], ["0_dt", " ("], ["1_dt", " "], ["2_dt", ":"], ["3_dt", ")"] ]

Play around with this update, let me know your feedback

Kayizoku commented 1 year ago

There are aspects that works for me and others that don't.

Here are bookmarks that have been untouched since last update. I didn't try to bookmark them again.

image

However, here's one item I tried to bookmark again, as you can see it messes up the date and gives some weird values while excluding day.

image

For some reason, this only happens after I have "%dt%" variable in the list_content_text. it won't retain the proper values for new items that are bookmarked. But the old ones are shown properly with the day and date. In any case, I appreciate implementing this, it really enrichens my experience with SimpleBookmark and I cannot wait to see it with the other scripts as well.

Eisa01 commented 1 year ago

For some reason, this only happens after I have "%dt%" variable in the list_content_text. it won't retain the proper values for new items that are bookmarked. But the old ones are shown properly with the day and date. In any case, I appreciate implementing this, it really enrichens my experience with SimpleBookmark and I cannot wait to see it with the other scripts as well.

Yes, this is the expected behavior, because this is the new format for date (in the log file date is saved like this). This new format allowed me to create %dt_"format"% variable. So, you can make the date in any format you like. (This is only applicable for dates with the new format).

Try to log many new entries and use the below so you see the difference: list_content_text = '%number%. (%dt_%x% %dt_%H%:%dt_%M%) %name%%0_duration%%duration%%0_keybind%%keybind%%0_group%%group%%1_group%'

Overall, this is the expected behavior which permits for date format customization.

Kayizoku commented 1 year ago

Ah, I see, then everything is working as it should, I tried using dt_format and that gave me the desired effect I wanted :)