mirror of
https://github.com/idanoo/autobrr
synced 2025-07-25 01:39:13 +00:00
Refactor irc client (#19)
* refactor: update http handlers * feat: add trace log level * refactir: irc handler * refactor(definitions): add irc settings and invite cmd: * feat: add dft values to inputs * refactor: indexer irc forms * refactor(definitions): fix nickserv.password var: * feat: pre fill indexer name field * refactor: handle stopping and updates
This commit is contained in:
parent
5f69ae9380
commit
4d40d41628
48 changed files with 1380 additions and 943 deletions
|
@ -14,31 +14,46 @@ supports:
|
|||
source: gazelle
|
||||
settings:
|
||||
- name: authkey
|
||||
type: text
|
||||
type: secret
|
||||
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.
|
||||
help: Right click DL on a torrent and get the authkey.
|
||||
- name: torrent_pass
|
||||
type: text
|
||||
type: secret
|
||||
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.
|
||||
help: Right click DL on a torrent and get the torrent_pass.
|
||||
|
||||
irc:
|
||||
network: AlphaRatio
|
||||
server: irc.alpharatio.cc:6697
|
||||
server: irc.alpharatio.cc
|
||||
port: 6697
|
||||
tls: true
|
||||
channels:
|
||||
- "#Announce"
|
||||
announcers:
|
||||
- Voyager
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user-bot
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
- name: invite_command
|
||||
type: secret
|
||||
default: "Voyager autobot USERNAME IRCKey"
|
||||
required: false
|
||||
label: Invite command
|
||||
help: Invite auth with 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. ]"
|
||||
- test:
|
||||
- "[New Release]-[MovieHD]-[That.Movie.2017.INTERNAL.1080p.BluRay.CRF.x264-GROUP]-[URL]-[ https://alpharatio.cc/torrents.php?id=000000 ]-[ 000000 ]-[ Uploaded 2 Mins, 59 Secs after pre. ]"
|
||||
pattern: \[New Release\]-\[(.*)\]-\[(.*)\]-\[URL\]-\[ (https?://.*)id=\d+ \]-\[ (\d+) \](?:-\[ Uploaded (.*) after pre. ])?
|
||||
vars:
|
||||
- category
|
||||
|
@ -46,9 +61,8 @@ parse:
|
|||
- 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]"
|
||||
- test:
|
||||
- "[AutoDL]-[MovieHD]-[000000]-[ 1 | 10659 | 1 | 1 ]-[That.Movie.2017.INTERNAL.1080p.BluRay.CRF.x264-GROUP]"
|
||||
pattern: \[AutoDL\]-\[.*\]-\[.*\]-\[ ([01]) \| (\d+) \| ([01]) \| ([01]) \]-\[.+\]
|
||||
vars:
|
||||
- scene
|
||||
|
|
|
@ -13,28 +13,44 @@ supports:
|
|||
- 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."
|
||||
- name: rsskey
|
||||
type: secret
|
||||
label: RSS key
|
||||
help: "Go to your profile, My Security, RSS Key and copy RSS key."
|
||||
|
||||
irc:
|
||||
network: BeyondHD-IRC
|
||||
server: irc.beyond-hd.me:6697
|
||||
server: irc.beyond-hd.me
|
||||
port: 6697
|
||||
tls: true
|
||||
channels:
|
||||
- "#bhd_announce"
|
||||
announcers:
|
||||
- Willie
|
||||
- Millie
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user|autodl
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
- name: invite_command
|
||||
type: secret
|
||||
default: "Millie announce ircKey"
|
||||
required: true
|
||||
label: Invite command
|
||||
help: Invite auth with 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"
|
||||
- test:
|
||||
- "New Torrent: That.Show.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=00000"
|
||||
pattern: 'New Torrent:(.*)Category:(.*)By:(.*)Size:(.*)Link: https?\:\/\/([^\/]+\/).*[&\?]id=(\d+)'
|
||||
vars:
|
||||
- torrentName
|
||||
|
|
|
@ -13,42 +13,57 @@ supports:
|
|||
- 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.
|
||||
- name: authkey
|
||||
type: secret
|
||||
label: Auth key
|
||||
help: Right click DL on a torrent and get the authkey.
|
||||
- name: torrent_pass
|
||||
type: secret
|
||||
label: Torrent pass
|
||||
help: Right click DL on a torrent and get the torrent_pass.
|
||||
|
||||
irc:
|
||||
network: BroadcasTheNet
|
||||
server: irc.broadcasthenet.net:6697
|
||||
server: irc.broadcasthenet.net
|
||||
port: 6697
|
||||
tls: true
|
||||
channels:
|
||||
- "#BTN-Announce"
|
||||
announcers:
|
||||
- Barney
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user|autodl
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
- name: invite_command
|
||||
type: secret
|
||||
default: "CableGuy IDENTIFY USERNAME IRCKey"
|
||||
required: true
|
||||
label: Invite command
|
||||
help: Invite auth with CableGuy.
|
||||
|
||||
parse:
|
||||
type: multi
|
||||
lines:
|
||||
-
|
||||
test:
|
||||
- "NOW BROADCASTING! [ Lost S06E07 720p WEB-DL DD 5.1 H.264 - LP ]"
|
||||
- test:
|
||||
- "NOW BROADCASTING! [ The Show S06E07 720p WEB-DL DD 5.1 H.264 - LP ]"
|
||||
pattern: ^NOW BROADCASTING! \[(.*)\]
|
||||
vars:
|
||||
- torrentName
|
||||
-
|
||||
test:
|
||||
- "[ Title: S06E07 ] [ Series: Lost ]"
|
||||
- test:
|
||||
- "[ Title: S06E07 ] [ Series: The Show ]"
|
||||
pattern: '^\[ Title: (.*) \] \[ Series: (.*) \]'
|
||||
vars:
|
||||
- title
|
||||
- name1
|
||||
-
|
||||
test:
|
||||
- test:
|
||||
- "[ 2010 ] [ Episode ] [ MKV | x264 | WEB ] [ Uploader: Uploader1 ]"
|
||||
pattern: '^(?:\[ (\d+) \] )?\[ (.*) \] \[ (.*) \] \[ Uploader: (.*?) \](?: \[ Pretime: (.*) \])?'
|
||||
vars:
|
||||
|
@ -57,10 +72,9 @@ parse:
|
|||
- tags
|
||||
- uploader
|
||||
- preTime
|
||||
-
|
||||
test:
|
||||
- test:
|
||||
- "[ https://XXXXXXXXX/torrents.php?id=7338 / https://XXXXXXXXX/torrents.php?action=download&id=9116 ]"
|
||||
pattern: ^\[ .* / (https?://.*id=\d+) \]
|
||||
pattern: ^\[ .* \/ (https?:\/\/.*id=\d+) \]
|
||||
vars:
|
||||
- baseUrl
|
||||
|
||||
|
|
|
@ -14,28 +14,39 @@ supports:
|
|||
source: gazelle
|
||||
settings:
|
||||
- name: authkey
|
||||
type: text
|
||||
type: secret
|
||||
label: Auth key
|
||||
description: Right click DL on a torrent and get the authkey.
|
||||
help: Right click DL on a torrent and get the authkey.
|
||||
- name: torrent_pass
|
||||
type: text
|
||||
type: secret
|
||||
label: Torrent pass
|
||||
description: Right click DL on a torrent and get the torrent_pass.
|
||||
help: Right click DL on a torrent and get the torrent_pass.
|
||||
|
||||
irc:
|
||||
network: DigitalIRC
|
||||
server: irc.empornium.is:6697
|
||||
server: irc.empornium.is
|
||||
port: 6697
|
||||
tls: true
|
||||
channels:
|
||||
- "#empornium-announce"
|
||||
announcers:
|
||||
- "^Wizard^"
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user_bot. Must have staff permission first.
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
|
||||
parse:
|
||||
type: single
|
||||
lines:
|
||||
-
|
||||
pattern: '^(.*?) - Size: ([0-9]+?.*?) - Uploader: (.*?) - Tags: (.*?) - (https://.*torrents.php\?)id=(.*)$'
|
||||
- pattern: '^(.*?) - Size: ([0-9]+?.*?) - Uploader: (.*?) - Tags: (.*?) - (https://.*torrents.php\?)id=(.*)$'
|
||||
vars:
|
||||
- torrentName
|
||||
- torrentSize
|
||||
|
|
|
@ -14,28 +14,38 @@ supports:
|
|||
source: custom
|
||||
settings:
|
||||
- name: passkey
|
||||
type: text
|
||||
type: secret
|
||||
label: Passkey
|
||||
tooltip: The passkey in your profile.
|
||||
description: "The passkey in your profile."
|
||||
help: "The passkey in your profile."
|
||||
|
||||
irc:
|
||||
network: FileList
|
||||
server: irc.filelist.io:6697
|
||||
server: irc.filelist.io
|
||||
port: 6697
|
||||
tls: true
|
||||
channels:
|
||||
- "#announce"
|
||||
announcers:
|
||||
- Announce
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user_dl
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: false
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
|
||||
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'
|
||||
- test:
|
||||
- 'New Torrent: This.Really.Old.Movie.1965.DVDRip.DD1.0.x264 -- [Filme SD] [1.91 GB] -- https://filelist.io/details.php?id=000000 -- 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=000000 -- 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=000000 -- by uploader1'
|
||||
pattern: 'New Torrent: (.*?) (?:-- \[(FreeLeech!)] )?(?:-- \[(Internal!)] )?-- \[(.*)] \[(.*)] -- (https?:\/\/filelist.io\/).*id=(.*) -- by (.*)'
|
||||
vars:
|
||||
- torrentName
|
||||
|
|
|
@ -14,32 +14,47 @@ supports:
|
|||
source: gazelle
|
||||
settings:
|
||||
- name: authkey
|
||||
type: text
|
||||
type: secret
|
||||
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.
|
||||
help: Right click DL on a torrent and get the authkey.
|
||||
- name: torrent_pass
|
||||
type: text
|
||||
type: secret
|
||||
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.
|
||||
help: Right click DL on a torrent and get the torrent_pass.
|
||||
|
||||
irc:
|
||||
network: GGn
|
||||
server: irc.gazellegames.net:7000
|
||||
server: irc.gazellegames.net
|
||||
port: 7000
|
||||
tls: true
|
||||
channels:
|
||||
- "#GGn-Announce"
|
||||
announcers:
|
||||
- Vertigo
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user|bot
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
- name: invite_command
|
||||
type: secret
|
||||
default: "Vertigo ENTER #GGn-Announce USERNAME IRCKey"
|
||||
required: true
|
||||
label: Invite command
|
||||
help: Invite auth with 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;"
|
||||
- test:
|
||||
- "Uploader :-: Nintendo 3DS :-: Cool.Game.KOR.3DS-BigBlueBox in Cool Game [2013] ::Korean, Multi-Region, Scene:: https://gazellegames.net/torrents.php?torrentid=00000 - adventure, role_playing_game, nintendo;"
|
||||
- "Uploader :-: Windows :-: Other.Game-HI2U in Other Game [2016] ::English, Scene:: FREELEECH! :: https://gazellegames.net/torrents.php?torrentid=00000 - action, adventure, casual, indie, role.playing.game;"
|
||||
pattern: '^(.+) :-: (.+) :-: (.+) \[(\d+)\] ::(.+?):: ?(.+? ::)? https?:\/\/([^\/]+\/)torrents.php\?torrentid=(\d+) ?-? ?(.*?)?;?$'
|
||||
vars:
|
||||
- uploader
|
||||
|
|
|
@ -14,26 +14,37 @@ supports:
|
|||
- 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"
|
||||
- name: cookie
|
||||
type: text
|
||||
label: Cookie
|
||||
help: "Check how to get cookies in your browser and find the uid and pass cookies. Example: uid=1234; pass=asdf12347asdf13"
|
||||
|
||||
irc:
|
||||
network: P2P-NET
|
||||
server: irc.p2p-network.net:6697
|
||||
server: irc.p2p-network.net
|
||||
port: 6697
|
||||
tls: true
|
||||
channels:
|
||||
- "#HD-Torrents.Announce"
|
||||
announcers:
|
||||
- HoboLarry
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user|bot
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
|
||||
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"
|
||||
- test:
|
||||
- "New Torrent in category [Movies/Remux] That Movie (2008) Blu-ray 1080p REMUX AVC DTS-HD MA 7 1 (14.60 GB) uploaded! Download: https://hd-torrents.org/download.php?id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
pattern: 'New Torrent in category \[([^\]]*)\] (.*) \(([^\)]*)\) uploaded! Download\: https?\:\/\/([^\/]+\/).*[&\?]id=([a-f0-9]+)'
|
||||
vars:
|
||||
- category
|
||||
|
|
|
@ -15,29 +15,38 @@ supports:
|
|||
source: unknown
|
||||
settings:
|
||||
- name: passkey
|
||||
type: text
|
||||
type: secret
|
||||
label: Passkey
|
||||
tooltip: Copy the passkey from your details page
|
||||
description: "Copy the passkey from your details page."
|
||||
help: "Copy the passkey from your details page."
|
||||
|
||||
irc:
|
||||
network: IPTorrents
|
||||
server: irc.iptorrents.com:6697
|
||||
server: irc.iptorrents.com
|
||||
port: 6697
|
||||
tls: true
|
||||
channels:
|
||||
- "#ipt.announce"
|
||||
- "#ipt.announce2"
|
||||
announcers:
|
||||
- IPT
|
||||
- FunTimes
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user_autodl
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: false
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
|
||||
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"
|
||||
- test:
|
||||
- "[Movies/XviD] The Movie 2010 DVDRip XviD-GROUP FREELEECH - http://www.iptorrents.com/details.php?id=000000 - 716.219 MB"
|
||||
- "[Movies/XviD] The Movie 2010 DVDRip XviD-GROUP - http://www.iptorrents.com/details.php?id=000000 - 716.219 MB"
|
||||
pattern: '^\[([^\]]*)](.*?)\s*(FREELEECH)*\s*-\s+https?\:\/\/([^\/]+).*[&\?]id=(\d+)\s*-(.*)'
|
||||
vars:
|
||||
- category
|
||||
|
|
|
@ -13,33 +13,41 @@ supports:
|
|||
- 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.
|
||||
- name: authkey
|
||||
type: secret
|
||||
label: Auth key
|
||||
help: Right click DL on a torrent and get the authkey.
|
||||
- name: torrent_pass
|
||||
type: secret
|
||||
label: Torrent pass
|
||||
help: Right click DL on a torrent and get the torrent_pass.
|
||||
|
||||
irc:
|
||||
network: Nebulance
|
||||
server: irc.nebulance.cc:6697
|
||||
server: irc.nebulance.cc
|
||||
port: 6697
|
||||
channels:
|
||||
- "#nbl-announce"
|
||||
announcers:
|
||||
- DRADIS
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user|bot
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
|
||||
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]"
|
||||
- test:
|
||||
- "[Episodes] The Show - S02E08 [WebRip / x264 / MKV / 720p / HD / VLAD / The.Show.S02E08.Episode.Name.720p.ANPL.WEBRip.AAC2.0.x264-GROUP.mkv] [702.00 MB - Uploader: UPLOADER] - http://nebulance.io/torrents.php?id=000 [Tags: comedy,subtitles,cbs]"
|
||||
- "[Seasons] Other Show - S10 [HDTV / x264 / MKV / MP4 / 480p / SD / BTN / Other.Show.S10.HDTV.x264-GROUP] [5.27 GB - Uploader: UPLOADER] - http://nebulance.io/torrents.php?id=0000 [Tags: comedy,subtitles,cbs]"
|
||||
pattern: '\[(.*?)\] (.*?) \[(.*?)\] \[(.*?) - Uploader: (.*?)\] - (https?://.*)id=(\d+) \[Tags: (.*)\]'
|
||||
vars:
|
||||
- category
|
||||
|
|
|
@ -13,33 +13,48 @@ supports:
|
|||
- 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.
|
||||
- name: authkey
|
||||
type: text
|
||||
label: Auth key
|
||||
help: Right click DL on a torrent and get the authkey.
|
||||
- name: torrent_pass
|
||||
type: text
|
||||
label: Torrent pass
|
||||
help: Right click DL on a torrent and get the torrent_pass.
|
||||
|
||||
irc:
|
||||
network: Orpheus
|
||||
server: irc.orpheus.network:7000
|
||||
server: irc.orpheus.network
|
||||
port: 7000
|
||||
tls: true
|
||||
channels:
|
||||
- "#announce"
|
||||
announcers:
|
||||
- hermes
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user|bot
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
- name: invite_command
|
||||
type: secret
|
||||
default: "hermes enter #announce USERNAME IRCKey"
|
||||
required: true
|
||||
label: Invite command
|
||||
help: Invite auth with 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"
|
||||
- test:
|
||||
- "TORRENT: That Artist - Albuum [2002] [Single] - FLAC / Lossless / WEB - 2000s,house,uk.garage,garage.house - https://orpheus.network/torrents.php?id=000000 / https://orpheus.network/torrents.php?action=download&id=0000000"
|
||||
- "TORRENT: Something [2021] [Album] - FLAC / Lossless / CD - - https://orpheus.network/torrents.php?id=000000 / https://orpheus.network/torrents.php?action=download&id=0000000"
|
||||
pattern: 'TORRENT: (.*) - (.*) - https?://.* / (https?://.*id=\d+)'
|
||||
vars:
|
||||
- torrentName
|
||||
|
|
|
@ -13,33 +13,48 @@ supports:
|
|||
- 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.
|
||||
- name: authkey
|
||||
type: secret
|
||||
label: Auth key
|
||||
help: Right click DL on a torrent and get the authkey.
|
||||
- name: torrent_pass
|
||||
type: secret
|
||||
label: Torrent pass
|
||||
help: Right click DL on a torrent and get the torrent_pass.
|
||||
|
||||
irc:
|
||||
network: PassThePopcorn
|
||||
server: irc.passthepopcorn.me:7000
|
||||
server: irc.passthepopcorn.me
|
||||
port: 7000
|
||||
tls: true
|
||||
channels:
|
||||
- "#ptp-announce"
|
||||
announcers:
|
||||
- Hummingbird
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user|autodl
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
- name: invite_command
|
||||
type: secret
|
||||
default: "Hummingbird ENTER USERNAME IRCKey #ptp-announce"
|
||||
required: true
|
||||
label: Invite command
|
||||
help: Invite auth with 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"
|
||||
- test:
|
||||
- "That Movie [2008] by Director - XviD / DVD / AVI / 640x352 - http://passthepopcorn.me/torrents.php?id=00000 / http://passthepopcorn.me/torrents.php?action=download&id=00000 - crime, drama, mystery"
|
||||
- "Some Old Movie [1988] by Director - x264 / Blu-ray / MKV / 720p - http://passthepopcorn.me/torrents.php?id=00000 / http://passthepopcorn.me/torrents.php?action=download&id=00000 - comedy, crime"
|
||||
pattern: '^(.*)-\s*https?:.*[&\?]id=.*https?\:\/\/([^\/]+\/).*[&\?]id=(\d+)\s*-\s*(.*)'
|
||||
vars:
|
||||
- torrentName
|
||||
|
|
|
@ -13,33 +13,48 @@ supports:
|
|||
- 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.
|
||||
- name: authkey
|
||||
type: secret
|
||||
label: Auth key
|
||||
help: Right click DL on a torrent and get the authkey.
|
||||
- name: torrent_pass
|
||||
type: secret
|
||||
label: Torrent pass
|
||||
help: Right click DL on a torrent and get the torrent_pass.
|
||||
|
||||
irc:
|
||||
network: Scratch-Network
|
||||
server: irc.scratch-network.net:6697
|
||||
server: irc.scratch-network.net
|
||||
port: 6697
|
||||
tls: true
|
||||
channels:
|
||||
- "#red-announce"
|
||||
announcers:
|
||||
- Drone
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user-autodl
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
- name: invite_command
|
||||
type: secret
|
||||
default: "Drone enter #red-announce USERNAME IRCKey"
|
||||
required: true
|
||||
label: Invite command
|
||||
help: Invite auth with 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"
|
||||
- test:
|
||||
- "Artist - Albumname [2008] [Single] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - hip.hop,rhythm.and.blues,2000s"
|
||||
- "A really long name here - Concertos 5 and 6, Suite No 2 [1991] [Album] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - classical"
|
||||
pattern: '^(.*)\s+-\s+https?:.*[&\?]id=.*https?\:\/\/([^\/]+\/).*[&\?]id=(\d+)\s*-\s*(.*)'
|
||||
vars:
|
||||
- torrentName
|
||||
|
|
|
@ -14,27 +14,37 @@ supports:
|
|||
source: rartracker
|
||||
settings:
|
||||
- name: passkey
|
||||
type: text
|
||||
type: secret
|
||||
label: Passkey
|
||||
tooltip: Copy the passkey from the /rss page
|
||||
description: "Copy the passkey from the /rss page."
|
||||
help: "Copy the passkey from the /rss page."
|
||||
|
||||
irc:
|
||||
network: SuperBits
|
||||
server: irc.superbits.org:6697
|
||||
server: irc.superbits.org
|
||||
port: 6697
|
||||
tls: true
|
||||
channels:
|
||||
- "#autodl"
|
||||
announcers:
|
||||
- SuperBits
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user-bot
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: false
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
|
||||
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]"
|
||||
- test:
|
||||
- "-[archive Film 1080]2[A.Movie.1985.FRENCH.1080p.BluRay.x264-GROUP]3[000000]4[Size: 4.41 GB]5[FL: no]6[Scene: yes]"
|
||||
- "-[new TV]2[Some.Show.S05E05.720p.WEB.h264-GROUP]3[000000]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
|
||||
|
|
|
@ -14,28 +14,38 @@ supports:
|
|||
source: custom
|
||||
settings:
|
||||
- name: rsskey
|
||||
type: text
|
||||
type: secret
|
||||
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."
|
||||
help: "Go to your profile and copy your RSS key"
|
||||
regex: /([\da-fA-F]{20})
|
||||
|
||||
irc:
|
||||
network: TorrentLeech.org
|
||||
server: irc.torrentleech.org:7021
|
||||
server: irc.torrentleech.org
|
||||
port: 7021
|
||||
tls: true
|
||||
channels:
|
||||
- "#tlannounces"
|
||||
announcers:
|
||||
- _AnnounceBot_
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: false
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user_bot
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: false
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
|
||||
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"
|
||||
- test:
|
||||
- "New Torrent Announcement: <PC :: Iso> Name:'debian live 10 6 0 amd64 standard iso' uploaded by 'Anonymous' - http://www.tracker01.test/torrent/000000"
|
||||
- "New Torrent Announcement: <PC :: Iso> Name:'debian live 10 6 0 amd64 standard iso' uploaded by 'Anonymous' freeleech - http://www.tracker01.test/torrent/000000"
|
||||
pattern: New Torrent Announcement:\s*<([^>]*)>\s*Name:'(.*)' uploaded by '([^']*)'\s*(freeleech)*\s*-\s*https?\:\/\/([^\/]+\/)torrent\/(\d+)
|
||||
vars:
|
||||
- category
|
||||
|
|
|
@ -13,33 +13,48 @@ supports:
|
|||
- 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.
|
||||
- name: authkey
|
||||
type: secret
|
||||
label: Auth key
|
||||
help: Right click DL on a torrent and get the authkey.
|
||||
- name: torrent_pass
|
||||
type: secret
|
||||
label: Torrent pass
|
||||
help: Right click DL on a torrent and get the torrent_pass.
|
||||
|
||||
irc:
|
||||
network: P2P-Network
|
||||
server: irc.p2p-network.net:6697
|
||||
server: irc.p2p-network.net
|
||||
port: 6697
|
||||
tls: true
|
||||
channels:
|
||||
- "#UHD.Announce"
|
||||
announcers:
|
||||
- UHDBot
|
||||
- cr0nusbot
|
||||
settings:
|
||||
- name: nickserv.account
|
||||
type: text
|
||||
required: true
|
||||
label: NickServ Account
|
||||
help: NickServ account. Make sure to group your user and bot. Eg. user|autodl
|
||||
- name: nickserv.password
|
||||
type: secret
|
||||
required: true
|
||||
label: NickServ Password
|
||||
help: NickServ password
|
||||
- name: invite_command
|
||||
type: secret
|
||||
default: "UHDBot invite IRCKey"
|
||||
required: true
|
||||
label: Invite command
|
||||
help: Invite auth with UHDBot.
|
||||
|
||||
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"
|
||||
- test:
|
||||
- "New Torrent: A Movie [2015] - GROUP Type: Movie / 1080p / Encode / Freeleech: 100 Size: 7.00GB - https://uhdbits.org/torrents.php?id=00000 / https://uhdbits.org/torrents.php?action=download&id=00000"
|
||||
pattern: 'New Torrent: (.*) Type: (.*?) Freeleech: (.*) Size: (.*) - https?:\/\/.* \/ (https?:\/\/.*id=\d+)'
|
||||
vars:
|
||||
- torrentName
|
||||
|
|
|
@ -5,9 +5,8 @@ import (
|
|||
"io/fs"
|
||||
"strings"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/autobrr/autobrr/internal/domain"
|
||||
)
|
||||
|
@ -26,9 +25,15 @@ type Service interface {
|
|||
}
|
||||
|
||||
type service struct {
|
||||
repo domain.IndexerRepo
|
||||
indexerDefinitions map[string]domain.IndexerDefinition
|
||||
indexerInstances map[string]domain.IndexerDefinition
|
||||
repo domain.IndexerRepo
|
||||
|
||||
// contains all raw indexer definitions
|
||||
indexerDefinitions map[string]domain.IndexerDefinition
|
||||
|
||||
// contains indexers with data set
|
||||
indexerInstances map[string]domain.IndexerDefinition
|
||||
|
||||
// map server:channel:announce to indexer.Identifier
|
||||
mapIndexerIRCToName map[string]string
|
||||
}
|
||||
|
||||
|
@ -44,6 +49,14 @@ func NewService(repo domain.IndexerRepo) Service {
|
|||
func (s *service) Store(indexer domain.Indexer) (*domain.Indexer, error) {
|
||||
i, err := s.repo.Store(indexer)
|
||||
if err != nil {
|
||||
log.Error().Stack().Err(err).Msgf("failed to store indexer: %v", indexer.Name)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// add to indexerInstances
|
||||
err = s.addIndexer(*i)
|
||||
if err != nil {
|
||||
log.Error().Stack().Err(err).Msgf("failed to add indexer: %v", indexer.Name)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -56,6 +69,13 @@ func (s *service) Update(indexer domain.Indexer) (*domain.Indexer, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// add to indexerInstances
|
||||
err = s.addIndexer(*i)
|
||||
if err != nil {
|
||||
log.Error().Stack().Err(err).Msgf("failed to add indexer: %v", indexer.Name)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return i, nil
|
||||
}
|
||||
|
||||
|
@ -94,46 +114,60 @@ func (s *service) GetAll() ([]*domain.IndexerDefinition, error) {
|
|||
var res = make([]*domain.IndexerDefinition, 0)
|
||||
|
||||
for _, indexer := range indexers {
|
||||
in := s.getDefinitionByName(indexer.Identifier)
|
||||
if in == nil {
|
||||
// if no indexerDefinition found, continue
|
||||
indexerDefinition, err := s.mapIndexer(indexer)
|
||||
if err != nil {
|
||||
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,
|
||||
if indexerDefinition == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// 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)
|
||||
res = append(res, indexerDefinition)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (s *service) mapIndexer(indexer domain.Indexer) (*domain.IndexerDefinition, error) {
|
||||
|
||||
in := s.getDefinitionByName(indexer.Identifier)
|
||||
if in == nil {
|
||||
// if no indexerDefinition found, continue
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
indexerDefinition := domain.IndexerDefinition{
|
||||
ID: int(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
|
||||
|
||||
indexerDefinition.SettingsMap[setting.Name] = v
|
||||
}
|
||||
|
||||
indexerDefinition.Settings = append(indexerDefinition.Settings, setting)
|
||||
}
|
||||
|
||||
return &indexerDefinition, nil
|
||||
}
|
||||
|
||||
func (s *service) GetTemplates() ([]domain.IndexerDefinition, error) {
|
||||
|
||||
definitions := s.indexerDefinitions
|
||||
|
@ -152,44 +186,81 @@ func (s *service) Start() error {
|
|||
return err
|
||||
}
|
||||
|
||||
indexers, err := s.GetAll()
|
||||
indexerDefinitions, err := s.GetAll()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, indexer := range indexers {
|
||||
if !indexer.Enabled {
|
||||
continue
|
||||
}
|
||||
for _, indexerDefinition := range indexerDefinitions {
|
||||
s.indexerInstances[indexerDefinition.Identifier] = *indexerDefinition
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
s.mapIRCIndexerLookup(indexerDefinition.Identifier, *indexerDefinition)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *service) removeIndexer(indexer domain.Indexer) error {
|
||||
|
||||
delete(s.indexerDefinitions, indexer.Identifier)
|
||||
|
||||
// TODO delete from mapIndexerIRCToName
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *service) addIndexer(indexer domain.Indexer) error {
|
||||
|
||||
// TODO only add if not already there?? Overwrite?
|
||||
|
||||
indexerDefinition, err := s.mapIndexer(indexer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO only add enabled?
|
||||
//if !indexer.Enabled {
|
||||
// continue
|
||||
//}
|
||||
|
||||
s.indexerInstances[indexerDefinition.Identifier] = *indexerDefinition
|
||||
|
||||
s.mapIRCIndexerLookup(indexer.Identifier, *indexerDefinition)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *service) mapIRCIndexerLookup(indexerIdentifier string, indexerDefinition domain.IndexerDefinition) {
|
||||
// map irc stuff to indexer.name
|
||||
// map[irc.network.test:channel:announcer1] = indexer1
|
||||
// map[irc.network.test:channel:announcer2] = indexer2
|
||||
if indexerDefinition.IRC != nil {
|
||||
server := indexerDefinition.IRC.Server
|
||||
channels := indexerDefinition.IRC.Channels
|
||||
announcers := indexerDefinition.IRC.Announcers
|
||||
|
||||
for _, channel := range channels {
|
||||
for _, announcer := range announcers {
|
||||
// format to server:channel:announcer
|
||||
val := fmt.Sprintf("%v:%v:%v", server, channel, announcer)
|
||||
val = strings.ToLower(val)
|
||||
|
||||
s.mapIndexerIRCToName[val] = indexerIdentifier
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
log.Fatal().Stack().Msgf("failed reading directory: %s", err)
|
||||
}
|
||||
|
||||
if len(entries) == 0 {
|
||||
log.Fatal().Msgf("failed reading directory: %s", err)
|
||||
log.Fatal().Stack().Msgf("failed reading directory: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -197,19 +268,19 @@ func (s *service) LoadIndexerDefinitions() error {
|
|||
filePath := "definitions/" + f.Name()
|
||||
|
||||
if strings.Contains(f.Name(), ".yaml") {
|
||||
log.Debug().Msgf("parsing: %v", filePath)
|
||||
log.Trace().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)
|
||||
log.Error().Stack().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)
|
||||
log.Error().Stack().Err(err).Msgf("failed unmarshal file: %v", filePath)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -217,10 +288,13 @@ func (s *service) LoadIndexerDefinitions() error {
|
|||
}
|
||||
}
|
||||
|
||||
log.Info().Msgf("Loaded %d indexer definitions", len(s.indexerDefinitions))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *service) GetIndexerByAnnounce(name string) *domain.IndexerDefinition {
|
||||
name = strings.ToLower(name)
|
||||
|
||||
if identifier, idOk := s.mapIndexerIRCToName[name]; idOk {
|
||||
if indexer, ok := s.indexerInstances[identifier]; ok {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue