added highest playback priority feature; added highest playback priority checkbox on preferences.

This commit is contained in:
Alberto Miranda
2016-08-27 03:35:53 -03:00
parent 89e77d34f4
commit bd41bd4db8
4 changed files with 99 additions and 7 deletions

View File

@@ -26,6 +26,15 @@ 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.state.location.go({
url: 'player',
setup: (cb) => {
@@ -300,6 +309,11 @@ module.exports = class PlaybackController {
ipcRenderer.send('onPlayerClose')
// playback priority: resume previously paused downloads
if (this.state.saved.prefs.highestPlaybackPriority) {
dispatch('resumePausedTorrents')
}
this.update()
}
}