Last active
April 17, 2020 12:51
-
-
Save shibafu528/2770eaa54cd507c66ad2b0ddcd86fe6a to your computer and use it in GitHub Desktop.
patch for chinachu gamma e8e9d056f8e99dbf0e1c3f440059c9cdb1169226
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app-scheduler.js b/app-scheduler.js | |
index dfcc7f4..8ff3af4 100644 | |
--- a/app-scheduler.js | |
+++ b/app-scheduler.js | |
@@ -360,11 +360,30 @@ function scheduler() { | |
const flagBracketsRE = /\[.{1,2}\]|【.】/g; | |
const flagExtractRE = /(?:【|\[)(.{1,2})(?:】|\])/; | |
const flagRE = /新|終|再|字|デ|解|無|二|S|SS|初|生|N|映|多|双/; | |
+const flagAribRE = /[🈟🈡🈞🈑🈓🈖🈚🈔🅂🅍🈠🈢🄽🈙🈕🈒]/gu; | |
const subtitleRE = /.{3,}([「【]([^」】]+)[」】]).*/; | |
const subtitleExRE = /(?:[##♯][0-90-9]{1,3}|[第][0-90-9]{1,3}[話回])(?:[ 「]+)([^「」]+)(?:[」]?)/; | |
const subtitleExExRE = /[「【][^」】]+[」】]/g; | |
const epinumRE = /[##♯][0-90-9]{1,3}|[第][0-90-9]{1,3}[話回]|([0-90-9]{1,3})/g; | |
const epinumExRE = /[##♯][0-90-9]{1,3}|[第][0-90-9]{1,3}[話回]/; | |
+const normalizeAribFlags = { | |
+ "🈟": "新", | |
+ "🈡": "終", | |
+ "🈞": "再", | |
+ "🈑": "字", | |
+ "🈓": "デ", | |
+ "🈖": "解", | |
+ "🈚": "無", | |
+ "🈔": "二", | |
+ "🅂": "S", | |
+ "🅍": "SS", | |
+ "🈠": "初", | |
+ "🈢": "生", | |
+ "🄽": "N", | |
+ "🈙": "映", | |
+ "🈕": "多", | |
+ "🈒": "双" | |
+}; | |
function convertPrograms(p, ch) { | |
const programs = []; | |
@@ -381,7 +400,7 @@ function convertPrograms(p, ch) { | |
// 理題 (title) | |
{ | |
- title = c.title.replace(flagBracketsRE, ""); | |
+ title = c.title.replace(flagBracketsRE, "").replace(flagAribRE, ""); | |
const subtitle = title.match(subtitleRE); | |
if (subtitle) { | |
@@ -408,11 +427,16 @@ function convertPrograms(p, ch) { | |
flags.push(flag); | |
} | |
} | |
+ | |
+ const matchedAribFlags = c.title.match(flagAribRE) || []; | |
+ for (const matchedFlag of matchedAribFlags) { | |
+ flags.push(normalizeAribFlags[matchedFlag]); | |
+ } | |
} | |
// 理題 (subtitle) | |
{ | |
- const title = c.title.replace(flagBracketsRE, ""); | |
+ const title = c.title.replace(flagBracketsRE, "").replace(flagAribRE, ""); | |
const detail = c.detail.split("\n")[0]; | |
const matchedSubtitleExInTitle = title.match(subtitleExRE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment