summaryrefslogtreecommitdiffstats
path: root/torrentparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'torrentparser.cpp')
-rw-r--r--torrentparser.cpp28
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'){