|
|
@ -370,17 +370,11 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) { |
|
|
|
qDebug(" -> Hash: %s", misc::toString(t.info_hash()).c_str()); |
|
|
|
qDebug(" -> Hash: %s", misc::toString(t.info_hash()).c_str()); |
|
|
|
qDebug(" -> Name: %s", t.name().c_str()); |
|
|
|
qDebug(" -> Name: %s", t.name().c_str()); |
|
|
|
QString hash = misc::toQString(t.info_hash()); |
|
|
|
QString hash = misc::toQString(t.info_hash()); |
|
|
|
if(s->find_torrent(t.info_hash()).is_valid()) { |
|
|
|
|
|
|
|
qDebug("/!\\ Torrent is already in download list"); |
|
|
|
|
|
|
|
// Update info Bar
|
|
|
|
|
|
|
|
if(!fromScanDir) { |
|
|
|
|
|
|
|
if(file.startsWith(torrentBackup.path())) { |
|
|
|
if(file.startsWith(torrentBackup.path())) { |
|
|
|
// Torrent hash has changed. This should not be possible but...
|
|
|
|
|
|
|
|
// XXX: Why does this happen sometimes?
|
|
|
|
|
|
|
|
QFileInfo fi(file); |
|
|
|
QFileInfo fi(file); |
|
|
|
QString old_hash = fi.baseName(); |
|
|
|
QString old_hash = fi.baseName(); |
|
|
|
qDebug("Strange, hash changed from %s to %s", old_hash.toUtf8().data(), hash.toUtf8().data()); |
|
|
|
if(old_hash != hash){ |
|
|
|
Q_ASSERT(old_hash != hash); |
|
|
|
qDebug("* ERROR: Strange, hash changed from %s to %s", old_hash.toUtf8().data(), hash.toUtf8().data()); |
|
|
|
QStringList filters; |
|
|
|
QStringList filters; |
|
|
|
filters << old_hash+".*"; |
|
|
|
filters << old_hash+".*"; |
|
|
|
QStringList files = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted); |
|
|
|
QStringList files = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted); |
|
|
@ -391,6 +385,11 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) { |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(s->find_torrent(t.info_hash()).is_valid()) { |
|
|
|
|
|
|
|
qDebug("/!\\ Torrent is already in download list"); |
|
|
|
|
|
|
|
// Update info Bar
|
|
|
|
|
|
|
|
if(!fromScanDir) { |
|
|
|
if(!from_url.isNull()) { |
|
|
|
if(!from_url.isNull()) { |
|
|
|
// If download from url, remove temp file
|
|
|
|
// If download from url, remove temp file
|
|
|
|
QFile::remove(file); |
|
|
|
QFile::remove(file); |
|
|
|