ensure Posters/ folder exists
This commit is contained in:
@@ -6,7 +6,7 @@ module.exports = {
|
||||
APP_NAME: 'WebTorrent',
|
||||
|
||||
CONFIG_PATH: applicationConfigPath('WebTorrent'),
|
||||
CONFIG_POSTER_PATH: path.join(applicationConfigPath('WebTorrent'), 'posters'),
|
||||
CONFIG_POSTER_PATH: path.join(applicationConfigPath('WebTorrent'), 'Posters'),
|
||||
|
||||
INDEX: 'file://' + path.join(__dirname, 'renderer', 'index.html'),
|
||||
|
||||
|
||||
@@ -290,6 +290,7 @@ function loadState (callback) {
|
||||
state.saved.torrents.forEach(function (torrentSummary) {
|
||||
if (torrentSummary.displayName) torrentSummary.name = torrentSummary.displayName
|
||||
})
|
||||
saveState()
|
||||
|
||||
if (callback) callback()
|
||||
})
|
||||
@@ -461,12 +462,15 @@ function generateTorrentPoster (torrent, torrentSummary) {
|
||||
torrentPoster(torrent, function (err, buf) {
|
||||
if (err) return onWarning(err)
|
||||
// save it for next time
|
||||
var posterFilePath = path.join(config.CONFIG_POSTER_PATH, torrent.infoHash + '.jpg')
|
||||
fs.writeFile(posterFilePath, buf, function (err) {
|
||||
fs.mkdir(config.CONFIG_POSTER_PATH, function (err) {
|
||||
if (err) return onWarning(err)
|
||||
// show the poster
|
||||
torrentSummary.posterURL = 'file:///' + posterFilePath
|
||||
update()
|
||||
var posterFilePath = path.join(config.CONFIG_POSTER_PATH, torrent.infoHash + '.jpg')
|
||||
fs.writeFile(posterFilePath, buf, function (err) {
|
||||
if (err) return onWarning(err)
|
||||
// show the poster
|
||||
torrentSummary.posterURL = 'file:///' + posterFilePath
|
||||
update()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user