112 lines
1.9 KiB
C++
112 lines
1.9 KiB
C++
#ifndef LIBSARIA_TRACK_H
|
|
#define LIBSARIA_TRACK_H
|
|
|
|
#include <playlist.h>
|
|
|
|
#include <set>
|
|
#include <list>
|
|
#include <string>
|
|
using namespace std;
|
|
|
|
enum track_sprop_t {
|
|
TRACK_FILEPATH,
|
|
TRACK_TITLE,
|
|
TRACK_ARTIST,
|
|
TRACK_ALBUM,
|
|
TRACK_COMMENT,
|
|
TRACK_GENRE,
|
|
TRACK_LENSTR,
|
|
};
|
|
|
|
enum track_uiprop_t {
|
|
TRACK_ID,
|
|
TRACK_LIBID,
|
|
TRACK_YEAR,
|
|
TRACK_TRACK,
|
|
TRACK_COUNT,
|
|
TRACK_LAST_DAY,
|
|
TRACK_LAST_MONTH,
|
|
TRACK_LAST_YEAR,
|
|
};
|
|
|
|
enum track_iprop_t {
|
|
TRACK_LENGTH,
|
|
TRACK_BITRATE,
|
|
TRACK_SAMPLE,
|
|
TRACK_CHANNELS,
|
|
};
|
|
|
|
enum track_bprop_t {
|
|
TRACK_BANNED,
|
|
};
|
|
|
|
namespace libsaria
|
|
{
|
|
namespace library
|
|
{
|
|
class Path;
|
|
}
|
|
|
|
class Track
|
|
{
|
|
private:
|
|
library::Path *path;
|
|
list<libsaria::Playlist *> playlists;
|
|
set<string> substrs;
|
|
|
|
string filepath;
|
|
string title;
|
|
string artist;
|
|
string album;
|
|
string comment;
|
|
string genre;
|
|
string lenstr;
|
|
unsigned int id;
|
|
unsigned int year;
|
|
unsigned int track;
|
|
unsigned int count;
|
|
unsigned int last_day;
|
|
unsigned int last_month;
|
|
unsigned int last_year;
|
|
int length;
|
|
int bitrate;
|
|
int sample;
|
|
int channels;
|
|
bool banned;
|
|
|
|
string *artist_lc;
|
|
string *album_lc;
|
|
void read_tags();
|
|
void mark_played();
|
|
void find_substrs();
|
|
|
|
public:
|
|
Track();
|
|
Track(string);
|
|
Track(string, library::Path *);
|
|
Track(ifstream &, library::Path *, unsigned int);
|
|
~Track();
|
|
|
|
void save(ofstream *);
|
|
void load_unlisted(bool);
|
|
void load(bool);
|
|
void add_playlist(libsaria::Playlist *);
|
|
void rm_playlist(libsaria::Playlist *);
|
|
bool is_visible(set<string> *);
|
|
|
|
string get_last_played();
|
|
|
|
void set_banned(bool);
|
|
|
|
bool operator<(Track &);
|
|
const string &operator[](track_sprop_t);
|
|
const unsigned int &operator[](track_uiprop_t);
|
|
const int &operator[](track_iprop_t);
|
|
const bool &operator[](track_bprop_t);
|
|
};
|
|
|
|
Track *current_track();
|
|
|
|
} /* Namespace: libsaria */
|
|
#endif /* LIBSARIA_TRACK_H */
|