blob: 653299c6d5829ea6ebaaf9fef9820dc8054da152 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/*!
* \file mg_selection.h
* \brief A general interface to data items, currently only GiantDisc
*
* \version $Revision: 1.0 $
* \date $Date: 2004-12-07 10:10:35 +0200 (Tue, 07 Dec 2004) $
* \author Wolfgang Rohdewald
* \author Responsible author: $Author: wr $
*
*/
#ifndef _MG_CONTENT_H
#define _MG_CONTENT_H
#include <stdlib.h>
#include <string>
#include <list>
#include <vector>
#include <map>
#include <mysql/mysql.h>
using namespace std;
#include "mg_tools.h"
#include "mg_valmap.h"
typedef vector<string> strvector;
class mgSelection;
class mgListItem
{
public:
mgListItem();
mgListItem(string v,string i,unsigned int c=0);
void set(string v,string i,unsigned int c=0);
void operator=(const mgListItem& from);
void operator=(const mgListItem* from);
bool operator==(const mgListItem& other) const;
string value() const { return m_value; }
string id() const { return m_id; }
unsigned int count() const { return m_count; }
bool valid() const { return m_valid; }
private:
bool m_valid;
string m_value;
string m_id;
unsigned int m_count;
};
//! \brief represents a content item like an mp3 file.
class mgContentItem
{
public:
mgContentItem ();
mgListItem* getKeyItem(mgKeyTypes kt);
//! \brief copy constructor
mgContentItem(const mgContentItem* c);
//! \brief construct an item from an SQL row
mgContentItem (const MYSQL_ROW row);
//! \brief returns track id
long getItemid () const
{
return m_trackid;
}
//! \brief returns title
string getTitle () const
{
return m_title;
}
//! \brief returns filename
string getSourceFile (bool AbsolutePath=true) const;
//! \brief returns artist
string getArtist () const
{
return m_artist;
}
//! \brief returns the name of the album
string getAlbum () const;
//! \brief returns the name of genre
string getGenre () const;
//! \brief returns the name of the language
string getLanguage () const;
//! \brief returns the bitrate
string getBitrate () const;
//! \brief returns the file name of the album image
string getImageFile () const;
//! \brief returns year
int getYear () const;
//! \brief returns rating
int getRating () const;
//! \brief returns duration
int getDuration () const;
//! \brief returns samplerate
int getSampleRate () const;
//! \brief returns # of channels
int getChannels () const;
bool Valid() const;
private:
mutable bool m_valid;
mutable bool m_validated;
long m_trackid;
string m_title;
mutable string m_mp3file;
string m_realfile;
string m_artist;
string m_albumtitle;
string m_genre1_id;
string m_genre2_id;
string m_genre1;
string m_genre2;
string m_bitrate;
string m_language_id;
string m_language;
int m_year;
int m_rating;
int m_duration;
int m_samplerate;
int m_channels;
bool readable(string filename) const;
};
extern mgListItem zeroitem;
#endif
|