diff --git a/.eslintignore b/.eslintignore index e019f3c..14ed7c6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,3 @@ -node_modules/ - -main.js +node_modules/ + +main.js diff --git a/.eslintrc b/.eslintrc index 0807290..b66af83 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,23 +1,23 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "env": { "node": true }, - "plugins": [ - "@typescript-eslint" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended" - ], - "parserOptions": { - "sourceType": "module" - }, - "rules": { - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": ["error", { "args": "none" }], - "@typescript-eslint/ban-ts-comment": "off", - "no-prototype-builtins": "off", - "@typescript-eslint/no-empty-function": "off" - } +{ + "root": true, + "parser": "@typescript-eslint/parser", + "env": { "node": true }, + "plugins": [ + "@typescript-eslint" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": ["error", { "args": "none" }], + "@typescript-eslint/ban-ts-comment": "off", + "no-prototype-builtins": "off", + "@typescript-eslint/no-empty-function": "off" + } } \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8272408..cfcead6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,34 +1,34 @@ -name: Release Obsidian plugin - -on: - push: - tags: - - "*" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: "18.x" - - - name: Build plugin - run: | - npm install - npm run build - - - name: Create release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - tag="${GITHUB_REF#refs/tags/}" - - gh release create "$tag" \ - --title="$tag" \ - --draft \ - main.js manifest.json styles.css +name: Release Obsidian plugin + +on: + push: + tags: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: "18.x" + + - name: Build plugin + run: | + npm install + npm run build + + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + tag="${GITHUB_REF#refs/tags/}" + + gh release create "$tag" \ + --title="$tag" \ + --draft \ + main.js manifest.json styles.css diff --git a/LICENSE b/LICENSE index aabbd57..55a3db3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2023 Leon Holtmeier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2023 Leon Holtmeier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index e509481..2e5b077 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,94 @@ -# Obsidian Moviegrabber - -A plugin to generate notes for movies and series with properties that can be used with [dataview](https://github.com/blacksmithgu/obsidian-dataview). Uses the [Open Movie Database (OMDb) API](http://www.omdbapi.com/) to retrieve movie/series data and the [Youtube Data API](https://developers.google.com/youtube/v3/docs?hl=de) to get the embed links for the trailers (optional). - -
- - -
- ---- - -# Usage - -https://github.com/Superschnizel/Obsidian-Moviegrabber/assets/47162464/28e2ca9d-e504-4923-9609-dc1e5953d219 - -*(Disclaimer: the choice selection uses outside assets for the movie posters in the preview, retrieved in the search request to OMDb)* - -To use this plugin you need to create an API key for the OMDb [here](http://www.omdbapi.com/apikey.aspx) and optionally also a Youtube Data API Key as described [here](https://developers.google.com/youtube/v3/docs#calling-the-api). and set these in the plugin settings. - -To search for a movie or series, simply call the command `Search movie` or `Search series` and search a movie by entering a title or a valid IMDB-id. - -## Templates - -To define how the data will be saved in your notes you can define a template. This template uses tags of the form `{{tag}}` to fill in the data. The available tags are: -``` -{{Title}} -{{Year}} -{{Rated}} -{{Runtime}} -{{Genre}} -{{Director}} -{{Writer}} -{{Actors}} -{{Plot}} -{{Language}} -{{Country}} -{{Awards}} -{{Poster}} -{{Ratings}} -{{Metascore}} -{{imdbRating}} -{{imdbVotes}} -{{imdbID}} -{{Type}} -{{DVD}} -{{BoxOffice}} -{{Production}} -{{Website}} -{{totalSeasons}} -{{YoutubeEmbed}} -``` -Additionally you can define a pre- and suffix to be applied to the data. this is done by using `{{tag|prefix|suffix}}`. *(if you want to use the "|" character, it can be escaped using "\\|")*. - -Example: ``{{Director|"[[|]]"}}`` will create an internal link of the form `"[[Director]]"` - -You can generate an example template in the plugin settings. If no template is given, this default template is used. - -## Regenerating notes - -When trying to create a note for a movie that already exists you will be asked if you want to overwrite the existing note. If you want to keep something from the old note in the newly generated one you can make use of the delimiter string: - -``` -%%==MOVIEGRABBER_KEEP==%% -``` -Everything below this will be transfered to the new note when overwriting. - -# Using the generated notes with Dataview and custom CSS - -Using a [dataview](https://github.com/blacksmithgu/) table in combination with a custom [css snippet](https://help.obsidian.md/Extending+Obsidian/CSS+snippets), you can use these notes to create an interactive display for your movies. - -![grafik](https://github.com/Superschnizel/Obsidian-Moviegrabber/assets/47162464/be2345a6-eeab-4e8b-b2e1-2a5263a9dc41) - - -https://github.com/Superschnizel/Obsidian-Moviegrabber/assets/47162464/fc555eea-0ae4-46b4-87d2-44cc2626d387 - -To use this, copy `aditional_css/CardViewMovies.css` to your vault's snippets folder (`.obsidian/snippets/`) and put - -```yaml ---- -cssclass: CardViewMovies ---- -``` -at the top of your note. - -A dataview query for movies not yet seen could look something like this: - -````dataview -```dataview -TABLE country, year, length, trailer_embed, availability, rating, seen -FROM "Movies" WHERE type = "movie" AND seen = Null -``` -```` - -Note that the cards need at least ``country, year, length, trailer_embed`` in the querry to show a card. +# Obsidian Moviegrabber + +A plugin to generate notes for movies and series with properties that can be used with [dataview](https://github.com/blacksmithgu/obsidian-dataview). Uses the [Open Movie Database (OMDb) API](http://www.omdbapi.com/) to retrieve movie/series data and the [Youtube Data API](https://developers.google.com/youtube/v3/docs?hl=de) to get the embed links for the trailers (optional). + ++ + +
+ +--- + +# Usage + +https://github.com/Superschnizel/Obsidian-Moviegrabber/assets/47162464/28e2ca9d-e504-4923-9609-dc1e5953d219 + +*(Disclaimer: the choice selection uses outside assets for the movie posters in the preview, retrieved in the search request to OMDb)* + +To use this plugin you need to create an API key for the OMDb [here](http://www.omdbapi.com/apikey.aspx) and optionally also a Youtube Data API Key as described [here](https://developers.google.com/youtube/v3/docs#calling-the-api). and set these in the plugin settings. + +To search for a movie or series, simply call the command `Search movie` or `Search series` and search a movie by entering a title or a valid IMDB-id. + +## Templates + +To define how the data will be saved in your notes you can define a template. This template uses tags of the form `{{tag}}` to fill in the data. The available tags are: +``` +{{Title}} +{{Year}} +{{Rated}} +{{Runtime}} +{{Genre}} +{{Director}} +{{Writer}} +{{Actors}} +{{Plot}} +{{Language}} +{{Country}} +{{Awards}} +{{Poster}} +{{Ratings}} +{{Metascore}} +{{imdbRating}} +{{imdbVotes}} +{{imdbID}} +{{Type}} +{{DVD}} +{{BoxOffice}} +{{Production}} +{{Website}} +{{totalSeasons}} +{{YoutubeEmbed}} +``` +Additionally you can define a pre- and suffix to be applied to the data. this is done by using `{{tag|prefix|suffix}}`. *(if you want to use the "|" character, it can be escaped using "\\|")*. + +Example: ``{{Director|"[[|]]"}}`` will create an internal link of the form `"[[Director]]"` + +You can generate an example template in the plugin settings. If no template is given, this default template is used. + +## Regenerating notes + +When trying to create a note for a movie that already exists you will be asked if you want to overwrite the existing note. If you want to keep something from the old note in the newly generated one you can make use of the delimiter string: + +``` +%%==MOVIEGRABBER_KEEP==%% +``` +Everything below this will be transfered to the new note when overwriting. + +# Using the generated notes with Dataview and custom CSS + +Using a [dataview](https://github.com/blacksmithgu/) table in combination with a custom [css snippet](https://help.obsidian.md/Extending+Obsidian/CSS+snippets), you can use these notes to create an interactive display for your movies. + +![grafik](https://github.com/Superschnizel/Obsidian-Moviegrabber/assets/47162464/be2345a6-eeab-4e8b-b2e1-2a5263a9dc41) + + +https://github.com/Superschnizel/Obsidian-Moviegrabber/assets/47162464/fc555eea-0ae4-46b4-87d2-44cc2626d387 + +To use this, copy `aditional_css/CardViewMovies.css` to your vault's snippets folder (`.obsidian/snippets/`) and put + +```yaml +--- +cssclass: CardViewMovies +--- +``` +at the top of your note. + +A dataview query for movies not yet seen could look something like this: + +````dataview +```dataview +TABLE country, year, length, trailer_embed, availability, rating, seen +FROM "Movies" WHERE type = "movie" AND seen = Null +``` +```` + +Note that the cards need at least ``country, year, length, trailer_embed`` in the querry to show a card. diff --git a/additional_css/CardViewMovies.css b/additional_css/CardViewMovies.css index d991e24..98f6b8b 100644 --- a/additional_css/CardViewMovies.css +++ b/additional_css/CardViewMovies.css @@ -1,296 +1,297 @@ -/* READ ME */ -/* ------------------------------------------------------------------------------------------------- -This file was adapted from https://obsidian-snippets.pages.dev/snippets/dataview-table-as-cards/ -by Leon Holtmeier (https://github.com/Superschnizel) to work with movie Notes. ------------------------------------------------------------------------------------------------- -original Text: - -This css has been built to be used with dataview tables, and assumes you are not using dataviewjs. -But this can easily be adapted to list view. Because this css is not supported by a js backend, -text and backgrounds will not autosize (i think so anyway, i haven't found a way. if you do share -on discord @yungbananapeel#2624) - -I'm not that great as using css, so there is probably a lot of redundancies in the file. -The Main thing to understand about using the css to manipulate the tables is the structure of a -DV table. - -Any content about a page you want returned is delivered as a child element of a span, that is -nested inside of a TD. -The TD's are the individual containers that make up the columns of a row. if you want to change -the structure of a table on top of this file, its important to remember all the relationships -between the TR>TD>SPAN>CONTENT. - -An an example images and links are returned as & tags as children of a div, -but strings are returned as the content of the span, not as content of a child element.like so: - - cool link - picture - -YOUR TEXT HERE - -TABLE STRUCTURE -- EACH TD CORRESPONDS TO A COLUMN - THEY ARE ORDERED TOP TO BOTTOM, IN ORDER FROM LEFT TO RIGHT - - THIS SPAN IS WHERE YOUR RETURNS INFO IS (links, images, text) - - | -
+ EACH TD CORRESPONDS TO A COLUMN + THEY ARE ORDERED TOP TO BOTTOM, IN ORDER FROM LEFT TO RIGHT + + THIS SPAN IS WHERE YOUR RETURNS INFO IS (links, images, text) + + | +