-
Notifications
You must be signed in to change notification settings - Fork 35
Embed Image links #142
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
base: master
Are you sure you want to change the base?
Embed Image links #142
Changes from 5 commits
4ec25de
ae5e0e4
8335112
85719d6
1254671
0e56ab2
45eb17b
3d865db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just reupload the files but the actual changes are on lines MALAPI: 119, 153, 184 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,15 +108,15 @@ export class MALAPI extends APIModel { | |
url: result.url, | ||
id: result.mal_id, | ||
|
||
plot: result.synopsis, | ||
plot: result.synopsis ? result.synopsis.replace('[Written by MAL Rewrite]', '').trim() : '', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and line 177 isnt need on the MALAPI.ts, this is suppose to remove the end comment return from pulling plot synopsis. No all of them had it and this was something i personally add on my end, that ened up getting pushed to PR, this doesnt need to be added. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems useful to keep |
||
genres: result.genres?.map((x: any) => x.name) ?? [], | ||
director: [], | ||
writer: [], | ||
studio: result.studios?.map((x: any) => x.name).join(', ') ?? 'unknown', | ||
duration: result.duration ?? 'unknown', | ||
onlineRating: result.score ?? 0, | ||
actors: [], | ||
image: result.images?.jpg?.image_url ?? '', | ||
image: this.plugin.settings.embedPosters ? `` ?? '' : result.images?.jpg?.image_url ?? '', | ||
|
||
released: true, | ||
premiere: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat) ?? 'unknown', | ||
|
@@ -150,7 +150,7 @@ export class MALAPI extends APIModel { | |
duration: result.duration ?? 'unknown', | ||
onlineRating: result.score ?? 0, | ||
actors: [], | ||
image: result.images?.jpg?.image_url ?? '', | ||
image: this.plugin.settings.embedPosters ? `` ?? '' : result.images?.jpg?.image_url ?? '', | ||
|
||
released: true, | ||
premiere: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat) ?? 'unknown', | ||
|
@@ -174,14 +174,15 @@ export class MALAPI extends APIModel { | |
url: result.url, | ||
id: result.mal_id, | ||
|
||
plot: result.synopsis ? result.synopsis.replace('[Written by MAL Rewrite]', '').trim() : '', | ||
genres: result.genres?.map((x: any) => x.name) ?? [], | ||
writer: [], | ||
studio: result.studios?.map((x: any) => x.name) ?? [], | ||
episodes: result.episodes, | ||
duration: result.duration ?? 'unknown', | ||
onlineRating: result.score ?? 0, | ||
streamingServices: result.streaming?.map((x: any) => x.name) ?? [], | ||
image: result.images?.jpg?.image_url ?? '', | ||
image: this.plugin.settings.embedPosters ? `` ?? '' : result.images?.jpg?.image_url ?? '', | ||
|
||
released: true, | ||
airedFrom: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat) ?? 'unknown', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just reupload the files but the actual changes are on lines OMDbAPI: 145, 177, 207 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ export interface MediaDbPluginSettings { | |
openNoteInNewTab: boolean; | ||
useDefaultFrontMatter: boolean; | ||
enableTemplaterIntegration: boolean; | ||
embedPosters: boolean; | ||
mProjectsCode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
apiToggle: { | ||
OMDbAPI: { | ||
movie: boolean; | ||
|
@@ -83,6 +84,7 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = { | |
openNoteInNewTab: true, | ||
useDefaultFrontMatter: true, | ||
enableTemplaterIntegration: false, | ||
embedPosters: false, | ||
apiToggle: { | ||
OMDbAPI: { | ||
movie: true, | ||
|
@@ -279,6 +281,15 @@ export class MediaDbSettingTab extends PluginSettingTab { | |
void this.plugin.saveSettings(); | ||
}); | ||
}); | ||
new Setting(containerEl) | ||
.setName('Embed posters in YAML') | ||
.setDesc('Embed the poster urls as images in the yaml to integrate with dataview.') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This pretty much sums it up nicely and no other way to put it, just adding a alternative "Embed the URLs of the poster images within the image property using the image embedding syntax There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
.addToggle(cb => { | ||
cb.setValue(this.plugin.settings.embedPosters).onChange(data => { | ||
this.plugin.settings.embedPosters = data; | ||
void this.plugin.saveSettings(); | ||
}); | ||
}); | ||
|
||
containerEl.createEl('h3', { text: 'APIs Per Media Type' }); | ||
containerEl.createEl('h5', { text: 'Movies' }); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing the ternary everywhere seems bad, as it's a lot of code duplication. This would be better as a general post-process step applied to all data models after the individual APIs created them.