consolidated method signatures
This commit is contained in:
parent
45cec560f6
commit
5fb8fdfda4
3 changed files with 13 additions and 13 deletions
|
@ -16,14 +16,14 @@ pub struct DatabaseRequest {
|
|||
}
|
||||
|
||||
impl SearchType {
|
||||
pub fn is_where(self: &Self) -> bool {
|
||||
pub fn is_where(&self) -> bool {
|
||||
match self {
|
||||
SearchType::Where => true,
|
||||
SearchType::Like => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_like(self: &Self) -> bool {
|
||||
pub fn is_like(&self) -> bool {
|
||||
match self {
|
||||
SearchType::Where => false,
|
||||
SearchType::Like => true,
|
||||
|
@ -111,7 +111,7 @@ impl DBObject {
|
|||
Ok(DBObject { conn })
|
||||
}
|
||||
|
||||
pub fn save_tag(self: &Self, tag: &ItemTag) -> Result<(), DatabaseCreationError> {
|
||||
pub fn save_tag(&self, tag: &ItemTag) -> Result<(), DatabaseCreationError> {
|
||||
self.conn.execute(
|
||||
"INSERT OR IGNORE INTO musicinfo (path, title, artist, album, album_artist) VALUES ( ?1, ?2, ?3, ?4, ?5 )",
|
||||
params![tag.path, tag.title, tag.artist, tag.album, tag.album_artist],
|
||||
|
@ -122,7 +122,7 @@ impl DBObject {
|
|||
/// Returns a vector of ItemTags that fulfil the requested query
|
||||
///
|
||||
pub fn get(
|
||||
self: &Self,
|
||||
&self,
|
||||
request: &DatabaseRequest,
|
||||
) -> Result<Option<Vec<ItemTag>>, rusqlite::Error> {
|
||||
assert!(!request.search_tag.is_empty(), "There must be at least one field filled in the PartialItem. Use `get_all()` if you want the full table");
|
||||
|
|
|
@ -44,27 +44,27 @@ impl Default for PartialTag {
|
|||
}
|
||||
|
||||
impl PartialTag {
|
||||
pub fn has_path(self: &Self) -> bool {
|
||||
pub fn has_path(&self) -> bool {
|
||||
self.path.is_some()
|
||||
}
|
||||
|
||||
pub fn has_title(self: &Self) -> bool {
|
||||
pub fn has_title(&self) -> bool {
|
||||
self.title.is_some()
|
||||
}
|
||||
|
||||
pub fn has_artist(self: &Self) -> bool {
|
||||
pub fn has_artist(&self) -> bool {
|
||||
self.artist.is_some()
|
||||
}
|
||||
|
||||
pub fn has_album(self: &Self) -> bool {
|
||||
pub fn has_album(&self) -> bool {
|
||||
self.album.is_some()
|
||||
}
|
||||
|
||||
pub fn has_album_artist(self: &Self) -> bool {
|
||||
pub fn has_album_artist(&self) -> bool {
|
||||
self.album_artist.is_some()
|
||||
}
|
||||
|
||||
pub fn is_empty(self: &Self) -> bool {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
return self.path.is_none()
|
||||
&& self.title.is_none()
|
||||
&& self.artist.is_none()
|
||||
|
|
|
@ -36,17 +36,17 @@ impl<'a> MusicPlayer<'a> {
|
|||
return mp;
|
||||
}
|
||||
|
||||
pub fn pause(self: &Self) -> () {
|
||||
pub fn pause(&self) {
|
||||
self.playing_sink.pause();
|
||||
}
|
||||
|
||||
pub fn play(self: &Self) -> () {
|
||||
pub fn play(&self) {
|
||||
self.playing_sink.play();
|
||||
println!("playing");
|
||||
}
|
||||
|
||||
// TODO: set these to return results
|
||||
pub fn change_now_playing(self: &mut Self, item: ItemTag) -> Result<(), MusicPlayerError> {
|
||||
pub fn change_now_playing(&mut self, item: ItemTag) -> Result<(), MusicPlayerError> {
|
||||
println!("\n\n switching now playing to: {}", item.path.clone());
|
||||
let file = File::open(item.path.clone());
|
||||
|
||||
|
|
Loading…
Reference in a new issue