diff options
author | Arno <arno@disconnect.de> | 2016-08-20 10:13:44 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2016-08-20 10:13:44 +0200 |
commit | ddd1616f5c310c94214e0ba2629f174c4cf768f3 (patch) | |
tree | 3e8eb94565dead6859a9b3fbd37ce24ec1d39c53 /torrentparser.cpp | |
parent | d47427a2d51fcc7f8e1f8926a706e04ff01603ed (diff) | |
download | ShemovCleaner-ddd1616f5c310c94214e0ba2629f174c4cf768f3.tar.gz ShemovCleaner-ddd1616f5c310c94214e0ba2629f174c4cf768f3.tar.bz2 ShemovCleaner-ddd1616f5c310c94214e0ba2629f174c4cf768f3.zip |
Implement file search
Search for a regular expression in all files of all torrents and select
them.
Diffstat (limited to 'torrentparser.cpp')
-rw-r--r-- | torrentparser.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/torrentparser.cpp b/torrentparser.cpp index 8e09681..cd2fde4 100644 --- a/torrentparser.cpp +++ b/torrentparser.cpp @@ -20,6 +20,34 @@ const QList<QVariant> TorrentParser::parse(){ return retval; } +const QStringList TorrentParser::files(QList<QVariant> data){ + QStringList retval; + foreach(QVariant cur, data){ + if(cur.canConvert<QVariantHash>()){ + QVariantHash h = cur.toHash(); + QHash<QString, QVariant>::const_iterator it = h.constBegin(); + while(it != h.constEnd()){ + if(it.key() == "info"){ + QVariantHash infoD = it.value().toHash(); + if(infoD.contains("files")){ + QVariantList fileList = infoD.value("files").toList(); + foreach(QVariant fn, fileList){ + QVariantHash e = fn.toHash(); + QVariantList path = e.value("path").toList(); + retval << path.last().toString(); + } + }else{ + retval << infoD.value("name").toString(); + } + break; + } + ++it; + } + } + } + return retval; +} + const QVariant TorrentParser::parseObject(){ QChar cur = mData.at(mPos); if(cur == 'i'){ |