diff options
| author | Xe Iaso <me@xeiaso.net> | 2023-08-26 14:14:51 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2023-08-26 14:14:51 -0400 |
| commit | 81fe4e8a12b362f7de9a97210f950c388d047664 (patch) | |
| tree | d71d879f62d74e528a1338470df268669e2565be /cmd/sanguisuga/js | |
| parent | 924a12ab6915b7dad147ed57c5a384c142f82c1e (diff) | |
| download | x-81fe4e8a12b362f7de9a97210f950c388d047664.tar.xz x-81fe4e8a12b362f7de9a97210f950c388d047664.zip | |
Switch from ln to slog
ln had a good run, but it's not going to last for the long term. I'm
going to standardize everything on log/slog and deprecate ln.
Closes #385
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd/sanguisuga/js')
| -rw-r--r-- | cmd/sanguisuga/js/scripts/iptorrents.js | 39 | ||||
| -rw-r--r-- | cmd/sanguisuga/js/scripts/subsplease.js | 50 | ||||
| -rw-r--r-- | cmd/sanguisuga/js/scripts/torrentleech.js | 39 |
3 files changed, 128 insertions, 0 deletions
diff --git a/cmd/sanguisuga/js/scripts/iptorrents.js b/cmd/sanguisuga/js/scripts/iptorrents.js new file mode 100644 index 0000000..fd45abe --- /dev/null +++ b/cmd/sanguisuga/js/scripts/iptorrents.js @@ -0,0 +1,39 @@ +const regex = + /^\[([^\]]*)]\s+(.*?(FREELEECH)?)\s+-\s+https?\:\/\/([^\/]+).*[&;\?]id=(\d+)\s*- (.*)$/; + +const genURL = (torrentName, baseURL, id, passkey) => + `https://${baseURL}/download.php/${id}/${torrentName}.torrent?torrent_pass=${passkey}`; + +export const allowLine = (nick, channel) => { + if (channel != "#ipt.announce") { + return false; + } + + if (nick !== "IPT") { + return false; + } + + return true; +}; + +export const parseLine = (msg) => { + const [ + _blank, + category, + torrentName, + freeleech, + baseURL, + id, + size, + ] = msg.split(regex); + + return { + torrent: { + category, + name: torrentName, + freeleech: freeleech !== "", + id: id, + url: genURL(torrentName, baseURL, id), + }, + }; +}; diff --git a/cmd/sanguisuga/js/scripts/subsplease.js b/cmd/sanguisuga/js/scripts/subsplease.js new file mode 100644 index 0000000..dd9566e --- /dev/null +++ b/cmd/sanguisuga/js/scripts/subsplease.js @@ -0,0 +1,50 @@ +const regex = + /^.*\* (\[SubsPlease\] (.*) - ([0-9]+) \(([0-9]{3,4})p\) \[([0-9A-Fa-f]{8})\]\.mkv) \* .MSG ([^ ]+) XDCC SEND ([0-9]+)$/; + +const bots = [ + "CR-ARUTHA|NEW", + "CR-HOLLAND|NEW", +]; + +export const ircInfo = { + server: "irc.rizon.net:6697", + channel: "#subsplease", + downloadType: "DCC", +}; + +export const allowLine = (nick, channel) => { + if (channel != "#subsplease") { + return false; + } + + if (!bots.includes(nick)) { + return false; + } + + return true; +}; + +export const parseLine = (msg) => { + const [ + _blank, + fname, + showName, + episode, + resolution, + crc32, + botName, + packID, + ] = msg.split(regex); + + const result = { + fname, + showName, + episode, + resolution, + crc32, + botName, + packID, + }; + + return result; +}; diff --git a/cmd/sanguisuga/js/scripts/torrentleech.js b/cmd/sanguisuga/js/scripts/torrentleech.js new file mode 100644 index 0000000..7ddfa9e --- /dev/null +++ b/cmd/sanguisuga/js/scripts/torrentleech.js @@ -0,0 +1,39 @@ +const regex = + /^New Torrent Announcement: <([^>]*)>\s+Name:'(.*)' uploaded by '.*' ?(freeleech)?\s+-\s+https:..\w+.\w+.\w+\/.\w+\/([0-9]+)$/; + +const genURL = (torrentName, baseURL, id, passkey) => + `https://www.torrentleech.org/rss/download/${id}/${passkey}/${torrentName}`; + +export const allowLine = (nick, channel) => { + if (channel !== "#tlannounces") { + return false; + } + + if (nick !== "_AnnounceBot_") { + return false; + } + + return true; +}; + +export const parseLine = (msg) => { + const [ + _blank, + category, + torrentName, + freeleech, + baseURL, + id, + size, + ] = msg.split(regex); + + return { + torrent: { + category, + name: torrentName, + freeleech: freeleech !== "", + id: id, + url: genURL(torrentName, baseURL, id), + }, + }; +}; |
