diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a21cd52..645b7fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,9 +30,13 @@ jobs: main.js manifest.json styles.css + - name: Generate Release Notes + run: | + git log -1 --pretty=%B > release-notes.md - name: Create Release # https://github.com/ncipollo/release-action uses: ncipollo/release-action@v1.20.0 with: artifacts: "main.js,manifest.json,styles.css" + bodyFile: release-notes.md token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index fae4c00..30cd8c4 100644 --- a/README.md +++ b/README.md @@ -24,17 +24,18 @@ https://github.com/user-attachments/assets/ab89ea54-b529-49e0-aa6a-15a6ee7679ca This plugin makes the following network requests: -| URL | Purpose | When | Initiated by | -| --- | ------- | ---- | ------------ | -| Streaming Availability API by Movie of the Night | Search movies and TV shows, fetch availability by TMDB ID, and load the supported country list | Searches, note refreshes, syncs, and settings views that need country data | The plugin calls the `streaming-availability` client, which sends the request | -| User-configured Jellyfin server URL | Search Jellyfin libraries for matching movies or series and read watched status for a configured user | Jellyfin sync commands and show syncs with Jellyfin enabled | This plugin's source code, using Obsidian `requestUrl` | -| Poster image URLs returned by the Streaming Availability API | Download poster images into the vault when local poster saving is enabled | Show syncs where the poster file is missing | This plugin's source code, using Obsidian `requestUrl` | -| `https://www.movieofthenight.com/about/api` and RapidAPI documentation/pricing pages | Open API documentation and signup pages | User clicks from settings or README links | Obsidian/browser link handling | +| Package | URL | Purpose | +| ------- | --- | ------- | +| `streaming-availability` | Streaming Availability API by Movie of the Night | Search movies and TV shows, fetch availability by TMDB ID, and load supported countries. | +| Who Is Streaming | User-configured Jellyfin server URL | Search Jellyfin libraries for matching shows and read watched status. | +| Who Is Streaming | Poster image URLs returned by the Streaming Availability API | Download poster images into the vault when local poster saving is enabled. | ## Dependencies -| Package | Description | -| ------- | ----------- | -| [streaming-availability](https://www.npmjs.com/package/streaming-availability) | Calls the Streaming Availability API by Movie of the Night | -| [he](https://github.com/mathiasbynens/he) | Decodes HTML entities in movie and show metadata | +| Package | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------ | +| [streaming-availability](https://www.npmjs.com/package/streaming-availability) | Calls the Streaming Availability API by Movie of the Night | +| [he](https://github.com/mathiasbynens/he) | Decodes HTML entities in movie and show metadata | +| [Dataview](https://blacksmithgu.github.io/obsidian-dataview/) | Optional. Used for bulk refresh features | + diff --git a/esbuild.config.mjs b/esbuild.config.mjs index 736fc13..fa11b89 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -15,6 +15,9 @@ const context = await esbuild.context({ banner: { js: banner, }, + alias: { + "streaming-availability": "./node_modules/streaming-availability/src/index.ts", + }, entryPoints: ["src/main.ts"], bundle: true, external: [ diff --git a/eslint.config.mjs b/eslint.config.mjs index 1d6b142..b38dd42 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -15,14 +15,18 @@ const obsidianRecommended = obsidianmd.configs.recommended.map((config) => { : config; }); -const brands = [ - ...DEFAULT_BRANDS, +const pluginBrands = [ "Dataview", "Jellyfin", "Movie of the Night", "Streaming Availability API", ]; +const brands = [ + ...DEFAULT_BRANDS, + ...pluginBrands.filter((brand) => !DEFAULT_BRANDS.includes(brand)), +]; + export default tseslint.config( { languageOptions: { diff --git a/manifest.json b/manifest.json index b1e061d..e8fad8f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "who-is-streaming", "name": "Who Is Streaming", - "version": "1.1.1", + "version": "1.1.2", "minAppVersion": "1.10.0", "description": "Discover and document which streaming services a movie is currently available to be streamed on.", "author": "Bob Stanton", diff --git a/package-lock.json b/package-lock.json index 19b422a..49c9e25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "who-is-streaming", - "version": "1.1.1", + "version": "1.1.2", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index a383f16..3379d44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "who-is-streaming", - "version": "1.1.1", + "version": "1.1.2", "description": "Discover and keep track of which streaming services a movie is currently available to be streamed on.", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index d73162a..17c3140 100644 --- a/src/main.ts +++ b/src/main.ts @@ -49,14 +49,19 @@ export default class WhoIsStreamingPlugin extends Plugin { this.addCommand({ id: "refresh", name: "Refresh", editorCallback: async (editor: Editor, view: MarkdownView) => { await this.refreshActiveFile(); }}); - this.addCommand({ id: "bulk-refresh", name: "Bulk refresh", callback: async () => { + const hasDataview = isDataviewPluginEnabled(this.app); + if (hasDataview) { + this.addCommand({ id: "bulk-refresh", name: "Bulk refresh", callback: async () => { await this.refreshAllFiles(); - }}); + }}); + } if (this.settings.jellyfinInstances && this.settings.jellyfinInstances.length > 0) { - this.addCommand({ id: "bulk-refresh-jellyfin", name: "Bulk refresh Jellyfin", callback: async () => { + if (hasDataview) { + this.addCommand({ id: "bulk-refresh-jellyfin", name: "Bulk refresh Jellyfin", callback: async () => { await this.syncJellyfinForAllFiles(); - }}); + }}); + } this.addCommand({ id: "sync-jellyfin", name: "Sync Jellyfin", editorCallback: async (editor: Editor, view: MarkdownView) => { await this.syncJellyfinActiveFile(); }}); @@ -185,27 +190,12 @@ export default class WhoIsStreamingPlugin extends Plugin { return; } - const findingNotice = new Notice("🔄 Finding files with TMDB ID...", 0); - - const allFiles = this.app.vault.getMarkdownFiles(); - const filesWithTmdbId: TFile[] = []; - - for (const file of allFiles) { - const [tmdb_id] = await this.getTmdbId(file); - if (tmdb_id) { - filesWithTmdbId.push(file); - } - } - - findingNotice.hide(); - - if (filesWithTmdbId.length === 0) { - new Notice("No files with TMDB ID found"); + const files = await this.getFilesToSync(); + if (files.length === 0) { + new Notice("No files to sync"); return; } - const files = filesWithTmdbId; - await this.runBulkOperation(files, "⚠️ Bulk Jellyfin refresh cancelled by user", async (file) => { const [tmdb_id, showType] = await this.getTmdbId(file); if (!tmdb_id || !showType) { @@ -306,16 +296,23 @@ export default class WhoIsStreamingPlugin extends Plugin { } async getFilesToSync(): Promise { - if (!isDataviewPluginEnabled(this.app) || this.settings.bulkSyncDataviewQuery.length === 0) { - return this.app.vault.getMarkdownFiles(); + if (!isDataviewPluginEnabled(this.app)) { + new Notice("Enable Dataview to use bulk refresh."); + return []; } const dataview = getDataviewApi(this.app); if (!dataview) { - return this.app.vault.getMarkdownFiles(); + new Notice("Dataview is unavailable. Reload Obsidian and try again."); + return []; + } + + let dataviewQuery = this.settings.bulkSyncDataviewQuery.trim(); + if (dataviewQuery.length === 0) { + new Notice("Set a Dataview query before using bulk refresh."); + return []; } - let dataviewQuery = this.settings.bulkSyncDataviewQuery; if (!dataviewQuery.startsWith("LIST")) { dataviewQuery = "LIST \n" + dataviewQuery; } diff --git a/tsconfig.json b/tsconfig.json index af96459..fc43c3a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "inlineSourceMap": true, "inlineSources": true, "module": "ESNext", - "target": "ES6", + "target": "ES2020", "allowJs": true, "noImplicitAny": true, "moduleResolution": "node", @@ -13,10 +13,7 @@ "strictNullChecks": true, "lib": [ "DOM", - "ES5", - "ES6", - "ES7", - "ES2019" + "ES2020" ] }, "include": [ diff --git a/versions.json b/versions.json index 3af629c..13636b1 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,5 @@ { "1.0.0": "1.8.0", - "1.1.1": "1.10.0" + "1.1.1": "1.10.0", + "1.1.2": "1.10.0" }