libsaria: Clean out the Track class for re-implementation
This also removed the other `typedef sid_t` left in the header file. I'll re-add in functions and variables as I need them, and hopefully keep things working more efficiently. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
d77b06f267
commit
a944869093
|
@ -7,7 +7,7 @@ namespace libsaria
|
|||
{
|
||||
void next();
|
||||
string next_file();
|
||||
void play_id(sid_t &);
|
||||
// void play_id(sid_t &);
|
||||
void set_pause_after(bool);
|
||||
bool get_pause_after();
|
||||
void toggle_play();
|
||||
|
|
|
@ -12,10 +12,10 @@ namespace libsaria
|
|||
void add_track(libsaria::Track *);
|
||||
void filter(string &);
|
||||
void refresh();
|
||||
bool is_visible(sid_t &);
|
||||
// bool is_visible(sid_t &);
|
||||
bool is_filtered();
|
||||
unsigned int size();
|
||||
sid_t rand_id();
|
||||
// sid_t rand_id();
|
||||
void print_stats();
|
||||
|
||||
}; /* Namespace: index */
|
||||
|
|
|
@ -14,21 +14,21 @@ namespace libsaria
|
|||
private:
|
||||
string path;
|
||||
list<libsaria::Track *> file_list;
|
||||
bool has_id(sid_t);
|
||||
//bool has_id(sid_t);
|
||||
|
||||
public:
|
||||
LibraryPath();
|
||||
LibraryPath(string);
|
||||
~LibraryPath();
|
||||
|
||||
void load_file(InFile &);
|
||||
//void load_file(InFile &);
|
||||
string get_path();
|
||||
unsigned int get_size();
|
||||
void prepare_for_removal();
|
||||
//void get_info(void (*)(struct libsaria::library::PathInfo &));
|
||||
bool add_track(string &, sid_t &);
|
||||
//bool add_track(string &, sid_t &);
|
||||
void validate_track(libsaria::Track *);
|
||||
void save(OutFile &);
|
||||
//void save(OutFile &);
|
||||
|
||||
void update();
|
||||
void validate();
|
||||
|
|
|
@ -12,14 +12,14 @@ using namespace std;
|
|||
struct file
|
||||
{
|
||||
string name;
|
||||
sid_t d_sid;
|
||||
// sid_t d_sid;
|
||||
};
|
||||
|
||||
string get_saria_dir();
|
||||
void make_saria_dir();
|
||||
bool exists(string);
|
||||
void remove_file(string);
|
||||
sid_t lookup_songid(string &);
|
||||
//sid_t lookup_songid(string &);
|
||||
string open_pipe(string);
|
||||
void close_pipes();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace libsaria
|
|||
void save();
|
||||
void reload();
|
||||
|
||||
void add_ids(list<sid_t> &);
|
||||
//void add_ids(list<sid_t> &);
|
||||
void add_track(Track *);
|
||||
void rm_indices(list<int> &);
|
||||
void rm_track(Track *);
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace libsaria
|
|||
|
||||
void stack_playlist(Playlist *);
|
||||
Playlist *new_playlist(string, unsigned int);
|
||||
void add_to_playlist(list<sid_t> &);
|
||||
//void add_to_playlist(list<sid_t> &);
|
||||
Playlist *stack_top();
|
||||
void stack_top_pop();
|
||||
string next_file();
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
#ifndef LIBSARIA_TRACK_H
|
||||
#define LIBSARIA_TRACK_H
|
||||
|
||||
#include <sys/types.h>
|
||||
/* Set up song id type */
|
||||
typedef ino_t sid_t;
|
||||
|
||||
#include <libsaria/files.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
|
@ -15,7 +10,7 @@ namespace libsaria
|
|||
class Track
|
||||
{
|
||||
private:
|
||||
string filepath;
|
||||
/* string filepath;
|
||||
string title;
|
||||
string artist;
|
||||
string album;
|
||||
|
@ -33,10 +28,10 @@ namespace libsaria
|
|||
string *artist_lc;
|
||||
string *album_lc;
|
||||
void make_lenstr();
|
||||
void do_bookkeeping();
|
||||
void do_bookkeeping();*/
|
||||
|
||||
public:
|
||||
Track();
|
||||
/* Track();
|
||||
Track(string, sid_t);
|
||||
Track(InFile &);
|
||||
~Track();
|
||||
|
@ -57,7 +52,7 @@ namespace libsaria
|
|||
int get_channels();
|
||||
sid_t get_songid();
|
||||
|
||||
bool operator<(Track &);
|
||||
bool operator<(Track &);*/
|
||||
};
|
||||
|
||||
} /* Namespace: libsaria */
|
||||
|
|
|
@ -57,11 +57,11 @@ class SongList : public libsaria::PlaylistRenderer
|
|||
void fill();
|
||||
void clear();
|
||||
void refilter();
|
||||
void list_selected_ids(list<sid_t> &);
|
||||
//void list_selected_ids(list<sid_t> &);
|
||||
void rm_selected_indices();
|
||||
void index_removed(int);
|
||||
void scroll_to(sid_t);
|
||||
sid_t current_id();
|
||||
//void scroll_to(sid_t);
|
||||
//sid_t current_id();
|
||||
|
||||
gint right_click(guint, guint64);
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ static void about_to_finish(GstElement *playbin, gpointer data)
|
|||
string file;
|
||||
|
||||
println("About to finish!");
|
||||
file = libsaria::next_file();
|
||||
//file = libsaria::next_file();
|
||||
if (file != "")
|
||||
load_file(playbin, file);
|
||||
}
|
||||
|
|
|
@ -26,18 +26,18 @@ namespace libsaria
|
|||
|
||||
void next()
|
||||
{
|
||||
string filepath = next_file();
|
||||
play_file(filepath);
|
||||
//string filepath = next_file();
|
||||
//play_file(filepath);
|
||||
}
|
||||
|
||||
void play_id(sid_t &songid)
|
||||
/*void play_id(sid_t &songid)
|
||||
{
|
||||
println("Playing id: %lu", songid);
|
||||
/*Track *track = library::lookup(songid);
|
||||
Track *track = library::lookup(songid);
|
||||
string filepath = track->get_filepath();
|
||||
println(filepath);
|
||||
play_file(filepath);*/
|
||||
}
|
||||
play_file(filepath);
|
||||
}*/
|
||||
|
||||
void set_pause_after(bool state)
|
||||
{
|
||||
|
|
|
@ -11,20 +11,20 @@ namespace libsaria
|
|||
|
||||
libsaria::Track *current_track()
|
||||
{
|
||||
sid_t songid;
|
||||
// sid_t songid;
|
||||
//libsaria::Track *current;
|
||||
string file = libsaria::audio::get_current_file();
|
||||
|
||||
if (file == "")
|
||||
return NULL;
|
||||
|
||||
songid = lookup_songid(file);
|
||||
// songid = lookup_songid(file);
|
||||
/*current = libsaria::library::lookup(songid);
|
||||
if (current)
|
||||
return current;*/
|
||||
|
||||
tmp_track = libsaria::Track(file, songid);
|
||||
tmp_track.do_cleanup();
|
||||
// tmp_track = libsaria::Track(file, songid);
|
||||
// tmp_track.do_cleanup();
|
||||
return &tmp_track;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
#include <libsaria/callback.h>
|
||||
#include "index.h"
|
||||
|
||||
set<sid_t> results;
|
||||
//set<sid_t> results;
|
||||
set<string> *cur_terms;
|
||||
static bool filtered = false;
|
||||
//static bool filtered = false;
|
||||
|
||||
/*
|
||||
* Thanks to: http://stackoverflow.com/questions/1773526/in-place-c-set-intersection
|
||||
* for the set intersection algorithm!
|
||||
*/
|
||||
static void inplace_intersect(set<sid_t> *ids)
|
||||
/*static void inplace_intersect(set<sid_t> *ids)
|
||||
{
|
||||
set<sid_t>::iterator it1 = results.begin();
|
||||
set<sid_t>::iterator it2 = ids->begin();
|
||||
|
@ -22,14 +22,14 @@ static void inplace_intersect(set<sid_t> *ids)
|
|||
results.erase(it1++);
|
||||
else if (*it2 < *it1)
|
||||
it2++;
|
||||
else { /* *it1 == *it2 */
|
||||
it1++;
|
||||
else { *//* *it1 == *it2 */
|
||||
/* it1++;
|
||||
it2++;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/* Remove everything in results that wasn't in inodes */
|
||||
results.erase(it1, results.end());
|
||||
/*results.erase(it1, results.end());
|
||||
|
||||
}
|
||||
|
||||
|
@ -58,19 +58,19 @@ static void do_filter(set<string> *terms)
|
|||
for (it = terms->begin(); it != terms->end(); it++) {
|
||||
found.clear();
|
||||
search_indexes(*it, &found);
|
||||
/*
|
||||
*/ /*
|
||||
* Key not found means we don't need to filter anymore
|
||||
* just clear the results set and return.
|
||||
*/
|
||||
if (found.size() == 0) {
|
||||
/* if (found.size() == 0) {
|
||||
results.clear();
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
* This is the first result, so the result set is empty.
|
||||
* Taking an intersection will always give us an empty set.
|
||||
*/
|
||||
if (it == terms->begin())
|
||||
/* if (it == terms->begin())
|
||||
results = found;
|
||||
else
|
||||
inplace_intersect(&found);
|
||||
|
@ -123,4 +123,4 @@ namespace libsaria
|
|||
{
|
||||
return results.size();
|
||||
}
|
||||
};
|
||||
};*/
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#include <stdlib.h>
|
||||
using namespace std;
|
||||
|
||||
map<string, set<sid_t> > artist_index;
|
||||
/*map<string, set<sid_t> > artist_index;
|
||||
map<string, set<sid_t> > album_index;
|
||||
map<string, set<sid_t> > title_index;
|
||||
map<string, set<sid_t> > title_index;*/
|
||||
|
||||
static map<string, set<string> > substr_cache;
|
||||
unsigned int hits;
|
||||
|
||||
/*
|
||||
static set<string> *gen_substrs(const string &word)
|
||||
{
|
||||
string substr, key;
|
||||
|
@ -81,24 +81,24 @@ static void index_tag(sid_t &songid, const string &tag,
|
|||
for (it = word_set->begin(); it != word_set->end(); it++)
|
||||
index_word(songid, *it, index);
|
||||
}
|
||||
|
||||
*/
|
||||
namespace libsaria
|
||||
{
|
||||
|
||||
void index::add_track(libsaria::Track *track)
|
||||
{
|
||||
sid_t songid = track->get_songid();
|
||||
/* sid_t songid = track->get_songid();
|
||||
index_tag(songid, track->get_artist(), &artist_index);
|
||||
index_tag(songid, track->get_album(), &album_index);
|
||||
index_tag(songid, track->get_title(), &title_index);
|
||||
index_tag(songid, track->get_title(), &title_index);*/
|
||||
}
|
||||
|
||||
void index::print_stats()
|
||||
{
|
||||
println("Index cache hits: %u size: %u", hits, substr_cache.size());
|
||||
// println("Index cache hits: %u size: %u", hits, substr_cache.size());
|
||||
}
|
||||
|
||||
sid_t index::rand_id()
|
||||
/*( sid_t index::rand_id()
|
||||
{
|
||||
set<sid_t>::iterator it = results.begin();
|
||||
unsigned int index = rand() % results.size();
|
||||
|
@ -107,5 +107,5 @@ namespace libsaria
|
|||
for (unsigned int i = 0; i < index; i++)
|
||||
it++;
|
||||
return *it;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
extern map<string, set<sid_t> > artist_index;
|
||||
/*extern map<string, set<sid_t> > artist_index;
|
||||
extern map<string, set<sid_t> > album_index;
|
||||
extern map<string, set<sid_t> > title_index;
|
||||
extern set<sid_t> results;
|
||||
extern set<sid_t> results;*/
|
||||
|
||||
#endif /* LIBSARIA_INDEX_INTERNAL_H */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace libsaria
|
||||
{
|
||||
void LibraryPath::load_file(InFile &in)
|
||||
/* void LibraryPath::load_file(InFile &in)
|
||||
{
|
||||
unsigned int size;
|
||||
libsaria::Track *track;
|
||||
|
@ -27,6 +27,6 @@ namespace libsaria
|
|||
out << path << file_list.size() << "\n";
|
||||
for (it = file_list.begin(); it != file_list.end(); it++)
|
||||
(*it)->save(out);
|
||||
}
|
||||
}*/
|
||||
|
||||
}; /* Namespace: libsaria */
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace libsaria
|
|||
void LibraryPath::prepare_for_removal()
|
||||
{
|
||||
list<libsaria::Track *>::iterator it;
|
||||
for (it = file_list.begin(); it != file_list.end(); it++)
|
||||
(*it)->do_cleanup();
|
||||
// for (it = file_list.begin(); it != file_list.end(); it++)
|
||||
// (*it)->do_cleanup();
|
||||
}
|
||||
|
||||
string LibraryPath::get_path()
|
||||
|
@ -48,7 +48,7 @@ namespace libsaria
|
|||
info_func(info);
|
||||
}*/
|
||||
|
||||
bool LibraryPath::has_id(sid_t id)
|
||||
/* bool LibraryPath::has_id(sid_t id)
|
||||
{
|
||||
list<libsaria::Track *>::iterator it;
|
||||
for (it = file_list.begin(); it != file_list.end(); it++) {
|
||||
|
@ -56,6 +56,6 @@ namespace libsaria
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
} /* Namespace: libsaria */
|
||||
|
|
|
@ -134,7 +134,7 @@ void ReaddirTask::run_task()
|
|||
namespace libsaria
|
||||
{
|
||||
|
||||
bool LibraryPath::add_track(string &filepath, sid_t &songid)
|
||||
/*bool LibraryPath::add_track(string &filepath, sid_t &songid)
|
||||
{
|
||||
libsaria::Track *track;
|
||||
if (has_id(songid) == false) {
|
||||
|
@ -143,7 +143,7 @@ namespace libsaria
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
void LibraryPath::update()
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#define MAX_VALIDATE 250
|
||||
|
||||
class ValidateTask : public IdleTask
|
||||
/*class ValidateTask : public IdleTask
|
||||
{
|
||||
private:
|
||||
libsaria::LibraryPath *lib_path;
|
||||
|
@ -62,4 +62,4 @@ namespace libsaria
|
|||
validate->queue();
|
||||
}
|
||||
|
||||
} /* Namespace: libsaria */
|
||||
}*/ /* Namespace: libsaria */
|
||||
|
|
|
@ -48,11 +48,8 @@ ScanTask::~ScanTask()
|
|||
{
|
||||
}
|
||||
|
||||
unsigned int count;
|
||||
void ScanTask::run_task()
|
||||
{
|
||||
count += file_list.size();
|
||||
println("ScanTask scanned %u files so far", count);
|
||||
}
|
||||
|
||||
ReaddirTask::ReaddirTask(struct libsaria::library::Path *p)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <libsaria/libsaria.h>
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/prefs.h>
|
||||
#include <libsaria/print.h>
|
||||
#include <libsaria/idle.h>
|
||||
#include <libsaria/fs.h>
|
||||
/*#include <libsaria/audio.h>
|
||||
|
|
|
@ -51,19 +51,19 @@ bool exists(string path)
|
|||
|
||||
void remove_file(string filename)
|
||||
{
|
||||
string path = get_saria_dir() + "/" + filename;
|
||||
/*string path = get_saria_dir() + "/" + filename;
|
||||
if (exists(path))
|
||||
remove(path.c_str());
|
||||
remove(path.c_str());*/
|
||||
}
|
||||
|
||||
sid_t lookup_songid(string &filepath)
|
||||
/*sid_t lookup_songid(string &filepath)
|
||||
{
|
||||
struct stat stat;
|
||||
int err = lstat(filepath.c_str(), &stat);
|
||||
if (err != 0)
|
||||
return err;
|
||||
return stat.st_ino;
|
||||
}
|
||||
}*/
|
||||
|
||||
static list<string> open_pipes;
|
||||
|
||||
|
|
|
@ -23,17 +23,17 @@ namespace libsaria
|
|||
void Playlist::do_load()
|
||||
{
|
||||
unsigned int size;
|
||||
sid_t songid;
|
||||
//sid_t songid;
|
||||
InFile in(filename);
|
||||
|
||||
if (!in.good())
|
||||
return;
|
||||
in >> size;
|
||||
|
||||
for (unsigned int i = 0; i < size; i++) {
|
||||
/*for (unsigned int i = 0; i < size; i++) {
|
||||
in >> songid;
|
||||
//plist.push_back(library::lookup(songid));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void Playlist::load()
|
||||
|
@ -53,8 +53,8 @@ namespace libsaria
|
|||
list<Track *>::iterator it;
|
||||
|
||||
out << plist.size() << "\n";
|
||||
for (it = plist.begin(); it != plist.end(); it++)
|
||||
out << (*it)->get_songid() << "\n";
|
||||
/*for (it = plist.begin(); it != plist.end(); it++)
|
||||
out << (*it)->get_songid() << "\n";*/
|
||||
}
|
||||
|
||||
void Playlist::save()
|
||||
|
|
|
@ -34,8 +34,8 @@ namespace libsaria
|
|||
}
|
||||
|
||||
if (flags & PL_FILTER) {
|
||||
sid_t songid = (*it)->get_songid();
|
||||
return libsaria::index::is_visible(songid);
|
||||
//sid_t songid = (*it)->get_songid();
|
||||
//return libsaria::index::is_visible(songid);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -65,11 +65,11 @@ namespace libsaria
|
|||
for (unsigned int i = 0; i < n; i++) {
|
||||
incr_iter(cur);
|
||||
if (flags & PL_FILTER) {
|
||||
sid_t songid = (*cur)->get_songid();
|
||||
/*sid_t songid = (*cur)->get_songid();
|
||||
while (!index::is_visible(songid)) {
|
||||
incr_iter(cur);
|
||||
songid = (*cur)->get_songid();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
static bool compare_tracks(libsaria::Track *one, libsaria::Track *two)
|
||||
{
|
||||
/* I want to compare tracks and not pointers */
|
||||
return *one < *two;
|
||||
//return *one < *two;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void advance_iterator(list<libsaria::Track *>::iterator &it, int n)
|
||||
|
@ -66,7 +67,7 @@ namespace libsaria
|
|||
init_common(filename, flags);
|
||||
}
|
||||
|
||||
void Playlist::add_ids(list<sid_t> &ids)
|
||||
/*void Playlist::add_ids(list<sid_t> &ids)
|
||||
{
|
||||
Track *track;
|
||||
list<sid_t>::iterator it;
|
||||
|
@ -78,7 +79,7 @@ namespace libsaria
|
|||
renderer->insert(track, plist.size() - 1);
|
||||
}
|
||||
save();
|
||||
}
|
||||
}*/
|
||||
|
||||
void Playlist::add_track(libsaria::Track *track)
|
||||
{
|
||||
|
@ -124,8 +125,8 @@ namespace libsaria
|
|||
|
||||
unsigned int Playlist::apparent_size()
|
||||
{
|
||||
if ( (flags & PL_FILTER) && (index::is_filtered()) )
|
||||
return index::size();
|
||||
/*if ( (flags & PL_FILTER) && (index::is_filtered()) )
|
||||
return index::size();*/
|
||||
return plist.size();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ using namespace std;
|
|||
|
||||
static list<libsaria::Playlist *> playlist_stack;
|
||||
|
||||
static void plist_loaded()
|
||||
/*static void plist_loaded()
|
||||
{
|
||||
trigger_callback(NEW_PLAYLIST);
|
||||
}
|
||||
}*/
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
|
@ -28,11 +28,11 @@ namespace libsaria
|
|||
return plist;
|
||||
}
|
||||
|
||||
void add_to_playlist(list<sid_t> &ids)
|
||||
/*void add_to_playlist(list<sid_t> &ids)
|
||||
{
|
||||
Playlist *plist;
|
||||
Playlist *plist;*/
|
||||
/* Only allow one queue and one library (for now) */
|
||||
if (playlist_stack.size() == 1) {
|
||||
/* if (playlist_stack.size() == 1) {
|
||||
plist = new_playlist("queue.q", PL_QUEUE);
|
||||
trigger_callback(NEW_PLAYLIST);
|
||||
plist->add_ids(ids);
|
||||
|
@ -40,7 +40,7 @@ namespace libsaria
|
|||
plist = playlist_stack.front();
|
||||
plist->add_ids(ids);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
Playlist *stack_top()
|
||||
{
|
||||
|
@ -57,22 +57,22 @@ namespace libsaria
|
|||
}
|
||||
}
|
||||
|
||||
string next_file()
|
||||
/*string next_file()
|
||||
{
|
||||
Playlist *plist = playlist_stack.front();
|
||||
Track *track = plist->next();
|
||||
stack_top_pop();
|
||||
return track->get_filepath();
|
||||
}
|
||||
}*/
|
||||
|
||||
void stack_init()
|
||||
{
|
||||
IOTask *task;
|
||||
/* IOTask *task;
|
||||
if (exists(get_saria_dir() + "/queue.q")) {
|
||||
new_playlist("queue.q", PL_QUEUE);
|
||||
task = new IOTask(plist_loaded);
|
||||
task->queue();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}; /* Namespace: libsaria */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace libsaria
|
||||
{
|
||||
|
||||
string Track::get_filepath()
|
||||
/*string Track::get_filepath()
|
||||
{
|
||||
return filepath;
|
||||
}
|
||||
|
@ -67,6 +67,6 @@ namespace libsaria
|
|||
sid_t Track::get_songid()
|
||||
{
|
||||
return songid;
|
||||
}
|
||||
}*/
|
||||
|
||||
} /* Namespace: libsaria */
|
||||
|
|
|
@ -20,26 +20,26 @@ namespace libsaria
|
|||
{
|
||||
|
||||
/* Return true if this < cmp_track */
|
||||
bool Track::operator<(Track &cmp_track)
|
||||
/*/ bool Track::operator<(Track &cmp_track)
|
||||
{
|
||||
int cmp;
|
||||
int cmp;*/
|
||||
|
||||
/* Compare artists */
|
||||
cmp = compare_strings(artist_lc, cmp_track.artist_lc);
|
||||
/*cmp = compare_strings(artist_lc, cmp_track.artist_lc);
|
||||
if (cmp < 0)
|
||||
return true;
|
||||
else if (cmp > 0)
|
||||
return false;
|
||||
return false;*/
|
||||
|
||||
/* Compare albums */
|
||||
cmp = compare_strings(album_lc, cmp_track.album_lc);
|
||||
/*cmp = compare_strings(album_lc, cmp_track.album_lc);
|
||||
if (cmp < 0)
|
||||
return true;
|
||||
else if (cmp > 0)
|
||||
return false;
|
||||
return false;*/
|
||||
|
||||
/* Compare tracks */
|
||||
return track < cmp_track.track;
|
||||
}
|
||||
/* return track < cmp_track.track;
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
namespace libsaria
|
||||
{
|
||||
|
||||
Track::Track()
|
||||
/* Track::Track()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -25,20 +25,20 @@ namespace libsaria
|
|||
throw "Error tagging file: " + file;
|
||||
|
||||
filepath = file;
|
||||
songid = sid;
|
||||
songid = sid;*/
|
||||
|
||||
/* Extract tags */
|
||||
tag = ref.tag();
|
||||
/* tag = ref.tag();
|
||||
title = tag->title().to8Bit(true);
|
||||
artist = tag->artist().to8Bit(true);
|
||||
album = tag->album().to8Bit(true);
|
||||
comment = tag->comment().to8Bit(true);
|
||||
genre = tag->genre().to8Bit(true);
|
||||
year = tag->year();
|
||||
track = tag->track();
|
||||
track = tag->track();*/
|
||||
|
||||
/* Extract audio properties */
|
||||
prop = ref.audioProperties();
|
||||
/* prop = ref.audioProperties();
|
||||
length = prop->length();
|
||||
bitrate = prop->bitrate();
|
||||
sample = prop->sampleRate();
|
||||
|
@ -105,16 +105,16 @@ namespace libsaria
|
|||
{
|
||||
int minutes;
|
||||
int seconds;
|
||||
stringstream stream;
|
||||
stringstream stream;*/
|
||||
|
||||
/* Convert length into mm:ss format */
|
||||
minutes = length / 60;
|
||||
/* minutes = length / 60;
|
||||
seconds = length - (minutes * 60);
|
||||
stream << minutes << ":";
|
||||
if (seconds < 10)
|
||||
stream << "0";
|
||||
stream << seconds;
|
||||
lenstr = stream.str();
|
||||
}
|
||||
}*/
|
||||
|
||||
} /* Namespace: libsaria */
|
||||
|
|
|
@ -115,10 +115,10 @@ void set_now_playing(libsaria::Track *track)
|
|||
{
|
||||
list<struct NowPlayingWidgets>::iterator it;
|
||||
|
||||
for (it = nowplaying_widgets.begin(); it != nowplaying_widgets.end(); it++) {
|
||||
/*for (it = nowplaying_widgets.begin(); it != nowplaying_widgets.end(); it++) {
|
||||
set_now_playing(&(*it),
|
||||
track->get_title(),
|
||||
track->get_artist(),
|
||||
track->get_album());
|
||||
};
|
||||
};*/
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ void focus_entry()
|
|||
static void do_filter(GtkWidget *entry)
|
||||
{
|
||||
string text = gtk_entry_get_text(GTK_ENTRY(entry));
|
||||
libsaria::index::filter(text);
|
||||
//libsaria::index::filter(text);
|
||||
}
|
||||
|
||||
static void destroyed(GtkWidget *entry)
|
||||
|
|
|
@ -19,9 +19,9 @@ static GtkWidget *library_page = NULL;
|
|||
|
||||
static void add_to_queue()
|
||||
{
|
||||
list<sid_t> selected;
|
||||
/*list<sid_t> selected;
|
||||
library_list.list_selected_ids(selected);
|
||||
libsaria::add_to_playlist(selected);
|
||||
libsaria::add_to_playlist(selected);*/
|
||||
}
|
||||
|
||||
static void add_to_queue_event(GtkMenuItem *menu, gpointer data)
|
||||
|
@ -34,17 +34,17 @@ namespace ocarina
|
|||
|
||||
void library::refilter()
|
||||
{
|
||||
sid_t cur = library_list.current_id();
|
||||
/*sid_t cur = library_list.current_id();
|
||||
library_list.refilter();
|
||||
library_list.scroll_to(cur);
|
||||
library_list.scroll_to(cur);*/
|
||||
}
|
||||
|
||||
void library::refresh()
|
||||
{
|
||||
sid_t cur = library_list.current_id();
|
||||
/*sid_t cur = library_list.current_id();
|
||||
library_list.clear();
|
||||
library_list.fill();
|
||||
library_list.scroll_to(cur);
|
||||
library_list.scroll_to(cur);*/
|
||||
}
|
||||
|
||||
void library::init()
|
||||
|
@ -61,7 +61,7 @@ namespace ocarina
|
|||
|
||||
void library::scroll_to(libsaria::Track *track)
|
||||
{
|
||||
library_list.scroll_to(track->get_songid());
|
||||
//library_list.scroll_to(track->get_songid());
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ void SongList::clear()
|
|||
|
||||
void SongList::insert(libsaria::Track *track, unsigned int index)
|
||||
{
|
||||
gtk_list_store_insert_with_values(liststore, NULL, index,
|
||||
/*gtk_list_store_insert_with_values(liststore, NULL, index,
|
||||
0, track->get_songid(),
|
||||
1, track->get_track(),
|
||||
2, track->get_title().c_str(),
|
||||
|
@ -40,7 +40,7 @@ void SongList::insert(libsaria::Track *track, unsigned int index)
|
|||
6, track->get_year(),
|
||||
7, formatted(track->get_filepath()).c_str(),
|
||||
-1);
|
||||
set_label_text();
|
||||
set_label_text();*/
|
||||
}
|
||||
|
||||
void SongList::fill()
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
|
||||
gboolean songlist_filter_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
sid_t inode;
|
||||
/*sid_t inode;
|
||||
gtk_tree_model_get(model, iter, 0, &inode, -1);
|
||||
return libsaria::index::is_visible(inode);
|
||||
return libsaria::index::is_visible(inode);*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SongList::refilter()
|
||||
|
|
|
@ -9,7 +9,7 @@ using namespace std;
|
|||
#include <libsaria/print.h>
|
||||
#include "songlist.h"
|
||||
|
||||
void songlist_selected_inode(GtkTreeView *treeview, GtkTreePath *path, sid_t &inode)
|
||||
/*void songlist_selected_inode(GtkTreeView *treeview, GtkTreePath *path, sid_t &inode)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model = gtk_tree_view_get_model(treeview);
|
||||
|
@ -28,24 +28,24 @@ sid_t songlist_current_id(GtkTreeView *treeview, GtkTreePath *path)
|
|||
gtk_tree_model_get(model, &iter, 0, &songid, -1);
|
||||
|
||||
return songid;
|
||||
}
|
||||
}*/
|
||||
|
||||
void songlist_row_activated(GtkTreeView *treeview, GtkTreePath *path,
|
||||
GtkTreeViewColumn *column, gpointer data)
|
||||
{
|
||||
sid_t songid = songlist_current_id(treeview, path);
|
||||
/* sid_t songid = songlist_current_id(treeview, path);
|
||||
println("Double click! %lu", songid);
|
||||
libsaria::play_id(songid);
|
||||
libsaria::play_id(songid);*/
|
||||
}
|
||||
|
||||
static void selected_foreach_func(GtkTreeModel *model, GtkTreePath *path,
|
||||
/*static void selected_foreach_func(GtkTreeModel *model, GtkTreePath *path,
|
||||
GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
list<sid_t> *res = (list<sid_t> *) data;
|
||||
sid_t inode;
|
||||
gtk_tree_model_get(model, iter, 0, &inode, -1);
|
||||
res->push_back(inode);
|
||||
}
|
||||
}*/
|
||||
|
||||
static void selected_foreach_func2(GtkTreeModel *model, GtkTreePath *path,
|
||||
GtkTreeIter *iter, gpointer data)
|
||||
|
@ -56,10 +56,10 @@ static void selected_foreach_func2(GtkTreeModel *model, GtkTreePath *path,
|
|||
println("Found index: %d", *index);
|
||||
}
|
||||
|
||||
void SongList::list_selected_ids(list<sid_t> &res)
|
||||
/*void SongList::list_selected_ids(list<sid_t> &res)
|
||||
{
|
||||
gtk_tree_selection_selected_foreach(selection, selected_foreach_func, &res);
|
||||
}
|
||||
}*/
|
||||
|
||||
void SongList::list_selected_indices(list<int> &res)
|
||||
{
|
||||
|
@ -96,12 +96,12 @@ void SongList::set_label_text()
|
|||
}
|
||||
|
||||
struct scroll_data {
|
||||
sid_t songid;
|
||||
// sid_t songid;
|
||||
GtkWidget *treeview;
|
||||
GdkRectangle rect;
|
||||
};
|
||||
|
||||
static int scroll_to_check_row(GtkTreeModel *model, GtkTreePath *path,
|
||||
/*static int scroll_to_check_row(GtkTreeModel *model, GtkTreePath *path,
|
||||
GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
struct scroll_data *scroll = (struct scroll_data *)data;
|
||||
|
@ -141,9 +141,9 @@ void SongList::scroll_to(sid_t songid)
|
|||
if (songid == 0)
|
||||
return;
|
||||
|
||||
gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(treeview), &data.rect);
|
||||
gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(treeview), &data.rect);*/
|
||||
/* Widget not realized yet */
|
||||
if (data.rect.height == 0)
|
||||
/* if (data.rect.height == 0)
|
||||
return;
|
||||
|
||||
gtk_tree_model_foreach(filter, scroll_to_check_row, &data);
|
||||
|
@ -166,4 +166,4 @@ sid_t SongList::current_id()
|
|||
g_list_free(selected);
|
||||
|
||||
return songid;
|
||||
}
|
||||
}*/
|
||||
|
|
Loading…
Reference in New Issue