-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Playback priority #840
Playback priority #840
Conversation
I think we need to resume downloads when the torrent you are watching finished downloading. |
Good catch @noamokman! |
@noamokman, now it resumes on |
Awesome! Great work 😄 |
Thanks :) |
@feross if this is still needed I can spend some time fixing conflicts. |
Exactly what I want @codealchemist nice work |
Thanks @Toinouu! |
@codealchemist Sorry we missed this. Reviewing today |
No worries @dcposch :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice feature, thanks for making it!
I found one thing that looks like a bug and others that could be simplified.
Feel free to merge once you're confident that it's fixed.
|
||
// if torrent was paused add it to paused torrents collection | ||
// we will use this collection to resume downloading when playback stops | ||
if (wasPaused) this.state.saved.pausedTorrents.push(torrent.infoHash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this, the pausedTorrents
array will contain all torrents which were paused before.
However, below, we use that same array to resume torrents. We want to resume the ones that were running before, right?
} | ||
|
||
resumePausedTorrents () { | ||
this.state.saved.pausedTorrents.map((infoHash) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, I'd consider renaming pausedTorrents
to torrentsToResume
.
There are two kinds of paused torrents:
- Torrents which the user paused manually, which we should not resume
- Torrents which were paused automatically as part of playback priority
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll use torrentsToResume
, which is a lot clearer.
Thanks!
if (playSound) sound.play('ENABLE') | ||
} | ||
|
||
pauseTorrent (torrentSummary, playSound, filter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd definitely put a short comment here explaining what filter
does.
label={'Highest Playback Priority'} | ||
onCheck={this.handleHighestPlaybackPriorityChange} | ||
/> | ||
<p>Pauses all active torrents to allow playback to use all of the available bandwidth.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -103,18 +103,73 @@ module.exports = class TorrentListController { | |||
} | |||
} | |||
|
|||
pauseAll ({filter, excluded}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about making this
prioritizeTorrent (infohash) {
...the filter arg is always just active torrents. Don't know if we need the ability to pause torrents by arbitrary JSON filter. The excluded arg is always an array containing a single infohash: the torrent we're playing.
Thanks a lot for your review @dcposch! |
# Conflicts: # src/renderer/controllers/playback-controller.js # src/renderer/controllers/torrent-list-controller.js # src/renderer/main.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there!
I'd like to do more testing before saying its OK to be merged.
Any help is really welcome :)
} | ||
|
||
resumePausedTorrents () { | ||
this.state.saved.pausedTorrents.map((infoHash) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll use torrentsToResume
, which is a lot clearer.
Thanks!
Tests passing. |
🎉 🎉 🎉 🎉 |
Added highest playback priority feature; added highest playback priority checkbox on preferences.
Pauses all active torrents when playback starts, giving all bandwidth to the streaming torrent.
Restores paused torrent when playback stops.
This is the easy way to solve #362.