Added warning levels / classification
This commit is contained in:
parent
c656e63fe8
commit
f0a34dcdb4
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name AnimeBytes Mediainfo Improvements
|
||||
// @author WeebDataHoarder
|
||||
// @version 1.0
|
||||
// @version 1.1
|
||||
// @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
|
||||
|
@ -571,7 +571,7 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
defaultAudio = audio;
|
||||
}
|
||||
if("language" in audio && audio.language !== "Japanese" && audio.language !== "Unknown" && isDefault && torrentType.match(/Live Action/) === null){
|
||||
warnings.audio.push("Default audio is not in Japanese");
|
||||
warnings.audio.push(["info", "Default audio is not in Japanese"]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -609,7 +609,7 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
const isSignsEntry = ("title" in text) ? text.title.match(/sign/i) !== null : false;
|
||||
const isDefault = text.default === "Yes";
|
||||
if(isSignsEntry && isDefault){
|
||||
warnings.text.push("Default subtitle is a Signs track");
|
||||
warnings.text.push(["warning", "Default subtitle is a Signs track"]);
|
||||
}
|
||||
|
||||
if(isDefault){
|
||||
|
@ -738,13 +738,13 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
tags.videoEncoder = "x264";
|
||||
}else if(video.writing_library.match(/_nvenc/) !== null){
|
||||
tags.videoEncoder = "NVENC";
|
||||
warnings.video.push("Found NVENC hardware-encoded stream");
|
||||
warnings.video.push(["danger", "Found NVENC hardware-encoded stream"]);
|
||||
}else if(video.writing_library.match(/_qsv/) !== null){
|
||||
tags.videoEncoder = "QuickSync";
|
||||
warnings.video.push("Found QuickSync hardware-encoded stream");
|
||||
warnings.video.push(["danger", "Found QuickSync hardware-encoded stream"]);
|
||||
}else if(video.writing_library.match(/_vaapi/) !== null){
|
||||
tags.videoEncoder = "VAAPI";
|
||||
warnings.video.push("Found VAAPI hardware-encoded stream");
|
||||
warnings.video.push(["danger", "Found VAAPI hardware-encoded stream"]);
|
||||
}else if(video.writing_library.match(/[^0-9A-F]/) !== null){
|
||||
[tags.videoEncoder] = video.writing_library.split(" ");
|
||||
}
|
||||
|
@ -759,19 +759,19 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
tags.videoCRF = "2pass";
|
||||
}
|
||||
if((match = video.encoding_settings.match(/profile=(?<profile>baseline|main)/)) !== null){
|
||||
warnings.video.push("Found encode using profile=" + match.groups.profile + " on encoding settings");
|
||||
warnings.video.push(["warning", "Found encode using profile=" + match.groups.profile + " on encoding settings"]);
|
||||
}
|
||||
if(video.encoding_settings.match(/cabac=0/) !== null){
|
||||
warnings.video.push("Found encode with CABAC disabled");
|
||||
warnings.video.push(["info", "Found encode with CABAC disabled"]);
|
||||
}
|
||||
if(video.encoding_settings.match(/mbtree=0/) !== null){
|
||||
warnings.video.push("Found encode with mbtree disabled");
|
||||
warnings.video.push(["info", "Found encode with mbtree disabled"]);
|
||||
}
|
||||
if(video.encoding_settings.match(/bframes=0/) !== null){
|
||||
warnings.video.push("Found encode with bframes disabled");
|
||||
warnings.video.push(["info", "Found encode with bframes disabled"]);
|
||||
}
|
||||
if(video.encoding_settings.match(/me=dia/) !== null){
|
||||
warnings.video.push("Found encode with me=dia");
|
||||
warnings.video.push(["info", "Found encode with me=dia"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
let newTagLine = getComparisonLine(tags);
|
||||
|
||||
if(newTagLine !== oldTagLine){
|
||||
warnings.general.push("Tag mismatch:\nold: " + oldTagLine + " !=\nnew: " + newTagLine);
|
||||
warnings.general.push(["danger", "Tag mismatch:\nold: " + oldTagLine + " !=\nnew: " + newTagLine]);
|
||||
}
|
||||
|
||||
if(tags.freeleech){
|
||||
|
@ -812,11 +812,33 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
|
||||
let warningText = "";
|
||||
|
||||
let infoCount = 0;
|
||||
let warningCount = 0;
|
||||
let dangerCount = 0;
|
||||
|
||||
for(const [key, value] of Object.entries(warnings)){
|
||||
if(value.length > 0){
|
||||
warningText += key.toUpperCase() + ":\n";
|
||||
for(let v of value){
|
||||
warningText += " " + v + "\n";
|
||||
if(Array.isArray(v)){
|
||||
switch (v[0]){
|
||||
case "info":
|
||||
infoCount++;
|
||||
warningText += " info: " + v[1] + "\n";
|
||||
break;
|
||||
case "warning":
|
||||
warningCount++;
|
||||
warningText += " warning: " + v[1] + "\n";
|
||||
break;
|
||||
case "danger":
|
||||
dangerCount++;
|
||||
warningText += " danger: " + v[1] + "\n";
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
warningText += " " + v + "\n";
|
||||
++warningCount;
|
||||
}
|
||||
}
|
||||
warningText += "\n";
|
||||
}
|
||||
|
@ -831,10 +853,18 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
}
|
||||
|
||||
torrent.elements.entry.prepend(" - ");
|
||||
for(let i = 0; i < 3; ++i){
|
||||
let warn = document.createElement("img");
|
||||
warn.src = "/static/common/symbols/warned.png";
|
||||
torrent.elements.entry.prepend(warn);
|
||||
for(let i = 0; i < infoCount; ++i){
|
||||
torrent.elements.entry.prepend("★");
|
||||
}
|
||||
for(let i = 0; i < warningCount; ++i){
|
||||
let icon = document.createElement("img");
|
||||
icon.src = "/static/common/symbols/warned.png";
|
||||
torrent.elements.entry.prepend(icon);
|
||||
}
|
||||
for(let i = 0; i < dangerCount; ++i){
|
||||
let icon = document.createElement("img");
|
||||
icon.src = "/static/common/symbols/disabled.png";
|
||||
torrent.elements.entry.prepend(icon);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -842,16 +872,16 @@ if(allowedVideoTypes.indexOf(torrentType.replace("Live Action ", "")) !== -1){
|
|||
torrent.elements.item.style["font-style"] = "italic";
|
||||
torrent.elements.item.style["text-decoration"] = "line-through";
|
||||
let pre = document.createElement("pre");
|
||||
pre.textContent = "== WARNINGS ==\n\nNo valid mediainfo section found. Maybe check Description?\n\n";
|
||||
pre.textContent = "== WARNINGS ==\n\nwarning: No valid mediainfo section found. Maybe check Description?\n\n";
|
||||
if("description" in torrent.elements){
|
||||
torrent.elements.description.prepend(pre);
|
||||
}
|
||||
|
||||
torrent.elements.entry.prepend(" - ");
|
||||
for(let i = 0; i < 3; ++i){
|
||||
let warn = document.createElement("img");
|
||||
warn.src = "/static/common/symbols/warned.png";
|
||||
torrent.elements.entry.prepend(warn);
|
||||
for(let i = 0; i < 1; ++i){
|
||||
let icon = document.createElement("img");
|
||||
icon.src = "/static/common/symbols/disabled.png";
|
||||
torrent.elements.entry.prepend(icon);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue