Add conversion from SongData to DashboardTile
This commit is contained in:
parent
906b5bd9dd
commit
7f4108e1c5
@ -1,4 +1,6 @@
|
|||||||
use crate::models::{Album, Artist, Song};
|
use crate::models::{Album, Artist, Song};
|
||||||
|
use crate::components::dashboard_tile::DashboardTile;
|
||||||
|
use crate::media_type::MediaType;
|
||||||
|
|
||||||
use time::Date;
|
use time::Date;
|
||||||
|
|
||||||
@ -95,3 +97,14 @@ impl TryInto<Song> for SongData {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Into<DashboardTile> for SongData {
|
||||||
|
fn into(self) -> DashboardTile {
|
||||||
|
DashboardTile {
|
||||||
|
image_path: self.image_path,
|
||||||
|
title: self.title,
|
||||||
|
media_type: Some(MediaType::Song),
|
||||||
|
artist: Some(Artist::display_list(&self.artists)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user