example/lastfmmusiceventplugin/lastfmmusiceventplugin.cpp
author cgandhi
Mon, 11 Oct 2010 21:59:54 +0530
changeset 26 83d6a149c755
parent 23 574948b60dab
permissions -rw-r--r--
Submitting following changes - AuthApps for Last.fm and Twitter added API for checking ServiceAuthorization added for SMFCredMgrClient API added for forcefully removing credential details from SMFCredMgr Extra argument checks in SMfClient APIs APIs for service login and logout from SMFClient Redundant members removed from SmfServerSymbian DSM bug fixes Test Apps included
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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);
26
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   188
		Q_UNUSED(aLocation)
23
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   189
		
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   190
		SmfPluginError error = SmfPluginErrUserNotLoggedIn;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   191
		 	
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   192
		// Get the key sets from SMF Plugin Utility class.
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   193
		QString apiKey;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   194
		QString apiSecret;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   195
		QString sessionKey;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   196
		QString sessionSecret;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   197
		fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   198
		writeLog("API KEY"+apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   199
		writeLog("API SECRET"+apiSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   200
		writeLog("SessionKey"+sessionKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   201
		writeLog("sessionSecret"+sessionSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   202
		writeLog("MusicEventPlugin::Venues()");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   203
		//QString qName("New York");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   204
		//aLocation.setCity(qName);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   205
		//QString qLocation = aLocation.city();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   206
		//640418
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   207
		//QString qLocation("New York");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   208
/*		QString baseString;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   209
		baseString.append(apiSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   210
		baseString.append("api_key"+apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   211
		baseString.append("auth_token");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   212
		baseString.append("formatjson");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   213
		baseString.append("location ="+aLocation.city());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   214
		baseString.append("method=geo.getEvents");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   215
		writeLog("Url string is :"+baseString);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   216
		 	
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   217
		//Create the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   218
		QUrl url("http://ws.audioscrobbler.com/2.0/?");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   219
		url.addQueryItem("method", "geo.getevents");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   220
		url.addQueryItem("location",aLocation.city());
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("api_key", apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   223
		url.addQueryItem("format","json");				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   224
		url.addQueryItem("auth_token","");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   225
		url.addQueryItem("api_sig", generateSignature(baseString));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   226
		
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   227
		writeLog("/n/n"+generateSignature(baseString)); 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   228
		writeLog("/n/n Response is :"+url.toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   229
		//Create the request, set the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   230
		aRequest.iNetworkRequest.setUrl(url);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   231
		aRequest.iRequestType = SmfEventsGetVenues;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   232
		aRequest.iPostData = NULL;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   233
		aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   234
		error = SmfPluginErrNone;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   235
		return error;	*/
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   238
	    QString baseString;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   239
		baseString.append(apiSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   240
		baseString.append("api_key"+apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   241
		baseString.append("auth_token");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   242
		baseString.append("formatjson");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   243
		baseString.append("location=Newyork");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   244
		baseString.append("method=geo.getEvents");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   245
		writeLog("Url string is :"+baseString);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   246
		
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   247
		// Create the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   248
		 QUrl url("http://ws.audioscrobbler.com/2.0/?");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   249
		 url.addQueryItem("method", "geo.getevents");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   250
		 url.addQueryItem("location","Newyork");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   251
		 url.addQueryItem("api_key", apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   252
		 url.addQueryItem("format","json");				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   253
		 url.addQueryItem("auth_token","");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   254
		 url.addQueryItem("api_sig", generateSignature(baseString));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   255
		 writeLog("/n/n"+generateSignature(baseString)); 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   256
		 writeLog("/n/n Response is :"+url.toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   257
					// Create the request, set the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   258
		 aRequest.iNetworkRequest.setUrl(url);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   259
		 aRequest.iRequestType = SmfEventsGetEvents;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   260
		 aRequest.iPostData = NULL;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   261
		 aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   262
		 error = SmfPluginErrNone;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   263
		 return error;	
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
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   269
 * Method to get the events based on venues
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   270
 * @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
   271
 * @param aVenue Venue of the event
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   272
 * @param aPageNum The page to be extracted
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   273
 * @param aItemsPerPage Number of items per page
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   274
 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   275
 */
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   276
SmfPluginError MusicEventPlugin::events( SmfPluginRequestData &aRequest,
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   277
		const SmfLocation &aVenue,const int aPageNum, 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   278
		const int aItemsPerPage)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   279
	{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   280
	Q_UNUSED(aItemsPerPage);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   281
	Q_UNUSED(aPageNum);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   282
	
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   283
	SmfPluginError error = SmfPluginErrUserNotLoggedIn;
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
	
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   286
	// Get the key sets from SMF Plugin Utility class.
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   287
		QString apiKey;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   288
		QString apiSecret;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   289
		QString sessionKey;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   290
		QString sessionSecret;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   291
		fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   292
		writeLog("API KEY"+apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   293
		writeLog("API SECRET"+apiSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   294
		writeLog("SessionKey"+sessionKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   295
		writeLog("sessionSecret"+sessionSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   296
	
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   297
	    QString baseString;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   298
		baseString.append(apiSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   299
		baseString.append("api_key"+apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   300
		baseString.append("auth_token");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   301
		baseString.append("formatjson");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   302
		baseString.append("location="+aVenue.city());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   303
		baseString.append("method=geo.getEvents");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   304
		writeLog("Url string is :"+baseString);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   305
		
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   306
		// Create the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   307
		 QUrl url("http://ws.audioscrobbler.com/2.0/?");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   308
		url.addQueryItem("method", "geo.getevents");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   309
		url.addQueryItem("location",aVenue.city());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   310
		url.addQueryItem("api_key", apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   311
		url.addQueryItem("format","json");				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   312
		url.addQueryItem("auth_token","");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   313
		url.addQueryItem("api_sig", generateSignature(baseString));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   314
		writeLog("/n/n"+generateSignature(baseString)); 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   315
		writeLog("/n/n Response is :"+url.toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   316
		//Create the request, set the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   317
		 aRequest.iNetworkRequest.setUrl(url);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   318
		 aRequest.iRequestType = SmfEventsGetEvents;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   319
		 aRequest.iPostData = NULL;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   320
		 aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   321
		 error = SmfPluginErrNone;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   322
		 return error;	
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
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   327
 * Method to post events
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   328
 * @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
   329
 * @param aEventList The list of events to be posted
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   330
 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   331
 */
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   332
SmfPluginError MusicEventPlugin::postEvents( SmfPluginRequestData &aRequest,
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   333
		const QList<SmfEvent> &aEventList )
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   334
	{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   335
	       Q_UNUSED(aEventList)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   336
		   SmfPluginError error = SmfPluginErrUserNotLoggedIn;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   337
		   writeLog("MusicEventPlugin::events()");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   338
		   int count =aEventList.count();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   339
		   for(int i=0;i<count;i++)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   340
			   { 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   341
		        SmfEvent ievent=aEventList[i];
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   342
		        writeLog("Event List"+ievent.id());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   343
			   }
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   344
			// Get the key sets from SMF Plugin Utility class.
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   345
			QString apiKey;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   346
			QString apiSecret;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   347
			QString sessionKey;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   348
			QString sessionSecret;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   349
			fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   350
			writeLog("API KEY"+apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   351
			writeLog("API SECRET"+apiSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   352
			writeLog("SessionKey"+sessionKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   353
			writeLog("sessionSecret"+sessionSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   354
		/*	QString baseString;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   355
			
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   356
			baseString.append(apiSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   357
			baseString.append("api_key"+apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   358
			baseString.append("auth_token");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   359
			baseString.append("formatjson");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   360
		//	baseString.append("method=event.shout"); // needs authentication
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   361
		//	baseString.append("Event"+"aEventList.at(0)");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   362
			writeLog("Url string is :"+baseString);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   363
			
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   364
		   //Create the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   365
			 QUrl url("http://ws.audioscrobbler.com/2.0/?");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   366
			 url.addQueryItem("method", "event.shout");   // needs authentication
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   367
			 url.addQueryItem("api_key", apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   368
			 url.addQueryItem("format","json");	
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   369
		//	 url.addQueryItem("Event","aEventList.at(0)");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   370
			 url.addQueryItem("auth_token","");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   371
			 url.addQueryItem("api_sig", generateSignature(baseString));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   372
			 writeLog("/n/n Response is :"+url.toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   373
						// Create the request, set the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   374
			 aRequest.iNetworkRequest.setUrl(url);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   375
			 aRequest.iRequestType = SmfEventsPostEvents;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   376
			 aRequest.iPostData = NULL;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   377
			 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   378
			 aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   379
			 error = SmfPluginErrNone;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   380
			 return error;	*/
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   381
			
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   382
		   //For Testing Only      
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   383
		    QString baseString;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   384
					
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   385
		    //QString strId("328799");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   386
			
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   387
		    QString eventId("328799");//= aEvent.id();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   388
			//QString eventId;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   389
			//eventId = aEvent.id();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   390
			baseString.append(apiSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   391
		    baseString.append("api_key"+apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   392
					//baseString.append("auth_token");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   393
			baseString.append("formatjson");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   394
			baseString.append("method=event.getattendees");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   395
			baseString.append("event"+eventId);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   396
			writeLog("Url string is :"+baseString);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   397
					
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   398
			//Create the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   399
			QUrl url("http://ws.audioscrobbler.com/2.0/?");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   400
			url.addQueryItem("method", "event.getattendees");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   401
			url.addQueryItem("event",eventId);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   402
			url.addQueryItem("api_key", apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   403
			url.addQueryItem("format","json");					 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   404
			//url.addQueryItem("auth_token","");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   405
			//url.addQueryItem("api_sig", generateSignature(baseString));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   406
			writeLog("/n/n Response is :"+url.toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   407
			//Create the request, set the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   408
			aRequest.iNetworkRequest.setUrl(url);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   409
			aRequest.iRequestType = SmfEventsPostEvents;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   410
			aRequest.iPostData = NULL;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   411
		
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   412
			aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   413
			error = SmfPluginErrNone;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   414
			return error;	
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
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   418
 * Customised method for SmfMusicEventsPlugin interface
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   419
 * @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
   420
 * @param aOperation The operation type (should be known between 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   421
 * the client interface and the plugin)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   422
 * @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
   423
 * 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
   424
 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   425
 */
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   426
SmfPluginError MusicEventPlugin::attendees( SmfPluginRequestData &aRequest,
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   427
			const SmfEvent &aEvent, 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   428
			const int aPageNum ,
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   429
			const int aItemsPerPage )
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   430
	{
26
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   431
		Q_UNUSED(aPageNum)
23
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   432
		Q_UNUSED(aItemsPerPage);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   433
		SmfPluginError error = SmfPluginErrUserNotLoggedIn;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   434
		writeLog("MusicEventPlugin::events()");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   435
				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   436
		// Get the key sets from SMF Plugin Utility class.
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   437
		QString apiKey;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   438
		QString apiSecret;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   439
		QString sessionKey;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   440
		QString sessionSecret;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   441
		fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   442
		writeLog("API KEY"+apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   443
		writeLog("API SECRET"+apiSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   444
		writeLog("SessionKey"+sessionKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   445
		writeLog("sessionSecret"+sessionSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   446
	    QString baseString;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   447
				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   448
	    //QString strId("328799");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   449
		//aEvent.setId(strId);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   450
	    //QString eventId = aEvent.id();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   451
		QString eventId;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   452
		eventId = aEvent.id();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   453
		baseString.append(apiSecret);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   454
	    baseString.append("api_key"+apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   455
				//baseString.append("auth_token");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   456
		baseString.append("formatjson");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   457
		baseString.append("method=event.getattendees");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   458
		baseString.append("event"+eventId);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   459
		writeLog("Url string is :"+baseString);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   460
				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   461
		//Create the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   462
		QUrl url("http://ws.audioscrobbler.com/2.0/?");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   463
		url.addQueryItem("method", "event.getattendees");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   464
		url.addQueryItem("event",eventId);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   465
		url.addQueryItem("api_key", apiKey);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   466
		url.addQueryItem("format","json");					 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   467
				// url.addQueryItem("auth_token","");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   468
				// url.addQueryItem("api_sig", generateSignature(baseString));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   469
		writeLog("/n/n Response is :"+url.toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   470
		//Create the request, set the url
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   471
		aRequest.iNetworkRequest.setUrl(url);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   472
		aRequest.iRequestType = SmfEventsGetEventAttendees;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   473
		aRequest.iPostData = NULL;
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
				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   476
				 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   477
		aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   478
		error = SmfPluginErrNone;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   479
		return error;	
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   480
	}
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   481
SmfPluginError MusicEventPlugin::customRequest( SmfPluginRequestData &aRequest, 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   482
		const int &aOperation, QByteArray *aData )
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   483
	{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   484
	Q_UNUSED(aRequest)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   485
	Q_UNUSED(aOperation)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   486
	Q_UNUSED(aData)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   487
    //SmfEventsCustomRequest
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   488
	return SmfPluginErrServiceNotSupported; 
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   491
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   492
 * 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
   493
 * 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
   494
 * 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
   495
 * @param aUtil The instance of SmfPluginUtil
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
void MusicEventPlugin::initialize(/* SmfPluginUtil *aUtil */)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   498
	{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   499
	// Save the SmfPluginUtil handle
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   500
	//m_util = aUtil;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   501
	
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   502
	// Create an instance of MusicProviderBase
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   503
	m_provider = new MusicProviderBase;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   504
	m_provider->initialize();
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   507
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   508
 * Method to get the provider information
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   509
 * @return Instance of SmfProviderBase
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
SmfProviderBase* MusicEventPlugin::getProviderInfo( )
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
	return m_provider;
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   516
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   517
 * Method to get the result for a network request.
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   518
 * @param aOperation The type of operation to be requested
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   519
 * @param aTransportResult The result of transport operation
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   520
 * @param aResponse The QByteArray instance containing the network response.
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   521
 * 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
   522
 * data from it.
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   523
 * @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
   524
 * return value is SmfSendRequestAgain, QVariant will be of type 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   525
 * SmfPluginRequestData.
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   526
 * For SmfGalleryPlugin: If last operation was pictures(), aResult will 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   527
 * 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
   528
 * 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
   529
 * postComment(), aResult will be of type bool.
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   530
 * @param aRetType [out] SmfPluginRetType
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   531
 * @param aPageResult [out] The SmfResultPage structure variable
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   532
 */
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   533
SmfPluginError MusicEventPlugin::responseAvailable( 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   534
		const SmfRequestTypeID aOperation,
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   535
		const SmfTransportResult &aTransportResult, 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   536
		QByteArray *aResponse, 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   537
		QVariant* aResult, 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   538
		SmfPluginRetType &aRetType,
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   539
		SmfResultPage &aPageResult )
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   540
	{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   541
	writeLog("MusicEventPlugin::responseAvailable");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   542
		Q_UNUSED(aPageResult)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   543
		SmfPluginError error = SmfPluginErrNetworkError;
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
		if( !aResponse || (0 == aResponse->size()) ) 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   546
			{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   547
			writeLog("Response is NULL or empty");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   548
			aRetType = SmfRequestError;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   549
			return error;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   550
			}
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   551
		
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   552
		QByteArray response(*aResponse);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   553
		delete aResponse;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   554
		
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   555
		//Write the response to a file
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   556
		QFile file("c:\\data\\musiceventresponse.txt");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   557
		writeLog("response data written to c:\\data\\musiceventresponse.txt");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   558
				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   559
		if (!file.open(QIODevice::Append | QIODevice::Text));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   560
		file.write(response);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   561
		file.close();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   562
		
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   563
		writeLog("MusicEvent response = "+QString(response));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   564
		writeLog("MusicEvent response size = "+QString::number(response.size(), 10));
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
		if(SmfTransportOpNoError == aTransportResult)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   567
			{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   568
			  writeLog("No transport error");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   569
			//  QVariantMap map1;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   570
			 // bool resType=response.startsWith("<?xml");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   571
			 /* if(resType) //XML REsponse
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
				   writeLog("Before XML Parser--");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   574
				  
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
			  else //JSON RESPONSE
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   577
			  {
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   578
				  bool ok;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   579
				  writeLog("Before JSON Parser--");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   580
		
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   581
				  SmfPluginUtil util;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   582
				  QVariant result = util.parse(response, &ok);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   583
				  if (!ok) 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   584
				   {
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   585
						writeLog("An error occurred during json parsing");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   586
						aRetType = SmfRequestError;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   587
						return SmfPluginErrParsingFailed;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   588
				   }
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
			 //map1 = result.toMap();*/
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
			  if(SmfEventsGetEvents == aOperation /*|| SmfMusicGetEventsOnVenue == aOperation*/)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   593
				 {
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   594
			       
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   595
			        QDateTime dt = QDateTime::currentDateTime();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   596
			        QList<SmfEvent> eventlist;
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
			        
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
			        //Tested By Hardcoding
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   601
			        
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   602
			        SmfEvent event;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   603
			        event.setId("111111");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   604
			        event.setTitle("bangalore");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   605
			      	event.setEventDateTime(dt);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   606
			        QStringList stringList; //for artist
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   607
			        stringList.append("sssss");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   608
			        stringList.append("aaaa");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   609
			        SmfArtists artists;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   610
			        artists.setNames(stringList);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   611
					event.setArtists(artists);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   612
					
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   613
					SmfLocation Location;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   614
					Location.setCity("Bangalore");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   615
					Location.setCountry("india");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   616
					
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   617
					event.setVenue(Location);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   618
					eventlist.append(event);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   619
					
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   620
					//2nd Event
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   621
					SmfEvent event1;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   622
					event1.setId("2222");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   623
					event1.setTitle("delhi");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   624
					event1.setEventDateTime(dt);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   625
					QStringList stringList1; //for artist
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   626
					stringList1.append("ddddd");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   627
				    stringList1.append("rrrrrr");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   628
				    SmfArtists artists1;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   629
					artists1.setNames(stringList1);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   630
					event1.setArtists(artists1);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   631
										
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   632
					SmfLocation Location1;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   633
					Location1.setCity("Delhi");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   634
					Location1.setCountry("india");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   635
										
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   636
					event1.setVenue(Location1);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   637
					eventlist.append(event1);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   638
										
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   639
					writeLog("SmfEventsGetEvents = ");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   640
					/*QVariantMap eventmap = map1["events"].toMap();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   641
					QList<QVariant> list1 = eventmap["event"].toList();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   642
					
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   643
					QListIterator<QVariant> iter(list1);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   644
					writeLog("SmfEventsGetEvents123 = ");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   645
					while(iter.hasNext())  //not runing for one event
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   646
					{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   647
					  SmfEvent event;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   648
					  QVariantMap map2 = iter.next().toMap();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   649
					  writeLog("id = "+map2["id"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   650
					  event.setId(map2["id"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   651
					  writeLog("title = "+map2["title"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   652
					  event.setTitle(map2["title"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   653
					  writeLog("EventDateTime= "+map2["startDate"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   654
					  event.setEventDateTime(map2["startDate"].toDateTime());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   655
					 // writeLog("SetdUration= "+map2["startDate"].toDateTime());  //didn't find that
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   656
					  //for Getting the Artist List
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   657
					  QVariantMap map4 = map2["artists"].toMap();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   658
					  QList<QVariant> artistList =map4["artist"].toList();
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("artist"+map4["artist"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   661
					 					  
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   662
					 //  writeLog("artists"+artistList["artist"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   663
					 // QList<QVariant> artistList =map2["artists"].toList();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   664
					
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   665
					  
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   666
					 QListIterator<QVariant> iterartists(artistList);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   667
					  SmfArtists artists;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   668
					  QStringList stringList;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   669
					  while(iterartists.hasNext())
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   670
					  {
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   671
						
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   672
						//QString artistName;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   673
						QString artistName = iterartists.next().toString();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   674
						writeLog("artist Name = "+ artistName);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   675
						//artistName.append(map2["artist"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   676
						stringList.append(artistName);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   677
						
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   678
					  }//end while
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   679
					  //writeLog("artists= "+stringList[0]);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   680
					  
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   681
					  artists.setNames(stringList);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   682
					  event.setArtists(artists);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   683
					  
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   684
					  //all Artist list we got 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   685
					  //For Venue
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   686
					  SmfLocation Location;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   687
					  QVariantMap map3 = map2["venue"].toMap();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   688
					  writeLog("LocationId : "+map3["id"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   689
					  Location.setId(map3["id"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   690
					  //for city
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   691
					  QVariantMap map6 = map3["location"].toMap();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   692
					  writeLog("Location city : "+map6["city"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   693
					  Location.setCity(map6["city"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   694
					  writeLog("Location city : "+map6["country"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   695
					  Location.setCountry(map6["country"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   696
					 // Location.geoPositionInfo()  dont know how to set 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   697
					  event.setVenue(Location);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   698
					  eventlist.append(event);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   699
					}//end While*/
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   700
					aResult->setValue(eventlist);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   701
					aRetType = SmfRequestComplete;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   702
					error = SmfPluginErrNone;										
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
			 else if(SmfEventsGetVenues == aOperation)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   705
				{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   706
				writeLog("SmfEventsGetVenues = ");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   707
				QList<SmfLocation> LocationList;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   708
				SmfLocation Location;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   709
			    Location.setId("111111");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   710
				//for city
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   711
				Location.setCity("delhi");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   712
				Location.setCountry("India");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   713
				Location.setUrl(QUrl("http://wwwqqqqq/ee"));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   714
				LocationList.append(Location);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   715
				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   716
				SmfLocation Location1;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   717
				Location1.setId("22222");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   718
				//for city
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   719
				Location1.setCity("bangalore");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   720
				Location1.setCountry("India");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   721
				LocationList.append(Location1);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   722
				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   723
				aResult->setValue(LocationList);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   724
				aRetType = SmfRequestComplete;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   725
				error = SmfPluginErrNone;
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
				}
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
			 else if (SmfEventsPostEvents == aOperation)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   731
				{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   732
				writeLog("SmfEventsPostEvents = ");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   733
				bool postEvent=true;	
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   734
				aResult->setValue(postEvent);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   735
				aRetType = SmfRequestComplete;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   736
				error = SmfPluginErrNone;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   737
				
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
			 else if (SmfEventsGetEventAttendees == aOperation)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   740
				 {
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
				        QList<SmfContact> contactList;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   743
				        
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   744
			             writeLog("SmfMusicGetEventsAttendees = ");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   745
			             bool ok;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   746
			           	writeLog("Before Parser--");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   747
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   748
			           	SmfPluginUtil util;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   749
			           	QVariantMap result = util.parse(response, &ok).toMap();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   750
			           	if (!ok) 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   751
			           	{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   752
			           	writeLog("An error occurred during json parsing");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   753
			           	aRetType = SmfRequestError;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   754
			           	return SmfPluginErrParsingFailed;
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
			           	}
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   757
			           							
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   758
			           	//QVariantMap map1 = result.toMap();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   759
			        	writeLog("MAP1");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   760
			            
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   761
			           
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   762
			           	QVariantMap map1 = result["attendees"].toMap();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   763
			        	//QVariantMap map2 = map1["attendees"].toMap();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   764
			           	writeLog("MAP2");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   765
			           	//int page = map2["page"].toInt(&ok);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   766
			           	QList<QVariant> list1 = map1["user"].toList();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   767
			           	writeLog("list count"+QString::number(list1.count(),10));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   768
			           				
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   769
			           	QListIterator<QVariant> i(list1);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   770
			           	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
   771
			            while(i.hasNext())
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   772
			           	{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   773
			                writeLog("inside loop");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   774
			           		SmfContact contact;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   775
			           		QVariantMap map2 = i.next().toMap();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   776
			           		writeLog("name= "+map2["name"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   777
			           		writeLog("realname = "+map2["realname"].toString());
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   778
			           					
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   779
			           		//Contact Name
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   780
			           		QContactName contactname;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   781
			           		QString username = map2["name"].toString();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   782
			           		writeLog("name = "+username);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   783
			           		contactname.setFirstName(username);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   784
			           		contactname.setLastName(username);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   785
			           		QVariant nameVar = QVariant::fromValue(contactname);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   786
			           		contact.setValue("Name",nameVar);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   787
			           		contactList.append(contact);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   788
			           	}
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   789
			             aResult->setValue(contactList);										
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   790
			 		     aRetType = SmfRequestComplete;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   791
			 		     error = SmfPluginErrNone;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   792
			 			
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
			 else
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   795
				{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   796
				writeLog("Service unsupported!!!");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   797
				aRetType = SmfRequestError;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   798
				error = SmfPluginErrServiceNotSupported;
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
			}//end if of if(SmfTransportOpNoError == 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
		else if(SmfTransportOpOperationCanceledError == aTransportResult)
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   803
			{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   804
			writeLog("Operation Cancelled !!!");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   805
			error = SmfPluginErrCancelComplete;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   806
			aRetType = SmfRequestComplete;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   807
			}
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
		else
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   810
			{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   811
			writeLog("Transport Error !!!");
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   812
			error = SmfPluginErrNetworkError;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   813
			aRetType = SmfRequestError;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   814
			}
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
		return error;
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
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
 * Destructor
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
MusicProviderBase::~MusicProviderBase( )
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   827
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   828
 * Method to get the Localisable name of the service.
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   829
 * @return The Localisable name of the service.
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
QString MusicProviderBase::serviceName( ) const
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
	return m_serviceName;
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   836
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   837
 * Method to get the Logo of the service
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   838
 * @return The Logo of the service
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
QImage MusicProviderBase::serviceIcon( ) const
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
	return m_serviceIcon;
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   845
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   846
 * Method to get the Readable service description
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   847
 * @return The Readable service description
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
QString MusicProviderBase::description( ) const
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
	return m_description;
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   854
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   855
 * Method to get the Website of the service
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   856
 * @return The Website of the service
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
QUrl MusicProviderBase::serviceUrl( ) const
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
	return m_serviceUrl;
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   863
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   864
 * 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
   865
 * @return The URL of the Application providing this service
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
QUrl MusicProviderBase::applicationUrl( ) const
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
	return m_applicationUrl;
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   872
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   873
 * Method to get the Icon of the application
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   874
 * @return The Icon of the application
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
QImage MusicProviderBase::applicationIcon( ) const
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
	return m_applicationIcon;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   879
	}
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   880
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   881
* 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
   882
* @return List of supported Interafces
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
QList<QString> MusicProviderBase::supportedInterfaces( ) const
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
	return m_serviceType;
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   889
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   890
* 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
   891
* @return a QStringList of languages supported by this service 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   892
* provider in 2 letter ISO 639-1 format.
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
QStringList MusicProviderBase::supportedLanguages( ) const
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
	return m_supportedLanguages;
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   899
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   900
 * Method to get the Plugin specific ID
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   901
 * @return The Plugin specific ID
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
QString MusicProviderBase::pluginId( ) const
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
	return m_pluginId;
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
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   908
/**
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   909
 * Method to get the ID of the authentication application 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   910
 * for this service
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   911
 * @param aProgram The authentication application name
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   912
 * @param aArguments List of arguments required for authentication app
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   913
 * @param aMode Strting mode for authentication application
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   914
 * @return The ID of the authentication application 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   915
 */
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   916
QString MusicProviderBase::authenticationApp( QString &aProgram, 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   917
		QStringList & aArguments, 
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   918
		QIODevice::OpenModeFlag aMode ) const
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   919
	{
26
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   920
	Q_UNUSED(aProgram)
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   921
	Q_UNUSED(aArguments)
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   922
	Q_UNUSED(aMode)
23
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   923
	return m_authAppId;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   924
	}
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   925
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   926
/**
26
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   927
 * Method to get the authentication application process name
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   928
 * @return The authentication application process name (eg: "FlickrAuthApp.exe")
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   929
 */
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   930
QString MusicProviderBase::authenticationAppName( ) const
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   931
	{
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   932
	return m_authAppName;
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   933
	}
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   934
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   935
/**
23
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   936
 * 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
   937
 * Smf for authorised plugins
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   938
 * @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
   939
 * authorised plugins
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   940
 */
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   941
QString MusicProviderBase::smfRegistrationId( ) const
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   942
	{
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   943
	return m_smfRegToken;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   944
	}
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   945
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   946
void MusicProviderBase::initialize()
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
	  m_serviceName = "Last.fm";
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   950
	  m_description = "Description";
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   951
	  m_serviceUrl =  QUrl(QString("http://ws.audioscrobbler.com"));
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   952
	 // m_serviceType << m_serviceName << m_description;// << (QString)(m_serviceUrl);
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   953
	  m_supportedLanguages << "English" ;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   954
	  m_pluginId =    "lastfmmusiceventplugin.qtplugin";
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   955
	  m_authAppId =   "0xE1D8C7D8";
26
83d6a149c755 Submitting following changes -
cgandhi
parents: 23
diff changeset
   956
	  m_authAppName = "LastFm.exe";
23
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   957
	  QSettings iSettings;
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   958
	  m_smfRegToken = iSettings.value("CMLastFmRegToken").toString();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   959
	  m_validity = iSettings.value("LastFmExpiryTime").toDateTime();
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   960
	  //m_smfRegToken = "hsdfusdghf";  //yet to be recvd
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   961
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   962
	}
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   963
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   964
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   965
/*
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   966
 * Export Macro
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   967
 * plugin name : musiceventplugin
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   968
 * plugin class : MusicEventPlugin
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   969
 */
574948b60dab updating the lastfm music plugins and adding the smfhelp.chm
cgandhi
parents:
diff changeset
   970
Q_EXPORT_PLUGIN2( musiceventplugin, MusicEventPlugin )