mecomp_core/state/library.rs
1use mecomp_storage::db::schemas::{
2 album::Album, artist::Artist, collection::Collection, dynamic::DynamicPlaylist,
3 playlist::Playlist, song::Song,
4};
5use serde::{Deserialize, Serialize};
6
7/// A brief representation of the library
8#[allow(clippy::module_name_repetitions)]
9#[derive(Clone, Debug, Deserialize, Serialize)]
10pub struct LibraryBrief {
11 pub artists: usize,
12 pub albums: usize,
13 pub songs: usize,
14 pub playlists: usize,
15 pub collections: usize,
16 pub dynamic_playlists: usize,
17}
18
19/// A full representation of the library
20#[allow(clippy::module_name_repetitions)]
21#[derive(Clone, Debug, Deserialize, Serialize, Default)]
22pub struct LibraryFull {
23 pub artists: Box<[Artist]>,
24 pub albums: Box<[Album]>,
25 pub songs: Box<[Song]>,
26 pub playlists: Box<[Playlist]>,
27 pub collections: Box<[Collection]>,
28 pub dynamic_playlists: Box<[DynamicPlaylist]>,
29}
30
31/// Health information about the library
32#[allow(clippy::module_name_repetitions)]
33#[derive(Clone, Debug, Deserialize, Serialize)]
34pub struct LibraryHealth {
35 /// The number of artists in the library
36 pub artists: usize,
37 /// The number of albums in the library
38 pub albums: usize,
39 /// The number of songs in the library
40 pub songs: usize,
41 /// The number of unanalyzed songs in the library
42 /// Optional because the analysis feature may not be enabled for the daemon
43 pub unanalyzed_songs: Option<usize>,
44 /// The number of playlists in the library
45 pub playlists: usize,
46 /// The number of collections in the library
47 pub collections: usize,
48 /// The number of dynamic playlists in the library
49 pub dynamic_playlists: usize,
50 /// The number of orphaned songs in the library
51 /// This is the number of artists that have no songs, and no albums
52 pub orphaned_artists: usize,
53 /// The number of orphaned albums in the library
54 /// This is the number of albums that have no songs
55 pub orphaned_albums: usize,
56 /// The number of orphaned playlists in the library
57 /// This is the number of playlists that have no songs
58 pub orphaned_playlists: usize,
59 /// The number of orphaned collections in the library
60 /// This is the number of collections that have no songs
61 pub orphaned_collections: usize,
62 // TODO: implement counting of missing items
63 // /// The number of missing artists in the library
64 // /// This is the number of artists of songs/albums that are not in the library
65 // pub missing_artists: usize,
66 // /// The number of missing albums in the library
67 // /// This is the number of albums of songs that are not in the library
68 // pub missing_albums: usize,
69 // /// The number of missing songs in the library
70 // /// This is the number of songs that are not in the library
71 // pub missing_songs: usize,
72 // /// The number of missing playlists in the library
73 // /// This is the number of playlists that are not in the library
74 // pub missing_playlists: usize,
75 // /// The number of missing collections in the library
76 // /// This is the number of collections that are not in the library
77 // pub missing_files: usize,
78}