Uniform line endings (dos2unix)

This commit is contained in:
Martchus 2016-08-29 20:47:13 +02:00
parent 634f46f525
commit 45ad449a92
4 changed files with 219 additions and 219 deletions

View File

@ -1,52 +1,52 @@
#include "./bitsharedownload.h" #include "./bitsharedownload.h"
#include "../application/utils.h" #include "../application/utils.h"
#include <QUrlQuery> #include <QUrlQuery>
using namespace Application; using namespace Application;
namespace Network { namespace Network {
/*! /*!
* \class BitshareDownload * \class BitshareDownload
* \brief Download implementation for specific hoster. * \brief Download implementation for specific hoster.
*/ */
/*! /*!
* \brief Constructs a new BitshareDownload for the specified \a url. * \brief Constructs a new BitshareDownload for the specified \a url.
*/ */
BitshareDownload::BitshareDownload(const QUrl &url, QObject *parent) : BitshareDownload::BitshareDownload(const QUrl &url, QObject *parent) :
HttpDownloadWithInfoRequst(url, parent) HttpDownloadWithInfoRequst(url, parent)
{} {}
Download *BitshareDownload::infoRequestDownload(bool &success, QString &) Download *BitshareDownload::infoRequestDownload(bool &success, QString &)
{ {
success = true; success = true;
HttpDownload *download = new HttpDownload(initialUrl()); HttpDownload *download = new HttpDownload(initialUrl());
download->setCookieJar(usedCookieJar()); download->setCookieJar(usedCookieJar());
return download; return download;
} }
QString BitshareDownload::typeName() const QString BitshareDownload::typeName() const
{ {
return tr("Bitshare"); return tr("Bitshare");
} }
void BitshareDownload::evalVideoInformation(Download *, QBuffer *videoInfoBuffer) void BitshareDownload::evalVideoInformation(Download *, QBuffer *videoInfoBuffer)
{ {
QString videoInfo(videoInfoBuffer->readAll()); QString videoInfo(videoInfoBuffer->readAll());
QString title; QString title;
if(substring(videoInfo, title, 0, QStringLiteral("<title>Streaming "), QStringLiteral(" ")) > 0 && !title.isEmpty()) { if(substring(videoInfo, title, 0, QStringLiteral("<title>Streaming "), QStringLiteral(" ")) > 0 && !title.isEmpty()) {
setTitle(title); setTitle(title);
} }
QString url; QString url;
if(substring(videoInfo, url, videoInfo.indexOf(QLatin1String("clip:"), Qt::CaseSensitive), QStringLiteral("url: '"), QStringLiteral("'")) > 0 && !url.isEmpty()) { if(substring(videoInfo, url, videoInfo.indexOf(QLatin1String("clip:"), Qt::CaseSensitive), QStringLiteral("url: '"), QStringLiteral("'")) > 0 && !url.isEmpty()) {
addDownloadUrl(tr("H.264/AAC/FLV"), url); addDownloadUrl(tr("H.264/AAC/FLV"), url);
reportInitiated(true); reportInitiated(true);
} else { } else {
reportInitiated(false, tr("The stream url couldn't be found.")); reportInitiated(false, tr("The stream url couldn't be found."));
} }
} }
} }

View File

@ -1,27 +1,27 @@
#ifndef BITSHAREDOWNLOAD_H #ifndef BITSHAREDOWNLOAD_H
#define BITSHAREDOWNLOAD_H #define BITSHAREDOWNLOAD_H
#include "./httpdownloadwithinforequst.h" #include "./httpdownloadwithinforequst.h"
namespace Network { namespace Network {
class BitshareDownload : public HttpDownloadWithInfoRequst class BitshareDownload : public HttpDownloadWithInfoRequst
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BitshareDownload(const QUrl &url, QObject *parent = nullptr); explicit BitshareDownload(const QUrl &url, QObject *parent = nullptr);
virtual Download *infoRequestDownload(bool &success, QString &reasonForFail); virtual Download *infoRequestDownload(bool &success, QString &reasonForFail);
virtual QString typeName() const; virtual QString typeName() const;
protected: protected:
virtual void evalVideoInformation(Download *, QBuffer *videoInfoBuffer); virtual void evalVideoInformation(Download *, QBuffer *videoInfoBuffer);
private: private:
QByteArray m_postData; QByteArray m_postData;
}; };
} }
#endif // BITSHAREDOWNLOAD_H #endif // BITSHAREDOWNLOAD_H

View File

@ -1,111 +1,111 @@
#include "./filenukedownload.h" #include "./filenukedownload.h"
#include "../application/utils.h" #include "../application/utils.h"
#include <QUrlQuery> #include <QUrlQuery>
using namespace Application; using namespace Application;
namespace Network { namespace Network {
/*! /*!
* \class FileNukeDownload * \class FileNukeDownload
* \brief Download implementation for specific hoster. * \brief Download implementation for specific hoster.
* \remarks Not maintained anymore. * \remarks Not maintained anymore.
*/ */
/*! /*!
* \brief Constructs a new FileNukeDownload for the specified \a url. * \brief Constructs a new FileNukeDownload for the specified \a url.
*/ */
FileNukeDownload::FileNukeDownload(const QUrl &url, QObject *parent) : FileNukeDownload::FileNukeDownload(const QUrl &url, QObject *parent) :
HttpDownloadWithInfoRequst(url, parent), HttpDownloadWithInfoRequst(url, parent),
m_currentStep(0) m_currentStep(0)
{ } { }
void FileNukeDownload::evalVideoInformation(Download *, QBuffer *videoInfoBuffer) void FileNukeDownload::evalVideoInformation(Download *, QBuffer *videoInfoBuffer)
{ {
videoInfoBuffer->seek(0); videoInfoBuffer->seek(0);
QString videoInfo(videoInfoBuffer->readAll()); QString videoInfo(videoInfoBuffer->readAll());
int pos; int pos;
QString str; QString str;
QString id; QString id;
QString fname; QString fname;
switch(m_currentStep) { switch(m_currentStep) {
case 0: case 0:
if(substring(videoInfo, str, 0, QStringLiteral("<h1>"), QStringLiteral("<")) > 0 && !str.isEmpty()) { if(substring(videoInfo, str, 0, QStringLiteral("<h1>"), QStringLiteral("<")) > 0 && !str.isEmpty()) {
setTitle(str); setTitle(str);
} }
substring(videoInfo, id, 0, QStringLiteral("<input type=\"hidden\" name=\"id\" value=\""), QStringLiteral("\"")); substring(videoInfo, id, 0, QStringLiteral("<input type=\"hidden\" name=\"id\" value=\""), QStringLiteral("\""));
substring(videoInfo, fname, 0, QStringLiteral("<input type=\"hidden\" name=\"fname\" value=\""), QStringLiteral("\"")); substring(videoInfo, fname, 0, QStringLiteral("<input type=\"hidden\" name=\"fname\" value=\""), QStringLiteral("\""));
if(id.isEmpty()) { if(id.isEmpty()) {
reportInitiated(false, tr("Couldn't find the id.")); reportInitiated(false, tr("Couldn't find the id."));
} else if(fname.isEmpty()) { } else if(fname.isEmpty()) {
reportInitiated(false, tr("Couldn't find the file name.")); reportInitiated(false, tr("Couldn't find the file name."));
} else { } else {
QUrlQuery query; QUrlQuery query;
query.addQueryItem(QStringLiteral("op1"), QStringLiteral("download1")); query.addQueryItem(QStringLiteral("op1"), QStringLiteral("download1"));
query.addQueryItem(QStringLiteral("user_login"), QString()); query.addQueryItem(QStringLiteral("user_login"), QString());
query.addQueryItem(QStringLiteral("id"), id); query.addQueryItem(QStringLiteral("id"), id);
query.addQueryItem(QStringLiteral("fname"), fname); query.addQueryItem(QStringLiteral("fname"), fname);
query.addQueryItem(QStringLiteral("referer"), QString()); query.addQueryItem(QStringLiteral("referer"), QString());
query.addQueryItem(QStringLiteral("method_free"), QStringLiteral("Free")); query.addQueryItem(QStringLiteral("method_free"), QStringLiteral("Free"));
m_postData.append(query.toString(QUrl::FullyEncoded)); m_postData.append(query.toString(QUrl::FullyEncoded));
++m_currentStep; ++m_currentStep;
doInit(); doInit();
} }
break; break;
case 1: case 1:
pos = videoInfo.indexOf(QLatin1String(";return p}(")); pos = videoInfo.indexOf(QLatin1String(";return p}("));
if(pos > 0) { if(pos > 0) {
pos = videoInfo.indexOf(QLatin1String(",'"), pos + 1); pos = videoInfo.indexOf(QLatin1String(",'"), pos + 1);
if(pos > 0) { if(pos > 0) {
substring(videoInfo, str, pos, QStringLiteral("'"), QStringLiteral("'")); substring(videoInfo, str, pos, QStringLiteral("'"), QStringLiteral("'"));
QStringList parts = str.split(QChar('|'), QString::KeepEmptyParts); QStringList parts = str.split(QChar('|'), QString::KeepEmptyParts);
if(parts.count() >= 21) { if(parts.count() >= 21) {
addDownloadUrl(tr("H.264/AAC/MP4"), QUrl(QStringLiteral("http://%1.%2.%3.%4/d/%5/%6.%7").arg(parts.at(8), parts.at(7), parts.at(6), parts.at(5), parts.at(20), parts.at(19), parts.at(18)))); addDownloadUrl(tr("H.264/AAC/MP4"), QUrl(QStringLiteral("http://%1.%2.%3.%4/d/%5/%6.%7").arg(parts.at(8), parts.at(7), parts.at(6), parts.at(5), parts.at(20), parts.at(19), parts.at(18))));
reportInitiated(true); reportInitiated(true);
} else } else
reportInitiated(false, tr("Download link info is incomplete.")); reportInitiated(false, tr("Download link info is incomplete."));
} else } else
reportInitiated(false, tr("Download link info is missing (2).")); reportInitiated(false, tr("Download link info is missing (2)."));
} else } else
reportInitiated(false, tr("Download link info is missing (1).")); reportInitiated(false, tr("Download link info is missing (1)."));
break; break;
default: default:
reportInitiated(false, tr("Internal error.")); reportInitiated(false, tr("Internal error."));
} }
} }
Download *FileNukeDownload::infoRequestDownload(bool &success, QString &reasonForFail) Download *FileNukeDownload::infoRequestDownload(bool &success, QString &reasonForFail)
{ {
HttpDownload *download; HttpDownload *download;
switch(m_currentStep) { switch(m_currentStep) {
case 0: case 0:
download = new HttpDownload(initialUrl()); download = new HttpDownload(initialUrl());
success = true; success = true;
return download; return download;
case 1: case 1:
download = new HttpDownload(initialUrl()); download = new HttpDownload(initialUrl());
download->setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); download->setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
download->setMethod(HttpDownloadMethod::Post); download->setMethod(HttpDownloadMethod::Post);
download->setPostData(m_postData); download->setPostData(m_postData);
success = true; success = true;
return download; return download;
case 2: case 2:
download = new HttpDownload(m_playlistUrl); download = new HttpDownload(m_playlistUrl);
success = true; success = true;
return download; return download;
default: default:
reasonForFail = tr("Internal error."); reasonForFail = tr("Internal error.");
success = false; success = false;
return nullptr; return nullptr;
} }
} }
QString FileNukeDownload::typeName() const QString FileNukeDownload::typeName() const
{ {
return tr("FileNuke"); return tr("FileNuke");
} }
} }

View File

@ -1,29 +1,29 @@
#ifndef FILENUKE_DOWNLOAD_H #ifndef FILENUKE_DOWNLOAD_H
#define FILENUKE_DOWNLOAD_H #define FILENUKE_DOWNLOAD_H
#include "./httpdownloadwithinforequst.h" #include "./httpdownloadwithinforequst.h"
namespace Network { namespace Network {
class FileNukeDownload : public HttpDownloadWithInfoRequst class FileNukeDownload : public HttpDownloadWithInfoRequst
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit FileNukeDownload(const QUrl &url, QObject *parent = nullptr); explicit FileNukeDownload(const QUrl &url, QObject *parent = nullptr);
Download *infoRequestDownload(bool &success, QString &reasonForFail); Download *infoRequestDownload(bool &success, QString &reasonForFail);
QString typeName() const; QString typeName() const;
protected: protected:
void evalVideoInformation(Download *, QBuffer *videoInfoBuffer); void evalVideoInformation(Download *, QBuffer *videoInfoBuffer);
private: private:
int m_currentStep; int m_currentStep;
QByteArray m_postData; QByteArray m_postData;
QUrl m_playlistUrl; QUrl m_playlistUrl;
}; };
} }
#endif // FILENUKE_H #endif // FILENUKE_H