forked from DebaucheryLibrarian/traxxx
Restored sorting trailers by quality.
This commit is contained in:
parent
af59ad3d33
commit
297f79f6e2
|
@ -236,7 +236,7 @@ module.exports = {
|
|||
thumbnailQuality: 100,
|
||||
lazySize: 90,
|
||||
lazyQuality: 90,
|
||||
videoQuality: [480, 360, 320, 540, 720, 1080, 2160, 270, 240, 180],
|
||||
trailerQuality: [480, 720, 360, 1080, 320, 540, 2160, 270, 240, 180],
|
||||
limit: 25, // max number of photos per release
|
||||
streamConcurrency: 2, // max number of video streams (m3u8 etc.) to fetch and process at once
|
||||
},
|
||||
|
|
24
src/media.js
24
src/media.js
|
@ -152,12 +152,34 @@ function baseSourceToBaseMedia(baseSource, role, metadata) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function sortBaseTrailersByQuality(sources, role) {
|
||||
if (role === 'trailers') {
|
||||
const sortedSources = sources.sort((sourceA, sourceB) => {
|
||||
if (config.media.trailerQuality.indexOf(sourceA.quality) > config.media.trailerQuality.indexOf(sourceB.quality)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (config.media.trailerQuality.indexOf(sourceA.quality) < config.media.trailerQuality.indexOf(sourceB.quality)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
return sortedSources;
|
||||
}
|
||||
|
||||
return sources;
|
||||
}
|
||||
|
||||
function fallbackMediaToBaseMedia(rawMedia, role, metadata) {
|
||||
const baseSources = rawMedia
|
||||
.map(source => toBaseSource(source))
|
||||
.filter(Boolean);
|
||||
|
||||
return baseSourceToBaseMedia(baseSources, role, metadata);
|
||||
const sortedBaseSources = sortBaseTrailersByQuality(baseSources, role);
|
||||
|
||||
return baseSourceToBaseMedia(sortedBaseSources, role, metadata);
|
||||
}
|
||||
|
||||
function toBaseMedias(rawMedias, role, metadata) {
|
||||
|
|
Loading…
Reference in New Issue