Fixed regex for some publishers.
This commit is contained in:
@ -87,7 +87,7 @@ export class GoogleService {
|
|||||||
thumbnail: secure && item.volumeInfo.imageLinks?.thumbnail ? item.volumeInfo.imageLinks.thumbnail.replaceAll('http://', 'https://') : item.volumeInfo.imageLinks?.thumbnail,
|
thumbnail: secure && item.volumeInfo.imageLinks?.thumbnail ? item.volumeInfo.imageLinks.thumbnail.replaceAll('http://', 'https://') : item.volumeInfo.imageLinks?.thumbnail,
|
||||||
url: item.volumeInfo.canonicalVolumeLink,
|
url: item.volumeInfo.canonicalVolumeLink,
|
||||||
provider: 'google'
|
provider: 'google'
|
||||||
}
|
};
|
||||||
|
|
||||||
const regex = this.getRegexByPublisher(result.publisher);
|
const regex = this.getRegexByPublisher(result.publisher);
|
||||||
const match = result.title.match(regex);
|
const match = result.title.match(regex);
|
||||||
@ -122,17 +122,17 @@ export class GoogleService {
|
|||||||
private getRegexByPublisher(publisher: string): RegExp {
|
private getRegexByPublisher(publisher: string): RegExp {
|
||||||
switch (publisher) {
|
switch (publisher) {
|
||||||
case 'J-Novel Club':
|
case 'J-Novel Club':
|
||||||
return /^(?<title>.+?):?\sVolume\s(?<volume>\d+)$/i;
|
return /^(?<title>.+?):?(?:\s\((?<media_type>\w+)\))?(?:\sVolume\s(?<volume>\d+))?$/i;
|
||||||
case 'Yen On':
|
case 'Yen On':
|
||||||
case 'Yen Press':
|
case 'Yen Press':
|
||||||
case 'Yen Press LLC':
|
case 'Yen Press LLC':
|
||||||
return /^(?<title>.+?)(?:,?\sVol\.\s(?<volume>\d+))?\s\((?<media_type>[\w\s]+)\)$/;
|
return /^(?:(?<title>.+?)(?:,?\sVol\.?\s(?<volume>\d+))(?:\s\((?<media_type>[\w\s]+)\))?)$/i;
|
||||||
case 'Hanashi Media':
|
case 'Hanashi Media':
|
||||||
return /^(?<title>.+?)\s\((?<media_type>[\w\s]+)\),?\sVol\.\s(?<volume>\d+)$/
|
return /^(?<title>.+?)\s\((?<media_type>[\w\s]+)\),?\sVol\.\s(?<volume>\d+)$/i
|
||||||
case 'Regin\'s Chronicles':
|
case 'Regin\'s Chronicles':
|
||||||
return /^(?<title>.+?)\s\((?<media_type>[\w\s]+)\)(?<subtitle>\:\s.+?)?$/
|
return /^(?<title>.+?)\s\((?<media_type>[\w\s]+)\)(?<subtitle>\:\s.+?)?$/i
|
||||||
default:
|
default:
|
||||||
return /^(?<title>.+?)(?:,|:|\s\-)?\s(?:Vol(?:\.|ume)?)?\s(?<volume>\d+)$/;
|
return /^(?<title>.+?)(?:,|:|\s\-)?\s(?:Vol(?:\.|ume)?)?\s(?<volume>\d+)$/i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user