void StreamInfo::get(const QString& broadID, const QString& userSession) { // make request QNetworkRequest rq; const QVariant& postData = makePostData(userSession); rq.setHeader(QNetworkRequest::CookieHeader, postData); rq.setUrl(QUrl("http://live.nicovideo.jp/api/getstreaminfo/lv" + broadID)); requestGet(rq); }
void PlayerStatus::get(const QString& broadID, const QString& userSession) { // make reques QNetworkRequest rq; const QVariant& postData = makePostData(userSession); rq.setHeader(QNetworkRequest::CookieHeader, postData); rq.setUrl(QUrl("http://live.nicovideo.jp/api/getplayerstatus?v=" + broadID)); requestGet(rq); }
void ExtendInfo::get(const QString& broadID, const QString& userSession) { this->broadID = broadID; // make request QNetworkRequest rq; QVariant&& postData = makePostData(userSession); rq.setHeader(QNetworkRequest::CookieHeader, postData); rq.setUrl(QUrl("http://watch.live.nicovideo.jp/api/getsalelist?v=" + broadID)); requestGet(rq); }
void CommPostKey::get() { // make request QNetworkRequest rq; QVariant&& postData = makePostData(userSession); rq.setHeader(QNetworkRequest::CookieHeader, postData); rq.setUrl(QUrl(QString("http://live.nicovideo.jp/api/getpostkey?") + "thread=" + thread + "&block_no=" + QString::number(blockNo))); requestGet(rq); }
void OwnerComment::get(const QString& text, const QString& name, const LiveWaku& waku, const QString& userSession) { // make reques QNetworkRequest rq; const QVariant& postData = makePostData(userSession); rq.setHeader(QNetworkRequest::CookieHeader, postData); rq.setUrl(QUrl("http://watch.live.nicovideo.jp/api/broadcast/" + waku.getBroadID() + "?body=" + QUrl::toPercentEncoding(text) + "&token=" + waku.getOwnerCommentToken() + "&name=" + QUrl::toPercentEncoding(name))); requestGet(rq); }
void fileExecute(const char* inputFile, bool bSingleStep) { FILE *fp; char szBuffer[128]; char* token; int line = 0; if ((fp=fopen(inputFile, "r")) != NULL) { do { rewind(fp); while (fgets(szBuffer, 128, fp) != NULL) { ++line; if (szBuffer[0] != 0) { printf("Executing %s", szBuffer); } token = strtok(szBuffer, " "); if (token == NULL) { break; } if (strcasecmp(token, "version") == 0) { token = strtok(NULL, " "); if (token == NULL) { fileError(1, line); } else { Url url(token); token = strtok(NULL, " "); if (token == NULL) { fileError(2, line); } else { DataSet = token; requestVersion(url); } } } else if (strcasecmp(token, "get") == 0) { token = strtok(NULL, " "); if (token == NULL) { fileError(1, line); } else { Url url(token); token = strtok(NULL, " "); if (token == NULL) { fileError(2, line); } else { DataSet = token; UtlSList names; while (token != NULL) { token = strtok(NULL, " "); if (token != NULL) { names.append(new UtlString(token)); } } requestGet(url, names); names.destroyAll(); } } } else if (strcasecmp(token, "set") == 0) { token = strtok(NULL, " "); if (token == NULL) { fileError(1, line); } else { Url url(token); token = strtok(NULL, " "); if (token == NULL) { fileError(2, line); } else { DataSet = token; UtlHashMap parameters; char *key; char *value; while (token != NULL) { key = strtok(NULL, " "); if (key == NULL) { break; } value = strtok(NULL, " "); if (value == NULL) { fileError(3, line); break; } parameters.insertKeyAndValue(new UtlString(key), new UtlString(value)); } int entries = parameters.entries(); if (entries != 0 || (entries%2) == 0) { requestSet(url, parameters); parameters.destroyAll(); } } } } else if (strcasecmp(token, "delete") == 0) { token = strtok(NULL, " "); if (token == NULL) { fileError(1, line); } else { Url url(token); token = strtok(NULL, " "); if (token == NULL) { fileError(2, line); } else { DataSet = token; UtlSList names; while (token != NULL) { token = strtok(NULL, " "); if (token != NULL) { names.append(new UtlString(token)); } } requestDelete(url, names); names.destroyAll(); } } } else { fprintf(stderr, "Unknown RPC request %s - ignoring line\n", token); } if (bSingleStep) { getchar(); } } } while ( bRepeatFile ); fclose(fp); } else { fprintf(stderr, "Can't open %s\n", inputFile); exit(1); } }
int main(int argc, char* argv[]) { parseArgs(argc, argv); initLogger(argv); OsEvent taskDone; Url url(xmlrpcURI); if (MemCheckDelay) { // Delay 45 seconds to allow memcheck start printf("Wating %d seconds for start of memcheck ...", MemCheckDelay); OsTask::delay(MemCheckDelay * 1000); printf("starting\n"); } // If an input file was specified we start up the number // of specified threads to execute that input file. If number // of threads wasn't specified we start up 1 thread. if (bInputFile) { int signaled = 0; for (int i=0; i<numThreads; i++) { ClientTask* pTask = new ClientTask(&taskDone); pTask->start(); } // Wait for threads to shut down while (signaled < numThreads) { taskDone.wait(); taskDone.reset(); ++signaled; } exit(0); } switch (Method) { case Version: // --version <xmlrpc URI> <dataset> { if (optind < argc) { fprintf(stderr, "Too many arguments: '%s'\n", argv[optind]); showHelp(argv); exit(1); } requestVersion(url); break; } case Get: // --get <xmlrpc URI> <dataset> <name> ... { UtlSList names; // copy remaining arguments into the names list while (optind < argc) { names.append(new UtlString(argv[optind++])); } requestGet(url, names); break; } case Set: // --set <xmlrpc URI> <dataset> <name> <value> [ <name> <value> ] ... { UtlHashMap parameters; // copy remaining arguments into the names list while (optind + 1 < argc) { UtlString* setName = new UtlString(argv[optind++]); UtlString* setValue = new UtlString(argv[optind++]); parameters.insertKeyAndValue(setName, setValue); } if (optind < argc) { fprintf(stderr, "name '%s' without a value\n", argv[optind]); showHelp(argv); exit(1); } if (parameters.isEmpty()) { fprintf(stderr, "must specify at least one name and value\n"); showHelp(argv); exit(1); } else { requestSet(url, parameters); parameters.destroyAll(); } break; } case Delete: // --delete <xmlrpc URI> <dataset> <name> ... { UtlSList names; // copy remaining arguments into the names list while (optind < argc) { names.append(new UtlString(argv[optind++])); } requestDelete(url, names); break; } default: fprintf(stderr, "No method specified\n"); showHelp(argv); exit(1); } if (MemCheckDelay) { // Delay 45 seconds to allow memcheck start printf("Wating %d seconds for stop of memcheck ...", MemCheckDelay); OsTask::delay(MemCheckDelay * 1000); printf("starting\n"); } exit(0); }