Initial commit

This commit is contained in:
pk committed 2026-11-21 18:51:54 +00:00
commit 352fa38ef3
8 files changed
+207

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
/cfg
/scripts/secrets.sh
+91
View File
@@ -0,0 +1,91 @@
version: "2.1"
services:
sonarr:
image: lscr.io/linuxserver/sonarr:latest
container_name: sonarr
environment:
- PUID=104
- PGID=666
- TZ=Europe/London
volumes:
- ./cfg/sonarr:/config
- ./scripts:/scripts
- /mnt/titan/media/shows:/media/shows:ro
- /mnt/titan/media/anime:/media/anime:ro
#- ./a:/media/anime
ports:
- 7101:8989
restart: unless-stopped
radarr:
image: lscr.io/linuxserver/radarr:latest
container_name: radarr
environment:
- PUID=104
- PGID=666
- TZ=Europe/London
volumes:
- ./cfg/radarr:/config
- ./scripts:/scripts
- /mnt/titan/media/movies:/media/movies:ro
#- ./a:/media/movies
ports:
- 7102:7878
restart: unless-stopped
lidarr:
image: lscr.io/linuxserver/lidarr:latest
container_name: lidarr
environment:
- PUID=104
- PGID=666
- TZ=Europe/London
volumes:
- ./cfg/lidarr:/config
- /mnt/titan/media/music:/media/music:ro
#- ./a:/media/music
ports:
- 7104:8686
restart: unless-stopped
jackett:
image: lscr.io/linuxserver/jackett:latest
container_name: jackett
environment:
- PUID=104
- PGID=666
- TZ=Europe/London
# - AUTO_UPDATE=true #optional
# - RUN_OPTS=<run options here> #optional
volumes:
- ./cfg/jackett:/config
ports:
- 7103:9117
restart: unless-stopped
overseerr:
image: lscr.io/linuxserver/overseerr:latest
container_name: overseerr
environment:
- PUID=104
- PGID=666
- TZ=Europe/London
- PORT=7105 #optional
ports:
- 7105:7105
volumes:
- ./cfg/overseerr:/config
restart: unless-stopped
flaresolverr:
# DockerHub mirror flaresolverr/flaresolverr:latest
image: ghcr.io/flaresolverr/flaresolverr:latest
container_name: flaresolverr
environment:
- LOG_LEVEL=info
- LOG_HTML=false
- CAPTCHA_SOLVER=none
- TZ=Europe/London
ports:
- 7106:8191
restart: unless-stopped
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+62
View File
@@ -0,0 +1,62 @@
class Radarr {
constructor(url, apiKey) {
this.url = url;
this.apiKey = apiKey;
}
async getMovie(movieId) {
const response = await fetch(`${this.url}/api/v3/movie/${movieId}`, {
headers: {
'X-Api-Key': this.apiKey,
},
});
return response.json();
}
}
class Deluge {
constructor(url) {
this.url = url;
this.delugeRpcId = 1;
this.cookies = {};
}
async rpc(method, params, cookies = {}) {
const response = await fetch(`${this.url}/json`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Cookie: cookies,
},
body: JSON.stringify({ id: this.delugeRpcId++, method, params }),
});
return response;
}
async login(apiKey) {
const response = await this.rpc("auth.login", [apiKey]);
this.cookies = response.headers.getSetCookie()
?.map(cookie => cookie.split(";")[0])
.join("; ");
}
async getTorrentStatus(torrentId) {
const response = await this.rpc("web.get_torrent_status", [torrentId, ["download_location", "tracker_host"]], this.cookies);
return await response.json();
}
async moveTorrent(torrentId, newLocation) {
const response = await this.rpc("core.move_storage", [[torrentId], newLocation], this.cookies);
return await response.json();
}
async setTorrentLabel(torrentId, label) {
const response = await this.rpc("label.set_torrent", [torrentId, label], this.cookies);
return await response.json();
}
}
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
export { Radarr, Deluge, sleep };
+45
View File
@@ -0,0 +1,45 @@
import { Radarr, Deluge, sleep } from './helpers.js';
const radarrEventtype = process.env.radarr_eventtype;
const radarrUrl = process.env.RADARR_URL;
const radarrApiKey = process.env.RADARR_API_KEY;
const radarrMovieId = process.env.radarr_movie_id
const radarrDownloadId = process.env.radarr_download_id
const delugeUrl = process.env.DELUGE_URL;
const delugeKey = process.env.DELUGE_PASS;
async function main() {
if (radarrEventtype !== 'Grab') {
console.log('Event type is not Grab, skipping');
return;
}
const radarr = new Radarr(radarrUrl, radarrApiKey);
const radarrMovie = await radarr.getMovie(radarrMovieId);
const deluge = new Deluge(delugeUrl);
await deluge.login(delugeKey);
for (let i = 0; i < 10; i++) {
const torrentStatus = await deluge.getTorrentStatus(radarrDownloadId.toLowerCase());
if (!torrentStatus.result?.download_location) {
// Torrent not found, wait and try again
await sleep(1000);
continue;
}
if (torrentStatus.result.tracker_host === "linkomanija.org") {
await deluge.setTorrentLabel(radarrDownloadId.toLowerCase(), "linkomanija");
}
if (torrentStatus.result.download_location !== radarrMovie.path) {
const moveStorage = await deluge.moveTorrent(radarrDownloadId.toLowerCase(), radarrMovie.path);
console.log('Moved torrent to', radarrMovie.path);
}
break;
}
}
await main();
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
source /scripts/secrets.sh
/scripts/bun-musl /scripts/radarr_on_grab.js
+4
View File
@@ -0,0 +1,4 @@
export RADARR_URL=http://10.0.3.36:7102
export RADARR_API_KEY=
export DELUGE_URL=http://10.0.3.36:8112
export DELUGE_PASS=