libsaria: Sort the new playlist after reading
Otherwise it won't be useful...
This commit is contained in:
parent
2effa26b32
commit
0fa608c90f
|
@ -6,7 +6,7 @@
|
|||
#include <libsaria/index.h>
|
||||
#include "library.h"
|
||||
|
||||
LibraryPath::LibraryPath(InFile &in, string dir)
|
||||
void LibraryPath::load_file(InFile &in, string dir)
|
||||
{
|
||||
unsigned int size;
|
||||
|
||||
|
@ -44,9 +44,11 @@ static void do_load()
|
|||
|
||||
for (unsigned int i = 0; i < size; i++) {
|
||||
in >> dir;
|
||||
path_list->push_back(LibraryPath(in, dir));
|
||||
path_list->push_back(LibraryPath());
|
||||
path_list->back().load_file(in, dir);
|
||||
}
|
||||
|
||||
libsaria::library::sort_list();
|
||||
libsaria::library::rebuild_list();
|
||||
libsaria::library::refresh();
|
||||
}
|
||||
|
|
|
@ -21,10 +21,11 @@ class LibraryPath
|
|||
list<libsaria::Track>::iterator find_id(sid_t &);
|
||||
|
||||
public:
|
||||
LibraryPath();
|
||||
LibraryPath(string);
|
||||
LibraryPath(InFile &, string);
|
||||
~LibraryPath();
|
||||
|
||||
void load_file(InFile &, string);
|
||||
list<libsaria::Track> *get_list();
|
||||
string get_path();
|
||||
void get_info(void (*)(struct libsaria::library::PathInfo &));
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/print.h>
|
||||
#include "list.h"
|
||||
|
||||
#include <list>
|
||||
|
@ -7,6 +8,12 @@ using namespace std;
|
|||
|
||||
static list<libsaria::Track *> track_list;
|
||||
|
||||
static bool compare_tracks(libsaria::Track *one, libsaria::Track *two)
|
||||
{
|
||||
/* I want to compare tracks and not pointers */
|
||||
return *one < *two;
|
||||
}
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
|
||||
|
@ -15,4 +22,9 @@ namespace libsaria
|
|||
track_list.push_back(&track);
|
||||
}
|
||||
|
||||
void library::sort_list()
|
||||
{
|
||||
track_list.sort(compare_tracks);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace libsaria
|
|||
{
|
||||
|
||||
void list_track(libsaria::Track &);
|
||||
void sort_list();
|
||||
|
||||
}; /* Namespace: library */
|
||||
}; /* Namespace: libsaria */
|
||||
|
|
|
@ -5,6 +5,10 @@ using namespace std;
|
|||
#include <libsaria/library.h>
|
||||
#include "library.h"
|
||||
|
||||
LibraryPath::LibraryPath()
|
||||
{
|
||||
}
|
||||
|
||||
LibraryPath::LibraryPath(string dir)
|
||||
{
|
||||
path = dir;
|
||||
|
|
Loading…
Reference in New Issue