not pausing active torrents when playing an already downloaded torrent.

This commit is contained in:
Alberto Miranda
2016-08-27 03:55:23 -03:00
parent e483263d70
commit 4cdc3085ff

View File

@@ -26,14 +26,7 @@ module.exports = class PlaybackController {
// * Stream, if not already fully downloaded
// * If no file index is provided, pick the default file to play
playFile (infoHash, index /* optional */) {
// playback priority: pause all active torrents
if (this.state.saved.prefs.highestPlaybackPriority) {
var params = {
filter: {status: /downloading|seeding/},
excluded: [infoHash]
}
dispatch('pauseAllTorrents', params)
}
this.pauseActiveTorrents(infoHash)
this.state.location.go({
url: 'player',
@@ -47,6 +40,24 @@ module.exports = class PlaybackController {
})
}
pauseActiveTorrents (infoHash) {
// playback priority: pause all active torrents if needed
if (this.state.saved.prefs.highestPlaybackPriority) {
// do not pause active torrents if playing a fully downloaded torrent
var torrentSummary = TorrentSummary.getByKey(this.state, infoHash)
if (torrentSummary.status === 'seeding') {
console.log('--- NOT PAUSING active torrents for already downloaded torrent!')
return
}
var params = {
filter: {status: /downloading|seeding/},
excluded: [infoHash]
}
dispatch('pauseAllTorrents', params)
}
}
// Open a file in OS default app.
openItem (infoHash, index) {
var torrentSummary = TorrentSummary.getByKey(this.state, infoHash)