Handle anamorphic video, check mediainfo has video entries before processing
This commit is contained in:
parent
fb10fce690
commit
fdd4a31f57
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name AnimeBytes Mediainfo Improvements
|
||||
// @author WeebDataHoarder
|
||||
// @version 1.24.0
|
||||
// @version 1.25.0
|
||||
// @downloadURL https://git.gammaspectra.live/WeebDataHoarder/userscripts/raw/branch/master/AnimeBytes/ab-mediainfo.user.js
|
||||
// @updateURL https://git.gammaspectra.live/WeebDataHoarder/userscripts/raw/branch/master/AnimeBytes/ab-mediainfo.user.js
|
||||
// @description AnimeBytes Mediainfo Improvements. Adds several listing and matching releases against mediainfo utilities. MIT license
|
||||
|
@ -404,8 +404,25 @@ function extractFromMediainfo(tags, mediainfo, warnings, fileName, fileList, sou
|
|||
let width = parseInt(video.width.replace(/[^0-9]/g, ""));
|
||||
let height = parseInt(video.height.replace(/[^0-9]/g, ""));
|
||||
|
||||
|
||||
let ar = width / height;
|
||||
|
||||
//Handle anamorphic video
|
||||
if("display_aspect_ratio" in video){
|
||||
let params = video.display_aspect_ratio.replace("/", ":").split(":");
|
||||
if(params.length === 2){
|
||||
let dar = params[0] / params[1];
|
||||
|
||||
if(Math.abs(ar - dar) >= 0.001){
|
||||
warnings.video.push(["info", "Anamorphic video found: " + width + "x" + height + " -> "+ Math.floor(height * dar) + "x" + height]);
|
||||
width = Math.floor(height * dar);
|
||||
}
|
||||
|
||||
ar = width / height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
let scanTypeLetter = "p";
|
||||
|
@ -1725,15 +1742,13 @@ if(
|
|||
tags[key] = value;
|
||||
}
|
||||
|
||||
if("mediainfo" in torrent && torrent.mediainfo.length > 0){
|
||||
if("mediainfo" in torrent && torrent.mediainfo.length > 0 && torrent.mediainfo[0].video && torrent.mediainfo[0].video.length > 0){
|
||||
let mediainfo = torrent.mediainfo[0];
|
||||
|
||||
if(torrent.mediainfoSource !== "mediainfo" && settings.getSetting("warning_mediainfoSource")){
|
||||
warnings.general.push(["mediainfo", "Mediainfo sourced from " + torrent.mediainfoSource + ". Consider reporting the torrent and providing it."])
|
||||
}
|
||||
|
||||
|
||||
|
||||
let isFileMatch = false;
|
||||
const fileNameToMatch = fileName.toLowerCase().replace(/[ \t\r\n]/g, "");
|
||||
|
||||
|
|
Loading…
Reference in a new issue