MCPcopy Create free account
hub / github.com/DialmasterOrg/Youtarr / resizeChannelThumbnail

Method resizeChannelThumbnail

server/modules/channelModule.js:516–537  ·  view source on GitHub ↗

* Resize channel thumbnail image * @param {string} channelId - Channel ID * @returns {Promise }

(channelId)

Source from the content-addressed store, hash-verified

514 * @returns {Promise<void>}
515 */
516 async resizeChannelThumbnail(channelId) {
517 const imagePath = configModule.getImagePath();
518 const realImagePath = path.join(
519 imagePath,
520 `channelthumb-${channelId}.jpg`
521 );
522 const smallImagePath = path.join(
523 imagePath,
524 `channelthumb-${channelId}-small.jpg`
525 );
526
527 try {
528 execSync(
529 `${configModule.ffmpegPath} -loglevel error -y -i "${realImagePath}" -vf "scale=iw*0.4:ih*0.4" -q:v 2 "${smallImagePath}"`,
530 { stdio: 'inherit' }
531 );
532 await fsPromises.rename(smallImagePath, realImagePath);
533 logger.debug({ channelId }, 'Channel thumbnail resized successfully');
534 } catch (err) {
535 logger.error({ err, channelId, imagePath: realImagePath }, 'Error resizing channel thumbnail');
536 }
537 }
538
539 /**
540 * Populate missing channel information for all enabled channels.

Callers 1

Calls 1

getImagePathMethod · 0.80

Tested by

no test coverage detected