Adding duplicate torrent when stopped

This commit is contained in:
Mathias Rasmussen
2016-05-26 20:26:25 +02:00
parent 1b8f180255
commit 7c7780b17e

View File

@@ -878,6 +878,14 @@ function torrentInfoHash (torrentKey, infoHash) {
torrentSummary ? 'existing' : 'new', torrentKey) torrentSummary ? 'existing' : 'new', torrentKey)
if (!torrentSummary) { if (!torrentSummary) {
// Check if another torrent has the same infoHash
var duplicate = state.saved.torrents.find((x) => x.infoHash === infoHash)
if (duplicate) {
duplicate.torrentKey = torrentKey
duplicate.status = 'new'
sound.play('ENABLE')
} else {
torrentSummary = { torrentSummary = {
torrentKey: torrentKey, torrentKey: torrentKey,
status: 'new' status: 'new'
@@ -885,6 +893,7 @@ function torrentInfoHash (torrentKey, infoHash) {
state.saved.torrents.unshift(torrentSummary) state.saved.torrents.unshift(torrentSummary)
sound.play('ADD') sound.play('ADD')
} }
}
torrentSummary.infoHash = infoHash torrentSummary.infoHash = infoHash
update() update()