summaryrefslogtreecommitdiff
path: root/muggle-plugin/mg_media.h
blob: f4cd64feec62677570c3c3fbd584b9a85f8d1db2 (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
/*******************************************************************/
/*! \file  mgmedia.h
 * \brief  Top level access to media in vdr plugin muggle
 * for the vdr muggle plugindatabase
 ******************************************************************** 
 * \version $Revision: 1.1 $
 * \date    $Date: 2004/02/01 18:22:53 $
 * \author  Ralf Klueber, Lars von Wedel, Andreas Kellner
 * \author  file owner: $Author: LarsAC $
 * 
 *
 */
/*******************************************************************/
/* makes sur we dont use parse the same declarations twice */
#ifndef _MG_MEDIA_H
#define _MG_MEDIA_H

#include <string>
#include <vector>

#include <mysql/mysql.h>

class mgPlaylist;
class mgTracklist;
class mgSelectionTreeNode;

/*! 
 *******************************************************************
 * \class mgFilters
 *
 * \brief stores a set of search constraints to the media database
 ********************************************************************/
class mgFilters 
{
    typedef enum filterType
    {
	NUMBER,         // integer number (with upper and lower limits)
	STRING,         // any string
	REGEXP_STRING,  // string containing wildcard symbol '*'
	CHOICE       // value fro ma list of choices
    }filterType;
	
 public:
    std::vector<std::string> fields;
    std::vector<std::string> values;

    mgFilters();
    ~mgFilters();

    int getNumFilters();
    std::string getName(int filter);
    int getValue(int filter);
    filterType getType(int filter);

    // for NUMBER filters
    int getMin(int filter);
    int getMax(int filter);

    // for CHOICE
    std::vector<std::string> getChoices();
    int getCurrent(int filter);

    // check, if a value is correct
    bool checkValue(int filter, std::string value);
    bool checkValue(int filter, int value);
    
    // finally set the values
    
    bool setValue(int filter, std::string value);
    bool setValue(int filter, int value);
};


/*! 
 *******************************************************************
 * \class mgMedia
 *
 * \brief main class to access content in the vdr plugin muggle
 ********************************************************************/
class mgMedia
{
 
 public: 
  typedef enum contentType{
    DUMMY =0,
    GD_MP3
  } contentType;

 private:
    MYSQL m_db;
    contentType m_mediatype;
    std::string m_filter;
    int m_defaultView;

 public:
   mgMedia(contentType mediatype);
   ~mgMedia();
  
  std::string getMediaTypeName();

  mgSelectionTreeNode* getSelectionRoot();

  mgFilters getActiveFilters();

  void setFilters(mgFilters filters);
  void setFilters(std::string sql)
    {
      m_filter=sql;
    }

  // playlist management
  mgPlaylist* createTemporaryPlaylist();
  mgPlaylist* loadPlaylist( std::string name );
  std::vector<std::string> getStoredPlaylists();

  std::vector<int> getDefaultCols();
  mgTracklist* getTracks();
};
#endif  /* END  _CONTENT_INTERFACE_H */