Skip to content

Restored and updated the api toggle + added a download option for poster images #183

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

Merged
merged 19 commits into from
May 20, 2025

Conversation

ltctceplrm
Copy link
Contributor

This will allow users to choose which API to use per media type, speeding up the requests and also getting rid of missing API key errors by simply disabling that API if they're not interested in using it.

In this updated version the settings are now dynamically added rather than manually.

The API toggles are grouped per media type and look like this:
image

The settings screen where you can toggle each API per media type is now fully automatic and works for each media type that has more than 1 API.
Copy link
Owner

@mProjectsCode mProjectsCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does look better, thanks :)

@ltctceplrm
Copy link
Contributor Author

I reverted the earlier fix for "MALAPI Manga" with the space in it's name because it didn't work well, to ensure compatibility I think spaces shouldn't be allowed in API names. I've added a conversion from dataSource: MALAPI Manga to dataSource: MALAPIManga so it shouldn't break anything for existing users.

If you prefer me to try to make it work with the space instead I can try that again.

Otherwise it should be fully functional now

@ltctceplrm ltctceplrm requested a review from mProjectsCode March 7, 2025 17:50
Copy link
Owner

@mProjectsCode mProjectsCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some few more minor things.

- Replaced interpolated string to a new function getDisabledMediaTypes()
- Added override for every API with the plugin settings for disabled media types
- Added _disabledMediaTypes for API's even if they are the only provider of a media type
- Replaced static apiMediaTypes to a dynamic version
@ltctceplrm ltctceplrm requested a review from mProjectsCode March 8, 2025 01:40
Use MediaType[] instead of string[], changed variables to lowercase
@ltctceplrm ltctceplrm requested a review from mProjectsCode March 8, 2025 13:01
@ltctceplrm
Copy link
Contributor Author

I'm adding a small bug fix for an unrelated issue: #188 where pressing cancel still creates the selected media entry, please let me know if you'd prefer it as a separate PR.

ltctceplrm added 5 commits May 5, 2025 16:36
changed steam to a vertical poster to fit the other posters and upgraded the quality of omdb from SX300 to SX600
Plugin will no longer download a poster if it already exists, to avoid unnecessary downloads and in case the user has modified the saved image themselves
@ltctceplrm ltctceplrm changed the title Restored and updated the api toggle Restored and updated the api toggle + added a download option for poster images May 12, 2025
@ltctceplrm
Copy link
Contributor Author

ltctceplrm commented May 12, 2025

The new download option would close #150, it is toggleable and defaults to false so if users prefer keeping the url they don't have to change anything, if users want to download then they can enter a path and turn on the button
image

Posters are saved as "[[{{ folder path}}/{{ mediatype }}_{{ title }} {{ year }}.{{ ext }}]]" which would translate to "[[Resources/Posters/series_Day Break (2006–2007).jpg]]", I use the wikilinks this way because it's how obsidian links to files and the user can then easily modify or delete the poster if they so choose.

Users can also choose to embed the image in their note with this dataview:
="!" + this.image or ="![[" + meta(this.image).path + "|350]]" if they want a specific size for the embedded image

image

The poster resolution has been upgraded from a width of 300px to 600px and the steam posters are now vertical rather than horizontal to fit in with the rest of the posters.

Previous:
header
New:
image

Edit: Users that turn on the toggle can simply reload the metadata for the note and it will download the image, no need to create a new note and copy it over.

if (mediaTypeModel.image && typeof mediaTypeModel.image === 'string' && mediaTypeModel.image.startsWith('http')) {
if (this.settings.imageDownload) {
try {
const imageurl = mediaTypeModel.image;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would extract this into a separate method.

@mProjectsCode
Copy link
Owner

Looks good, thanks :)

@mProjectsCode mProjectsCode merged commit 917f7ab into mProjectsCode:master May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants