1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #ifndef NULLSOFT_PLAYLIST_PLAYLISTS_H
- #define NULLSOFT_PLAYLIST_PLAYLISTS_H
- #include "api_playlists.h"
- #include <vector>
- #include "../nu/AutoLock.h"
- class PlaylistInfo
- {
- public:
- PlaylistInfo();
- PlaylistInfo(const wchar_t *_filename, const wchar_t *_title, GUID playlist_guid = INVALID_GUID);
- PlaylistInfo(const PlaylistInfo ©);
- wchar_t filename[MAX_PATH];
- wchar_t title[1024];
- int length;
- int numItems;
- GUID guid;
- uint64_t iTunesID;
- int cloud;
- };
- class Playlists : public api_playlists
- {
- public:
- Playlists();
- bool DelayLoad();
-
- void Lock();
- void Unlock();
- size_t GetIterator();
- int Sort(size_t sort_type);
- void Flush();
-
- size_t GetCount();
- const wchar_t *GetFilename(size_t index);
- const wchar_t *GetName(size_t index);
- GUID GetGUID(size_t index);
- int GetPosition(GUID playlist_guid, size_t *index);
- int GetInfo(size_t index, GUID info, void *data, size_t dataLen);
-
- int MoveBefore(size_t index1, size_t index2);
- size_t AddPlaylist(const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid = INVALID_GUID);
- size_t AddPlaylist_NoCallback(const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid = INVALID_GUID);
- size_t AddCloudPlaylist(const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid = INVALID_GUID);
- int SetGUID(size_t index, GUID playlist_guid);
- int RenamePlaylist(size_t index, const wchar_t *name);
- int MovePlaylist(size_t index, const wchar_t *filename);
- int SetInfo(size_t index, GUID info, void *data, size_t dataLen);
- int RemovePlaylist(size_t index);
- int ClearPlaylists();
- size_t AddPlaylist_internal(const wchar_t *filename, const wchar_t *playlistName, GUID playlist_guid, size_t numItems, size_t length, uint64_t iTunesID, size_t cloud);
-
-
- const PlaylistInfo &GetPlaylistInfo(size_t i);
- private:
- bool loaded;
- bool triedLoaded;
- bool dirty;
- size_t iterator;
- typedef std::vector<PlaylistInfo> PlaylistsList;
- PlaylistsList playlists;
- Nullsoft::Utility::LockGuard playlistsGuard;
- RECVS_DISPATCH;
- };
- #endif
|