Browse Source

Merge pull request #10 from jrtechs/aboutPage

Bug Fixes
pull/17/head
Jeffery Russell 5 years ago
committed by GitHub
parent
commit
803e5b0ad7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 20 deletions
  1. +2
    -2
      package.json
  2. +2
    -1
      routes/icon.js
  3. +16
    -17
      videoManager.js

+ 2
- 2
package.json View File

@ -1,5 +1,5 @@
{
"name": "Home Brew Plex",
"name": "HomeBrewPlex",
"version": "1.0.0",
"description": "Light weight alternative for Plex",
"main": "server.js",
@ -22,7 +22,7 @@
"download-file": "^0.1.5",
"express": "^4.16.4",
"express-session": "^1.15.6",
"filepreview": "^1.0.16",
"ffmpeg-generate-video-preview": "^1.0.3",
"fs": "0.0.2",
"path": "^0.12.7",
"url": "^0.11.0",

+ 2
- 1
routes/icon.js View File

@ -18,7 +18,7 @@ routes.get('/', (request, result) =>
const videoID = request.query.v;
const splitArray = videoID.split('/');
const name = splitArray[splitArray.length -1] + ".png";
const name = splitArray[splitArray.length -1] + ".gif";
var file="";
@ -36,6 +36,7 @@ routes.get('/', (request, result) =>
}
else
{
console.log("reading ./icon/public/" + name);
file = fs.readFileSync("./icon/public/" + name);
}

+ 16
- 17
videoManager.js View File

@ -2,7 +2,7 @@ const configManager = require('./configManager');
const recursive = require('./recursiveTraversal');
const filepreview = require('filepreview');
const generatePreview = require('ffmpeg-generate-video-preview')
const fs = require('fs');
@ -17,24 +17,22 @@ function createIndex(filename, videos, templateKey)
console.log("Generating icon for " + filename);
var splitArray = filename.split('/');
var name = splitArray[splitArray.length -1];
const icon = './icon/' + templateKey + '/' + name + ".png";
const icon = 'icon/' + templateKey + '/' + name + ".gif";
if (!fs.existsSync(icon))
{
var options = {
width: 200,
quality: 50,
previewTime: '00:05:00.000'
};
filepreview.generate(filename, icon, options, function (error)
{
if (error)
var options =
{
resolve();
}
console.log('File preview is located ' + icon);
input: filename,
output: icon,
width: 128,
numFrames: 40
};
console.log(options);
generatePreview(options).then(function(metaData)
{
console.log(metaData);
resolve();
});
})
}
else
{
@ -125,7 +123,7 @@ module.exports =
{
const splitArray = publicVideos[i].name.split('/');
const name = splitArray[splitArray.length -1];
videoName = videoName.split('/').join("");
if(name === videoName)
{
return true;
@ -141,7 +139,8 @@ module.exports =
const splitArray = publicVideos[i].name.split('/');
const name = splitArray[splitArray.length -1];
if(name === videoName)
videoName = videoName.split('/').join("");
if(name + "" === videoName)
{
return true;
}

Loading…
Cancel
Save