library: Don't save length strings to disk
Recalculating this doesn't change the runtime significantly, so we might as well save some disk space. Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
This commit is contained in:
parent
1e09406730
commit
fc07e28201
|
@ -218,22 +218,33 @@ const std::string library :: Track :: primary_key()
|
|||
|
||||
void library :: Track :: read(File &f)
|
||||
{
|
||||
std::stringstream ss;
|
||||
unsigned int minutes, seconds;
|
||||
|
||||
f >> library_id >> artist_id >> album_id >> genre_id;
|
||||
f >> track >> last_year >> last_month >> last_day;
|
||||
f >> play_count >> length;
|
||||
length_str = f.getline();
|
||||
title = f.getline();
|
||||
filepath = f.getline();
|
||||
|
||||
title_lower = filter :: lowercase(title);
|
||||
full_path = library_db.at(library_id)->root_path + "/" + filepath;
|
||||
library_db.at(library_id)->size++;
|
||||
|
||||
minutes = length / 60;
|
||||
seconds = length % 60;
|
||||
ss << minutes << ":";
|
||||
if (seconds < 10)
|
||||
ss << "0";
|
||||
ss << seconds;
|
||||
length_str = ss.str();
|
||||
}
|
||||
|
||||
void library :: Track :: write(File &f)
|
||||
{
|
||||
f << library_id << " " << artist_id << " " << album_id << " " << genre_id;
|
||||
f << " " << track << " " << last_year << " " << last_month << " " << last_day;
|
||||
f << " " << play_count << " " << length << " " << length_str << std :: endl;
|
||||
f << " " << play_count << " " << length; // << std :: endl;
|
||||
f << title << std :: endl;
|
||||
f << filepath;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue