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

feat: show audio/video file lengths #741

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

SkeleyM
Copy link
Contributor

@SkeleyM SkeleyM commented Jan 28, 2025

this pr gets and sets the file lengths for video and audio, upon hovering over a thumbnail, this can work as a temporary fix until I can get it to work without a performance hit (thanks @Nginearing for the idea)

image
image

this doesnt block the main thread and i havent noticed any performance hit (my audio libraries arent huge, 30 at best).

@CyanVoxel CyanVoxel added Type: Enhancement New feature or request Type: UI/UX User interface and/or user experience Priority: Medium An issue that shouldn't be be saved for last Status: Review Needed A review of this is needed labels Jan 28, 2025
@CyanVoxel
Copy link
Member

Could you update this from main? This will be easier to review and benchmark with the thumbnail caching system and newest internal library version (DB_VERSION 5)

@CyanVoxel
Copy link
Member

While this does provide duration labels for video and audio files, unfortunately in my testing it indeed appears to lock up the program for several seconds during each operation. Loading pages with video and audio files that would otherwise be instant now takes up to 40 seconds to become responsive.

@SkeleyM
Copy link
Contributor Author

SkeleyM commented Jan 28, 2025

i think the slowdowns are due to my approach. of course reading every single file for each page is extremely slow.

maybe only doing that process once could be beneficial i.e. caching the timestamps in an external file (of course then changes wont be reflected) or having a background thread update the timestamps as it goes to avoid unresponsiveness. or maybe some combination of the two.
i'm going to change this to a draft since this wont be done overnight

@SkeleyM SkeleyM marked this pull request as draft January 28, 2025 20:35
@Nginearing
Copy link
Contributor

Nginearing commented Feb 2, 2025

i think the slowdowns are due to my approach. of course reading every single file for each page is extremely slow.

maybe only doing that process once could be beneficial i.e. caching the timestamps in an external file (of course then changes wont be reflected) or having a background thread update the timestamps as it goes to avoid unresponsiveness. or maybe some combination of the two. i'm going to change this to a draft since this wont be done overnight

Perhaps, you could only show the length on hover, or if it is being used to find a video or audio file of a certain length, maybe it is better suited to be in the form of a search query. This has also been suggested to be part of a file sorting feature #207

@SkeleyM
Copy link
Contributor Author

SkeleyM commented Feb 2, 2025

showing length on hover could work as a temporary way of having the lengths be previewed, so long as it doesnt increase time to interact. might try it and see if it could be suitable

@SkeleyM SkeleyM marked this pull request as ready for review February 18, 2025 10:56
@CyanVoxel
Copy link
Member

The duration on hover isn't a bad holdover solution, but I'm thinking it may be worth just waiting until there's a longer-term solution. I've had it in mind to eventually cache information like the video duration inside the database but haven't settled on schema to do so yet. I hastily added the date_added and date_modified file attribute columns to the Entry table in anticipation of caching those, but my thought now is to create a dedicated table for this sort of information. This would also let us feel free to add several new columns for things like the word count or line count of text files without worrying about bloating the Entry table. Or maybe that was only my worry... 😅

Assuming I decide on and put in a table with a column to cache the video and/or audio duration, I think taking a similar approach to how the preview panel refactor works where we can return certain stats when rendering a thumbnail would be beneficial for speeding up the initial generation of this data. For example in the preview panel I have image dimensions and video durations returned in a "stats" dict that gets used by other elements in the preview panel without the need to expensively re-access the file.

Let me know what you think of this. I'll workshop the the cached data table schema some more. I've already got an idea for how detecting updates may work as well (just comparing the date_modified column of the file).

@SkeleyM
Copy link
Contributor Author

SkeleyM commented Feb 27, 2025

I agree creating an exclusive table for information relating to entries would be a very nice and organized solution for things like this. I think ill close this pr and revisit this in the future when the schema for this stuff is more concrete :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium An issue that shouldn't be be saved for last Status: Review Needed A review of this is needed Type: Enhancement New feature or request Type: UI/UX User interface and/or user experience
Projects
Status: 🏓 Ready for Review
Development

Successfully merging this pull request may close these issues.

3 participants