Skip to content

Commit

Permalink
Add Radarr
Browse files Browse the repository at this point in the history
  • Loading branch information
cvzi committed Nov 2, 2023
1 parent 4e435ea commit 94c9d7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Supported sites and products:
* save.tv
* argenteam.net
* wikiwand.com (only Movies and TV Shows)
* [Radarr](https://github.com/Radarr/Radarr) - you need to set your server address in the script header, default is `@match http://localhost:7878/*`

Screenshot:
![Screenshot of amazon product page](https://raw.githubusercontent.com/cvzi/Metacritic-userscript/master/screenshot_amazon.jpg)
Expand Down
12 changes: 11 additions & 1 deletion Show_metacritic_ratings.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
// @match https://www.save.tv/*
// @match https://argenteam.net/*
// @match https://www.wikiwand.com/*
// @match http://localhost:7878/*
// ==/UserScript==

/* globals alert, confirm, GM, DOMParser, $, Image, unsafeWindow, parent, Blob, failedImages */
Expand Down Expand Up @@ -2770,6 +2771,15 @@ const sites = {
type: 'tv',
data: () => document.querySelector('h1').textContent.replace(/\(tv series\)/i, '').trim()
}]
},
radarr: {
host: ['*'],
condition: () => document.location.pathname.startsWith('/movie/'),
products: [{
condition: () => document.querySelector('[class*="MovieDetails-title"] span'),
type: 'movie',
data: () => document.querySelector('[class*="MovieDetails-title"] span').textContent.trim()
}]
}

}
Expand All @@ -2781,7 +2791,7 @@ async function main () {

for (const name in sites) {
const site = sites[name]
if (site.host.some(function (e) { return ~this.indexOf(e) }, document.location.hostname) && site.condition()) {
if (site.host.some(function (e) { return ~this.indexOf(e) || e === '*' }, document.location.hostname) && site.condition()) {
for (let i = 0; i < site.products.length; i++) {
if (site.products[i].condition()) {
// Check map for a match
Expand Down

0 comments on commit 94c9d7a

Please sign in to comment.