-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslimimagecache2.h
69 lines (53 loc) · 1.82 KB
/
slimimagecache2.h
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
#ifndef SLIMIMAGECACHE_H
#define SLIMIMAGECACHE_H
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <QTimer>
#include <QTime>
#include <QUrl>
#include <QString>
#include <QStringList>
#include <QByteArray>
#include <QList>
#include <QHash>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QFile>
#include <QDir>
#include "squeezedefines.h"
class SlimImageCache : public QThread
{
Q_OBJECT
public:
explicit SlimImageCache(QObject *parent = 0);
~SlimImageCache();
void Init(QString serveraddr, qint16 httpport);
void Init(QString serveraddr, qint16 httpport, QString imageSize, QString cliuname, QString clipass);
// bool HaveListImages(SqueezePictureFlow *picflow, QList<Album> list);
void CheckImages(QList<Album> list);
QByteArray RetrieveCover(const Album &a);
void Stop(void);
signals:
void ImagesReady(void);
protected:
void run();
private:
QMutex mutex;
QWaitCondition condition;
bool isrunning;
void RequestArtwork(QByteArray cover_id, QString artist_album);
// SqueezePictureFlow *picflow; // reference to the object we are working for
QString SlimServerAddr; // server IP address
quint16 httpPort; // port to use for cli, usually 9090, but we allow the user to change this
QString cliUsername; // username for cli if needed
QString cliPassword; // password for cli if needed **NOTE: DANGER, DANGER this is done in clear text, so don't use a password you care about!!
QString imageSizeStr; // default to "200X200"
QString cachePath;
bool requestingImages;
QList<Album> albumList;
QNetworkAccessManager *imageServer;
QHash< QNetworkReply*,QString > httpReplyList; // associate image request to artist+album name
};
#endif // SLIMIMAGECACHE_H