| 1 | /***************************************************************************** |
| 2 | ** QNapi |
| 3 | ** Copyright (C) 2008-2017 Piotr KrzemiĆski <[email protected]> |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or modify |
| 6 | ** it under the terms of the GNU General Public License as published by |
| 7 | ** the Free Software Foundation; either version 2 of the License, or |
| 8 | ** (at your option) any later version. |
| 9 | ** |
| 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 12 | ** |
| 13 | *****************************************************************************/ |
| 14 | |
| 15 | #include "napiprojektdownloadengine.h"cxx . . $ `<file>/libqnapi/src/engines/napiprojektdownloadengine.h`/ |
| 16 | #include "subtitlelanguage.h"cxx . . $ `<file>/libqnapi/src/subtitlelanguage.h`/ |
| 17 | #include "utils/synchttp.h"cxx . . $ `<file>/libqnapi/src/utils/synchttp.h`/ |
| 18 | |
| 19 | #include <cmath> |
| 20 | |
| 21 | #include <QCryptographicHash> |
| 22 | #include <QNetworkReply> |
| 23 | #include <QNetworkRequest> |
| 24 | #include <QProcess> |
| 25 | #include <QUrl> |
| 26 | |
| 27 | #ifdef Q_OS_WIN // for SetFileAttributes |
| 28 | #include <qt_windows.h> |
| 29 | #endif |
| 30 | |
| 31 | // This sadly has to be added in order to build under VS >= 2005 |
| 32 | #ifdef _MSC_VER |
| 33 | // from Visual Studio 2005 onwards |
| 34 | // https://msdn.microsoft.com/en-us/library/2ts7cx93%28v=vs.80%29.aspx |
| 35 | #include <stdio.h> |
| 36 | #define snprintf _snprintf_s |
| 37 | #endif |
| 38 | |
| 39 | namespace NapiProjektDownloadEngineConstscxx . . $ NapiProjektDownloadEngineConsts/ { |
| 40 | const unsigned long NAPI_10MBcxx . . $ NapiProjektDownloadEngineConsts/NAPI_10MB. = 10485760; |
| 41 | |
| 42 | const QStringcxx . . $ QString# napiZipPasswordcxx . . $ NapiProjektDownloadEngineConsts/napiZipPassword. = "iBlm8NTigvru0Jr0"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 43 | const QStringcxx . . $ QString# napiDownloadUrlTplcxx . . $ NapiProjektDownloadEngineConsts/napiDownloadUrlTpl. = |
| 44 | "http://www.napiprojekt.pl/unit_napisy/dl.php"cxx . . $ QString#QString(85c52e162fed56f9). |
| 45 | "?l=%1&f=%2&t=%3&v=other&kolejka=false&nick=%4&pass=%5&napios=%6"; |
| 46 | const QStringcxx . . $ QString# napiCheckUserUrlTplcxx . . $ NapiProjektDownloadEngineConsts/napiCheckUserUrlTpl. = |
| 47 | "http://www.napiprojekt.pl/users_check.php?nick=%1&pswd=%2"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 48 | const QStringcxx . . $ QString# napiUploadUrlTplcxx . . $ NapiProjektDownloadEngineConsts/napiUploadUrlTpl. = |
| 49 | "http://www.napiprojekt.pl/unit_napisy/upload.php"cxx . . $ QString#QString(85c52e162fed56f9). |
| 50 | "?m_length=%1&m_resolution=%2x%3&m_fps=%4&m_hash=%5&m_filesize=%6"; |
| 51 | const QStringcxx . . $ QString# napiUploadUrlSimpleTplcxx . . $ NapiProjektDownloadEngineConsts/napiUploadUrlSimpleTpl. = |
| 52 | "http://www.napiprojekt.pl/unit_napisy/upload.php"cxx . . $ QString#QString(85c52e162fed56f9). |
| 53 | "?m_hash=%5&m_filesize=%6"; |
| 54 | const QStringcxx . . $ QString# napiReportBadUrlTplcxx . . $ NapiProjektDownloadEngineConsts/napiReportBadUrlTpl. = |
| 55 | "http://www.napiprojekt.pl/unit_napisy/zlenapisyadd.php"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 56 | } // namespace NapiProjektDownloadEngineConsts |
| 57 | |
| 58 | using namespace NapiProjektDownloadEngineConsts; |
| 59 | |
| 60 | SubtitleDownloadEngineMetadatacxx . . $ SubtitleDownloadEngineMetadata# NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::metadatacxx . . $ NapiProjektDownloadEngine#metadata. = |
| 61 | SubtitleDownloadEngineMetadatacxx . . $ SubtitleDownloadEngineMetadata#SubtitleDownloadEngineMetadata(274a86c14fe7729a).( |
| 62 | "NapiProjekt"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 63 | QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("<b>www.napiprojekt.pl</b> subtitles download engine"), |
| 64 | justcxx . . $ just(62f398f3cea75aa5).(QUrlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb).("http://www.napiprojekt.pl/rejestracja"cxx . . $ QString#QString(85c52e162fed56f9).)), nothingcxx . . $ nothing(adb11f779fe07013).()); |
| 65 | |
| 66 | NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#NapiProjektDownloadEngine(e7bc3b5e500dcfd7).( |
| 67 | const QStringcxx . . $ QString# &tmpPath, const EngineConfigcxx . . $ EngineConfig# &config, |
| 68 | const QSharedPointercxx . . $ QSharedPointer#<const P7ZipDecodercxx . . $ P7ZipDecoder#> &p7zipDecoder) |
| 69 | : SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#(tmpPath), |
| 70 | engineConfigcxx . . $ NapiProjektDownloadEngine#engineConfig.(config), |
| 71 | p7zipDecodercxx . . $ NapiProjektDownloadEngine#p7zipDecoder.(p7zipDecoder) {} |
| 72 | |
| 73 | NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::~cxx . . $ NapiProjektDownloadEngine#`~NapiProjektDownloadEngine`(49f6e7a06ebc5aa8).NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#() { cleanupcxx . . $ NapiProjektDownloadEngine#cleanup(49f6e7a06ebc5aa8).(); } |
| 74 | |
| 75 | SubtitleDownloadEngineMetadatacxx . . $ SubtitleDownloadEngineMetadata# NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::metacxx . . $ NapiProjektDownloadEngine#meta(f92abb37f8393eac).() const { |
| 76 | return NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::metadatacxx . . $ NapiProjektDownloadEngine#metadata.; |
| 77 | } |
| 78 | |
| 79 | const char *const *NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::enginePixmapDatacxx . . $ NapiProjektDownloadEngine#enginePixmapData(69503a37793e448d).() const { |
| 80 | return NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::pixmapDatacxx . . $ NapiProjektDownloadEngine#pixmapData.; |
| 81 | } |
| 82 | |
| 83 | QStringcxx . . $ QString# NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::checksumcxx . . $ NapiProjektDownloadEngine#checksum(f7f320d754b8fd09).(QStringcxx . . $ QString# filename) { |
| 84 | if (filename.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) filename =cxx . . $ QString#`operator=`(6a89d0b7f4d2681c). moviecxx . . $ SubtitleDownloadEngine#movie.; |
| 85 | return (cxx . . $ QString#QString(3520e46b33348bf6).checkSumcxx . . $ SubtitleDownloadEngine#checkSum. =cxx . . $ QString#`operator=`(7b76e6691bca1027). checksumcxx . . $ NapiProjektDownloadEngine#checksum(afa4754008a97e3f).(filenamecxx . . $ QString#QString(3520e46b33348bf6)., true)); |
| 86 | } |
| 87 | |
| 88 | bool NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::lookForSubtitlescxx . . $ NapiProjektDownloadEngine#lookForSubtitles(7dc6c9a0b6a7270f).(QStringcxx . . $ QString# lang) { |
| 89 | Maybecxx . . $ Maybe#<QStringcxx . . $ QString#> tmpPackedFileOpt = downloadByLangAndChecksumcxx . . $ NapiProjektDownloadEngine#downloadByLangAndChecksum(1dd7ed6bda84349f).(langcxx . . $ QString#QString(3520e46b33348bf6)., checkSumcxx . . $ QString#QString(3520e46b33348bf6).); |
| 90 | |
| 91 | if (!tmpPackedFileOpt) { |
| 92 | return false; |
| 93 | } |
| 94 | |
| 95 | QStringcxx . . $ QString# tmpPackedFile = tmpPackedFileOptcxx . . $ QString#QString(e1217c004a86c950)..valuecxx . . $ Maybe#value(8f5363d873dd4781).(); |
| 96 | |
| 97 | subtitlesListcxx . . $ SubtitleDownloadEngine#subtitlesList. <<cxx . . $ QList#`operator<<`(309d1580d8f5dc58). SubtitleInfocxx . . $ SubtitleInfo#SubtitleInfo(b0b7d91110c9239c).(langcxx . . $ QString#QString(3520e46b33348bf6)., metacxx . . $ QString#QString(e1217c004a86c950).().namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).(), tmpPackedFilecxx . . $ QString#QString(3520e46b33348bf6)., |
| 98 | QFileInfocxx . . $ QString#QString(e1217c004a86c950).(moviecxx . . $ SubtitleDownloadEngine#movie.).completeBaseNamecxx . . $ QFileInfo#completeBaseName(6ef7b6c27b00b43d).(), ""cxx . . $ QString#QString(e1217c004a86c950)., "txt"cxx . . $ QString#QString(e1217c004a86c950)., |
| 99 | SUBTITLE_UNKNOWNcxx . . $ SUBTITLE_UNKNOWN.); |
| 100 | return true; |
| 101 | } |
| 102 | |
| 103 | QListcxx . . $ QList#<SubtitleInfocxx . . $ SubtitleInfo#> NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::listSubtitlescxx . . $ NapiProjektDownloadEngine#listSubtitles(b615605bf031efa3).() { |
| 104 | return subtitlesListcxx . . $ QList#QList(3d2301cfd89f773a).; |
| 105 | } |
| 106 | |
| 107 | bool NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::downloadcxx . . $ NapiProjektDownloadEngine#download(786ace61d67fbe7f).(QUuidcxx . . $ QUuid# id) { |
| 108 | Maybecxx . . $ Maybe#<SubtitleInfocxx . . $ SubtitleInfo#> ms = resolveByIdcxx . . $ SubtitleDownloadEngine#resolveById(efe4ef1cfff5bbe2).(id); |
| 109 | |
| 110 | return ms && QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(ms.valuecxx . . $ Maybe#value(8f5363d873dd4781).().sourceLocationcxx . . $ SubtitleInfo#sourceLocation.); |
| 111 | } |
| 112 | |
| 113 | Maybecxx . . $ Maybe#<QStringcxx . . $ QString#> NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::downloadByLangAndChecksumcxx . . $ NapiProjektDownloadEngine#downloadByLangAndChecksum(1dd7ed6bda84349f).( |
| 114 | QStringcxx . . $ QString# lang, QStringcxx . . $ QString# checksum) const { |
| 115 | if (checksum.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) return nothingcxx . . $ nothing(adb11f779fe07013).(); |
| 116 | |
| 117 | QStringcxx . . $ QString# urlTxt = napiDownloadUrlTplcxx . . $ QString#QString(e1217c004a86c950)..argcxx . . $ QString#arg(bc823072288cbbb5).(npLangWrappercxx . . $ NapiProjektDownloadEngine#npLangWrapper(f6736f2569bd2ccc).(langcxx . . $ QString#QString(3520e46b33348bf6).)) |
| 118 | .argcxx . . $ QString#arg(bc823072288cbbb5).(checksum) |
| 119 | .argcxx . . $ QString#arg(bc823072288cbbb5).(npFDigestcxx . . $ NapiProjektDownloadEngine#npFDigest(5555d9024dcf93fb).(checksum)) |
| 120 | .argcxx . . $ QString#arg(bc823072288cbbb5).(engineConfigcxx . . $ NapiProjektDownloadEngine#engineConfig..nickcxx . . $ EngineConfig#nick(6ef7b6c27b00b43d).()) |
| 121 | .argcxx . . $ QString#arg(bc823072288cbbb5).(engineConfigcxx . . $ NapiProjektDownloadEngine#engineConfig..passwordcxx . . $ EngineConfig#password(6ef7b6c27b00b43d).()) |
| 122 | .argcxx . . $ QString#arg(bc823072288cbbb5).(napiOScxx . . $ NapiProjektDownloadEngine#napiOS(6ef7b6c27b00b43d).()); |
| 123 | |
| 124 | QUrlcxx . . $ QUrl# urlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb).(urlTxt); |
| 125 | |
| 126 | SyncHTTPcxx . . $ SyncHTTP# httpcxx . . $ SyncHTTP#SyncHTTP(49f6e7a06ebc5aa8).; |
| 127 | QNetworkReplycxx . . $ QNetworkReply# *reply = http.syncGetcxx . . $ SyncHTTP#syncGet(d12587da35e4fcd1).(QNetworkRequestcxx . . $ QNetworkRequest#(url)); |
| 128 | |
| 129 | if (reply->errorcxx . . $ QNetworkReply#error(c916dcceceba1ae7).() != QNetworkReplycxx . . $ QNetworkReply#::NoErrorcxx . . $ QNetworkReply#NoError.) return nothingcxx . . $ nothing(adb11f779fe07013).(); |
| 130 | |
| 131 | QByteArraycxx . . $ QByteArray# buffer = replycxx . . $ QByteArray#QByteArray(3203d9f8f38841a4).->readAllcxx . . $ QIODevice#readAll(b3c286cec66e09f4).(); |
| 132 | |
| 133 | if (buffer.indexOfcxx . . $ QByteArray#indexOf(1fcae3292dcee438).("NPc") == 0) return nothingcxx . . $ nothing(adb11f779fe07013).(); |
| 134 | |
| 135 | QStringcxx . . $ QString# tmpPackedFile = generateTmpPathcxx . . $ QString#QString(e1217c004a86c950).(); |
| 136 | |
| 137 | QFilecxx . . $ QFile# filecxx . . $ QFile#QFile(3520e46b33348bf6).(tmpPackedFile); |
| 138 | if (file.existscxx . . $ QFile#exists(50ce9a9e25b4a850).()) file.removecxx . . $ QFile#remove(c9857a73d68e59ba).(); |
| 139 | if (!file.opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QFlags#QFlags(9b289cee16747614).::WriteOnlycxx . . $ QIODevice#WriteOnly.)) return nothingcxx . . $ nothing(adb11f779fe07013).(); |
| 140 | |
| 141 | long r = file.writecxx . . $ QIODevice#write(4ee2750a0be83987).(buffer); |
| 142 | file.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 143 | |
| 144 | if (r < 0) return nothingcxx . . $ nothing(adb11f779fe07013).(); |
| 145 | |
| 146 | return justcxx . . $ just(62f398f3cea75aa5).(tmpPackedFile); |
| 147 | } |
| 148 | |
| 149 | bool NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::unpackcxx . . $ NapiProjektDownloadEngine#unpack(786ace61d67fbe7f).(QUuidcxx . . $ QUuid# id) { |
| 150 | Maybecxx . . $ Maybe#<SubtitleInfocxx . . $ SubtitleInfo#> ms = resolveByIdcxx . . $ SubtitleDownloadEngine#resolveById(efe4ef1cfff5bbe2).(id); |
| 151 | if (!ms) return false; |
| 152 | |
| 153 | if (!QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(moviecxx . . $ SubtitleDownloadEngine#movie.)) return false; |
| 154 | subtitlesTmpcxx . . $ SubtitleDownloadEngine#subtitlesTmp. =cxx . . $ QString#`operator=`(6a89d0b7f4d2681c). tmpPathcxx . . $ SubtitleDownloadEngine#tmpPath. +cxx . . $ operator+(3d22f08efddf8107). "/" +cxx . . $ operator+(fab9b4f80031f353). checkSumcxx . . $ SubtitleDownloadEngine#checkSum. +cxx . . $ operator+(3d22f08efddf8107). ".txt"; |
| 155 | |
| 156 | if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(subtitlesTmpcxx . . $ SubtitleDownloadEngine#subtitlesTmp.)) QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(subtitlesTmpcxx . . $ SubtitleDownloadEngine#subtitlesTmp.); |
| 157 | |
| 158 | QStringcxx . . $ QString# archivePath = mscxx . . $ QString#QString(e1217c004a86c950)..valuecxx . . $ Maybe#value(8f5363d873dd4781).().sourceLocationcxx . . $ SubtitleInfo#sourceLocation.; |
| 159 | |
| 160 | bool unpacked = p7zipDecodercxx . . $ NapiProjektDownloadEngine#p7zipDecoder.->cxx . . $ QSharedPointer#`operator->`(5a2a78a048fb49a8).unpackSecureArchiveFilescxx . . $ P7ZipDecoder#unpackSecureArchiveFiles(b62c89774989cffa).( |
| 161 | archivePath, napiZipPasswordcxx . . $ NapiProjektDownloadEngineConsts/napiZipPassword., tmpPathcxx . . $ SubtitleDownloadEngine#tmpPath.); |
| 162 | |
| 163 | return unpacked && QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(subtitlesTmpcxx . . $ SubtitleDownloadEngine#subtitlesTmp.); |
| 164 | } |
| 165 | |
| 166 | void NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::cleanupcxx . . $ NapiProjektDownloadEngine#cleanup(49f6e7a06ebc5aa8).() { |
| 167 | clearSubtitlesListcxx . . $ SubtitleDownloadEngine#clearSubtitlesList(49f6e7a06ebc5aa8).(); |
| 168 | if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(subtitlesTmpcxx . . $ SubtitleDownloadEngine#subtitlesTmp.)) QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(subtitlesTmpcxx . . $ SubtitleDownloadEngine#subtitlesTmp.); |
| 169 | } |
| 170 | |
| 171 | bool NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::checkUsercxx . . $ NapiProjektDownloadEngine#checkUser(edf9e4f73813982f).(const QStringcxx . . $ QString# &nick, |
| 172 | const QStringcxx . . $ QString# &pass) { |
| 173 | SyncHTTPcxx . . $ SyncHTTP# httpcxx . . $ SyncHTTP#SyncHTTP(49f6e7a06ebc5aa8).; |
| 174 | QStringcxx . . $ QString# urlTxt = napiCheckUserUrlTplcxx . . $ QString#QString(e1217c004a86c950)..argcxx . . $ QString#arg(bc823072288cbbb5).(nick).argcxx . . $ QString#arg(bc823072288cbbb5).(pass); |
| 175 | |
| 176 | QUrlcxx . . $ QUrl# urlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb).(urlTxt); |
| 177 | QNetworkReplycxx . . $ QNetworkReply# *reply = http.syncGetcxx . . $ SyncHTTP#syncGet(d12587da35e4fcd1).(QNetworkRequestcxx . . $ QNetworkRequest#(url)); |
| 178 | if (reply->errorcxx . . $ QNetworkReply#error(c916dcceceba1ae7).() != QNetworkReplycxx . . $ QNetworkReply#::NoErrorcxx . . $ QNetworkReply#NoError.) return false; |
| 179 | |
| 180 | QStringcxx . . $ QString# buffercxx . . $ QString#QString(e1217c004a86c950). = replycxx . . $ QString#QString(45672f3c6961a244).->readAllcxx . . $ QIODevice#readAll(b3c286cec66e09f4).(); |
| 181 | if (buffer.indexOfcxx . . $ QString#indexOf(a1e52806cd31c200).("ok"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) return true; |
| 182 | return false; |
| 183 | } |
| 184 | |
| 185 | QStringcxx . . $ QString# NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::checksumcxx . . $ NapiProjektDownloadEngine#checksum(afa4754008a97e3f).(QStringcxx . . $ QString# filename, bool limit10M) { |
| 186 | QFilecxx . . $ QFile# filecxx . . $ QFile#QFile(3520e46b33348bf6).(filename); |
| 187 | QByteArraycxx . . $ QByteArray# fileArraycxx . . $ QByteArray#QByteArray(49f6e7a06ebc5aa8).; |
| 188 | |
| 189 | if (!file.opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QFlags#QFlags(9b289cee16747614).::ReadOnlycxx . . $ QIODevice#ReadOnly.)) return QStringcxx . . $ QString#QString(e1217c004a86c950).(""); |
| 190 | |
| 191 | fileArray =cxx . . $ QByteArray#`operator=`(d0b0ff031ded1fc3). limit10M ? filecxx . . $ QByteArray#QByteArray(3203d9f8f38841a4)..readcxx . . $ QIODevice#read(1117a85f2fd4e5c8).(NAPI_10MBcxx . . $ NapiProjektDownloadEngineConsts/NAPI_10MB.) : filecxx . . $ QByteArray#QByteArray(3203d9f8f38841a4)..readAllcxx . . $ QIODevice#readAll(b3c286cec66e09f4).(); |
| 192 | file.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 193 | |
| 194 | QByteArraycxx . . $ QByteArray# b = QCryptographicHashcxx . . $ QByteArray#QByteArray(3203d9f8f38841a4).::hashcxx . . $ QCryptographicHash#hash(595c36016fa0b4ef).(fileArray, QCryptographicHashcxx . . $ QCryptographicHash#::Md5cxx . . $ QCryptographicHash#Md5.); |
| 195 | fileArray.clearcxx . . $ QByteArray#clear(49f6e7a06ebc5aa8).(); |
| 196 | |
| 197 | QStringcxx . . $ QString# outcxx . . $ QString#QString(49f6e7a06ebc5aa8).; |
| 198 | char next[3]; |
| 199 | |
| 200 | for (int i = 0; i < 16; i++) { |
| 201 | snprintf(next, 3, "%.2x", static_cast<unsigned char>(b[cxx . . $ QByteArray#`operator[]`(6eaff86c84670f1a).i])); |
| 202 | out +=cxx . . $ QString#`operator+=`(d02845eef0c33901). next; |
| 203 | } |
| 204 | |
| 205 | checkSumcxx . . $ SubtitleDownloadEngine#checkSum. =cxx . . $ QString#`operator=`(6a89d0b7f4d2681c). out; |
| 206 | return checkSumcxx . . $ QString#QString(3520e46b33348bf6).; |
| 207 | } |
| 208 | |
| 209 | QStringcxx . . $ QString# NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::npFDigestcxx . . $ NapiProjektDownloadEngine#npFDigest(5555d9024dcf93fb).(const QStringcxx . . $ QString# &input) const { |
| 210 | if (input.sizecxx . . $ QString#size(455f465bc33b4cdf).() != 32) returncxx . . $ QString#QString(e1217c004a86c950). ""cxx . . $ QString#QString(85c52e162fed56f9).; |
| 211 | |
| 212 | int idx[] = {0xe, 0x3, 0x6, 0x8, 0x2}, mul[] = {2, 2, 5, 4, 3}, |
| 213 | add[] = {0x0, 0xd, 0x10, 0xb, 0x5}, a, m, i, t, v; |
| 214 | |
| 215 | QStringcxx . . $ QString# bcxx . . $ QString#QString(49f6e7a06ebc5aa8).; |
| 216 | char tmp[2] = {0, 0}; |
| 217 | |
| 218 | for (int j = 0; j <= 4; j++) { |
| 219 | a = add[j]; |
| 220 | m = mul[j]; |
| 221 | i = idx[j]; |
| 222 | |
| 223 | tmp[0] = input[cxx . . $ QString#`operator[]`(13af7ae5a875439e).i].toLatin1cxx . . $ QChar#toLatin1(1b8b762cbef9c2c9).(); |
| 224 | t = a + static_cast<int>(strtol(tmp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 16)); |
| 225 | v = static_cast<int>(strtol(input.midcxx . . $ QString#mid(44b7563da18aea72).(t, 2).toLocal8Bitcxx . . $ QString#toLocal8Bit(7c2073558a834e49).(), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 16)); |
| 226 | |
| 227 | snprintf(tmp, 2, "%x", (v * m) % 0x10); |
| 228 | b +=cxx . . $ QString#`operator+=`(d02845eef0c33901). tmp; |
| 229 | } |
| 230 | |
| 231 | return bcxx . . $ QString#QString(e1217c004a86c950).; |
| 232 | } |
| 233 | |
| 234 | QStringcxx . . $ QString# NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::npLangWrappercxx . . $ NapiProjektDownloadEngine#npLangWrapper(f6736f2569bd2ccc).(QStringcxx . . $ QString# lang) const { |
| 235 | lang =cxx . . $ QString#`operator=`(7b76e6691bca1027). SubtitleLanguagecxx . . $ SubtitleLanguage#(langcxx . . $ QString#QString(3520e46b33348bf6).).toTwoLettercxx . . $ SubtitleLanguage#toTwoLetter(4365c3963150523e).().toUppercxx . . $ QString#toUpper(30b3b70527b1c61a).(); |
| 236 | |
| 237 | if (lang ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "EN") lang =cxx . . $ QString#`operator=`(d02845eef0c33901). "ENG"; |
| 238 | |
| 239 | return langcxx . . $ QString#QString(e1217c004a86c950).; |
| 240 | } |
| 241 | |
| 242 | QStringcxx . . $ QString# NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::napiOScxx . . $ NapiProjektDownloadEngine#napiOS(6ef7b6c27b00b43d).() const { |
| 243 | #if defined(Q_OS_WIN) |
| 244 | return "Windows"; |
| 245 | #elif defined(Q_OS_MAC) |
| 246 | return "Mac OS X"; |
| 247 | #else |
| 248 | returncxx . . $ QString#QString(e1217c004a86c950). "Linux/UNIX"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 249 | #endif |
| 250 | } |
| 251 | |
| 252 | const char *const NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::pixmapDatacxx . . $ NapiProjektDownloadEngine#pixmapData.[] = { |
| 253 | "16 16 5 1", " c #FFFFFF", ". c #000080", |
| 254 | "+ c #0052CC", "@ c #005CE6", "# c #BFD9FF", |
| 255 | " ... ", " ... . ", " ... ... ", |
| 256 | " ... .... ", " ... .... ", " ... .... ", |
| 257 | ".. .... ", "....+ ", " ...............", |
| 258 | " . . . . . . . .", " ...............", " .@@####@####@@.", |
| 259 | " .@@#@@#@#@@#@@.", " .@@#@@#@####@@.", " .@@#@@#@#@@@@@.", |
| 260 | " ..............."}; |