Prioritizing known video qualities as fallbacks, fixed Gamma quality format.
This commit is contained in:
parent
8194c1c8ea
commit
0e69898c32
|
@ -438,7 +438,7 @@ module.exports = {
|
|||
thumbnailQuality: 100,
|
||||
lazySize: 90,
|
||||
lazyQuality: 90,
|
||||
trailerQuality: [540, 720, 480, 360, 960, 1080, 320, 1440, 1600, 1920, 2160, 270, 240, 180],
|
||||
trailerQuality: [540, 720, 960, 480, 1080, 360, 320, 1440, 1600, 1920, 2160, 270, 240, 180],
|
||||
limit: 25, // max number of photos per release
|
||||
attempts: 2,
|
||||
fetchStreams: true,
|
||||
|
|
10
src/media.js
10
src/media.js
|
@ -213,7 +213,7 @@ function baseSourceToBaseMedia(baseSource, role, metadata) {
|
|||
|
||||
function sortBaseTrailersByQuality(sources, role) {
|
||||
if (role === 'trailers') {
|
||||
const sortedSources = sources.sort((sourceA, sourceB) => {
|
||||
const sortedSources = sources.toSorted((sourceA, sourceB) => {
|
||||
if (config.media.trailerQuality.includes(sourceB.quality) && config.media.trailerQuality.indexOf(sourceA.quality) > config.media.trailerQuality.indexOf(sourceB.quality)) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -222,6 +222,14 @@ function sortBaseTrailersByQuality(sources, role) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (config.media.trailerQuality.includes(sourceB.quality) && !config.media.trailerQuality.includes(sourceA.quality)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (config.media.trailerQuality.includes(sourceA.quality) && !config.media.trailerQuality.includes(sourceB.quality)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
|
|
|
@ -436,6 +436,10 @@ async function scrapeScene({ query }, url, channel, baseRelease, mobileItem, opt
|
|||
return release;
|
||||
}
|
||||
|
||||
const qualityMap = {
|
||||
'4k': 2160,
|
||||
};
|
||||
|
||||
async function scrapeReleaseApi(data, site, options, movieScenes) {
|
||||
const release = {};
|
||||
|
||||
|
@ -478,7 +482,10 @@ async function scrapeReleaseApi(data, site, options, movieScenes) {
|
|||
release.teaser = `https://videothumb.gammacdn.com/500x281/${release.entryId}.mp4`;
|
||||
|
||||
if (data.trailers) {
|
||||
release.trailer = Object.entries(data.trailers).map(([quality, source]) => ({ src: source, quality }));
|
||||
release.trailer = Object.entries(data.trailers).map(([quality, source]) => ({
|
||||
src: source,
|
||||
quality: qualityMap[quality] || parseInt(quality, 10) || quality,
|
||||
}));
|
||||
}
|
||||
|
||||
if (data.movie_id && !data.movie_path && options.parameters.sceneMovies !== false) {
|
||||
|
@ -494,7 +501,7 @@ async function scrapeReleaseApi(data, site, options, movieScenes) {
|
|||
}
|
||||
|
||||
release.channel = slugify(data.mainChannel?.id || data.sitename, ''); // remove -
|
||||
release.qualities = data.download_sizes;
|
||||
release.qualities = data.download_sizes?.map((quality) => qualityMap[quality] || parseInt(quality, 10) || quality);
|
||||
|
||||
return release;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue