mirror of
https://github.com/Wanxp/obsidian-douban.git
synced 2026-04-04 16:48:44 +08:00
fix movie/teleplay actor and director name wrong
This commit is contained in:
parent
508e4c9303
commit
022b1e347f
@ -102,9 +102,9 @@ export default abstract class DoubanAbstractLoadHandler<T extends DoubanSubject>
|
||||
handleContentArray(array: any[], context: HandleContext, textMode: TemplateTextMode): string {
|
||||
let result;
|
||||
switch (textMode) {
|
||||
case TemplateTextMode.YAML:
|
||||
result = array.map(YamlUtil.handleText).join(', ');
|
||||
break;
|
||||
// case TemplateTextMode.YAML:
|
||||
// result = array.map(YamlUtil.handleText).join(', ');
|
||||
// break;
|
||||
default:
|
||||
result = array.join(context.settings.arraySpilt);
|
||||
}
|
||||
@ -463,7 +463,7 @@ export default abstract class DoubanAbstractLoadHandler<T extends DoubanSubject>
|
||||
const fileNameSpilt = filename.split('.');
|
||||
const highImage = `https://img9.doubanio.com/view/photo/raw/public/${fileNameSpilt.first()}.jpg`
|
||||
const highFilename = fileNameSpilt.first() + '.jpg';
|
||||
const {success, filepath} = await context.netFileHandler.downloadFile(highImage, folder, highFilename, context);
|
||||
const {success, filepath} = await context.netFileHandler.downloadFile(highImage, folder, highFilename, context, false);
|
||||
if (success) {
|
||||
extract.image = filepath;
|
||||
return;
|
||||
@ -473,7 +473,7 @@ export default abstract class DoubanAbstractLoadHandler<T extends DoubanSubject>
|
||||
console.error('下载高清封面失败,将会使用普通封面')
|
||||
}
|
||||
}
|
||||
const {success, filepath} = await context.netFileHandler.downloadFile(image, folder, filename, context);
|
||||
const {success, filepath} = await context.netFileHandler.downloadFile(image, folder, filename, context, true);
|
||||
if (success) {
|
||||
extract.image = filepath;
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ export default class NetFileHandler {
|
||||
this.fileHandler = fileHandler;
|
||||
}
|
||||
|
||||
async downloadFile(url: string, folder:string, filename: string, context:HandleContext): Promise<{ success: boolean, error:string, filepath: string }> {
|
||||
async downloadFile(url: string, folder:string, filename: string, context:HandleContext, showError:boolean): Promise<{ success: boolean, error:string, filepath: string }> {
|
||||
const requestUrlParam: RequestUrlParam = {
|
||||
url: url,
|
||||
method: "GET",
|
||||
@ -26,11 +26,17 @@ export default class NetFileHandler {
|
||||
}).then(() => {
|
||||
return {success: true, error: '', filepath: filePath};
|
||||
})
|
||||
.catch(e => log
|
||||
.catch(e => {
|
||||
if (showError) {
|
||||
return log
|
||||
.error(
|
||||
i18nHelper.getMessage('130101')
|
||||
.replace('{0}', e.toString())
|
||||
, e));
|
||||
, e);
|
||||
}else {
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,15 +15,15 @@ export default class YamlUtil {
|
||||
}
|
||||
|
||||
public static handleText(text: string) {
|
||||
return YamlUtil.hasSpecialChar(text) ? YamlUtil.handleSpecialChar(text)
|
||||
return YamlUtil.hasSpecialChar(text) ? YamlUtil.handleSpecialChar(text.replaceAll('"', '\\"'))
|
||||
.replaceAll('\n', '。')
|
||||
.replaceAll('。。', '。') : text;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const SPECIAL_CHAR_REG = /[{}\[\]&*#?|\-<>=!%@:`,\n]/;
|
||||
export const TITLE_ALIASES_SPECIAL_CHAR_REG_G = /[{}\[\]&*#?|\-<>=!%@:`,, \n]/g;
|
||||
export const SPECIAL_CHAR_REG = /[{}\[\]&*#?|\-<>=!%@:"`,\n]/;
|
||||
export const TITLE_ALIASES_SPECIAL_CHAR_REG_G = /[{}\[\]&*#?|\-<>=!%@:"`,, \n]/g;
|
||||
|
||||
const SPECIAL_CHAR_REG_REPLACE: Map<string, string> = new Map([
|
||||
['{', '\\{'],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user