Allow seeding torrents that contain subtitles

Fixes a bug in our drag-drop handling: before, it was impossible to create a torrent containing .torrent, .srt, or .vtt files
This commit is contained in:
DC
2016-05-13 16:59:18 -07:00
parent 6df33bc58b
commit 461744da5b

View File

@@ -539,15 +539,18 @@ function saveState () {
function onOpen (files) { function onOpen (files) {
if (!Array.isArray(files)) files = [ files ] if (!Array.isArray(files)) files = [ files ]
// .torrent file = start downloading the torrent // All .torrent files? Start downloading
files.filter(isTorrent).forEach(addTorrent) if (files.every(isTorrent)) {
return files.forEach(addTorrent)
}
// subtitle file // Playing media and adding subtitles?
files.filter(isSubtitle).forEach(addSubtitle) if (files.some(isSubtitle) && state.location.current().url === 'player') {
return files.filter(isSubtitle).forEach(addSubtitle)
}
// everything else = seed these files // Show the Create Torrent screen. Let's seed those files.
var rest = files.filter(not(isTorrent)).filter(not(isSubtitle)) if (files.length > 0) showCreateTorrent(files)
if (rest.length > 0) showCreateTorrent(rest)
} }
function isTorrent (file) { function isTorrent (file) {