libsaria: Remove second library path list

I kept around the old list while I was converting everything over to the
new list.  Now that I support all the needed features, I can remove the
old variable.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-07-01 10:12:59 -04:00
parent a7d1f57403
commit aed5a023b3
6 changed files with 18 additions and 24 deletions

View File

@ -2,9 +2,7 @@
#define LIBSARIA_PLAYLIST_STACK_H
#include <libsaria/playlist.h>
#include <list>
using namespace std;
#include <libsaria/list.h>
#define MAX_PLAYLISTS 10
@ -35,7 +33,7 @@ namespace libsaria
Playlist *get_recent_plist();
void list_recent(Track *);
void tracks_removed(list<Track> &);
void tracks_removed(List<Track> &);
void set_pause_type(AutoPauseType, unsigned int);
AutoPauseType get_pause_type();

View File

@ -21,8 +21,7 @@ namespace libsaria
unsigned int id;
unsigned int next_track;
string path;
list<Track> tracks;
List<Track> _tracks;
List<Track> tracks;
};
class Driver {

View File

@ -37,9 +37,9 @@ static void do_save_path(ofstream &stream, void *data)
stream << 2 << "\n"; /* Save file version: 2 */
stream << path->path << "\n";
stream << path->id << " " << path->visible << " ";
stream << path->next_track << " " << path->_tracks.size() << "\n";
stream << path->next_track << " " << path->tracks.size() << "\n";
path->_tracks.for_each_item(save_track, &stream);
path->tracks.for_each_item(save_track, &stream);
}
void libsaria::library::save_path(libsaria::library::Path *path)
@ -56,6 +56,7 @@ void read_path(ifstream &stream)
unsigned int version;
libsaria::Track *track;
list<libsaria::Track *> tracks, banned;
libsaria::ListItem<libsaria::Track> *item;
struct libsaria::library::Path path, *path_ptr;
getline(stream, tmp);
@ -78,9 +79,8 @@ void read_path(ifstream &stream)
path_ptr = push_path(path);
for (unsigned int i = 0; i < size; i++) {
path_ptr->tracks.push_back(libsaria::Track(stream, path_ptr, version));
track = &path_ptr->tracks.back();
path_ptr->_tracks.push_back(*track);
item = path_ptr->tracks.push_back(libsaria::Track(stream, path_ptr, version));
track = &item->get_value();
if (track->get_banned())
banned.push_back(track);
else

View File

@ -136,7 +136,7 @@ namespace libsaria
{
struct sort_data sort;
path->_tracks.for_each_item(sort_tracks, &sort);
path->tracks.for_each_item(sort_tracks, &sort);
lib_playlist.remove_tracks(sort.tracks);
ban::get_banned_plist()->remove_tracks(sort.banned);
@ -150,7 +150,7 @@ namespace libsaria
{
struct sort_data sort;
path->_tracks.for_each_item(sort_tracks, &sort);
path->tracks.for_each_item(sort_tracks, &sort);
lib_playlist.add_tracks(sort.tracks);
ban::get_banned_plist()->add_tracks(sort.banned);
@ -172,7 +172,7 @@ namespace libsaria
if (p_it == path_list.end())
return NULL;
track = p_it->_tracks.find_item(check_trackid, &trackid);
track = p_it->tracks.find_item(check_trackid, &trackid);
if (track == NULL)
return NULL;
return &track->get_value();

View File

@ -38,11 +38,11 @@ void ValidateTask::run_task()
libsaria::Track *track;
libsaria::ListItem<libsaria::Track> *it;
for (it = path->_tracks.first(); it != path->_tracks.end(); it = it->next()) {
for (it = path->tracks.first(); it != path->tracks.end(); it = it->next()) {
track = &it->get_value();
if (!libsaria::exists(track->get_filepath())) {
println("Reaping: " + track->get_filepath());
it = path->_tracks.erase(it);
it = path->tracks.erase(it);
path->data_state = DIRTY;
}
};
@ -96,7 +96,6 @@ void ScanTask::run_task()
{
list<string>::iterator it;
list<libsaria::Track *> tracks;
libsaria::ListItem<libsaria::Track> *item;
for (it = file_list.begin(); it != file_list.end(); it++) {
/*
@ -105,13 +104,11 @@ void ScanTask::run_task()
* the tree to check if the path exists. It'll be much faster
* than having to walk the same list over and over...
*/
if (path->_tracks.find_item(check_file, &(*it)))
if (path->tracks.find_item(check_file, &(*it)))
continue;
try {
path->tracks.push_back(libsaria::Track(*it, path));
item = path->_tracks.push_back(libsaria::Track(*it, path));
tracks.push_back(&item->get_value());
path->data_state = DIRTY;
} catch (string message) {
println(message);

View File

@ -202,14 +202,14 @@ namespace libsaria
return *it;
}
void deck::tracks_removed(list<Track> &tracks)
void deck::tracks_removed(List<Track> &tracks)
{
list<Track *> track_ptrs;
list<Track>::iterator t_it;
ListItem<Track> *item;
list<Playlist *>::iterator it;
for (t_it = tracks.begin(); t_it != tracks.end(); t_it++)
track_ptrs.push_back(&(*t_it));
for (item = tracks.first(); item != tracks.end(); item = item->next())
track_ptrs.push_back(&item->get_value());
for (it = playlist_deck.begin(); it != playlist_deck.end(); it++)
(*it)->remove_tracks(track_ptrs);