3 releases

Uses new Rust 2024

0.1.4 Jul 21, 2025
0.1.1 May 7, 2025
0.1.0 Oct 4, 2024

#1173 in Development tools

Download history 58/week @ 2025-08-20 67/week @ 2025-08-27 129/week @ 2025-09-03 56/week @ 2025-09-10 42/week @ 2025-09-17 52/week @ 2025-09-24 122/week @ 2025-10-01 19/week @ 2025-10-08 89/week @ 2025-10-15 82/week @ 2025-10-22 24/week @ 2025-10-29 42/week @ 2025-11-05 68/week @ 2025-11-12 45/week @ 2025-11-19 39/week @ 2025-11-26 34/week @ 2025-12-03

197 downloads per month
Used in 23 crates (2 directly)

MPL-2.0 license

270KB
6.5K SLoC

MoosicBox Library Models

Data models for MoosicBox music library management and storage.

Overview

The MoosicBox Library Models package provides:

  • Library Data Models: Core data structures for music library items
  • API Integration: Models with API source tracking and conversion
  • Database Support: Database-compatible model structures
  • Type Conversions: Conversion between library and API models
  • Multi-Source Support: Track music from multiple streaming services

Models

LibraryArtist

  • Basic Info: ID, title, cover artwork
  • API Sources: Integration with multiple music services
  • Conversion: Converts to/from generic Artist model

LibraryAlbum

  • Album Data: Title, artist, type, release dates
  • Artwork: Cover art and blur effect support
  • Versions: Multiple quality versions (Hi-Res, CD, etc.)
  • Sources: Local and streaming service source tracking
  • Directory: Local filesystem path information

LibraryTrack

  • Track Info: Number, title, duration, format details
  • Audio Metadata: Bitrate, sample rate, channels, bit depth
  • File Info: Local file path and byte size
  • Album Association: Connected album and artist information
  • Multi-Source: Tracks from local files and streaming services

LibraryAlbumType

  • Album Categories: LP, Live, Compilations, EPs & Singles, Other
  • Conversion: Maps to/from generic AlbumType
  • Serialization: JSON and database compatible

Installation

Add this to your Cargo.toml:

[dependencies]
moosicbox_library_models = { path = "../library/models" }

# Enable specific features
moosicbox_library_models = {
    path = "../library/models",
    features = ["api", "db"]
}

Usage

Basic Model Usage

use moosicbox_library_models::{LibraryArtist, LibraryAlbum, LibraryTrack};
use moosicbox_music_models::ApiSources;

// Create a library artist
let artist = LibraryArtist {
    id: 1,
    title: "The Beatles".to_string(),
    cover: Some("/covers/beatles.jpg".to_string()),
    api_sources: ApiSources::default(),
};

// Create a library album
let album = LibraryAlbum {
    id: 1,
    title: "Abbey Road".to_string(),
    artist: "The Beatles".to_string(),
    artist_id: 1,
    album_type: LibraryAlbumType::Lp,
    date_released: Some("1969-09-26".to_string()),
    ..Default::default()
};

Dependencies

  • MoosicBox Music Models: Core music data types
  • MoosicBox Date Utils: Date parsing and formatting
  • Serde: Serialization and deserialization
  • Chrono: Date and time handling

Dependencies

~2–17MB
~169K SLoC