Fix player flakiness

* No more pause icon in the file list
* Reset state.playng completely after each play
* Fixes #318: false "cannot add dupe torrent" error
This commit is contained in:
DC
2016-04-06 00:58:34 -07:00
parent 8629fc956d
commit 85b6ca0639
4 changed files with 95 additions and 79 deletions

View File

@@ -201,7 +201,7 @@ function TorrentList (state) {
// First, find out how much of the file we've downloaded
var isDone = file.numPiecesPresent === file.numPieces
var progress = ''
if (torrentSummary.progress) {
if (torrentSummary.progress && torrentSummary.progress.files) {
var fileProg = torrentSummary.progress.files[index]
progress = Math.round(100 * fileProg.numPiecesPresent / fileProg.numPieces) + '%'
}
@@ -211,10 +211,7 @@ function TorrentList (state) {
var icon
var rowClass = ''
var handleClick
if (state.playing.infoHash === infoHash && state.playing.fileIndex === index) {
icon = 'pause_arrow' /* playing? add option to pause */
handleClick = undefined // TODO: pause audio
} else if (TorrentPlayer.isPlayable(file)) {
if (TorrentPlayer.isPlayable(file)) {
icon = 'play_arrow' /* playable? add option to play */
handleClick = dispatcher('play', infoHash, index)
} else {