Skip to content

Instantly share code, notes, and snippets.

@shibafu528
Last active April 17, 2020 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shibafu528/2770eaa54cd507c66ad2b0ddcd86fe6a to your computer and use it in GitHub Desktop.
Save shibafu528/2770eaa54cd507c66ad2b0ddcd86fe6a to your computer and use it in GitHub Desktop.
patch for chinachu gamma e8e9d056f8e99dbf0e1c3f440059c9cdb1169226
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