maintenance
This commit is contained in:
parent
846f7de184
commit
1d76bb8981
7 changed files with 80 additions and 55 deletions
|
|
@ -112,7 +112,7 @@ Now you select the result you want and the plugin will cast it's magic and creat
|
||||||
### Currently supported APIs:
|
### Currently supported APIs:
|
||||||
|
|
||||||
| Name | Description | Supported formats | Authentification | Rate limiting | SFW filter support |
|
| Name | Description | Supported formats | Authentification | Rate limiting | SFW filter support |
|
||||||
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------ | ---------------------------------------------------------------------------- | ------------------------------ | ------------------ |
|
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
|
||||||
| [Jikan](https://jikan.moe/) | Jikan is an API that uses [My Anime List](https://myanimelist.net) and offers metadata for anime. | series, movies, specials, OVAs, manga, manwha, novels | No | 60 per minute and 3 per second | Yes |
|
| [Jikan](https://jikan.moe/) | Jikan is an API that uses [My Anime List](https://myanimelist.net) and offers metadata for anime. | series, movies, specials, OVAs, manga, manwha, novels | No | 60 per minute and 3 per second | Yes |
|
||||||
| [OMDb](https://www.omdbapi.com/) | OMDb is an API that offers metadata for movie, series and games. | series, movies, games | Yes, you can get a free key here [here](https://www.omdbapi.com/apikey.aspx) | 1000 per day | No |
|
| [OMDb](https://www.omdbapi.com/) | OMDb is an API that offers metadata for movie, series and games. | series, movies, games | Yes, you can get a free key here [here](https://www.omdbapi.com/apikey.aspx) | 1000 per day | No |
|
||||||
| [MusicBrainz](https://musicbrainz.org/) | MusicBrainz is an API that offers information about music releases. | music releases | No | 50 per second | No |
|
| [MusicBrainz](https://musicbrainz.org/) | MusicBrainz is an API that offers information about music releases. | music releases | No | 50 per second | No |
|
||||||
|
|
@ -120,7 +120,6 @@ Now you select the result you want and the plugin will cast it's magic and creat
|
||||||
| [Steam](https://store.steampowered.com/) | The Steam API offers information on all steam games. | games | No | 10000 per day | No |
|
| [Steam](https://store.steampowered.com/) | The Steam API offers information on all steam games. | games | No | 10000 per day | No |
|
||||||
| [Open Library](https://openlibrary.org) | The OpenLibrary API offers metadata for books | books | No | Cover access is rate-limited when not using CoverID or OLID by max 100 requests/IP every 5 minutes. This plugin uses OLID so there shouldn't be a rate limit. | No |
|
| [Open Library](https://openlibrary.org) | The OpenLibrary API offers metadata for books | books | No | Cover access is rate-limited when not using CoverID or OLID by max 100 requests/IP every 5 minutes. This plugin uses OLID so there shouldn't be a rate limit. | No |
|
||||||
|
|
||||||
|
|
||||||
#### Notes
|
#### Notes
|
||||||
|
|
||||||
- [Jikan](https://jikan.moe/)
|
- [Jikan](https://jikan.moe/)
|
||||||
|
|
@ -154,7 +153,6 @@ Now you select the result you want and the plugin will cast it's magic and creat
|
||||||
- e.g. for "Fantastic Mr. Fox" the URL looks like this `https://openlibrary.org/works/OL45804W` so the ID is `/works/OL45804W`
|
- e.g. for "Fantastic Mr. Fox" the URL looks like this `https://openlibrary.org/works/OL45804W` so the ID is `/works/OL45804W`
|
||||||
- This URL is located near the top of the page above the title, see `An edition of Fantastic Mr Fox (1970) `
|
- This URL is located near the top of the page above the title, see `An edition of Fantastic Mr Fox (1970) `
|
||||||
|
|
||||||
|
|
||||||
### Problems, unexpected behavior or improvement suggestions?
|
### Problems, unexpected behavior or improvement suggestions?
|
||||||
|
|
||||||
You are more than welcome to open an issue on [GitHub](https://github.com/mProjectsCode/obsidian-media-db-plugin/issues).
|
You are more than welcome to open an issue on [GitHub](https://github.com/mProjectsCode/obsidian-media-db-plugin/issues).
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,12 @@ export class APIManager {
|
||||||
this.apis = [];
|
this.apis = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queries the basic info for one query string and multiple APIs.
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @param apisToQuery
|
||||||
|
*/
|
||||||
async query(query: string, apisToQuery: string[]): Promise<MediaTypeModel[]> {
|
async query(query: string, apisToQuery: string[]): Promise<MediaTypeModel[]> {
|
||||||
console.debug(`MDB | api manager queried with "${query}"`);
|
console.debug(`MDB | api manager queried with "${query}"`);
|
||||||
|
|
||||||
|
|
@ -23,10 +29,21 @@ export class APIManager {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queries detailed information for a MediaTypeModel.
|
||||||
|
*
|
||||||
|
* @param item
|
||||||
|
*/
|
||||||
async queryDetailedInfo(item: MediaTypeModel): Promise<MediaTypeModel> {
|
async queryDetailedInfo(item: MediaTypeModel): Promise<MediaTypeModel> {
|
||||||
return await this.queryDetailedInfoById(item.id, item.dataSource);
|
return await this.queryDetailedInfoById(item.id, item.dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queries detailed info for an id from an API.
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param apiName
|
||||||
|
*/
|
||||||
async queryDetailedInfoById(id: string, apiName: string): Promise<MediaTypeModel> {
|
async queryDetailedInfoById(id: string, apiName: string): Promise<MediaTypeModel> {
|
||||||
for (const api of this.apis) {
|
for (const api of this.apis) {
|
||||||
if (api.apiName === apiName) {
|
if (api.apiName === apiName) {
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ export class MALAPIManga extends APIModel {
|
||||||
personalRating: 0,
|
personalRating: 0,
|
||||||
},
|
},
|
||||||
} as MangaModel)
|
} as MangaModel)
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,8 @@ export class MediaDbPreviewModal extends Modal {
|
||||||
fileContent = `\n${fileContent}\n`;
|
fileContent = `\n${fileContent}\n`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await MarkdownRenderer.renderMarkdown(fileContent, fileDiv, '', this.markdownComponent);
|
// TODO: fix this not rendering the frontmatter any more
|
||||||
|
await MarkdownRenderer.render(this.app, fileContent, fileDiv, '', this.markdownComponent);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(`mdb | error during rendering of preview`, e);
|
console.warn(`mdb | error during rendering of preview`, e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,16 @@ import { MusicReleaseModel } from '../models/MusicReleaseModel';
|
||||||
import { BoardGameModel } from '../models/BoardGameModel';
|
import { BoardGameModel } from '../models/BoardGameModel';
|
||||||
import { BookModel } from '../models/BookModel';
|
import { BookModel } from '../models/BookModel';
|
||||||
|
|
||||||
export const MEDIA_TYPES: MediaType[] = [MediaType.Movie, MediaType.Series, MediaType.Manga, MediaType.Game, MediaType.Wiki, MediaType.MusicRelease, MediaType.BoardGame, MediaType.Book];
|
export const MEDIA_TYPES: MediaType[] = [
|
||||||
|
MediaType.Movie,
|
||||||
|
MediaType.Series,
|
||||||
|
MediaType.Manga,
|
||||||
|
MediaType.Game,
|
||||||
|
MediaType.Wiki,
|
||||||
|
MediaType.MusicRelease,
|
||||||
|
MediaType.BoardGame,
|
||||||
|
MediaType.Book,
|
||||||
|
];
|
||||||
|
|
||||||
export class MediaTypeManager {
|
export class MediaTypeManager {
|
||||||
mediaFileNameTemplateMap: Map<MediaType, string>;
|
mediaFileNameTemplateMap: Map<MediaType, string>;
|
||||||
|
|
|
||||||
|
|
@ -440,7 +440,7 @@ export class ModalHelper {
|
||||||
* then executes the `submitCallback` returning the callbacks result and closing the modal.
|
* then executes the `submitCallback` returning the callbacks result and closing the modal.
|
||||||
*
|
*
|
||||||
* @param selectModalOptions the options for the modal, see {@link SELECT_MODAL_OPTIONS_DEFAULT}
|
* @param selectModalOptions the options for the modal, see {@link SELECT_MODAL_OPTIONS_DEFAULT}
|
||||||
* @param submitCallback the callback that gets executed after the modal has been submitted, but after it has been closed
|
* @param submitCallback the callback that gets executed after the modal has been submitted, but before it has been closed
|
||||||
* @returns the user input or nothing and a reference to the modal.
|
* @returns the user input or nothing and a reference to the modal.
|
||||||
*/
|
*/
|
||||||
async openSelectModal(selectModalOptions: SelectModalOptions, submitCallback: (selectModalData: SelectModalData) => Promise<MediaTypeModel[]>): Promise<MediaTypeModel[]> {
|
async openSelectModal(selectModalOptions: SelectModalOptions, submitCallback: (selectModalData: SelectModalData) => Promise<MediaTypeModel[]>): Promise<MediaTypeModel[]> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue