49
* Construct a query command in m_request to search on the server.
47
* Send a query command in to search on the server.
51
49
* @param cfg import source configuration
52
50
* @param artist artist to search
53
51
* @param album album to search
54
* @param dest the server to connect to is returned here
55
* @param destPort the port of the server is returned here
57
void FreedbClient::constructFindQuery(
53
void FreedbClient::sendFindQuery(
58
54
const ImportSourceConfig*,
59
const QString& artist, const QString& album,
60
QString& dest, int& destPort)
55
const QString& artist, const QString& album)
62
57
// At the moment, only www.gnudb.org has a working search
63
58
// so we always use this server for find queries.
64
QString server(gnudbServer);
65
QString what = artist + " " + album;
66
QString destNamePort(getProxyOrDest(server));
67
splitNamePort(destNamePort, dest, destPort);
70
splitNamePort(server, serverName, serverPort);
71
what.replace(QRegExp(" +"), " "); // collapse spaces
72
QCM_QUrl_encode(what);
73
what.replace("%20", "+"); // replace spaces by '+'
75
if (dest != serverName) {
76
m_request += "http://";
77
m_request += serverName;
78
if (serverPort != 80) {
80
m_request += QString::number(serverPort);
83
m_request += "/search/";
85
m_request += " HTTP/1.0\r\nUser-Agent: Kid3/" VERSION "\r\nHost: ";
86
m_request += serverName;
87
m_request += "\r\nConnection: close\r\n\r\n";
59
sendRequest(gnudbServer, QString("/search/") +
60
encodeUrlQuery(artist + " " + album));
91
* Construct a query command in m_request to fetch the track list
64
* Send a query command to fetch the track list
94
67
* @param cfg import source configuration
95
68
* @param cat category
97
* @param dest the server to connect to is returned here
98
* @param destPort the port of the server is returned here
100
void FreedbClient::constructTrackListQuery(
101
const ImportSourceConfig* cfg, const QString& cat, const QString& id,
102
QString& dest, int& destPort)
71
void FreedbClient::sendTrackListQuery(
72
const ImportSourceConfig* cfg, const QString& cat, const QString& id)
104
QString destNamePort(getProxyOrDest(cfg->m_server));
105
splitNamePort(destNamePort, dest, destPort);
108
splitNamePort(cfg->m_server, serverName, serverPort);
110
if (dest != serverName) {
111
m_request += "http://";
112
m_request += serverName;
113
if (serverPort != 80) {
115
m_request += QString::number(serverPort);
118
m_request += cfg->m_cgiPath;
119
m_request += "?cmd=cddb+read+";
123
m_request += "&hello=noname+localhost+";
124
m_request += "Kid3+" VERSION "&proto=1 HTTP/1.1\r\nHost: ";
125
m_request += serverName;
126
m_request += "\r\nConnection: close\r\n\r\n";
74
sendRequest(cfg->m_server,
75
cfg->m_cgiPath + "?cmd=cddb+read+" + cat + "+" + id +
76
"&hello=noname+localhost+Kid3+" VERSION "&proto=6");