aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_local/db.h
blob: 76b2eca068e00910a8522a02ae442fb0599a3464 (plain) (blame)
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
#ifndef NULLSOT_LOCALMEDIA_DB_H
#define NULLSOT_LOCALMEDIA_DB_H

#define MAINTABLE_ID_FILENAME		0
#define MAINTABLE_ID_TITLE			1
#define MAINTABLE_ID_ARTIST			2
#define MAINTABLE_ID_ALBUM			3
#define MAINTABLE_ID_YEAR			4
#define MAINTABLE_ID_GENRE			5
#define MAINTABLE_ID_COMMENT			6
#define MAINTABLE_ID_TRACKNB			7
#define MAINTABLE_ID_LENGTH			8  //in seconds
#define MAINTABLE_ID_TYPE			9 //0=audio, 1=video
#define MAINTABLE_ID_LASTUPDTIME		10 // last time (seconds since 1970) of db update of this item
#define MAINTABLE_ID_LASTPLAY		11 // last time (seconds since 1970) of last play
#define MAINTABLE_ID_RATING			12
#define MAINTABLE_ID_GRACENOTE_ID	14
#define MAINTABLE_ID_PLAYCOUNT		15 // play count
#define MAINTABLE_ID_FILETIME		16 // file time
#define MAINTABLE_ID_FILESIZE		17 // file size, kilobytes
#define MAINTABLE_ID_BITRATE			18 // file bitratea, kbps

#include "../nde/nde.h"
#include <map>
#include <string>

// DataBase manipulations
class DB
{
// construcotrs
public: 
	DB();
	~DB();

// methods
public:
	int Open();
	int Close();
	int Nuke();
	int AddColumn(char* metaKey, int type); // returns index of the new column or -1 on error
private:
	BOOL Discover(void);
	void ClearMap(void);


// properties
public:
	void SetTableDir(const char* tableDir);
	const char* GetTableDir();
	int GetColumnsCount();
	int GetColumnId(char *metaKey); // returns index of the column or -1 if can't find

// fields
private:
	char * tableDir;
	Database db;
	Table	*table;
	Scanner *sc;

	std::map< std::string, int> columnsMap; 

};

#endif //NULLSOT_LOCALMEDIA_DB_H