Merge pull request #28 from kdeng00/refactoring
Removing fields not used
This commit was merged in pull request #28.
This commit is contained in:
@@ -339,7 +339,7 @@ impl CommitManager {
|
|||||||
filenames.push(s.clone());
|
filenames.push(s.clone());
|
||||||
fp = s.clone();
|
fp = s.clone();
|
||||||
dir = song_file.parent().unwrap().display().to_string();
|
dir = song_file.parent().unwrap().display().to_string();
|
||||||
song.filepath = Some(s.clone());
|
song.filename = Some(s.clone());
|
||||||
song.directory = Some(dir.clone());
|
song.directory = Some(dir.clone());
|
||||||
self.initialize_disc_and_track(&mut song);
|
self.initialize_disc_and_track(&mut song);
|
||||||
}
|
}
|
||||||
@@ -354,7 +354,7 @@ impl CommitManager {
|
|||||||
let album = self.retrieve_metadata(&meta_path);
|
let album = self.retrieve_metadata(&meta_path);
|
||||||
let trck = i32::from_str(track_id).unwrap();
|
let trck = i32::from_str(track_id).unwrap();
|
||||||
let mut s = album.retrieve_song(trck, 1).unwrap();
|
let mut s = album.retrieve_song(trck, 1).unwrap();
|
||||||
s.filepath = Some(fp);
|
s.filename = Some(fp);
|
||||||
s.directory = Some(dir);
|
s.directory = Some(dir);
|
||||||
s.genre = Some(album.genre.clone());
|
s.genre = Some(album.genre.clone());
|
||||||
s.year = Some(album.year.clone());
|
s.year = Some(album.year.clone());
|
||||||
@@ -433,7 +433,7 @@ impl CommitManager {
|
|||||||
match fname {
|
match fname {
|
||||||
Ok(s) => {
|
Ok(s) => {
|
||||||
filenames.push(s.clone());
|
filenames.push(s.clone());
|
||||||
song.filepath = Some(s.clone());
|
song.filename = Some(s.clone());
|
||||||
song.directory = Some(sourcepath.clone());
|
song.directory = Some(sourcepath.clone());
|
||||||
song.data = Some(song.to_data().unwrap());
|
song.data = Some(song.to_data().unwrap());
|
||||||
self.initialize_disc_and_track(&mut song);
|
self.initialize_disc_and_track(&mut song);
|
||||||
@@ -513,7 +513,7 @@ impl CommitManager {
|
|||||||
let mut index = 0;
|
let mut index = 0;
|
||||||
for song in &mut album.songs {
|
for song in &mut album.songs {
|
||||||
let filename = filenames[index].clone();
|
let filename = filenames[index].clone();
|
||||||
song.filepath = Some(filename);
|
song.filename = Some(filename);
|
||||||
index += 1;
|
index += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,7 +598,7 @@ impl CommitManager {
|
|||||||
let mut track = 1;
|
let mut track = 1;
|
||||||
let mut mode = 0;
|
let mut mode = 0;
|
||||||
let filename =
|
let filename =
|
||||||
&<std::option::Option<std::string::String> as Clone>::clone(&song.filepath).unwrap();
|
&<std::option::Option<std::string::String> as Clone>::clone(&song.filename).unwrap();
|
||||||
|
|
||||||
let trd = filename.contains("trackd");
|
let trd = filename.contains("trackd");
|
||||||
let tr = filename.contains("track");
|
let tr = filename.contains("track");
|
||||||
|
|||||||
+2
-4
@@ -24,7 +24,6 @@ pub struct Song {
|
|||||||
pub filename: Option<String>,
|
pub filename: Option<String>,
|
||||||
pub user_id: Option<i32>,
|
pub user_id: Option<i32>,
|
||||||
pub data: Option<Vec<u8>>,
|
pub data: Option<Vec<u8>>,
|
||||||
pub filepath: Option<String>,
|
|
||||||
pub directory: Option<String>,
|
pub directory: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +73,6 @@ impl Default for Song {
|
|||||||
filename: None,
|
filename: None,
|
||||||
user_id: None,
|
user_id: None,
|
||||||
data: None,
|
data: None,
|
||||||
filepath: None,
|
|
||||||
directory: None,
|
directory: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +96,7 @@ impl Song {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let filename =
|
let filename =
|
||||||
&<std::option::Option<std::string::String> as Clone>::clone(&self.filepath).unwrap();
|
&<std::option::Option<std::string::String> as Clone>::clone(&self.filename).unwrap();
|
||||||
buffer += filename;
|
buffer += filename;
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
@@ -134,7 +132,7 @@ impl Song {
|
|||||||
filename += constants::file_extensions::WAV_FILE_EXTENSION;
|
filename += constants::file_extensions::WAV_FILE_EXTENSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.filepath = Some(filename);
|
self.filename = Some(filename);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user