~ubuntu-branches/ubuntu/saucy/clementine/saucy

« back to all changes in this revision

Viewing changes to src/library/librarybackend.h

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include <QObject>
22
22
#include <QSet>
 
23
#include <QUrl>
23
24
 
24
25
#include "directory.h"
25
26
#include "libraryquery.h"
32
33
namespace smart_playlists { class Search; }
33
34
 
34
35
class LibraryBackendInterface : public QObject {
35
 
 public:
 
36
  Q_OBJECT
 
37
 
 
38
public:
36
39
  LibraryBackendInterface(QObject* parent = 0) : QObject(parent) {}
37
40
  virtual ~LibraryBackendInterface() {}
38
41
 
40
43
    Album() {}
41
44
    Album(const QString& _artist, const QString& _album_name,
42
45
          const QString& _art_automatic, const QString& _art_manual,
43
 
          const QString& _first_filename)
 
46
          const QUrl& _first_url)
44
47
            : artist(_artist), album_name(_album_name),
45
48
              art_automatic(_art_automatic), art_manual(_art_manual),
46
 
              first_filename(_first_filename) {}
 
49
              first_url(_first_url) {}
47
50
 
48
51
    QString artist;
49
52
    QString album_name;
50
53
 
51
54
    QString art_automatic;
52
55
    QString art_manual;
53
 
    QString first_filename;
 
56
    QUrl first_url;
54
57
  };
55
58
  typedef QList<Album> AlbumList;
56
59
 
 
60
  virtual QString songs_table() const = 0;
 
61
 
57
62
  // Get a list of directories in the library.  Emits DirectoriesDiscovered.
58
63
  virtual void LoadDirectoriesAsync() = 0;
59
64
 
63
68
  virtual SongList FindSongsInDirectory(int id) = 0;
64
69
  virtual SubdirectoryList SubdirsInDirectory(int id) = 0;
65
70
  virtual DirectoryList GetAllDirectories() = 0;
66
 
  virtual void ChangeDirPath(int id, const QString& new_path) = 0;
 
71
  virtual void ChangeDirPath(int id, const QString& old_path, const QString& new_path) = 0;
67
72
 
68
73
  virtual QStringList GetAllArtists(const QueryOptions& opt = QueryOptions()) = 0;
69
74
  virtual QStringList GetAllArtistsWithAlbums(const QueryOptions& opt = QueryOptions()) = 0;
84
89
 
85
90
  // Returns all sections of a song with the given filename. If there's just one section
86
91
  // the resulting list will have it's size equal to 1.
87
 
  virtual SongList GetSongsByFilename(const QString& filename) = 0;
 
92
  virtual SongList GetSongsByUrl(const QUrl& url) = 0;
88
93
  // Returns a section of a song with the given filename and beginning. If the section
89
94
  // is not present in library, returns invalid song.
90
95
  // Using default beginning value is suitable when searching for single-section songs.
91
 
  virtual Song GetSongByFilename(const QString& filename, qint64 beginning = 0) = 0;
 
96
  virtual Song GetSongByUrl(const QUrl& url, qint64 beginning = 0) = 0;
92
97
 
93
98
  virtual void AddDirectory(const QString& path) = 0;
94
99
  virtual void RemoveDirectory(const Directory& dir) = 0;
120
125
  SongList FindSongsInDirectory(int id);
121
126
  SubdirectoryList SubdirsInDirectory(int id);
122
127
  DirectoryList GetAllDirectories();
123
 
  void ChangeDirPath(int id, const QString& new_path);
 
128
  void ChangeDirPath(int id, const QString& old_path, const QString& new_path);
124
129
 
125
130
  QStringList GetAll(const QString& column, const QueryOptions& opt = QueryOptions());
126
131
  QStringList GetAllArtists(const QueryOptions& opt = QueryOptions());
143
148
  SongList GetSongsByForeignId(const QStringList& ids, const QString& table,
144
149
                               const QString& column);
145
150
 
146
 
  SongList GetSongsByFilename(const QString& filename);
147
 
  Song GetSongByFilename(const QString& filename, qint64 beginning = 0);
 
151
  SongList GetSongsByUrl(const QUrl& url);
 
152
  Song GetSongByUrl(const QUrl& url, qint64 beginning = 0);
148
153
 
149
154
  void AddDirectory(const QString& path);
150
155
  void RemoveDirectory(const Directory& dir);
165
170
  void AddOrUpdateSongs(const SongList& songs);
166
171
  void UpdateMTimesOnly(const SongList& songs);
167
172
  void DeleteSongs(const SongList& songs);
 
173
  void MarkSongsUnavailable(const SongList& songs);
168
174
  void AddOrUpdateSubdirs(const SubdirectoryList& subdirs);
169
175
  void UpdateCompilations();
170
176
  void UpdateManualAlbumArt(const QString& artist, const QString& album, const QString& art);
171
 
  void ForceCompilation(const QString& artist, const QString& album, bool on);
 
177
  void ForceCompilation(const QString& album, const QList<QString>& artists, bool on);
172
178
  void IncrementPlayCount(int id);
173
179
  void IncrementSkipCount(int id, float progress);
174
180
  void ResetStatistics(int id);