Display crf/2pass/cqp prominently, fix issue with multiple default tracks in English

This commit is contained in:
DataHoarder 2021-12-27 16:05:17 +01:00
parent 55ae776566
commit fd2fe6c5db

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name AnimeBytes Mediainfo Improvements
// @author WeebDataHoarder
// @version 1.22.5
// @version 1.23.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
@ -72,7 +72,7 @@ function getEntryLine(tags, messages){
codec.textContent = getLineTagEntry(tags.videoCodec, false);
span.append(codec);
if("videoEncoder" in tags && settings.getSetting("showEncodingDetails")){
span.append(" (" + tags.videoEncoder + ("videoCRF" in tags ? " " + tags.videoCRF : "") + ("videoBitrate" in tags ? " " + tags.videoBitrate + "k" : "") + ")");
span.append(" (" + tags.videoEncoder + ("videoCRF" in tags ? " " + tags.videoCRF : "") + ("videoBitrate" in tags ? " " + tags.videoBitrate : "") + ")");
}
entries.video.push(span);
}
@ -561,15 +561,25 @@ function extractFromMediainfo(tags, mediainfo, warnings, fileName, fileList, sou
if("encoding_settings" in video){
let match = null;
if(video.encoding_settings.match(/rc=crf/) !== null){
tags.videoCRF = "crf";
}
if((match = video.encoding_settings.match(/crf=(?<crf>[0-9.]+)/)) !== null){
tags.videoCRF = parseFloat(match.groups.crf).toFixed(1);
tags.videoCRF = "crf";
tags.videoBitrate = parseFloat(match.groups.crf).toFixed(1);
}else if(video.encoding_settings.match(/rc=cqp/) !== null && (match = video.encoding_settings.match(/ qp=(?<qp>[0-9.]+)/)) !== null){
tags.videoCRF = "cqp";
tags.videoBitrate = parseFloat(match.groups.qp).toFixed(1);
if(settings.getSetting("warning_encodeSettings")){
warnings.video.push(["info", "Found encode using rc=cqp (Constant QP) mode on encoding settings"]);
}
}else if((match = video.encoding_settings.match(/bitrate=(?<bitrate>[0-9.]+)/)) !== null){
tags.videoBitrate = parseInt(match.groups.bitrate) + "k";
}
if(video.encoding_settings.match(/rc=2pass/) !== null){
tags.videoCRF = "2pass";
}
if((match = video.encoding_settings.match(/bitrate=(?<bitrate>[0-9.]+)/)) !== null){
tags.videoBitrate = parseInt(match.groups.bitrate);
}
if(!("remux" in tags) && video.codec_id === "V_MPEG4/ISO/AVC" && (match = video.format_profile.match(/(?<profile>(baseline|main)[ 0-9]*)@/i)) !== null){
if(settings.getSetting("warning_encodeProfile")){
warnings.video.push(["warning", "Found encode using profile=" + match.groups.profile + " on encoding settings"]);
@ -741,7 +751,7 @@ function extractFromMediainfo(tags, mediainfo, warnings, fileName, fileList, sou
}
}
if(!isSignsEntry && isDefault && text !== englishSubs && sourceTags.subtitleType === "Softsubs"){
if(!isSignsEntry && isDefault && text !== englishSubs && text.language !== "English" && sourceTags.subtitleType === "Softsubs"){
warnings.text.push(["warning", "Default Subtitles track #"+(index+1)+" is not in English"]);
}
});