diff --git a/src/renderer/lib/torrent-poster.js b/src/renderer/lib/torrent-poster.js index f05d1bb5..d90d6b87 100644 --- a/src/renderer/lib/torrent-poster.js +++ b/src/renderer/lib/torrent-poster.js @@ -3,6 +3,13 @@ module.exports = torrentPoster const captureFrame = require('capture-frame') const path = require('path') +const mediaExtensions = { + audio: ['.aac', '.asf', '.flac', '.m2a', '.m4a', '.mp2', '.mp4', '.mp3', '.oga', '.ogg', '.opus', + '.wma', '.wav', '.wv', '.wvp'], + video: ['.mp4', '.m4v', '.webm', '.mov', '.mkv'], + image: ['.gif', '.jpg', '.jpeg', '.png'] +} + function torrentPoster (torrent, cb) { // First, try to use a poster image if available const posterFile = torrent.files.filter(function (file) { @@ -10,32 +17,95 @@ function torrentPoster (torrent, cb) { })[0] if (posterFile) return torrentPosterFromImage(posterFile, torrent, cb) - // Second, try to use the largest video file - // Filter out file formats that the