mirror of https://github.com/tycrek/ass.git
Removed old JSDoc (replaced with TypeScript)
This commit is contained in:
parent
b44172d999
commit
901e831589
|
@ -6,8 +6,6 @@ import { log } from './utils';
|
|||
|
||||
/**
|
||||
* Generates a SHA1 hash for the provided file
|
||||
* @param {*} file The file to hash
|
||||
* @returns The SHA1 hash
|
||||
*/
|
||||
export default (file: FileData): Promise<string> =>
|
||||
new Promise((resolve, reject) =>
|
||||
|
|
|
@ -19,9 +19,6 @@ const THUMBNAIL = {
|
|||
|
||||
/**
|
||||
* Builds a safe escaped ffmpeg command
|
||||
* @param {String} src Path to the input file
|
||||
* @param {String} dest Path of the output file
|
||||
* @returns {String} The command to execute
|
||||
*/
|
||||
function getCommand(src: String, dest: String) {
|
||||
return shell([
|
||||
|
@ -37,8 +34,6 @@ function getCommand(src: String, dest: String) {
|
|||
|
||||
/**
|
||||
* Builds a thumbnail filename
|
||||
* @param {String} oldName The original filename
|
||||
* @returns {String} The filename for the thumbnail
|
||||
*/
|
||||
function getNewName(oldName: String) {
|
||||
return oldName.concat('.thumbnail.jpg');
|
||||
|
@ -46,8 +41,6 @@ function getNewName(oldName: String) {
|
|||
|
||||
/**
|
||||
* Builds a path to the thumbnails
|
||||
* @param {String} oldName The original filename
|
||||
* @returns {String} The path to the thumbnail
|
||||
*/
|
||||
function getNewNamePath(oldName: String) {
|
||||
return path(diskFilePath, 'thumbnails/', getNewName(oldName));
|
||||
|
@ -55,7 +48,6 @@ function getNewNamePath(oldName: String) {
|
|||
|
||||
/**
|
||||
* Extracts an image from a video file to use as a thumbnail, using ffmpeg
|
||||
* @param {*} file The video file to pull a frame from
|
||||
*/
|
||||
function getVideoThumbnail(file: FileData) {
|
||||
return new Promise((resolve: Function, reject: Function) => exec(
|
||||
|
@ -67,7 +59,6 @@ function getVideoThumbnail(file: FileData) {
|
|||
|
||||
/**
|
||||
* Generates a thumbnail for the provided image
|
||||
* @param {*} file The file to generate a thumbnail for
|
||||
*/
|
||||
function getImageThumbnail(file: FileData) {
|
||||
return new Promise((resolve, reject) =>
|
||||
|
@ -81,8 +72,6 @@ function getImageThumbnail(file: FileData) {
|
|||
|
||||
/**
|
||||
* Generates a thumbnail
|
||||
* @param {*} file The file to generate a thumbnail for
|
||||
* @returns The thumbnail filename (NOT the path)
|
||||
*/
|
||||
export default (file: FileData): Promise<string> =>
|
||||
new Promise((resolve, reject) =>
|
||||
|
|
|
@ -9,9 +9,6 @@ const QUALITY = 3;
|
|||
|
||||
/**
|
||||
* Extracts a prominent colour from the provided image file
|
||||
* @param {*} file The image to extract a colour from
|
||||
* @param {*} resolve Runs if Promise was successful
|
||||
* @param {*} reject Runs if Promise failed
|
||||
*/
|
||||
function getVibrant(file: FileData, resolve: Function, reject: Function) {
|
||||
sharp(file.path).png().toBuffer()
|
||||
|
@ -25,7 +22,5 @@ function getVibrant(file: FileData, resolve: Function, reject: Function) {
|
|||
|
||||
/**
|
||||
* Extracts a colour from an image file. Returns a random Hex value if provided file is a video
|
||||
* @param {*} file The file to get a colour from
|
||||
* @returns The Vibrant colour as a Hex value (or random Hex value for videos)
|
||||
*/
|
||||
export default (file: FileData): Promise<string> => new Promise((resolve, reject) => (!file.is.image || file.mimetype.includes('webp')) ? resolve(randomHexColour()) : getVibrant(file, resolve, reject)); // skipcq: JS-0229
|
||||
|
|
Loading…
Reference in New Issue