diff options
Diffstat (limited to 'src/findsubtitles/osparser.cpp')
-rw-r--r-- | src/findsubtitles/osparser.cpp | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/src/findsubtitles/osparser.cpp b/src/findsubtitles/osparser.cpp index f526007..3708704 100644 --- a/src/findsubtitles/osparser.cpp +++ b/src/findsubtitles/osparser.cpp @@ -18,8 +18,8 @@ #include "osparser.h" #include <QDomDocument> -#include <QFile> -#include <QDataStream> +//#include <QFile> +//#include <QDataStream> OSParser::OSParser() { } @@ -54,7 +54,12 @@ bool OSParser::parseXml(QByteArray text) { OSSubtitle sub; sub.releasename = subtitle.firstChildElement("releasename").text(); - sub.link = base_url + subtitle.firstChildElement("download").text(); + QString path = subtitle.firstChildElement("download").text(); + if (path.contains("http://")) { + sub.link = subtitle.firstChildElement("download").text(); + } else { + sub.link = base_url + subtitle.firstChildElement("download").text(); + } sub.detail = subtitle.firstChildElement("detail").text(); sub.date = subtitle.firstChildElement("subadddate").text(); sub.rating = subtitle.firstChildElement("subrating").text(); @@ -75,32 +80,3 @@ bool OSParser::parseXml(QByteArray text) { return true; } -// From the patch by Kamil Dziobek turbos11(at)gmail.com -// (c) Kamil Dziobek turbos11(at)gmail.com | BSD or GPL or public domain -QString OSParser::calculateHash(QString filename) { - QFile file(filename); - - if (!file.exists()) { - qWarning("OSParser:calculateHash: error hashing file. File doesn't exist."); - return QString(); - } - - file.open(QIODevice::ReadOnly); - QDataStream in(&file); - in.setByteOrder(QDataStream::LittleEndian); - quint64 size=file.size (); - quint64 hash=size; - quint64 a; - for(int i = 0; i < 8192; i++) { - in >> a ; hash += a; - }; - file.seek(size-65536); - for(int i = 0; i < 8192; i++) { - in >> a ; hash += a; - }; - - QString hexhash = QString("%1").arg(hash, 16, 16, QChar('0')); - - return hexhash; -} - |