Return of the test API and update readme

This commit is contained in:
mProjectsCode 2022-05-26 20:20:00 +02:00
parent 3b1e500317
commit f6825bbadc
3 changed files with 66 additions and 8 deletions

View file

@ -4,10 +4,10 @@ A plugin that can query multiple APIs for movies, series, anime, games, music an
### Features
#### Search by Title
Search a movie, series, anime or game by its name across multiple APIs.
Search a movie, series, anime, game, music release or wiki article by its name across multiple APIs.
#### Search by ID
Allows you to search by an ID that varies from API to API. Concrete info can be found in the description of the individual APIs.
Allows you to search by an ID that varies from API to API. Concrete information on this feature can be found in the description of the individual APIs.
#### Templates
The plugin allows you to set a template note that gets added to the end of any note created by this plugin.
@ -27,9 +27,37 @@ For arrays there are two special ways of displaying them.
element 1, element 2, element 3, ...
```
Available variables that can be used in template tags are the same variables from the metadata of the note.
I also published my own templates [here](https://github.com/mProjectsCode/obsidian-media-db-templates).
### How to install
Currently, you have to manually download the zip archive from the latest release here on GitHub.
After downloading, extract the archive into the `.obsidian/plugins` folder in your vault.
The folder structure should look like this:
```
[path to your vault]
|_ .obsidian
|_ plugins
|_ obsidian-media-db-plugin
|_ main.js
|_ manifest.json
|_ styles.css
```
Once the plugin submission goes through, the plugin will also be installable directly through obsidian's plugin installer.
### How to use
(pictures are coming)
Once you have installed this plugin, you will find a database icon in the left ribbon.
When using this or the `Add new Media DB entry` command, a popup will open.
Here you can enter the title of what you want to search for and then select in which APIs to search.
After clicking search, a new popup will open prompting you to select from the search results.
Now you select the result you want and the plugin will cast it's magic and create a new note in your vault, that contains the metadata of the selected search result.
### Currently supported media types
- movies (including specials)
- series (including OVAs)
@ -39,11 +67,11 @@ I also published my own templates [here](https://github.com/mProjectsCode/obsidi
### Currently supported APIs:
| 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 | 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 |
| [MusicBrainz](https://musicbrainz.org/) | MusicBrainz is an API that offers information about music releases. | music releases | No | 50 per second | No |
| [Wikipedia](https://en.wikipedia.org/wiki/Main_Page) | The Wikipedia API allows acces to all Wikipedia articles. | wiki articles | No | None | No | | | | | | |
| [Wikipedia](https://en.wikipedia.org/wiki/Main_Page) | The Wikipedia API allows acces to all Wikipedia articles. | wiki articles | No | None | No |
#### Notes
- [Jikan](https://jikan.moe/)
@ -65,6 +93,9 @@ I also published my own templates [here](https://github.com/mProjectsCode/obsidi
- [Wikipedia](https://en.wikipedia.org/wiki/Main_Page)
- [here](https://en.wikipedia.org/wiki/Wikipedia:Finding_a_Wikidata_ID) is a guide to finding the Wikipedia ID for an article
### 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).
### Contributions
Thank you for wanting to contribute to this project.

View file

@ -22,7 +22,7 @@ export default class MediaDbPlugin extends Plugin {
// add icon to the left ribbon
const ribbonIconEl = this.addRibbonIcon('database', 'Add new Media DB entry', (evt: MouseEvent) =>
this.createMediaDbNote(this.openMediaDbSearchModal.bind(this)),
this.createMediaDbNote(this.openMediaDbAdvancedSearchModal.bind(this)),
);
ribbonIconEl.addClass('obsidian-media-db-plugin-ribbon-class');
@ -30,7 +30,7 @@ export default class MediaDbPlugin extends Plugin {
this.addCommand({
id: 'open-media-db-search-modal',
name: 'Add new Media DB entry',
callback: () => this.createMediaDbNote(this.openMediaDbSearchModal.bind(this)),
callback: () => this.createMediaDbNote(this.openMediaDbAdvancedSearchModal.bind(this)),
});
// register command to open id search modal
this.addCommand({
@ -38,7 +38,7 @@ export default class MediaDbPlugin extends Plugin {
name: 'Add new Media DB entry by id',
callback: () => this.createMediaDbNote(this.openMediaDbIdSearchModal.bind(this)),
});
// register command to update the open note
this.addCommand({
id: 'update-media-db-note',
name: 'Update the open note, if it is a Media DB entry.',
@ -103,7 +103,7 @@ export default class MediaDbPlugin extends Plugin {
}
}
async openMediaDbSearchModal(): Promise<MediaTypeModel> {
async openMediaDbAdvancedSearchModal(): Promise<MediaTypeModel> {
return new Promise(((resolve, reject) => {
new MediaDbAdvancedSearchModal(this.app, this, (err, results) => {
if (err) return reject(err);

27
src/tests/TestAPI.ts Normal file
View file

@ -0,0 +1,27 @@
import {APIModel} from '../api/APIModel';
import {MediaTypeModel} from '../models/MediaTypeModel';
import MediaDbPlugin from '../main';
export class TestAPI extends APIModel {
plugin: MediaDbPlugin;
constructor(plugin: MediaDbPlugin) {
super();
this.plugin = plugin;
this.apiName = 'TestAPI';
this.apiDescription = 'A test API for automated testing.';
this.apiUrl = '';
this.types = [];
}
async getById(item: MediaTypeModel): Promise<MediaTypeModel> {
return undefined;
}
async searchByTitle(title: string): Promise<MediaTypeModel[]> {
return [] as MediaTypeModel[];
}
}