libsaria: Create track tags with an inode
I need to store the inode somewhere if I want to use a linked list to store LibraryPath data. I currently have a map <ino_t, TrackTag>, so the obvious choice is to store the inode in the TrackTag structure.
This commit is contained in:
parent
8609b9a6a7
commit
9c0e61b42d
|
@ -22,14 +22,15 @@ class TrackTag
|
|||
int bitrate;
|
||||
int sample;
|
||||
int channels;
|
||||
ino_t inode;
|
||||
|
||||
void make_lenstr();
|
||||
|
||||
public:
|
||||
TrackTag();
|
||||
TrackTag(const TrackTag &);
|
||||
TrackTag(string);
|
||||
TrackTag(InFile &);
|
||||
TrackTag(string, ino_t);
|
||||
TrackTag(InFile &, ino_t);
|
||||
~TrackTag();
|
||||
void save(OutFile &);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace libsaria
|
|||
}
|
||||
|
||||
if (!library::get_info(inode, func)) {
|
||||
TrackTag tag(libsaria::audio::get_current_file());
|
||||
TrackTag tag(libsaria::audio::get_current_file(), inode);
|
||||
Track track(inode, &tag);
|
||||
func(track);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ LibraryPath::LibraryPath(InFile &in, string dir)
|
|||
|
||||
for (unsigned int i = 0; i < size; i++) {
|
||||
inode = in.read_ino();
|
||||
file_map[inode] = TrackTag(in);
|
||||
file_map[inode] = TrackTag(in, inode);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ ScanTask::~ScanTask()
|
|||
void ScanTask::tag_file(file filepath)
|
||||
{
|
||||
try {
|
||||
TrackTag tag(dir + "/" + filepath.name);
|
||||
TrackTag tag(dir + "/" + filepath.name, filepath.d_ino);
|
||||
library->insert_track(filepath.d_ino, tag);
|
||||
} catch (string message) {
|
||||
println(message);
|
||||
|
|
|
@ -28,9 +28,10 @@ TrackTag::TrackTag(const TrackTag &tag)
|
|||
bitrate = tag.bitrate;
|
||||
sample = tag.sample;
|
||||
channels = tag.channels;
|
||||
inode = tag.inode;
|
||||
}
|
||||
|
||||
TrackTag::TrackTag(string file)
|
||||
TrackTag::TrackTag(string file, ino_t inode)
|
||||
{
|
||||
Tag *tag;
|
||||
AudioProperties *prop;
|
||||
|
@ -57,10 +58,12 @@ TrackTag::TrackTag(string file)
|
|||
sample = prop->sampleRate();
|
||||
channels = prop->channels();
|
||||
|
||||
inode = inode;
|
||||
|
||||
make_lenstr();
|
||||
}
|
||||
|
||||
TrackTag::TrackTag(InFile &in)
|
||||
TrackTag::TrackTag(InFile &in, ino_t inode)
|
||||
{
|
||||
filepath = in.read_str();
|
||||
title = in.read_str();
|
||||
|
@ -75,6 +78,7 @@ TrackTag::TrackTag(InFile &in)
|
|||
bitrate = in.read_int();
|
||||
sample = in.read_int();
|
||||
channels = in.read_int();
|
||||
inode = inode;
|
||||
}
|
||||
|
||||
TrackTag::~TrackTag()
|
||||
|
|
Loading…
Reference in New Issue