Style: extra linting

This commit is contained in:
DC
2016-08-31 14:13:43 -07:00
parent e0af554caa
commit 0bda5358bd
11 changed files with 98 additions and 25 deletions

View File

@@ -47,7 +47,10 @@ module.exports = class MediaController {
openExternalPlayer () {
var state = this.state
var mediaURL = Playlist.getCurrentLocalURL(this.state)
ipcRenderer.send('openExternalPlayer', state.saved.prefs.externalPlayerPath, mediaURL, state.window.title)
ipcRenderer.send('openExternalPlayer',
state.saved.prefs.externalPlayerPath,
mediaURL,
state.window.title)
state.playing.location = 'external'
}

View File

@@ -148,13 +148,16 @@ module.exports = class PlaybackController {
rate += 0.25
} else if (direction < 0 && rate > 0.25 && rate <= 2) {
rate -= 0.25
} else if (direction < 0 && rate === 0.25) { /* when we set playback rate at 0 in html 5, playback hangs ;( */
} else if (direction < 0 && rate === 0.25) {
// When we set playback rate at 0 in html 5, playback hangs ;(
rate = -1
} else if (direction > 0 && rate === -1) {
rate = 0.25
} else if ((direction > 0 && rate >= 1 && rate < 16) || (direction < 0 && rate > -16 && rate <= -1)) {
} else if ((direction > 0 && rate >= 1 && rate < 16) ||
(direction < 0 && rate > -16 && rate <= -1)) {
rate *= 2
} else if ((direction < 0 && rate > 1 && rate <= 16) || (direction > 0 && rate >= -16 && rate < -1)) {
} else if ((direction < 0 && rate > 1 && rate <= 16) ||
(direction > 0 && rate >= -16 && rate < -1)) {
rate /= 2
}
state.playing.playbackRate = rate
@@ -342,7 +345,7 @@ module.exports = class PlaybackController {
var result = state.playing.result // 'success' or 'error'
if (result === 'success') telemetry.logPlayAttempt('success') // first frame displayed
else if (result === 'error') telemetry.logPlayAttempt('error') // codec missing, etc
else if (result === undefined) telemetry.logPlayAttempt('abandoned') // user exited before first frame
else if (result === undefined) telemetry.logPlayAttempt('abandoned') // user gave up waiting
else console.error('Unknown state.playing.result', state.playing.result)
// Reset the window contents back to the home screen

View File

@@ -17,8 +17,8 @@ module.exports = class TorrentListController {
this.state = state
}
// Adds a torrent to the list, starts downloading/seeding. TorrentID can be a
// magnet URI, infohash, or torrent file: https://github.com/feross/webtorrent#clientaddtorrentid-opts-function-ontorrent-torrent-
// Adds a torrent to the list, starts downloading/seeding.
// TorrentID can be a magnet URI, infohash, or torrent file: https://git.io/vik9M
addTorrent (torrentId) {
if (torrentId.path) {
// Use path string instead of W3C File object
@@ -149,7 +149,7 @@ module.exports = class TorrentListController {
// remove torrent and poster file
deleteFile(TorrentSummary.getTorrentPath(summary))
deleteFile(TorrentSummary.getPosterPath(summary)) // TODO: will the css path hack affect windows?
deleteFile(TorrentSummary.getPosterPath(summary))
// optionally delete the torrent data
if (deleteData) moveItemToTrash(summary)
@@ -159,7 +159,8 @@ module.exports = class TorrentListController {
State.saveThrottled(this.state)
}
this.state.location.clearForward('player') // prevent user from going forward to a deleted torrent
// prevent user from going forward to a deleted torrent
this.state.location.clearForward('player')
sound.play('DELETE')
}
@@ -288,7 +289,8 @@ function saveTorrentFileAs (torrentSummary) {
{ name: 'All Files', extensions: ['*'] }
]
}
electron.remote.dialog.showSaveDialog(electron.remote.getCurrentWindow(), opts, function (savePath) {
var win = electron.remote.getCurrentWindow()
electron.remote.dialog.showSaveDialog(win, opts, function (savePath) {
if (!savePath) return // They clicked Cancel
var torrentPath = TorrentSummary.getTorrentPath(torrentSummary)
fs.readFile(torrentPath, function (err, torrentFile) {