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