Skip to content

Commit f6825bb

Browse files
committed
Return of the test API and update readme
1 parent 3b1e500 commit f6825bb

File tree

3 files changed

+66
-8
lines changed

3 files changed

+66
-8
lines changed

README.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ A plugin that can query multiple APIs for movies, series, anime, games, music an
44

55
### Features
66
#### Search by Title
7-
Search a movie, series, anime or game by its name across multiple APIs.
7+
Search a movie, series, anime, game, music release or wiki article by its name across multiple APIs.
88

99
#### Search by ID
10-
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.
10+
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.
1111

1212
#### Templates
1313
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.
2727
element 1, element 2, element 3, ...
2828
```
2929

30+
Available variables that can be used in template tags are the same variables from the metadata of the note.
3031

3132
I also published my own templates [here](https://github.com/mProjectsCode/obsidian-media-db-templates).
3233

34+
### How to install
35+
Currently, you have to manually download the zip archive from the latest release here on GitHub.
36+
After downloading, extract the archive into the `.obsidian/plugins` folder in your vault.
37+
38+
The folder structure should look like this:
39+
```
40+
[path to your vault]
41+
|_ .obsidian
42+
|_ plugins
43+
|_ obsidian-media-db-plugin
44+
|_ main.js
45+
|_ manifest.json
46+
|_ styles.css
47+
```
48+
49+
Once the plugin submission goes through, the plugin will also be installable directly through obsidian's plugin installer.
50+
51+
### How to use
52+
(pictures are coming)
53+
54+
Once you have installed this plugin, you will find a database icon in the left ribbon.
55+
When using this or the `Add new Media DB entry` command, a popup will open.
56+
Here you can enter the title of what you want to search for and then select in which APIs to search.
57+
58+
After clicking search, a new popup will open prompting you to select from the search results.
59+
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.
60+
3361
### Currently supported media types
3462
- movies (including specials)
3563
- series (including OVAs)
@@ -39,11 +67,11 @@ I also published my own templates [here](https://github.com/mProjectsCode/obsidi
3967

4068
### Currently supported APIs:
4169
| Name | Description | Supported formats | Authentification | Rate limiting | SFW filter support |
42-
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------ | ---------------------------------------------------------------------------- | ------------------------------ | ------------------ |
70+
|------------------------------------------------------|---------------------------------------------------------------------------------------------------|--------------------------------|------------------------------------------------------------------------------|--------------------------------|--------------------|
4371
| [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 |
4472
| [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 |
4573
| [MusicBrainz](https://musicbrainz.org/) | MusicBrainz is an API that offers information about music releases. | music releases | No | 50 per second | No |
46-
| [Wikipedia](https://en.wikipedia.org/wiki/Main_Page) | The Wikipedia API allows acces to all Wikipedia articles. | wiki articles | No | None | No | | | | | | |
74+
| [Wikipedia](https://en.wikipedia.org/wiki/Main_Page) | The Wikipedia API allows acces to all Wikipedia articles. | wiki articles | No | None | No |
4775

4876
#### Notes
4977
- [Jikan](https://jikan.moe/)
@@ -65,6 +93,9 @@ I also published my own templates [here](https://github.com/mProjectsCode/obsidi
6593
- [Wikipedia](https://en.wikipedia.org/wiki/Main_Page)
6694
- [here](https://en.wikipedia.org/wiki/Wikipedia:Finding_a_Wikidata_ID) is a guide to finding the Wikipedia ID for an article
6795

96+
### Problems, unexpected behavior or improvement suggestions?
97+
You are more than welcome to open an issue on [GitHub](https://github.com/mProjectsCode/obsidian-media-db-plugin/issues).
98+
6899
### Contributions
69100
Thank you for wanting to contribute to this project.
70101

src/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ export default class MediaDbPlugin extends Plugin {
2222

2323
// add icon to the left ribbon
2424
const ribbonIconEl = this.addRibbonIcon('database', 'Add new Media DB entry', (evt: MouseEvent) =>
25-
this.createMediaDbNote(this.openMediaDbSearchModal.bind(this)),
25+
this.createMediaDbNote(this.openMediaDbAdvancedSearchModal.bind(this)),
2626
);
2727
ribbonIconEl.addClass('obsidian-media-db-plugin-ribbon-class');
2828

2929
// register command to open search modal
3030
this.addCommand({
3131
id: 'open-media-db-search-modal',
3232
name: 'Add new Media DB entry',
33-
callback: () => this.createMediaDbNote(this.openMediaDbSearchModal.bind(this)),
33+
callback: () => this.createMediaDbNote(this.openMediaDbAdvancedSearchModal.bind(this)),
3434
});
3535
// register command to open id search modal
3636
this.addCommand({
3737
id: 'open-media-db-id-search-modal',
3838
name: 'Add new Media DB entry by id',
3939
callback: () => this.createMediaDbNote(this.openMediaDbIdSearchModal.bind(this)),
4040
});
41-
41+
// register command to update the open note
4242
this.addCommand({
4343
id: 'update-media-db-note',
4444
name: 'Update the open note, if it is a Media DB entry.',
@@ -103,7 +103,7 @@ export default class MediaDbPlugin extends Plugin {
103103
}
104104
}
105105

106-
async openMediaDbSearchModal(): Promise<MediaTypeModel> {
106+
async openMediaDbAdvancedSearchModal(): Promise<MediaTypeModel> {
107107
return new Promise(((resolve, reject) => {
108108
new MediaDbAdvancedSearchModal(this.app, this, (err, results) => {
109109
if (err) return reject(err);

src/tests/TestAPI.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {APIModel} from '../api/APIModel';
2+
import {MediaTypeModel} from '../models/MediaTypeModel';
3+
import MediaDbPlugin from '../main';
4+
5+
export class TestAPI extends APIModel {
6+
plugin: MediaDbPlugin;
7+
8+
9+
constructor(plugin: MediaDbPlugin) {
10+
super();
11+
12+
this.plugin = plugin;
13+
this.apiName = 'TestAPI';
14+
this.apiDescription = 'A test API for automated testing.';
15+
this.apiUrl = '';
16+
this.types = [];
17+
}
18+
19+
20+
async getById(item: MediaTypeModel): Promise<MediaTypeModel> {
21+
return undefined;
22+
}
23+
24+
async searchByTitle(title: string): Promise<MediaTypeModel[]> {
25+
return [] as MediaTypeModel[];
26+
}
27+
}

0 commit comments

Comments
 (0)