whitespace + plex rule

This commit is contained in:
Tamius Han 2021-07-05 00:51:15 +02:00
parent 1cc76ab3b1
commit 246743203f
2 changed files with 89 additions and 49 deletions

View File

@ -126,7 +126,7 @@ const ExtensionConfPatch = [
updateFn: (userOptions, defaultOptions) => { updateFn: (userOptions, defaultOptions) => {
// remove 'press P to toggle panning mode' thing // remove 'press P to toggle panning mode' thing
const togglePan = userOptions.actions.find(x => x.cmd && x.cmd.length === 1 && x.cmd[0].action === 'toggle-pan'); const togglePan = userOptions.actions.find(x => x.cmd && x.cmd.length === 1 && x.cmd[0].action === 'toggle-pan');
if (togglePan) { if (togglePan) {
togglePan.scopes = {}; togglePan.scopes = {};
} }
@ -221,7 +221,7 @@ const ExtensionConfPatch = [
show: true, show: true,
} }
}); });
// patch shortcuts for non-latin layouts, but only if the user hasn't changed default keys // patch shortcuts for non-latin layouts, but only if the user hasn't changed default keys
for (const action of userOptions.actions) { for (const action of userOptions.actions) {
if (!action.cmd || action.cmd.length !== 1) { if (!action.cmd || action.cmd.length !== 1) {
@ -263,7 +263,7 @@ const ExtensionConfPatch = [
updateFn: (userOptions, defaultOptions) => { updateFn: (userOptions, defaultOptions) => {
try { try {
userOptions.actions.push( userOptions.actions.push(
{ {
name: 'Stretch source to 4:3', name: 'Stretch source to 4:3',
label: '4:3 stretch (src)', label: '4:3 stretch (src)',
cmd: [{ cmd: [{
@ -280,7 +280,7 @@ const ExtensionConfPatch = [
show: true, show: true,
path: 'crop' path: 'crop'
} }
}, { }, {
name: 'Stretch source to 16:9', name: 'Stretch source to 16:9',
label: '16:9 stretch (src)', label: '16:9 stretch (src)',
cmd: [{ cmd: [{
@ -337,7 +337,7 @@ const ExtensionConfPatch = [
if (!userOptions.sites['www.disneyplus.com']) { if (!userOptions.sites['www.disneyplus.com']) {
userOptions.sites['www.disneyplus.com'] = { userOptions.sites['www.disneyplus.com'] = {
mode: ExtensionMode.Enabled, mode: ExtensionMode.Enabled,
autoar: ExtensionMode.Enabled, autoar: ExtensionMode.Enabled,
override: false, override: false,
type: 'community', type: 'community',
stretch: StretchType.Default, stretch: StretchType.Default,
@ -456,7 +456,7 @@ const ExtensionConfPatch = [
limit: 0.997, limit: 0.997,
fullscreenOnly: true fullscreenOnly: true
} }
} }
} catch (e) { } catch (e) {
// do nothing // do nothing
} }
@ -471,7 +471,7 @@ const ExtensionConfPatch = [
limit: 0.997, limit: 0.997,
fullscreenOnly: true fullscreenOnly: true
} }
} }
} catch (e) { } catch (e) {
// do nothing // do nothing
} }
@ -487,7 +487,7 @@ const ExtensionConfPatch = [
limit: 0.997, limit: 0.997,
fullscreenOnly: true fullscreenOnly: true
} }
} }
} else if (BrowserDetect.chrome) { } else if (BrowserDetect.chrome) {
userOptions.mitigations = { userOptions.mitigations = {
zoomLimit: { zoomLimit: {
@ -495,7 +495,7 @@ const ExtensionConfPatch = [
limit: 0.997, limit: 0.997,
fullscreenOnly: true fullscreenOnly: true
} }
} }
} }
} catch (e) { } catch (e) {
// do nothing // do nothing
@ -511,6 +511,28 @@ const ExtensionConfPatch = [
videoAncestor: 1 videoAncestor: 1
} }
} }
}, {
forVersion: '5.0.5',
sites: {
"app.plex.tv": {
mode: 3,
autoar: 3,
type: "user-added",
stretch: -1,
videoAlignment: -1,
keyboardShortcutsEnabled: 0,
DOM: {
player: {
manual: false,
querySelectors: "",
additionalCss: "",
useRelativeAncestor: false,
playerNodeCss: ""
}
},
css: "body {\n background-color: #000;\n}\n\n.application {\n background-color: #000;\n}"
}
}
} }
]; ];

View File

@ -15,7 +15,7 @@ if(Debug.debug)
const ExtensionConf: SettingsInterface = { const ExtensionConf: SettingsInterface = {
arDetect: { arDetect: {
disabledReason: "", // if automatic aspect ratio has been disabled, show reason disabledReason: "", // if automatic aspect ratio has been disabled, show reason
allowedMisaligned: 0.05, // top and bottom letterbox thickness can differ by this much. allowedMisaligned: 0.05, // top and bottom letterbox thickness can differ by this much.
// Any more and we don't adjust ar. // Any more and we don't adjust ar.
allowedArVariance: 0.075, // amount by which old ar can differ from the new (1 = 100%) allowedArVariance: 0.075, // amount by which old ar can differ from the new (1 = 100%)
timers: { // autodetection frequency timers: { // autodetection frequency
@ -46,14 +46,14 @@ const ExtensionConf: SettingsInterface = {
}, },
}, },
// samplingInterval: 10, // we sample at columns at (width/this) * [ 1 .. this - 1] // samplingInterval: 10, // we sample at columns at (width/this) * [ 1 .. this - 1]
blackframe: { blackframe: {
sufficientColorVariance: 0.10, // calculate difference between average intensity and pixel, for every pixel for every color sufficientColorVariance: 0.10, // calculate difference between average intensity and pixel, for every pixel for every color
// component. Average intensity is normalized to where 0 is black and 1 is biggest value for // component. Average intensity is normalized to where 0 is black and 1 is biggest value for
// that component. If sum of differences between normalized average intensity and normalized // that component. If sum of differences between normalized average intensity and normalized
// component varies more than this % between color components, we can afford to use less strict // component varies more than this % between color components, we can afford to use less strict
// cumulative threshold. // cumulative threshold.
cumulativeThresholdLax: 1600, cumulativeThresholdLax: 1600,
cumulativeThresholdStrict: 2560,// if we add values of all pixels together and get more than this, the frame is bright enough. cumulativeThresholdStrict: 2560,// if we add values of all pixels together and get more than this, the frame is bright enough.
// (note: blackframe is 16x9 px -> 144px total. cumulative threshold can be reached fast) // (note: blackframe is 16x9 px -> 144px total. cumulative threshold can be reached fast)
blackPixelsCondition: 0.6, // How much pixels must be black (1 all, 0 none) before we consider frame as black. Takes blackPixelsCondition: 0.6, // How much pixels must be black (1 all, 0 none) before we consider frame as black. Takes
@ -93,7 +93,7 @@ const ExtensionConf: SettingsInterface = {
randomCols: 0, // we add this many randomly selected columns to the static columns randomCols: 0, // we add this many randomly selected columns to the static columns
staticRows: 9, // forms grid with staticSampleCols. Determined in the same way. For black frame checks staticRows: 9, // forms grid with staticSampleCols. Determined in the same way. For black frame checks
}, },
guardLine: { // all pixels on the guardline need to be black, or else we trigger AR recalculation guardLine: { // all pixels on the guardline need to be black, or else we trigger AR recalculation
// (if AR fails to be recalculated, we reset AR) // (if AR fails to be recalculated, we reset AR)
enabled: true, enabled: true,
ignoreEdgeMargin: 0.20, // we ignore anything that pokes over the black line this close to the edge ignoreEdgeMargin: 0.20, // we ignore anything that pokes over the black line this close to the edge
@ -107,14 +107,14 @@ const ExtensionConf: SettingsInterface = {
safetyBorderPx: 5, // determines the thickness of safety border in fallback mode safetyBorderPx: 5, // determines the thickness of safety border in fallback mode
noTriggerZonePx: 8 // if we detect edge less than this many pixels thick, we don't correct. noTriggerZonePx: 8 // if we detect edge less than this many pixels thick, we don't correct.
}, },
arSwitchLimiter: { // to be implemented arSwitchLimiter: { // to be implemented
switches: 2, // we can switch this many times switches: 2, // we can switch this many times
period: 2.0 // per this period period: 2.0 // per this period
}, },
edgeDetection: { edgeDetection: {
sampleWidth: 8, // we take a sample this wide for edge detection sampleWidth: 8, // we take a sample this wide for edge detection
detectionThreshold: 4, // sample needs to have this many non-black pixels to be a valid edge detectionThreshold: 4, // sample needs to have this many non-black pixels to be a valid edge
confirmationThreshold: 1, // confirmationThreshold: 1, //
singleSideConfirmationThreshold: 3, // we need this much edges (out of all samples, not just edges) in order singleSideConfirmationThreshold: 3, // we need this much edges (out of all samples, not just edges) in order
// to confirm an edge in case there's no edges on top or bottom (other // to confirm an edge in case there's no edges on top or bottom (other
// than logo, of course) // than logo, of course)
@ -128,11 +128,11 @@ const ExtensionConf: SettingsInterface = {
// are now. (NOTE: keep this less than 1 in case we implement logo detection) // are now. (NOTE: keep this less than 1 in case we implement logo detection)
}, },
pillarTest: { pillarTest: {
ignoreThinPillarsPx: 5, // ignore pillars that are less than this many pixels thick. ignoreThinPillarsPx: 5, // ignore pillars that are less than this many pixels thick.
allowMisaligned: 0.05 // left and right edge can vary this much (%) allowMisaligned: 0.05 // left and right edge can vary this much (%)
}, },
textLineTest: { textLineTest: {
nonTextPulse: 0.10, // if a single continuous pulse has this many non-black pixels, we aren't dealing nonTextPulse: 0.10, // if a single continuous pulse has this many non-black pixels, we aren't dealing
// with text. This value is relative to canvas width (%) // with text. This value is relative to canvas width (%)
pulsesToConfirm: 10, // this is a threshold to confirm we're seeing text. pulsesToConfirm: 10, // this is a threshold to confirm we're seeing text.
pulsesToConfirmIfHalfBlack: 5, // this is the threshold to confirm we're seeing text if longest black pulse pulsesToConfirmIfHalfBlack: 5, // this is the threshold to confirm we're seeing text if longest black pulse
@ -171,8 +171,8 @@ const ExtensionConf: SettingsInterface = {
// ::: ACTIONS ::: // ::: ACTIONS :::
// ----------------------------------------- // -----------------------------------------
// Nastavitve za ukaze. Zamenja stare nastavitve za bližnične tipke. // Nastavitve za ukaze. Zamenja stare nastavitve za bližnične tipke.
// //
// Polje 'shortcut' je tabela, če se slučajno lotimo kdaj delati choordov. // Polje 'shortcut' je tabela, če se slučajno lotimo kdaj delati choordov.
actions: [{ actions: [{
name: 'Trigger automatic detection', // name displayed in settings name: 'Trigger automatic detection', // name displayed in settings
label: 'Automatic', // name displayed in ui (can be overridden in scope/playerUi) label: 'Automatic', // name displayed in ui (can be overridden in scope/playerUi)
@ -197,7 +197,7 @@ const ExtensionConf: SettingsInterface = {
code: 'KeyA', code: 'KeyA',
ctrlKey: false, ctrlKey: false,
metaKey: false, metaKey: false,
altKey: false, altKey: false,
shiftKey: false, shiftKey: false,
onKeyUp: true, onKeyUp: true,
onKeyDown: false, onKeyDown: false,
@ -223,7 +223,7 @@ const ExtensionConf: SettingsInterface = {
code: 'KeyR', code: 'KeyR',
ctrlKey: false, ctrlKey: false,
metaKey: false, metaKey: false,
altKey: false, altKey: false,
shiftKey: false, shiftKey: false,
onKeyUp: true, onKeyUp: true,
onKeyDown: false, onKeyDown: false,
@ -249,7 +249,7 @@ const ExtensionConf: SettingsInterface = {
code: 'KeyW', code: 'KeyW',
ctrlKey: false, ctrlKey: false,
metaKey: false, metaKey: false,
altKey: false, altKey: false,
shiftKey: false, shiftKey: false,
onKeyUp: true, onKeyUp: true,
onKeyDown: false, onKeyDown: false,
@ -275,7 +275,7 @@ const ExtensionConf: SettingsInterface = {
code: 'KeyE', code: 'KeyE',
ctrlKey: false, ctrlKey: false,
metaKey: false, metaKey: false,
altKey: false, altKey: false,
shiftKey: false, shiftKey: false,
onKeyUp: true, onKeyUp: true,
onKeyDown: false, onKeyDown: false,
@ -303,7 +303,7 @@ const ExtensionConf: SettingsInterface = {
code: 'KeyS', code: 'KeyS',
ctrlKey: false, ctrlKey: false,
metaKey: false, metaKey: false,
altKey: false, altKey: false,
shiftKey: false, shiftKey: false,
onKeyUp: false, onKeyUp: false,
onKeyDown: true, onKeyDown: true,
@ -331,7 +331,7 @@ const ExtensionConf: SettingsInterface = {
code: 'KeyD', code: 'KeyD',
ctrlKey: false, ctrlKey: false,
metaKey: false, metaKey: false,
altKey: false, altKey: false,
shiftKey: false, shiftKey: false,
onKeyUp: false, onKeyUp: false,
onKeyDown: true, onKeyDown: true,
@ -359,7 +359,7 @@ const ExtensionConf: SettingsInterface = {
code: 'KeyX', code: 'KeyX',
ctrlKey: false, ctrlKey: false,
metaKey: false, metaKey: false,
altKey: false, altKey: false,
shiftKey: false, shiftKey: false,
onKeyUp: true, onKeyUp: true,
onKeyDown: false, onKeyDown: false,
@ -472,7 +472,7 @@ const ExtensionConf: SettingsInterface = {
code: 'KeyY', code: 'KeyY',
ctrlKey: false, ctrlKey: false,
metaKey: false, metaKey: false,
altKey: false, altKey: false,
shiftKey: false, shiftKey: false,
onKeyUp: true, onKeyUp: true,
onKeyDown: false, onKeyDown: false,
@ -497,7 +497,7 @@ const ExtensionConf: SettingsInterface = {
code: 'KeyU', code: 'KeyU',
ctrlKey: false, ctrlKey: false,
metaKey: false, metaKey: false,
altKey: false, altKey: false,
shiftKey: false, shiftKey: false,
onKeyUp: true, onKeyUp: true,
onKeyDown: false, onKeyDown: false,
@ -532,7 +532,7 @@ const ExtensionConf: SettingsInterface = {
shortcut: [{ shortcut: [{
ctrlKey: false, ctrlKey: false,
metaKey: false, metaKey: false,
altKey: false, altKey: false,
shiftKey: true, shiftKey: true,
onKeyDown: false, onKeyDown: false,
onKeyUp: false, onKeyUp: false,
@ -657,7 +657,7 @@ const ExtensionConf: SettingsInterface = {
} }
} }
}, // NEW OPTIONS }, // NEW OPTIONS
{ {
name: 'Stretch source to 4:3', name: 'Stretch source to 4:3',
label: '4:3 stretch (src)', label: '4:3 stretch (src)',
cmd: [{ cmd: [{
@ -674,7 +674,7 @@ const ExtensionConf: SettingsInterface = {
show: true, show: true,
path: 'crop' path: 'crop'
} }
}, { }, {
name: 'Stretch source to 16:9', name: 'Stretch source to 16:9',
label: '16:9 stretch (src)', label: '16:9 stretch (src)',
cmd: [{ cmd: [{
@ -778,7 +778,7 @@ const ExtensionConf: SettingsInterface = {
// E N A B L E E X T E N S I O N / A U T O A R // E N A B L E E X T E N S I O N / A U T O A R
// (for sites/extension tab in the popup) // (for sites/extension tab in the popup)
// //
{ {
name: 'Enable extension', name: 'Enable extension',
label: 'Enable', label: 'Enable',
cmd: [{ cmd: [{
@ -889,7 +889,7 @@ const ExtensionConf: SettingsInterface = {
scopes: { scopes: {
global: { global: {
show: true, show: true,
}, },
site: { site: {
show: true, show: true,
} }
@ -899,7 +899,7 @@ const ExtensionConf: SettingsInterface = {
// //
// Enable/disable keyboard shortcuts // Enable/disable keyboard shortcuts
// //
{ {
name: 'Enable keyboard shortcuts', name: 'Enable keyboard shortcuts',
label: 'Enable', label: 'Enable',
cmd: [{ cmd: [{
@ -974,31 +974,31 @@ const ExtensionConf: SettingsInterface = {
// ----------------------------------------- // -----------------------------------------
// Nastavitve za posamezno stran // Nastavitve za posamezno stran
// Config for a given page: // Config for a given page:
// //
// <hostname> : { // <hostname> : {
// status: <option> // should extension work on this site? // status: <option> // should extension work on this site?
// arStatus: <option> // should we do autodetection on this site? // arStatus: <option> // should we do autodetection on this site?
// //
// defaultAr?: <ratio> // automatically apply this aspect ratio on this side. Use extension defaults if undefined. // defaultAr?: <ratio> // automatically apply this aspect ratio on this side. Use extension defaults if undefined.
// stretch? <stretch mode> // automatically stretch video on this site in this manner // stretch? <stretch mode> // automatically stretch video on this site in this manner
// videoAlignment? <left|center|right> // videoAlignment? <left|center|right>
// //
// type: <official|community|user> // 'official' — blessed by Tam. // type: <official|community|user> // 'official' — blessed by Tam.
// // 'community' — blessed by reddit. // // 'community' — blessed by reddit.
// // 'user' — user-defined (not here) // // 'user' — user-defined (not here)
// override: <true|false> // override user settings for this site on update // override: <true|false> // override user settings for this site on update
// } // }
// //
// Veljavne vrednosti za možnosti // Veljavne vrednosti za možnosti
// Valid values for options: // Valid values for options:
// //
// status, arStatus, statusEmbedded: // status, arStatus, statusEmbedded:
// //
// * enabled — always allow, full // * enabled — always allow, full
// * basic — allow, but only the basic version without playerData // * basic — allow, but only the basic version without playerData
// * default — allow if default is to allow, block if default is to block // * default — allow if default is to allow, block if default is to block
// * disabled — never allow // * disabled — never allow
// //
sites: { sites: {
"@global": { // global defaults. Possible options will state site-only options in order "@global": { // global defaults. Possible options will state site-only options in order
// to avoid writing this multiple times. Tags: // to avoid writing this multiple times. Tags:
@ -1010,12 +1010,12 @@ const ExtensionConf: SettingsInterface = {
// 'disabled' - work nowhere // 'disabled' - work nowhere
// 'basic' - (Possible future use) // 'basic' - (Possible future use)
// 'default' - follow global rules (#s) // 'default' - follow global rules (#s)
autoar: ExtensionMode.Enabled, // Should we try to automatically detect aspect ratio? autoar: ExtensionMode.Enabled, // Should we try to automatically detect aspect ratio?
// Options: 'enabled', 'whitelist' (#g), 'default' (#s), 'disabled' // Options: 'enabled', 'whitelist' (#g), 'default' (#s), 'disabled'
autoarFallback: currentBrowser.firefox ? // if autoAr fails, try fallback mode? autoarFallback: currentBrowser.firefox ? // if autoAr fails, try fallback mode?
ExtensionMode.Enabled : // Options same as in autoar. ExtensionMode.Enabled : // Options same as in autoar.
ExtensionMode.Disabled, // if autoar is disabled, this setting is irrelevant ExtensionMode.Disabled, // if autoar is disabled, this setting is irrelevant
stretch: StretchType.NoStretch, // Default stretch mode. stretch: StretchType.NoStretch, // Default stretch mode.
videoAlignment: VideoAlignmentType.Center, // Video alignment videoAlignment: VideoAlignmentType.Center, // Video alignment
keyboardShortcutsEnabled: ExtensionMode.Enabled, keyboardShortcutsEnabled: ExtensionMode.Enabled,
}, },
@ -1041,7 +1041,7 @@ const ExtensionConf: SettingsInterface = {
}, },
"www.netflix.com" : { "www.netflix.com" : {
mode: ExtensionMode.Enabled, mode: ExtensionMode.Enabled,
autoar: ExtensionMode.Enabled, autoar: ExtensionMode.Enabled,
override: false, override: false,
type: 'official', type: 'official',
stretch: StretchType.Default, stretch: StretchType.Default,
@ -1060,7 +1060,7 @@ const ExtensionConf: SettingsInterface = {
}, },
"www.disneyplus.com" : { "www.disneyplus.com" : {
mode: ExtensionMode.Enabled, mode: ExtensionMode.Enabled,
autoar: ExtensionMode.Enabled, autoar: ExtensionMode.Enabled,
override: false, override: false,
type: 'community', type: 'community',
stretch: StretchType.Default, stretch: StretchType.Default,
@ -1081,7 +1081,7 @@ const ExtensionConf: SettingsInterface = {
}, },
"www.twitch.tv": { "www.twitch.tv": {
mode: ExtensionMode.Enabled, mode: ExtensionMode.Enabled,
autoar: ExtensionMode.Enabled, autoar: ExtensionMode.Enabled,
override: true, override: true,
type: 'official', type: 'official',
stretch: StretchType.Default, stretch: StretchType.Default,
@ -1124,7 +1124,7 @@ const ExtensionConf: SettingsInterface = {
}, },
"old.reddit.com" : { "old.reddit.com" : {
mode: ExtensionMode.Enabled, mode: ExtensionMode.Enabled,
autoar:ExtensionMode.Enabled, autoar:ExtensionMode.Enabled,
override: false, override: false,
type: 'testing', type: 'testing',
stretch: StretchType.Default, stretch: StretchType.Default,
@ -1141,7 +1141,7 @@ const ExtensionConf: SettingsInterface = {
}, },
"www.reddit.com" : { "www.reddit.com" : {
mode: ExtensionMode.Enabled, mode: ExtensionMode.Enabled,
autoar: ExtensionMode.Enabled, autoar: ExtensionMode.Enabled,
override: false, override: false,
type: 'testing', type: 'testing',
stretch: StretchType.Default, stretch: StretchType.Default,
@ -1192,6 +1192,24 @@ const ExtensionConf: SettingsInterface = {
} }
} }
}, },
"app.plex.tv": {
mode: 3,
autoar: 3,
type: "user-added",
stretch: -1,
videoAlignment: -1,
keyboardShortcutsEnabled: 0,
DOM: {
player: {
manual: false,
querySelectors: "",
additionalCss: "",
useRelativeAncestor: false,
playerNodeCss: ""
}
},
css: "body {\n background-color: #000;\n}\n\n.application {\n background-color: #000;\n}"
}
} }
} }