Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve JAV title in Tagger #5645

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions ui/v2.5/src/components/Tagger/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ const MMddyyRegex = new RegExp(
`(${months.join("|")})\\.?.(\\d{1,2}),?.(\\d{4})`,
"i"
);
const parseDate = (input: string): string => {
const javcodeRegex = /([a-zA-Z|tT28|tT38]+-\d+[zZeE]?)/;

const parseString = (input: string): string => {
let output = input;
const ddmmyy = output.match(ddmmyyRegex);
if (ddmmyy) {
Expand Down Expand Up @@ -73,6 +75,16 @@ const parseDate = (input: string): string => {
output.slice(yyyymmdd, yyyymmdd + 10).replace(/\./g, "-") +
output.slice(yyyymmdd + 10).replace(/-/g, " ")
);

const javcode_index = output.search(javcodeRegex);
if (javcode_index !== -1) {
const javcode_length = output.match(javcodeRegex)![1].length;
return (
output.slice(0, javcode_index).replace(/-/g, " ") +
output.slice(javcode_index, javcode_index + javcode_length) +
output.slice(javcode_index + javcode_length).replace(/-/g, " ")
);
}
return output.replace(/-/g, " ");
};

Expand Down Expand Up @@ -121,7 +133,7 @@ export function prepareQueryString(
regexs.forEach((re) => {
s = s.replace(re, " ");
});
s = parseDate(s);
s = parseString(s);
return s.replace(/\./g, " ").replace(/ +/g, " ");
}

Expand Down