-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlbumArt.h
More file actions
76 lines (69 loc) · 2.58 KB
/
AlbumArt.h
File metadata and controls
76 lines (69 loc) · 2.58 KB
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
#ifndef ALBUMART_H
#define ALBUMART_H
#include <windows.h>
#include <vector>
#include <map>
#include <string>
#include "lsapi.h"
// Case insensitive string comparison
struct stringicmp {
bool operator()(const std::string& s1, const std::string& s2) const {
return (lstrcmpi(s1.c_str(), s2.c_str()) < 0);
}
};
// (group) Variables
typedef struct GroupData {
char szPrefix[MAX_LINE_LENGTH];
// Paths
char szNoArtPath[MAX_PATH];
char szParsedPath[MAX_PATH];
char szDownloadPath[MAX_PATH];
char szOutOfBoundsPath[MAX_PATH];
// Other user set variables
std::vector<std::string> CoverNames;
std::vector<UCHAR> ParseTypes;
int iTrackOffset;
bool bNoCRC32;
bool bSearchFolderBeforeTag;
// Module maintained variables
bool bNoCRC32ForErrors; //
bool bIsOutOfBounds; //
ULONG crc; // The crc32 of the current cover art
bool bThreadIsRunning; // Whether or not this group has a downloader thread running
bool *threadbTerminate; // Pointer to the bTerminate variable in the currently running downloader thread (if there is one)
} GroupData;
typedef std::map<std::string, GroupData, stringicmp> GroupMap;
// Data passed between the downloader thread and the main thread
typedef struct DownLoadCoverData {
char szAlbum[MAX_LINE_LENGTH]; // Name of the album to locate covers for
char szPath[MAX_PATH]; // Where to save the cover when one is found
std::string szSearchPageContents; // Holds the data returned from albumart.org
GroupData *gData; // Pointer to a GroupData
UINT uMinWidth;
UINT uMinHeight;
UINT uMaxHeight;
UINT uMaxWidth;
unsigned threadID;
bool bTerminate;
bool bInitalized;
} DownLoadCoverData;
namespace AlbumArt
{
void UpdateInformation(bool bInitializing = false);
void LoadSettings (bool bIsRefresh = false);
void GetCover(GroupData *gData, LPCSTR pszTrackPath, LPSTR szCoverPath, UINT cchCoverLength);
bool GetCoverFromTag(GroupData *gData, LPCSTR pszTrackPath, LPSTR szCoverPath, UINT cchCoverLength);
bool GetCoverFromFolder(GroupData *gData, LPCSTR pszTrackPath, LPSTR szCoverPath, UINT cchCoverLength);
void SetPath(GroupData *gData, LPCSTR pszPath, bool bError = false);
void CreateGroup(LPCSTR pszPrefix);
void DestroyGroup(LPCSTR pszPrefix);
void HandleError(LPCSTR pszFormat, ...);
void DownloadCover(GroupData *gData, LPCSTR pszTrackPath);
GroupData* GetGroupByPrefix(LPCSTR pszPrefix);
}
namespace AlbumArt_Download_Thread
{
unsigned __stdcall DownloadCover_Thread(void *CoverData);
size_t DownloadCover_Thread_Reader(void *ptr, size_t size, size_t nmemb, void *CoverData);
}
#endif