libMO - Rust Media ORM
Provides an ORM to structure referencing media files and metadata. Leveraging this information we can validate the metadata for presence.
From a single entry point of defining at least 1 root folder to start from, generate a full media library and run useful functions off them.
Usage
[]
# Add to dependencies
= "0.1.0"
Initialise the library, this generates the config %XDG_CONFIG_HOME/liborm and cache %XDG_CACHE_HOME/liborm folders, creates the sqlite DB and applies migrations
use migration;
run.await;
Now the backend is ready, we can then provide a library directory to start collection from:
use media_manager as MM;
let lib_name = "MyMusic";
let lib_path = "/path/to/music";
MMinsert_library.await?;
We can confirm this library exists:
use media_manager as MM;
use Model as LibraryModel
let libraries: = MMget_library.await?;
println!;
// [Model { id: 1, name: "MyMusic", path: "/path/to/music", files: "" }]
Now we have a root directory to start from we set off the manager. This process is a simple walkdir for each file and we store them away in the database with their full path, modified time, and matching against an interal list of extension enums.
This should be a fast process, ~12s for ~16k files
use media_manager as MM;
MMcollect_media.await?;
Then taking each media file in the directory structure we need to work out which music fles we could care about
~20s for ~12k files
use media_checker as MC;
MCcheck_media.await?;
Now onto populating the remainder of the ORM. This is a much more demanding function, currently generates all the valid track and album records and the album art thumbnail. This is where we read all the tag metadata present on the music records
~30mins for ~12k valid tracks
(~5mins without album art generation)
use media_checker as MC;
MCcheck_albums.await?;
Future features/improvements
Bugs and Performance
- check_media should first get all
musicrecords and compare there rather than 1 by 1 Seperate album art thumbnail generation out into async function, also allow it to be called on demand- Reset DB, currently slow if you delete the library record
Allow clearing down orreporttableDelete media records that are no longer present in the libraryDelete albums if no tracks remain after clearing deleted media
Features
- Allow override of where DB and cache storage is set
- Allow choice of artwork thumbnail file format, currently locked at jpg
- Adjust resolution of output file, locked at 300x300
- Check size of artwork and add
reportentry if too small - Logger settings and useful messages