author | cgandhi |
Thu, 23 Sep 2010 17:15:03 +0530 | |
changeset 23 | 574948b60dab |
child 26 | 83d6a149c755 |
permissions | -rw-r--r-- |
23
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
1 |
/* |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
2 |
* lastfmmusiceventplugin.cpp |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
3 |
* |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
4 |
* Created on: Jun 21, 2010 |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
5 |
* Author: ankitg |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
6 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
7 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
8 |
//Include files |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
9 |
#include <QtPlugin> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
10 |
#include <QCryptographicHash> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
11 |
#include <QDataStream> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
12 |
#include <QTextStream> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
13 |
#include <QFile> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
14 |
#include <QNetworkReply> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
15 |
#include <QMap> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
16 |
#include <QListIterator> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
17 |
#include <QXmlStreamReader> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
18 |
#include <SmfPicture.h> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
19 |
#include <QSettings> |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
20 |
#include "lastfmmusiceventplugin.h" |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
21 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
22 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
23 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
24 |
//Added for testing - start |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
25 |
//static const QString apiKey = "8823ece35e487bada68fa893d7ecf91e"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
26 |
//static const QString apiKey = "50ac6d6581c3784efe40748fe87d8413"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
27 |
//static const QString apiSecret = "20ccb1cc62aa50caf7d8aae31808d429"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
28 |
//static const QString apiSecret = "623f4274bcea772fd6f411cf298b6bfa"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
29 |
//static const QString miniToken = "773193698 "; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
30 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
31 |
//static const QString apiKey = "eb3a2d8361718782ebf3887f2bb8775b"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
32 |
//static const QString apiSecret = "7a390c4c1ec4fef41cef4d77354b30f8"; // created on 12th Aug |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
33 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
34 |
static const QString apiKey = "50ac6d6581c3784efe40748fe87d8413"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
35 |
static const QString apiSecret = "623f4274bcea772fd6f411cf298b6bfa"; // created on 23th Aug |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
36 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
37 |
//QString fullToken = "72157624000326005-e6cba1c7665a778e"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
38 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
39 |
//Payload data array |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
40 |
QByteArray payload; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
41 |
QString uids; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
42 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
43 |
* Method called by plugins for logging |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
44 |
* @param log string to be logged |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
45 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
46 |
void MusicEventPlugin::writeLog(QString log) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
47 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
48 |
QFile file("c:\\data\\PluginLogs.txt"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
49 |
if (!file.open(QIODevice::Append | QIODevice::Text)) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
50 |
; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
51 |
QTextStream out(&file); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
52 |
out << log << "\n"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
53 |
file.close(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
54 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
55 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
56 |
* Method to interpret the key sets obtained from credential manager |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
57 |
* @param aApiKey [out] The api key |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
58 |
* @param aApiSecret [out] The api secret |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
59 |
* @param aSessionKey [out] The session key |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
60 |
* @param aSessionSecret [out] The session secret |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
61 |
* @param aAppId [out] The application ID |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
62 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
63 |
void MusicEventPlugin::fetchKeys( QString &aApiKey, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
64 |
QString &aApiSecret, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
65 |
QString &aSessionKey, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
66 |
QString &aSessionSecret ) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
67 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
68 |
writeLog("Inside MusicEventPlugin::fetchKeys()"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
69 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
70 |
writeLog("Reg Token = "+m_provider->m_smfRegToken); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
71 |
writeLog("Expiry Date as int = "+m_provider->m_validity.toTime_t()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
72 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
73 |
SmfAuthParams keys; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
74 |
SmfPluginUtil util; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
75 |
util.getAuthKeys(keys, m_provider->m_smfRegToken, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
76 |
m_provider->m_validity, m_provider->m_pluginId); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
77 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
78 |
writeLog("Number of key-value pairs = "+keys.count()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
79 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
80 |
QByteArray keyName; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
81 |
keyName.append("ApiKey"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
82 |
aApiKey.append(keys.value(keyName)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
83 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
84 |
keyName.clear(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
85 |
keyName.append("ApiSecret"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
86 |
aApiSecret.append(keys.value(keyName)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
87 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
88 |
keyName.clear(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
89 |
keyName.append("SessionKey"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
90 |
aSessionKey.append(keys.value(keyName)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
91 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
92 |
keyName.clear(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
93 |
keyName.append("SessionSecret"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
94 |
aSessionSecret.append(keys.value(keyName)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
95 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
96 |
writeLog("Api Key = "+aApiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
97 |
writeLog("Api Secret = "+aApiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
98 |
writeLog("session Key = "+aSessionKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
99 |
writeLog("session Secret = "+aSessionSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
100 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
101 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
102 |
* Destructor |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
103 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
104 |
MusicEventPlugin::~MusicEventPlugin() |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
105 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
106 |
if(m_provider) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
107 |
delete m_provider; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
108 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
109 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
110 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
111 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
112 |
* Method called by plugins to generate a signature string from a base string |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
113 |
* @param aBaseString The base string |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
114 |
* @return The md5 hash of the base string |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
115 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
116 |
QString MusicEventPlugin::generateSignature(const QString aBaseString) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
117 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
118 |
writeLog("MusicEventPlugin::generateSignature"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
119 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
120 |
// Create md5 hash of the signature string |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
121 |
QByteArray byteArray; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
122 |
byteArray.insert(0, aBaseString.toAscii()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
123 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
124 |
QByteArray md5Hash = QCryptographicHash::hash(byteArray,QCryptographicHash::Md5 ).toHex(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
125 |
QString returnString (md5Hash); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
126 |
return returnString; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
127 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
128 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
129 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
130 |
* Method to get the events based on location |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
131 |
* @param aRequest [out] The request data to be sent to network |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
132 |
* @param aLocation Location of the event |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
133 |
* @param aPageNum The page to be extracted |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
134 |
* @param aItemsPerPage Number of items per page |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
135 |
* @return SmfPluginError Plugin error if any, else SmfPluginErrNone |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
136 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
137 |
/*SmfPluginError MusicEventPlugin::events( SmfPluginRequestData &aRequest, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
138 |
const QGeoPositionInfo &aLocation,const int aPageNum, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
139 |
const int aItemsPerPage) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
140 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
141 |
Q_UNUSED(aItemsPerPage); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
142 |
SmfPluginError error = SmfPluginErrUserNotLoggedIn; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
143 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
144 |
writeLog("MusicEventPlugin::events()"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
145 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
146 |
QString baseString; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
147 |
baseString.append(apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
148 |
baseString.append("api_key"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
149 |
baseString.append("auth_token"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
150 |
baseString.append("formatjson"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
151 |
baseString.append("location=Delhi"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
152 |
baseString.append("method=geo.getEvents"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
153 |
writeLog("Url string is :"+baseString); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
154 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
155 |
// Create the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
156 |
QUrl url("http://ws.audioscrobbler.com/2.0/?"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
157 |
url.addQueryItem("method", "geo.getevents"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
158 |
url.addQueryItem("location","madrid"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
159 |
url.addQueryItem("api_key", apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
160 |
url.addQueryItem("format","json"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
161 |
url.addQueryItem("auth_token",""); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
162 |
url.addQueryItem("api_sig", generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
163 |
writeLog("/n/n"+generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
164 |
writeLog("/n/n Response is :"+url.toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
165 |
// Create the request, set the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
166 |
aRequest.iNetworkRequest.setUrl(url); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
167 |
aRequest.iRequestType = SmfMusicGetEventsOnLoc; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
168 |
aRequest.iPostData = NULL; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
169 |
aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
170 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
171 |
return error; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
172 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
173 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
174 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
175 |
* Method to get the venues based on location |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
176 |
* @param aRequest [out] The request data to be sent to network |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
177 |
* @param aLocation Location of the venue |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
178 |
* @param aPageNum The page to be extracted |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
179 |
* @param aItemsPerPage Number of items per page |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
180 |
* @return SmfPluginError Plugin error if any, else SmfPluginErrNone |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
181 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
182 |
SmfPluginError MusicEventPlugin::venues( SmfPluginRequestData &aRequest, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
183 |
const SmfLocation &aLocation,const int aPageNum, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
184 |
const int aItemsPerPage) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
185 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
186 |
Q_UNUSED(aItemsPerPage); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
187 |
Q_UNUSED(aPageNum); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
188 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
189 |
SmfPluginError error = SmfPluginErrUserNotLoggedIn; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
190 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
191 |
// Get the key sets from SMF Plugin Utility class. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
192 |
QString apiKey; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
193 |
QString apiSecret; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
194 |
QString sessionKey; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
195 |
QString sessionSecret; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
196 |
fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
197 |
writeLog("API KEY"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
198 |
writeLog("API SECRET"+apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
199 |
writeLog("SessionKey"+sessionKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
200 |
writeLog("sessionSecret"+sessionSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
201 |
writeLog("MusicEventPlugin::Venues()"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
202 |
//QString qName("New York"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
203 |
//aLocation.setCity(qName); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
204 |
//QString qLocation = aLocation.city(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
205 |
//640418 |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
206 |
//QString qLocation("New York"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
207 |
/* QString baseString; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
208 |
baseString.append(apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
209 |
baseString.append("api_key"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
210 |
baseString.append("auth_token"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
211 |
baseString.append("formatjson"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
212 |
baseString.append("location ="+aLocation.city()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
213 |
baseString.append("method=geo.getEvents"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
214 |
writeLog("Url string is :"+baseString); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
215 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
216 |
//Create the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
217 |
QUrl url("http://ws.audioscrobbler.com/2.0/?"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
218 |
url.addQueryItem("method", "geo.getevents"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
219 |
url.addQueryItem("location",aLocation.city()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
220 |
url.addQueryItem("api_key", apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
221 |
url.addQueryItem("api_key", apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
222 |
url.addQueryItem("format","json"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
223 |
url.addQueryItem("auth_token",""); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
224 |
url.addQueryItem("api_sig", generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
225 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
226 |
writeLog("/n/n"+generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
227 |
writeLog("/n/n Response is :"+url.toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
228 |
//Create the request, set the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
229 |
aRequest.iNetworkRequest.setUrl(url); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
230 |
aRequest.iRequestType = SmfEventsGetVenues; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
231 |
aRequest.iPostData = NULL; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
232 |
aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
233 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
234 |
return error; */ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
235 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
236 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
237 |
QString baseString; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
238 |
baseString.append(apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
239 |
baseString.append("api_key"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
240 |
baseString.append("auth_token"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
241 |
baseString.append("formatjson"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
242 |
baseString.append("location=Newyork"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
243 |
baseString.append("method=geo.getEvents"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
244 |
writeLog("Url string is :"+baseString); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
245 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
246 |
// Create the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
247 |
QUrl url("http://ws.audioscrobbler.com/2.0/?"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
248 |
url.addQueryItem("method", "geo.getevents"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
249 |
url.addQueryItem("location","Newyork"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
250 |
url.addQueryItem("api_key", apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
251 |
url.addQueryItem("format","json"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
252 |
url.addQueryItem("auth_token",""); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
253 |
url.addQueryItem("api_sig", generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
254 |
writeLog("/n/n"+generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
255 |
writeLog("/n/n Response is :"+url.toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
256 |
// Create the request, set the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
257 |
aRequest.iNetworkRequest.setUrl(url); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
258 |
aRequest.iRequestType = SmfEventsGetEvents; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
259 |
aRequest.iPostData = NULL; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
260 |
aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
261 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
262 |
return error; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
263 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
264 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
265 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
266 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
267 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
268 |
* Method to get the events based on venues |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
269 |
* @param aRequest [out] The request data to be sent to network |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
270 |
* @param aVenue Venue of the event |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
271 |
* @param aPageNum The page to be extracted |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
272 |
* @param aItemsPerPage Number of items per page |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
273 |
* @return SmfPluginError Plugin error if any, else SmfPluginErrNone |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
274 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
275 |
SmfPluginError MusicEventPlugin::events( SmfPluginRequestData &aRequest, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
276 |
const SmfLocation &aVenue,const int aPageNum, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
277 |
const int aItemsPerPage) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
278 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
279 |
Q_UNUSED(aItemsPerPage); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
280 |
Q_UNUSED(aPageNum); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
281 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
282 |
SmfPluginError error = SmfPluginErrUserNotLoggedIn; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
283 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
284 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
285 |
// Get the key sets from SMF Plugin Utility class. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
286 |
QString apiKey; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
287 |
QString apiSecret; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
288 |
QString sessionKey; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
289 |
QString sessionSecret; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
290 |
fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
291 |
writeLog("API KEY"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
292 |
writeLog("API SECRET"+apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
293 |
writeLog("SessionKey"+sessionKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
294 |
writeLog("sessionSecret"+sessionSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
295 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
296 |
QString baseString; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
297 |
baseString.append(apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
298 |
baseString.append("api_key"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
299 |
baseString.append("auth_token"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
300 |
baseString.append("formatjson"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
301 |
baseString.append("location="+aVenue.city()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
302 |
baseString.append("method=geo.getEvents"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
303 |
writeLog("Url string is :"+baseString); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
304 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
305 |
// Create the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
306 |
QUrl url("http://ws.audioscrobbler.com/2.0/?"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
307 |
url.addQueryItem("method", "geo.getevents"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
308 |
url.addQueryItem("location",aVenue.city()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
309 |
url.addQueryItem("api_key", apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
310 |
url.addQueryItem("format","json"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
311 |
url.addQueryItem("auth_token",""); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
312 |
url.addQueryItem("api_sig", generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
313 |
writeLog("/n/n"+generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
314 |
writeLog("/n/n Response is :"+url.toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
315 |
//Create the request, set the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
316 |
aRequest.iNetworkRequest.setUrl(url); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
317 |
aRequest.iRequestType = SmfEventsGetEvents; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
318 |
aRequest.iPostData = NULL; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
319 |
aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
320 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
321 |
return error; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
322 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
323 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
324 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
325 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
326 |
* Method to post events |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
327 |
* @param aRequest [out] The request data to be sent to network |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
328 |
* @param aEventList The list of events to be posted |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
329 |
* @return SmfPluginError Plugin error if any, else SmfPluginErrNone |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
330 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
331 |
SmfPluginError MusicEventPlugin::postEvents( SmfPluginRequestData &aRequest, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
332 |
const QList<SmfEvent> &aEventList ) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
333 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
334 |
Q_UNUSED(aEventList) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
335 |
SmfPluginError error = SmfPluginErrUserNotLoggedIn; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
336 |
writeLog("MusicEventPlugin::events()"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
337 |
int count =aEventList.count(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
338 |
for(int i=0;i<count;i++) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
339 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
340 |
SmfEvent ievent=aEventList[i]; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
341 |
writeLog("Event List"+ievent.id()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
342 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
343 |
// Get the key sets from SMF Plugin Utility class. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
344 |
QString apiKey; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
345 |
QString apiSecret; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
346 |
QString sessionKey; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
347 |
QString sessionSecret; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
348 |
fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
349 |
writeLog("API KEY"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
350 |
writeLog("API SECRET"+apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
351 |
writeLog("SessionKey"+sessionKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
352 |
writeLog("sessionSecret"+sessionSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
353 |
/* QString baseString; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
354 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
355 |
baseString.append(apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
356 |
baseString.append("api_key"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
357 |
baseString.append("auth_token"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
358 |
baseString.append("formatjson"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
359 |
// baseString.append("method=event.shout"); // needs authentication |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
360 |
// baseString.append("Event"+"aEventList.at(0)"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
361 |
writeLog("Url string is :"+baseString); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
362 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
363 |
//Create the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
364 |
QUrl url("http://ws.audioscrobbler.com/2.0/?"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
365 |
url.addQueryItem("method", "event.shout"); // needs authentication |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
366 |
url.addQueryItem("api_key", apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
367 |
url.addQueryItem("format","json"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
368 |
// url.addQueryItem("Event","aEventList.at(0)"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
369 |
url.addQueryItem("auth_token",""); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
370 |
url.addQueryItem("api_sig", generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
371 |
writeLog("/n/n Response is :"+url.toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
372 |
// Create the request, set the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
373 |
aRequest.iNetworkRequest.setUrl(url); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
374 |
aRequest.iRequestType = SmfEventsPostEvents; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
375 |
aRequest.iPostData = NULL; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
376 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
377 |
aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
378 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
379 |
return error; */ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
380 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
381 |
//For Testing Only |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
382 |
QString baseString; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
383 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
384 |
//QString strId("328799"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
385 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
386 |
QString eventId("328799");//= aEvent.id(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
387 |
//QString eventId; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
388 |
//eventId = aEvent.id(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
389 |
baseString.append(apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
390 |
baseString.append("api_key"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
391 |
//baseString.append("auth_token"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
392 |
baseString.append("formatjson"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
393 |
baseString.append("method=event.getattendees"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
394 |
baseString.append("event"+eventId); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
395 |
writeLog("Url string is :"+baseString); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
396 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
397 |
//Create the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
398 |
QUrl url("http://ws.audioscrobbler.com/2.0/?"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
399 |
url.addQueryItem("method", "event.getattendees"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
400 |
url.addQueryItem("event",eventId); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
401 |
url.addQueryItem("api_key", apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
402 |
url.addQueryItem("format","json"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
403 |
//url.addQueryItem("auth_token",""); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
404 |
//url.addQueryItem("api_sig", generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
405 |
writeLog("/n/n Response is :"+url.toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
406 |
//Create the request, set the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
407 |
aRequest.iNetworkRequest.setUrl(url); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
408 |
aRequest.iRequestType = SmfEventsPostEvents; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
409 |
aRequest.iPostData = NULL; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
410 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
411 |
aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
412 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
413 |
return error; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
414 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
415 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
416 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
417 |
* Customised method for SmfMusicEventsPlugin interface |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
418 |
* @param aRequest [out] The request data to be sent to network |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
419 |
* @param aOperation The operation type (should be known between |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
420 |
* the client interface and the plugin) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
421 |
* @param aData The data required to form the request (The type |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
422 |
* of data should be known between client and the plugin) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
423 |
* @return SmfPluginError Plugin error if any, else SmfPluginErrNone |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
424 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
425 |
SmfPluginError MusicEventPlugin::attendees( SmfPluginRequestData &aRequest, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
426 |
const SmfEvent &aEvent, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
427 |
const int aPageNum , |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
428 |
const int aItemsPerPage ) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
429 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
430 |
Q_UNUSED(aItemsPerPage); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
431 |
SmfPluginError error = SmfPluginErrUserNotLoggedIn; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
432 |
writeLog("MusicEventPlugin::events()"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
433 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
434 |
// Get the key sets from SMF Plugin Utility class. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
435 |
QString apiKey; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
436 |
QString apiSecret; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
437 |
QString sessionKey; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
438 |
QString sessionSecret; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
439 |
fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
440 |
writeLog("API KEY"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
441 |
writeLog("API SECRET"+apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
442 |
writeLog("SessionKey"+sessionKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
443 |
writeLog("sessionSecret"+sessionSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
444 |
QString baseString; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
445 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
446 |
//QString strId("328799"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
447 |
//aEvent.setId(strId); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
448 |
//QString eventId = aEvent.id(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
449 |
QString eventId; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
450 |
eventId = aEvent.id(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
451 |
baseString.append(apiSecret); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
452 |
baseString.append("api_key"+apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
453 |
//baseString.append("auth_token"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
454 |
baseString.append("formatjson"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
455 |
baseString.append("method=event.getattendees"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
456 |
baseString.append("event"+eventId); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
457 |
writeLog("Url string is :"+baseString); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
458 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
459 |
//Create the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
460 |
QUrl url("http://ws.audioscrobbler.com/2.0/?"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
461 |
url.addQueryItem("method", "event.getattendees"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
462 |
url.addQueryItem("event",eventId); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
463 |
url.addQueryItem("api_key", apiKey); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
464 |
url.addQueryItem("format","json"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
465 |
// url.addQueryItem("auth_token",""); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
466 |
// url.addQueryItem("api_sig", generateSignature(baseString)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
467 |
writeLog("/n/n Response is :"+url.toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
468 |
//Create the request, set the url |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
469 |
aRequest.iNetworkRequest.setUrl(url); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
470 |
aRequest.iRequestType = SmfEventsGetEventAttendees; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
471 |
aRequest.iPostData = NULL; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
472 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
473 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
474 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
475 |
aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
476 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
477 |
return error; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
478 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
479 |
SmfPluginError MusicEventPlugin::customRequest( SmfPluginRequestData &aRequest, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
480 |
const int &aOperation, QByteArray *aData ) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
481 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
482 |
Q_UNUSED(aRequest) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
483 |
Q_UNUSED(aOperation) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
484 |
Q_UNUSED(aData) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
485 |
//SmfEventsCustomRequest |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
486 |
return SmfPluginErrServiceNotSupported; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
487 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
488 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
489 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
490 |
* The first method to be called in the plugin that implements this interface. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
491 |
* If this method is not called, plugin may not behave as expected. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
492 |
* Plugins are expected to save the aUtil handle and use and when required. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
493 |
* @param aUtil The instance of SmfPluginUtil |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
494 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
495 |
void MusicEventPlugin::initialize(/* SmfPluginUtil *aUtil */) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
496 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
497 |
// Save the SmfPluginUtil handle |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
498 |
//m_util = aUtil; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
499 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
500 |
// Create an instance of MusicProviderBase |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
501 |
m_provider = new MusicProviderBase; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
502 |
m_provider->initialize(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
503 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
504 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
505 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
506 |
* Method to get the provider information |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
507 |
* @return Instance of SmfProviderBase |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
508 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
509 |
SmfProviderBase* MusicEventPlugin::getProviderInfo( ) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
510 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
511 |
return m_provider; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
512 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
513 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
514 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
515 |
* Method to get the result for a network request. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
516 |
* @param aOperation The type of operation to be requested |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
517 |
* @param aTransportResult The result of transport operation |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
518 |
* @param aResponse The QByteArray instance containing the network response. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
519 |
* The plugins should delete this instance once they have read the |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
520 |
* data from it. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
521 |
* @param aResult [out] An output parameter to the plugin manager.If the |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
522 |
* return value is SmfSendRequestAgain, QVariant will be of type |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
523 |
* SmfPluginRequestData. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
524 |
* For SmfGalleryPlugin: If last operation was pictures(), aResult will |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
525 |
* be of type QList<SmfPicture>. If last operation was description(), |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
526 |
* aResult will be of type QString. If last operation was upload() or |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
527 |
* postComment(), aResult will be of type bool. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
528 |
* @param aRetType [out] SmfPluginRetType |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
529 |
* @param aPageResult [out] The SmfResultPage structure variable |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
530 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
531 |
SmfPluginError MusicEventPlugin::responseAvailable( |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
532 |
const SmfRequestTypeID aOperation, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
533 |
const SmfTransportResult &aTransportResult, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
534 |
QByteArray *aResponse, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
535 |
QVariant* aResult, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
536 |
SmfPluginRetType &aRetType, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
537 |
SmfResultPage &aPageResult ) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
538 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
539 |
writeLog("MusicEventPlugin::responseAvailable"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
540 |
Q_UNUSED(aPageResult) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
541 |
SmfPluginError error = SmfPluginErrNetworkError; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
542 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
543 |
if( !aResponse || (0 == aResponse->size()) ) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
544 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
545 |
writeLog("Response is NULL or empty"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
546 |
aRetType = SmfRequestError; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
547 |
return error; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
548 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
549 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
550 |
QByteArray response(*aResponse); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
551 |
delete aResponse; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
552 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
553 |
//Write the response to a file |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
554 |
QFile file("c:\\data\\musiceventresponse.txt"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
555 |
writeLog("response data written to c:\\data\\musiceventresponse.txt"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
556 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
557 |
if (!file.open(QIODevice::Append | QIODevice::Text)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
558 |
file.write(response); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
559 |
file.close(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
560 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
561 |
writeLog("MusicEvent response = "+QString(response)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
562 |
writeLog("MusicEvent response size = "+QString::number(response.size(), 10)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
563 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
564 |
if(SmfTransportOpNoError == aTransportResult) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
565 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
566 |
writeLog("No transport error"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
567 |
// QVariantMap map1; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
568 |
// bool resType=response.startsWith("<?xml"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
569 |
/* if(resType) //XML REsponse |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
570 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
571 |
writeLog("Before XML Parser--"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
572 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
573 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
574 |
else //JSON RESPONSE |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
575 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
576 |
bool ok; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
577 |
writeLog("Before JSON Parser--"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
578 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
579 |
SmfPluginUtil util; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
580 |
QVariant result = util.parse(response, &ok); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
581 |
if (!ok) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
582 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
583 |
writeLog("An error occurred during json parsing"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
584 |
aRetType = SmfRequestError; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
585 |
return SmfPluginErrParsingFailed; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
586 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
587 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
588 |
//map1 = result.toMap();*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
589 |
//} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
590 |
if(SmfEventsGetEvents == aOperation /*|| SmfMusicGetEventsOnVenue == aOperation*/) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
591 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
592 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
593 |
QDateTime dt = QDateTime::currentDateTime(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
594 |
QList<SmfEvent> eventlist; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
595 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
596 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
597 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
598 |
//Tested By Hardcoding |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
599 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
600 |
SmfEvent event; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
601 |
event.setId("111111"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
602 |
event.setTitle("bangalore"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
603 |
event.setEventDateTime(dt); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
604 |
QStringList stringList; //for artist |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
605 |
stringList.append("sssss"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
606 |
stringList.append("aaaa"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
607 |
SmfArtists artists; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
608 |
artists.setNames(stringList); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
609 |
event.setArtists(artists); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
610 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
611 |
SmfLocation Location; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
612 |
Location.setCity("Bangalore"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
613 |
Location.setCountry("india"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
614 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
615 |
event.setVenue(Location); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
616 |
eventlist.append(event); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
617 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
618 |
//2nd Event |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
619 |
SmfEvent event1; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
620 |
event1.setId("2222"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
621 |
event1.setTitle("delhi"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
622 |
event1.setEventDateTime(dt); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
623 |
QStringList stringList1; //for artist |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
624 |
stringList1.append("ddddd"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
625 |
stringList1.append("rrrrrr"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
626 |
SmfArtists artists1; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
627 |
artists1.setNames(stringList1); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
628 |
event1.setArtists(artists1); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
629 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
630 |
SmfLocation Location1; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
631 |
Location1.setCity("Delhi"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
632 |
Location1.setCountry("india"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
633 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
634 |
event1.setVenue(Location1); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
635 |
eventlist.append(event1); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
636 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
637 |
writeLog("SmfEventsGetEvents = "); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
638 |
/*QVariantMap eventmap = map1["events"].toMap(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
639 |
QList<QVariant> list1 = eventmap["event"].toList(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
640 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
641 |
QListIterator<QVariant> iter(list1); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
642 |
writeLog("SmfEventsGetEvents123 = "); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
643 |
while(iter.hasNext()) //not runing for one event |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
644 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
645 |
SmfEvent event; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
646 |
QVariantMap map2 = iter.next().toMap(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
647 |
writeLog("id = "+map2["id"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
648 |
event.setId(map2["id"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
649 |
writeLog("title = "+map2["title"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
650 |
event.setTitle(map2["title"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
651 |
writeLog("EventDateTime= "+map2["startDate"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
652 |
event.setEventDateTime(map2["startDate"].toDateTime()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
653 |
// writeLog("SetdUration= "+map2["startDate"].toDateTime()); //didn't find that |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
654 |
//for Getting the Artist List |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
655 |
QVariantMap map4 = map2["artists"].toMap(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
656 |
QList<QVariant> artistList =map4["artist"].toList(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
657 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
658 |
writeLog("artist"+map4["artist"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
659 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
660 |
// writeLog("artists"+artistList["artist"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
661 |
// QList<QVariant> artistList =map2["artists"].toList(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
662 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
663 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
664 |
QListIterator<QVariant> iterartists(artistList); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
665 |
SmfArtists artists; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
666 |
QStringList stringList; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
667 |
while(iterartists.hasNext()) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
668 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
669 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
670 |
//QString artistName; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
671 |
QString artistName = iterartists.next().toString(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
672 |
writeLog("artist Name = "+ artistName); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
673 |
//artistName.append(map2["artist"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
674 |
stringList.append(artistName); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
675 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
676 |
}//end while |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
677 |
//writeLog("artists= "+stringList[0]); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
678 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
679 |
artists.setNames(stringList); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
680 |
event.setArtists(artists); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
681 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
682 |
//all Artist list we got |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
683 |
//For Venue |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
684 |
SmfLocation Location; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
685 |
QVariantMap map3 = map2["venue"].toMap(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
686 |
writeLog("LocationId : "+map3["id"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
687 |
Location.setId(map3["id"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
688 |
//for city |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
689 |
QVariantMap map6 = map3["location"].toMap(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
690 |
writeLog("Location city : "+map6["city"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
691 |
Location.setCity(map6["city"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
692 |
writeLog("Location city : "+map6["country"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
693 |
Location.setCountry(map6["country"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
694 |
// Location.geoPositionInfo() dont know how to set |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
695 |
event.setVenue(Location); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
696 |
eventlist.append(event); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
697 |
}//end While*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
698 |
aResult->setValue(eventlist); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
699 |
aRetType = SmfRequestComplete; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
700 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
701 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
702 |
else if(SmfEventsGetVenues == aOperation) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
703 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
704 |
writeLog("SmfEventsGetVenues = "); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
705 |
QList<SmfLocation> LocationList; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
706 |
SmfLocation Location; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
707 |
Location.setId("111111"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
708 |
//for city |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
709 |
Location.setCity("delhi"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
710 |
Location.setCountry("India"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
711 |
Location.setUrl(QUrl("http://wwwqqqqq/ee")); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
712 |
LocationList.append(Location); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
713 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
714 |
SmfLocation Location1; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
715 |
Location1.setId("22222"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
716 |
//for city |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
717 |
Location1.setCity("bangalore"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
718 |
Location1.setCountry("India"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
719 |
LocationList.append(Location1); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
720 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
721 |
aResult->setValue(LocationList); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
722 |
aRetType = SmfRequestComplete; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
723 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
724 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
725 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
726 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
727 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
728 |
else if (SmfEventsPostEvents == aOperation) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
729 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
730 |
writeLog("SmfEventsPostEvents = "); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
731 |
bool postEvent=true; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
732 |
aResult->setValue(postEvent); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
733 |
aRetType = SmfRequestComplete; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
734 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
735 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
736 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
737 |
else if (SmfEventsGetEventAttendees == aOperation) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
738 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
739 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
740 |
QList<SmfContact> contactList; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
741 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
742 |
writeLog("SmfMusicGetEventsAttendees = "); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
743 |
bool ok; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
744 |
writeLog("Before Parser--"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
745 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
746 |
SmfPluginUtil util; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
747 |
QVariantMap result = util.parse(response, &ok).toMap(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
748 |
if (!ok) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
749 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
750 |
writeLog("An error occurred during json parsing"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
751 |
aRetType = SmfRequestError; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
752 |
return SmfPluginErrParsingFailed; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
753 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
754 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
755 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
756 |
//QVariantMap map1 = result.toMap(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
757 |
writeLog("MAP1"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
758 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
759 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
760 |
QVariantMap map1 = result["attendees"].toMap(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
761 |
//QVariantMap map2 = map1["attendees"].toMap(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
762 |
writeLog("MAP2"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
763 |
//int page = map2["page"].toInt(&ok); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
764 |
QList<QVariant> list1 = map1["user"].toList(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
765 |
writeLog("list count"+QString::number(list1.count(),10)); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
766 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
767 |
QListIterator<QVariant> i(list1); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
768 |
writeLog("iterate list"); //While loop not work if there is only one attendee |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
769 |
while(i.hasNext()) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
770 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
771 |
writeLog("inside loop"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
772 |
SmfContact contact; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
773 |
QVariantMap map2 = i.next().toMap(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
774 |
writeLog("name= "+map2["name"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
775 |
writeLog("realname = "+map2["realname"].toString()); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
776 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
777 |
//Contact Name |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
778 |
QContactName contactname; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
779 |
QString username = map2["name"].toString(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
780 |
writeLog("name = "+username); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
781 |
contactname.setFirstName(username); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
782 |
contactname.setLastName(username); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
783 |
QVariant nameVar = QVariant::fromValue(contactname); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
784 |
contact.setValue("Name",nameVar); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
785 |
contactList.append(contact); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
786 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
787 |
aResult->setValue(contactList); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
788 |
aRetType = SmfRequestComplete; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
789 |
error = SmfPluginErrNone; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
790 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
791 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
792 |
else |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
793 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
794 |
writeLog("Service unsupported!!!"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
795 |
aRetType = SmfRequestError; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
796 |
error = SmfPluginErrServiceNotSupported; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
797 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
798 |
}//end if of if(SmfTransportOpNoError == aTransportResult) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
799 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
800 |
else if(SmfTransportOpOperationCanceledError == aTransportResult) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
801 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
802 |
writeLog("Operation Cancelled !!!"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
803 |
error = SmfPluginErrCancelComplete; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
804 |
aRetType = SmfRequestComplete; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
805 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
806 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
807 |
else |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
808 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
809 |
writeLog("Transport Error !!!"); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
810 |
error = SmfPluginErrNetworkError; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
811 |
aRetType = SmfRequestError; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
812 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
813 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
814 |
return error; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
815 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
816 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
817 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
818 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
819 |
* Destructor |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
820 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
821 |
MusicProviderBase::~MusicProviderBase( ) |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
822 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
823 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
824 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
825 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
826 |
* Method to get the Localisable name of the service. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
827 |
* @return The Localisable name of the service. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
828 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
829 |
QString MusicProviderBase::serviceName( ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
830 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
831 |
return m_serviceName; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
832 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
833 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
834 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
835 |
* Method to get the Logo of the service |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
836 |
* @return The Logo of the service |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
837 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
838 |
QImage MusicProviderBase::serviceIcon( ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
839 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
840 |
return m_serviceIcon; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
841 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
842 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
843 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
844 |
* Method to get the Readable service description |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
845 |
* @return The Readable service description |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
846 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
847 |
QString MusicProviderBase::description( ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
848 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
849 |
return m_description; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
850 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
851 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
852 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
853 |
* Method to get the Website of the service |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
854 |
* @return The Website of the service |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
855 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
856 |
QUrl MusicProviderBase::serviceUrl( ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
857 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
858 |
return m_serviceUrl; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
859 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
860 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
861 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
862 |
* Method to get the URL of the Application providing this service |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
863 |
* @return The URL of the Application providing this service |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
864 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
865 |
QUrl MusicProviderBase::applicationUrl( ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
866 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
867 |
return m_applicationUrl; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
868 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
869 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
870 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
871 |
* Method to get the Icon of the application |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
872 |
* @return The Icon of the application |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
873 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
874 |
QImage MusicProviderBase::applicationIcon( ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
875 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
876 |
return m_applicationIcon; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
877 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
878 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
879 |
* Method to get the list of interfaces that this provider support |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
880 |
* @return List of supported Interafces |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
881 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
882 |
QList<QString> MusicProviderBase::supportedInterfaces( ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
883 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
884 |
return m_serviceType; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
885 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
886 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
887 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
888 |
* Method to get the list of languages supported by this service provider |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
889 |
* @return a QStringList of languages supported by this service |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
890 |
* provider in 2 letter ISO 639-1 format. |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
891 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
892 |
QStringList MusicProviderBase::supportedLanguages( ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
893 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
894 |
return m_supportedLanguages; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
895 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
896 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
897 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
898 |
* Method to get the Plugin specific ID |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
899 |
* @return The Plugin specific ID |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
900 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
901 |
QString MusicProviderBase::pluginId( ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
902 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
903 |
return m_pluginId; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
904 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
905 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
906 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
907 |
* Method to get the ID of the authentication application |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
908 |
* for this service |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
909 |
* @param aProgram The authentication application name |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
910 |
* @param aArguments List of arguments required for authentication app |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
911 |
* @param aMode Strting mode for authentication application |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
912 |
* @return The ID of the authentication application |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
913 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
914 |
QString MusicProviderBase::authenticationApp( QString &aProgram, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
915 |
QStringList & aArguments, |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
916 |
QIODevice::OpenModeFlag aMode ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
917 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
918 |
return m_authAppId; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
919 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
920 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
921 |
/** |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
922 |
* Method to get the unique registration ID provided by the |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
923 |
* Smf for authorised plugins |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
924 |
* @return The unique registration ID/token provided by the Smf for |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
925 |
* authorised plugins |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
926 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
927 |
QString MusicProviderBase::smfRegistrationId( ) const |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
928 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
929 |
return m_smfRegToken; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
930 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
931 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
932 |
void MusicProviderBase::initialize() |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
933 |
{ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
934 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
935 |
m_serviceName = "Last.fm"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
936 |
m_description = "Description"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
937 |
m_serviceUrl = QUrl(QString("http://ws.audioscrobbler.com")); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
938 |
// m_serviceType << m_serviceName << m_description;// << (QString)(m_serviceUrl); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
939 |
m_supportedLanguages << "English" ; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
940 |
m_pluginId = "lastfmmusiceventplugin.qtplugin"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
941 |
m_authAppId = "0xE1D8C7D8"; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
942 |
QSettings iSettings; |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
943 |
m_smfRegToken = iSettings.value("CMLastFmRegToken").toString(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
944 |
m_validity = iSettings.value("LastFmExpiryTime").toDateTime(); |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
945 |
//m_smfRegToken = "hsdfusdghf"; //yet to be recvd |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
946 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
947 |
} |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
948 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
949 |
|
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
950 |
/* |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
951 |
* Export Macro |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
952 |
* plugin name : musiceventplugin |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
953 |
* plugin class : MusicEventPlugin |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
954 |
*/ |
574948b60dab
updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff
changeset
|
955 |
Q_EXPORT_PLUGIN2( musiceventplugin, MusicEventPlugin ) |