feat: add backend

This commit is contained in:
Ludvig Lundgren 2021-08-11 15:26:17 +02:00
parent bc418ff248
commit a838d994a6
68 changed files with 9561 additions and 0 deletions

View file

@ -0,0 +1,6 @@
package indexer
import "embed"
//go:embed definitions
var Definitions embed.FS

View file

@ -0,0 +1,60 @@
---
#id: alpharatio
name: AlphaRatio
identifier: alpharatio
description: AlphaRatio (AR) is a private torrent tracker for 0DAY / GENERAL
language: en-us
urls:
- https://alpharatio.cc/
privacy: private
protocol: torrent
supports:
- irc
- rss
source: gazelle
settings:
- name: authkey
type: text
label: Auth key
tooltip: Right click DL on a torrent and get the authkey.
description: Right click DL on a torrent and get the authkey.
- name: torrent_pass
type: text
label: Torrent pass
tooltip: Right click DL on a torrent and get the torrent_pass.
description: Right click DL on a torrent and get the torrent_pass.
irc:
network: AlphaRatio
server: irc.alpharatio.cc:6697
port: 6697
channels:
- "#Announce"
announcers:
- Voyager
parse:
type: multi
lines:
-
test:
- "[New Release]-[MovieHD]-[War.For.The.Planet.Of.The.Apes.2017.INTERNAL.1080p.BluRay.CRF.x264-SAPHiRE]-[URL]-[ https://alpharatio.cc/torrents.php?id=699463 ]-[ 699434 ]-[ Uploaded 2 Mins, 59 Secs after pre. ]"
pattern: \[New Release\]-\[(.*)\]-\[(.*)\]-\[URL\]-\[ (https?://.*)id=\d+ \]-\[ (\d+) \](?:-\[ Uploaded (.*) after pre. ])?
vars:
- category
- torrentName
- baseUrl
- torrentId
- preTime
-
test:
- "[AutoDL]-[MovieHD]-[699434]-[ 1 | 10659 | 1 | 1 ]-[War.For.The.Planet.Of.The.Apes.2017.INTERNAL.1080p.BluRay.CRF.x264-SAPHiRE]"
pattern: \[AutoDL\]-\[.*\]-\[.*\]-\[ ([01]) \| (\d+) \| ([01]) \| ([01]) \]-\[.+\]
vars:
- scene
- torrentSize
- freeleech
- auto
match:
torrenturl: "{{ .baseUrl }}action=download&id={{ .torrentId }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}"

View file

@ -0,0 +1,48 @@
---
#id: beyondhd
name: BeyondHD
identifier: beyondhd
description: BeyondHD (BHD) is a private torrent tracker for HD MOVIES / TV
language: en-us
urls:
- https://beyond-hd.me/
privacy: private
protocol: torrent
supports:
- irc
- rss
source: UNIT3D (F3NIX)
settings:
- name: passkey
type: text
label: Passkey
tooltip: The passkey in your BeyondHD RSS feed.
description: "Go to your profile and copy and paste your RSS link to extract the rsskey."
irc:
network: BeyondHD-IRC
server: irc.beyond-hd.me:6697
port: 6697
channels:
- "#bhd_announce"
announcers:
- Willie
- Millie
parse:
type: single
lines:
-
test:
- "New Torrent: Orange.Is.the.New.Black.S01.1080p.Blu-ray.AVC.DTS-HD.MA.5.1-Test Category: TV By: Uploader Size: 137.73 GB Link: https://beyond-hd.me/details.php?id=25918"
pattern: 'New Torrent:(.*)Category:(.*)By:(.*)Size:(.*)Link: https?\:\/\/([^\/]+\/).*[&\?]id=(\d+)'
vars:
- torrentName
- category
- uploader
- torrentSize
- baseUrl
- torrentId
match:
torrenturl: "https://{{ .baseUrl }}torrent/download/auto.{{ .torrentId }}.{{ .passkey }}"

View file

@ -0,0 +1,68 @@
---
#id: btn
name: BroadcasTheNet
identifier: btn
description: BroadcasTheNet (BTN) is a private torrent tracker focused on TV shows
language: en-us
urls:
- https://broadcasthe.net/
privacy: private
protocol: torrent
supports:
- irc
- rss
source: gazelle
settings:
- name: authkey
type: text
label: Auth key
description: Right click DL on a torrent and get the authkey.
- name: torrent_pass
type: text
label: Torrent pass
description: Right click DL on a torrent and get the torrent_pass.
irc:
network: BroadcasTheNet
server: irc.broadcasthenet.net:6697
port: 6697
channels:
- "#BTN-Announce"
announcers:
- Barney
parse:
type: multi
lines:
-
test:
- "NOW BROADCASTING! [ Lost S06E07 720p WEB-DL DD 5.1 H.264 - LP ]"
pattern: ^NOW BROADCASTING! \[(.*)\]
vars:
- torrentName
-
test:
- "[ Title: S06E07 ] [ Series: Lost ]"
pattern: '^\[ Title: (.*) \] \[ Series: (.*) \]'
vars:
- title
- name1
-
test:
- "[ 2010 ] [ Episode ] [ MKV | x264 | WEB ] [ Uploader: Uploader1 ]"
pattern: '^(?:\[ (\d+) \] )?\[ (.*) \] \[ (.*) \] \[ Uploader: (.*?) \](?: \[ Pretime: (.*) \])?'
vars:
- year
- category
- tags
- uploader
- preTime
-
test:
- "[ https://XXXXXXXXX/torrents.php?id=7338 / https://XXXXXXXXX/torrents.php?action=download&id=9116 ]"
pattern: ^\[ .* / (https?://.*id=\d+) \]
vars:
- baseUrl
match:
torrenturl: "{{ .baseUrl }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}"

View file

@ -0,0 +1,48 @@
---
#id: emp
name: Empornium
identifier: emp
description: Empornium (EMP) is a private torrent tracker for XXX
language: en-us
urls:
- https://www.empornium.is
privacy: private
protocol: torrent
supports:
- irc
- rss
source: gazelle
settings:
- name: authkey
type: text
label: Auth key
description: Right click DL on a torrent and get the authkey.
- name: torrent_pass
type: text
label: Torrent pass
description: Right click DL on a torrent and get the torrent_pass.
irc:
network: DigitalIRC
server: irc.empornium.is:6697
port: 6697
channels:
- "#empornium-announce"
announcers:
- "^Wizard^"
parse:
type: single
lines:
-
pattern: '^(.*?) - Size: ([0-9]+?.*?) - Uploader: (.*?) - Tags: (.*?) - (https://.*torrents.php\?)id=(.*)$'
vars:
- torrentName
- torrentSize
- uploader
- tags
- baseUrl
- torrentId
match:
torrenturl: "{{ .baseUrl }}action=download&id={{ .torrentId }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}"

View file

@ -0,0 +1,53 @@
---
#id: filelist
name: FileList
identifier: fl
description: FileList (FL) is a ROMANIAN private torrent tracker for MOVIES / TV / GENERAL
language: en-us
urls:
- https://filelist.io
privacy: private
protocol: torrent
supports:
- irc
- rss
source: custom
settings:
- name: passkey
type: text
label: Passkey
tooltip: The passkey in your profile.
description: "The passkey in your profile."
irc:
network: FileList
server: irc.filelist.io:6697
port: 6697
channels:
- "#announce"
announcers:
- Announce
parse:
type: single
lines:
-
test:
- 'New Torrent: This.Really.Old.Movie.1965.DVDRip.DD1.0.x264 -- [Filme SD] [1.91 GB] -- https://filelist.io/details.php?id=746781 -- by uploader1'
- 'New Torrent: This.New.Movie.2021.1080p.Blu-ray.AVC.DTS-HD.MA.5.1-BEATRIX -- [FreeLeech!] -- [Filme Blu-Ray] [26.78 GB] -- https://filelist.io/details.php?id=746782 -- by uploader1'
- 'New Torrent: This.New.Movie.2021.1080p.Remux.AVC.DTS-HD.MA.5.1-playBD -- [FreeLeech!] -- [Internal!] -- [Filme Blu-Ray] [17.69 GB] -- https://filelist.io/details.php?id=746789 -- by uploader1'
pattern: 'New Torrent: (.*?) (?:-- \[(FreeLeech!)] )?(?:-- \[(Internal!)] )?-- \[(.*)] \[(.*)] -- (https?:\/\/filelist.io\/).*id=(.*) -- by (.*)'
vars:
- torrentName
- freeleech
- internal
- category
- torrentSize
- baseUrl
- torrentId
- uploader
match:
torrenturl: "{{ .baseUrl }}download.php?id={{ .torrentId }}&file={{ .torrentName }}.torrent&passkey={{ .passkey }}"
encode:
- torrentName

View file

@ -0,0 +1,56 @@
---
#id: gazellegames
name: GazelleGames
identifier: ggn
description: GazelleGames (GGn) is a private torrent tracker for GAMES
language: en-us
urls:
- https://gazellegames.net/
privacy: private
protocol: torrent
supports:
- irc
- rss
source: gazelle
settings:
- name: authkey
type: text
label: Auth key
tooltip: Right click DL on a torrent and get the authkey.
description: Right click DL on a torrent and get the authkey.
- name: torrent_pass
type: text
label: Torrent pass
tooltip: Right click DL on a torrent and get the torrent_pass.
description: Right click DL on a torrent and get the torrent_pass.
irc:
network: GGn
server: irc.gazellegames.net:7000
port: 7000
channels:
- "#GGn-Announce"
announcers:
- Vertigo
parse:
type: single
lines:
-
test:
- "Uploader :-: Nintendo 3DS :-: Yo-Kai.Watch.KOR.3DS-BigBlueBox in Yo-kai Watch [2013] ::Korean, Multi-Region, Scene:: https://gazellegames.net/torrents.php?torrentid=78851 - adventure, role_playing_game, nintendo;"
- "Uploader :-: Windows :-: Warriors.Wrath.Evil.Challenge-HI2U in Warriors' Wrath [2016] ::English, Scene:: FREELEECH! :: https://gazellegames.net/torrents.php?torrentid=78902 - action, adventure, casual, indie, role.playing.game;"
pattern: '^(.+) :-: (.+) :-: (.+) \[(\d+)\] ::(.+?):: ?(.+? ::)? https?:\/\/([^\/]+\/)torrents.php\?torrentid=(\d+) ?-? ?(.*?)?;?$'
vars:
- uploader
- category
- torrentName
- year
- flags
- bonus
- baseUrl
- torrentId
- tags
match:
torrenturl: "{{ .baseUrl }}torrents.php?action=download&id={{ .torrentId }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}"

View file

@ -0,0 +1,49 @@
---
#id: hdt
name: HD-Torrents
identifier: hdt
description: HD-Torrents (HD-T) is a private torrent tracker for HD MOVIES / TV
language: en-us
urls:
- https://hd-torrents.org/
- https://hdts.ru
privacy: private
protocol: torrent
supports:
- irc
- rss
source: xbtit
settings:
- name: cookie
type: text
label: Cookie
description: "FireFox -> Preferences -> Privacy -> Show Cookies and find the uid and pass cookies. Example: uid=1234; pass=asdf12347asdf13"
irc:
network: P2P-NET
server: irc.p2p-network.net:6697
port: 6697
channels:
- "#HD-Torrents.Announce"
announcers:
- HoboLarry
parse:
type: single
lines:
-
test:
- "New Torrent in category [XXX/Blu-ray] Erotische Fantasien 3D (2008) Blu-ray 1080p AVC DTS-HD MA 7 1 (14.60 GB) uploaded! Download: https://hd-torrents.org/download.php?id=806bc36530d146969d300c5352483a5e6e0639e9"
pattern: 'New Torrent in category \[([^\]]*)\] (.*) \(([^\)]*)\) uploaded! Download\: https?\:\/\/([^\/]+\/).*[&\?]id=([a-f0-9]+)'
vars:
- category
- torrentName
- torrentSize
- baseUrl
- torrentId
match:
torrenturl: "https://{{ .baseUrl }}download.php?id={{ .torrentId }}&f={{ .torrentName }}.torrent"
cookie: true
encode:
- torrentName

View file

@ -0,0 +1,53 @@
---
#id: iptorrents
name: IPTorrents
identifier: ipt
description: IPTorrents (IPT) is a private torrent tracker for 0DAY / GENERAL.
language: en-us
urls:
- https://iptorrents.com/
- https://iptorrents.me/
privacy: private
protocol: torrent
supports:
- irc
- rss
source: unknown
settings:
- name: passkey
type: text
label: Passkey
tooltip: Copy the passkey from your details page
description: "Copy the passkey from your details page."
irc:
network: IPTorrents
server: irc.iptorrents.com:6697
port: 6697
channels:
- "#ipt.announce"
- "#ipt.announce2"
announcers:
- IPT
- FunTimes
parse:
type: single
lines:
-
test:
- "[Movie/XXX] Audrey Bitoni HD Pack FREELEECH - http://www.iptorrents.com/details.php?id=789421 - 14.112 GB"
- "[Movies/XviD] The First Men In The Moon 2010 DVDRip XviD-VoMiT - http://www.iptorrents.com/details.php?id=396589 - 716.219 MB"
pattern: '^\[([^\]]*)](.*?)\s*(FREELEECH)*\s*-\s+https?\:\/\/([^\/]+).*[&\?]id=(\d+)\s*-(.*)'
vars:
- category
- torrentName
- freeleech
- baseUrl
- torrentId
- torrentSize
match:
torrenturl: "{{ .baseUrl }}download.php?id={{ .torrentId }}&file={{ .torrentName }}.torrent&passkey={{ .passkey }}"
encode:
- torrentName

View file

@ -0,0 +1,55 @@
---
#id: nebulance
name: Nebulance
identifier: nbl
description: Nebulance (NBL) is a ratioless private torrent tracker for TV
language: en-us
urls:
- https://nebulance.io/
privacy: private
protocol: torrent
supports:
- irc
- rss
source: gazelle
settings:
- name: authkey
type: text
label: Auth key
tooltip: Right click DL on a torrent and get the authkey.
description: Right click DL on a torrent and get the authkey.
- name: torrent_pass
type: text
label: Torrent pass
tooltip: Right click DL on a torrent and get the torrent_pass.
description: Right click DL on a torrent and get the torrent_pass.
irc:
network: Nebulance
server: irc.nebulance.cc:6697
port: 6697
channels:
- "#nbl-announce"
announcers:
- DRADIS
parse:
type: single
lines:
-
test:
- "[Episodes] The Vet Life - S02E08 [WebRip / x264 / MKV / 720p / HD / VLAD / The.Vet.Life.S02E08.Tuskegee.Reunion.720p.ANPL.WEBRip.AAC2.0.x264-VLAD.mkv] [702.00 MB - Uploader: UPLOADER] - http://nebulance.io/torrents.php?id=147 [Tags: comedy,subtitles,cbs]"
- "[Seasons] Police Interceptors - S10 [HDTV / x264 / MKV / MP4 / 480p / SD / BTN / Police.Interceptors.S10.HDTV.x264-BTN] [5.27 GB - Uploader: UPLOADER] - http://nebulance.io/torrents.php?id=1472 [Tags: comedy,subtitles,cbs]"
pattern: '\[(.*?)\] (.*?) \[(.*?)\] \[(.*?) - Uploader: (.*?)\] - (https?://.*)id=(\d+) \[Tags: (.*)\]'
vars:
- category
- torrentName
- releaseTags
- torrentSize
- uploader
- baseUrl
- torrentId
- tags
match:
torrenturl: "{{ .baseUrl }}action=download&id={{ .torrentId }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}"

View file

@ -0,0 +1,50 @@
---
#id: orpheus
name: Orpheus
identifier: ops
description: Orpheus (OPS) is a Private Torrent Tracker for MUSIC
language: en-us
urls:
- https://orpheus.network/
privacy: private
protocol: torrent
supports:
- irc
- rss
source: gazelle
settings:
- name: authkey
type: text
label: Auth key
tooltip: Right click DL on a torrent and get the authkey.
description: Right click DL on a torrent and get the authkey.
- name: torrent_pass
type: text
label: Torrent pass
tooltip: Right click DL on a torrent and get the torrent_pass.
description: Right click DL on a torrent and get the torrent_pass.
irc:
network: Orpheus
server: irc.orpheus.network:7000
port: 7000
channels:
- "#announce"
announcers:
- hermes
parse:
type: single
lines:
-
test:
- "TORRENT: Todd Edwards - You Came To Me [2002] [Single] - FLAC / Lossless / WEB - 2000s,house,uk.garage,garage.house - https://orpheus.network/torrents.php?id=756102 / https://orpheus.network/torrents.php?action=download&id=1647868"
- "TORRENT: THE BOOK [2021] [Album] - FLAC / Lossless / CD - - https://orpheus.network/torrents.php?id=693523 / https://orpheus.network/torrents.php?action=download&id=1647867"
pattern: 'TORRENT: (.*) - (.*) - https?://.* / (https?://.*id=\d+)'
vars:
- torrentName
- tags
- torrentId
match:
torrenturl: "{{ .baseUrl }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}"

View file

@ -0,0 +1,51 @@
---
#id: ptp
name: PassThePopcorn
identifier: ptp
description: PassThePopcorn (PTP) is a private torrent tracker for MOVIES
language: en-us
urls:
- https://passthepopcorn.me
privacy: private
protocol: torrent
supports:
- irc
- rss
source: gazelle
settings:
- name: authkey
type: text
label: Auth key
tooltip: Right click DL on a torrent and get the authkey.
description: Right click DL on a torrent and get the authkey.
- name: torrent_pass
type: text
label: Torrent pass
tooltip: Right click DL on a torrent and get the torrent_pass.
description: Right click DL on a torrent and get the torrent_pass.
irc:
network: PassThePopcorn
server: irc.passthepopcorn.me:7000
port: 7000
channels:
- "#ptp-announce"
announcers:
- Hummingbird
parse:
type: single
lines:
-
test:
- "Irene Huss - Nattrond AKA The Night Round [2008] by Anders Engström - XviD / DVD / AVI / 640x352 - http://passthepopcorn.me/torrents.php?id=51627 / http://passthepopcorn.me/torrents.php?action=download&id=97333 - crime, drama, mystery"
- "Dirty Rotten Scoundrels [1988] by Frank Oz - x264 / Blu-ray / MKV / 720p - http://passthepopcorn.me/torrents.php?id=10735 / http://passthepopcorn.me/torrents.php?action=download&id=97367 - comedy, crime"
pattern: '^(.*)-\s*https?:.*[&\?]id=.*https?\:\/\/([^\/]+\/).*[&\?]id=(\d+)\s*-\s*(.*)'
vars:
- torrentName
- baseUrl
- torrentId
- tags
match:
torrenturl: "https://{{ .baseUrl }}torrents.php?action=download&id={{ .torrentId }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}"

View file

@ -0,0 +1,51 @@
---
#id: red
name: Redacted
identifier: redacted
description: Redacted (RED) is a private torrent tracker for MUSIC
language: en-us
urls:
- https://redacted.ch/
privacy: private
protocol: torrent
supports:
- irc
- rss
source: gazelle
settings:
- name: authkey
type: text
label: Auth key
tooltip: Right click DL on a torrent and get the authkey.
description: Right click DL on a torrent and get the authkey.
- name: torrent_pass
type: text
label: Torrent pass
tooltip: Right click DL on a torrent and get the torrent_pass.
description: Right click DL on a torrent and get the torrent_pass.
irc:
network: Scratch-Network
server: irc.scratch-network.net:6697
port: 6697
channels:
- "#red-announce"
announcers:
- Drone
parse:
type: single
lines:
-
test:
- "JR Get Money - Nobody But You [2008] [Single] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=1592366 / https://redacted.ch/torrents.php?action=download&id=3372962 - hip.hop,rhythm.and.blues,2000s"
- "Johann Sebastian Bach performed by Festival Strings Lucerne under Rudolf Baumgartner - Brandenburg Concertos 5 and 6, Suite No 2 [1991] [Album] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=1592367 / https://redacted.ch/torrents.php?action=download&id=3372963 - classical"
pattern: '^(.*)\s+-\s+https?:.*[&\?]id=.*https?\:\/\/([^\/]+\/).*[&\?]id=(\d+)\s*-\s*(.*)'
vars:
- torrentName
- baseUrl
- torrentId
- tags
match:
torrenturl: "https://{{ .baseUrl }}torrents.php?action=download&id={{ .torrentId }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}"

View file

@ -0,0 +1,49 @@
---
#id: superbits
name: SuperBits
identifier: superbits
description: Superbits is a SWEDISH private torrent tracker for MOVIES / TV / 0DAY / GENERAL
language: en-us
urls:
- https://superbits.org/
privacy: private
protocol: torrent
supports:
- irc
- rss
source: rartracker
settings:
- name: passkey
type: text
label: Passkey
tooltip: Copy the passkey from the /rss page
description: "Copy the passkey from the /rss page."
irc:
network: SuperBits
server: irc.superbits.org:6697
port: 6697
channels:
- "#autodl"
announcers:
- SuperBits
parse:
type: single
lines:
-
test:
- "-[archive Film 1080]2[Asterix.Et.La.Surprise.De.Cesar.1985.FRENCH.1080p.BluRay.x264-TSuNaMi]3[844551]4[Size: 4.41 GB]5[FL: no]6[Scene: yes]"
- "-[new TV]2[Party.Down.South.S05E05.720p.WEB.h264-DiRT]3[844557]4[Size: 964.04 MB]5[FL: no]6[Scene: yes]7[Pred 1m 30s ago]"
pattern: '\-\[(.*)\]2\[(.*)\]3\[(\d+)\]4\[Size\:\s(.*)\]5\[FL\:\s(no|yes)\]6\[Scene\:\s(no|yes)\](?:7\[Pred\s(.*)\sago\])?'
vars:
- category
- torrentName
- torrentId
- torrentSize
- freeleech
- scene
- preTime
match:
torrenturl: "https://superbits.org/download.php?id={{ .torrentId }}&passkey={{ .passkey }}"

View file

@ -0,0 +1,53 @@
---
#id: tracker01
name: TorrentLeech
identifier: torrentleech
description: TorrentLeech (TL) is a private torrent tracker for 0DAY / GENERAL.
language: en-us
urls:
- https://www.torrentleech.org
privacy: private
protocol: torrent
supports:
- irc
- rss
source: custom
settings:
- name: rsskey
type: text
label: RSS key
tooltip: The rsskey in your TorrentLeech RSS feed link.
description: "Go to your profile and copy and paste your RSS link to extract the rsskey."
regex: /([\da-fA-F]{20})
irc:
network: TorrentLeech.org
server: irc.torrentleech.org:7021
port: 7021
channels:
- "#tlannounces"
announcers:
- _AnnounceBot_
parse:
type: single
lines:
-
test:
- "New Torrent Announcement: <PC :: Iso> Name:'debian live 10 6 0 amd64 standard iso' uploaded by 'Anonymous' - http://www.tracker01.test/torrent/263302"
- "New Torrent Announcement: <PC :: Iso> Name:'debian live 10 6 0 amd64 standard iso' uploaded by 'Anonymous' freeleech - http://www.tracker01.test/torrent/263302"
pattern: New Torrent Announcement:\s*<([^>]*)>\s*Name:'(.*)' uploaded by '([^']*)'\s*(freeleech)*\s*-\s*https?\:\/\/([^\/]+\/)torrent\/(\d+)
vars:
- category
- torrentName
- uploader
- freeleech
- baseUrl
- torrentId
match:
torrenturl: "https://{{ .baseUrl }}rss/download/{{ .torrentId }}/{{ .rsskey }}/{{ .torrentName }}.torrent"
encode:
- torrentName

View file

@ -0,0 +1,52 @@
---
#id: uhd
name: UHDBits
identifier: uhdbits
description: UHDBits (UHD) is a private torrent tracker for HD MOVIES / TV
language: en-us
urls:
- https://uhdbits.org/
privacy: private
protocol: torrent
supports:
- irc
- rss
source: gazelle
settings:
- name: authkey
type: text
label: Auth key
tooltip: Right click DL on a torrent and get the authkey.
description: Right click DL on a torrent and get the authkey.
- name: torrent_pass
type: text
label: Torrent pass
tooltip: Right click DL on a torrent and get the torrent_pass.
description: Right click DL on a torrent and get the torrent_pass.
irc:
network: P2P-Network
server: irc.p2p-network.net:6697
port: 6697
channels:
- "#UHD.Announce"
announcers:
- UHDBot
- cr0nusbot
parse:
type: single
lines:
-
test:
- "New Torrent: D'Ardennen [2015] - TayTO Type: Movie / 1080p / Encode / Freeleech: 100 Size: 7.00GB - https://uhdbits.org/torrents.php?id=13882 / https://uhdbits.org/torrents.php?action=download&id=20488"
pattern: 'New Torrent: (.*) Type: (.*?) Freeleech: (.*) Size: (.*) - https?:\/\/.* \/ (https?:\/\/.*id=\d+)'
vars:
- torrentName
- releaseTags
- freeleechPercent
- torrentSize
- baseUrl
match:
torrenturl: "{{ .baseUrl }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}"

252
internal/indexer/service.go Normal file
View file

@ -0,0 +1,252 @@
package indexer
import (
"fmt"
"io/fs"
"strings"
"gopkg.in/yaml.v2"
"github.com/rs/zerolog/log"
"github.com/autobrr/autobrr/internal/domain"
)
type Service interface {
Store(indexer domain.Indexer) (*domain.Indexer, error)
Update(indexer domain.Indexer) (*domain.Indexer, error)
Delete(id int) error
FindByFilterID(id int) ([]domain.Indexer, error)
List() ([]domain.Indexer, error)
GetAll() ([]*domain.IndexerDefinition, error)
GetTemplates() ([]domain.IndexerDefinition, error)
LoadIndexerDefinitions() error
GetIndexerByAnnounce(name string) *domain.IndexerDefinition
Start() error
}
type service struct {
repo domain.IndexerRepo
indexerDefinitions map[string]domain.IndexerDefinition
indexerInstances map[string]domain.IndexerDefinition
mapIndexerIRCToName map[string]string
}
func NewService(repo domain.IndexerRepo) Service {
return &service{
repo: repo,
indexerDefinitions: make(map[string]domain.IndexerDefinition),
indexerInstances: make(map[string]domain.IndexerDefinition),
mapIndexerIRCToName: make(map[string]string),
}
}
func (s *service) Store(indexer domain.Indexer) (*domain.Indexer, error) {
i, err := s.repo.Store(indexer)
if err != nil {
return nil, err
}
return i, nil
}
func (s *service) Update(indexer domain.Indexer) (*domain.Indexer, error) {
i, err := s.repo.Update(indexer)
if err != nil {
return nil, err
}
return i, nil
}
func (s *service) Delete(id int) error {
if err := s.repo.Delete(id); err != nil {
return err
}
return nil
}
func (s *service) FindByFilterID(id int) ([]domain.Indexer, error) {
filters, err := s.repo.FindByFilterID(id)
if err != nil {
return nil, err
}
return filters, nil
}
func (s *service) List() ([]domain.Indexer, error) {
i, err := s.repo.List()
if err != nil {
return nil, err
}
return i, nil
}
func (s *service) GetAll() ([]*domain.IndexerDefinition, error) {
indexers, err := s.repo.List()
if err != nil {
return nil, err
}
var res = make([]*domain.IndexerDefinition, 0)
for _, indexer := range indexers {
in := s.getDefinitionByName(indexer.Identifier)
if in == nil {
// if no indexerDefinition found, continue
continue
}
temp := domain.IndexerDefinition{
ID: indexer.ID,
Name: in.Name,
Identifier: in.Identifier,
Enabled: indexer.Enabled,
Description: in.Description,
Language: in.Language,
Privacy: in.Privacy,
Protocol: in.Protocol,
URLS: in.URLS,
Settings: nil,
SettingsMap: make(map[string]string),
IRC: in.IRC,
Parse: in.Parse,
}
// map settings
// add value to settings objects
for _, setting := range in.Settings {
if v, ok := indexer.Settings[setting.Name]; ok {
setting.Value = v
temp.SettingsMap[setting.Name] = v
}
temp.Settings = append(temp.Settings, setting)
}
res = append(res, &temp)
}
return res, nil
}
func (s *service) GetTemplates() ([]domain.IndexerDefinition, error) {
definitions := s.indexerDefinitions
var ret []domain.IndexerDefinition
for _, definition := range definitions {
ret = append(ret, definition)
}
return ret, nil
}
func (s *service) Start() error {
err := s.LoadIndexerDefinitions()
if err != nil {
return err
}
indexers, err := s.GetAll()
if err != nil {
return err
}
for _, indexer := range indexers {
if !indexer.Enabled {
continue
}
s.indexerInstances[indexer.Identifier] = *indexer
// map irc stuff to indexer.name
if indexer.IRC != nil {
server := indexer.IRC.Server
for _, channel := range indexer.IRC.Channels {
for _, announcer := range indexer.IRC.Announcers {
val := fmt.Sprintf("%v:%v:%v", server, channel, announcer)
s.mapIndexerIRCToName[val] = indexer.Identifier
}
}
}
}
return nil
}
// LoadIndexerDefinitions load definitions from golang embed fs
func (s *service) LoadIndexerDefinitions() error {
entries, err := fs.ReadDir(Definitions, "definitions")
if err != nil {
log.Fatal().Msgf("failed reading directory: %s", err)
}
if len(entries) == 0 {
log.Fatal().Msgf("failed reading directory: %s", err)
return err
}
for _, f := range entries {
filePath := "definitions/" + f.Name()
if strings.Contains(f.Name(), ".yaml") {
log.Debug().Msgf("parsing: %v", filePath)
var d domain.IndexerDefinition
data, err := fs.ReadFile(Definitions, filePath)
if err != nil {
log.Debug().Err(err).Msgf("failed reading file: %v", filePath)
return err
}
err = yaml.Unmarshal(data, &d)
if err != nil {
log.Error().Err(err).Msgf("failed unmarshal file: %v", filePath)
return err
}
s.indexerDefinitions[d.Identifier] = d
}
}
return nil
}
func (s *service) GetIndexerByAnnounce(name string) *domain.IndexerDefinition {
if identifier, idOk := s.mapIndexerIRCToName[name]; idOk {
if indexer, ok := s.indexerInstances[identifier]; ok {
return &indexer
}
}
return nil
}
func (s *service) getDefinitionByName(name string) *domain.IndexerDefinition {
if v, ok := s.indexerDefinitions[name]; ok {
return &v
}
return nil
}
func (s *service) getDefinitionForAnnounce(name string) *domain.IndexerDefinition {
// map[network:channel:announcer] = indexer01
if v, ok := s.indexerDefinitions[name]; ok {
return &v
}
return nil
}