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

View File

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

View File

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

View File

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