This commit is contained in:
Diego Rodríguez Baquero
2021-10-10 13:58:19 -05:00
parent 08a182d165
commit 1350f3f7cf
5 changed files with 5 additions and 14 deletions

View File

@@ -156,8 +156,7 @@ module.exports = class TorrentListController {
prioritizeTorrent (infoHash) {
this.state.saved.torrents
.filter(torrent => // We're interested in active torrents only.
['downloading', 'seeding'].indexOf(torrent.status) !== -1)
.filter(torrent => ['downloading', 'seeding'].includes(torrent.status)) // Active torrents only.
.forEach((torrent) => { // Pause all active torrents except the one that started playing.
if (infoHash === torrent.infoHash) return

View File

@@ -19,10 +19,7 @@ const config = require('../../config')
const { CastingError } = require('./errors')
// Lazy load these for a ~300ms improvement in startup time
let airplayer
let chromecasts
let dlnacasts
let airplayer, chromecasts, dlnacasts
// App state. Cast modifies state.playing and state.errors in response to events
let state

View File

@@ -61,9 +61,7 @@ function migrate_0_7_0 (saved) {
// * Then, relative paths for the default torrents, eg '../static/sintel.torrent'
// * Then, paths computed at runtime for default torrents, eg 'sintel.torrent'
// * Finally, now we're getting rid of torrentPath altogether
let src
let dst
let src, dst
if (ts.torrentPath) {
if (path.isAbsolute(ts.torrentPath) || ts.torrentPath.startsWith('..')) {
src = ts.torrentPath

View File

@@ -16,8 +16,7 @@ function torrentPoster (torrent, cb) {
const bestScore = ['audio', 'video', 'image'].map(mediaType => ({
type: mediaType,
size: calculateDataLengthByExtension(torrent, mediaExtensions[mediaType])
})).sort((a, b) => // sort descending on size
b.size - a.size)[0]
})).sort((a, b) => b.size - a.size)[0] // sort descending on size
if (bestScore.size === 0) {
// Admit defeat, no video, audio or image had a significant presence

View File

@@ -40,9 +40,7 @@ class CreateTorrentPage extends React.Component {
// Then, use the name of the base folder (or sole file, for a single file torrent)
// as the default name. Show all files relative to the base folder.
let defaultName
let basePath
let defaultName, basePath
if (files.length === 1) {
// Single file torrent: /a/b/foo.jpg -> torrent name 'foo.jpg', path '/a/b'
defaultName = files[0].name