0.1.9 upd
This commit is contained in:
parent
58a582e797
commit
20d6b6d9a9
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -90,7 +90,7 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itunesdb"
|
name = "itunesdb"
|
||||||
version = "0.1.7"
|
version = "0.1.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "itunesdb"
|
name = "itunesdb"
|
||||||
version = "0.1.8"
|
version = "0.1.9"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["alterwain"]
|
authors = ["alterwain"]
|
||||||
|
|
||||||
|
@ -72,6 +72,57 @@ pub enum XSomeList {
|
|||||||
AlbumList(Vec<XAlbumItem>)
|
AlbumList(Vec<XAlbumItem>)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl XTrackItem {
|
||||||
|
pub fn set_location(&mut self, location: String) {
|
||||||
|
self.update_arg(2, location);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_title(&mut self, title: String) {
|
||||||
|
self.update_arg(1, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_artist(&mut self, artist: String) {
|
||||||
|
self.update_arg(4, artist);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_album(&mut self, album: String) {
|
||||||
|
self.update_arg(3, album);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_genre(&mut self, genre: String) {
|
||||||
|
self.update_arg(5, genre);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_location(&self) -> String {
|
||||||
|
self.get_arg(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_title(&self) -> String {
|
||||||
|
self.get_arg(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_artist(&self) -> String {
|
||||||
|
self.get_arg(4)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_album(&self) -> String {
|
||||||
|
self.get_arg(3)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_genre(&self) -> String {
|
||||||
|
self.get_arg(5)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_arg(&self, id: u32) -> String {
|
||||||
|
self.args.iter().find(|t| t.arg_type == id).map_or(String::new(), |t| t.val)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_arg(&mut self, id: u32, val: String) {
|
||||||
|
self.args.retain_mut(|t| t.arg_type == id);
|
||||||
|
self.args.push(XArgument { arg_type: id, val});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl XDatabase {
|
impl XDatabase {
|
||||||
pub fn find_dataset(&mut self, data_type: u32) -> &mut XDataSet {
|
pub fn find_dataset(&mut self, data_type: u32) -> &mut XDataSet {
|
||||||
self.children.iter_mut().find(|d| d.data.data_type == data_type).unwrap()
|
self.children.iter_mut().find(|d| d.data.data_type == data_type).unwrap()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user