aboutsummaryrefslogtreecommitdiff
path: root/cmd/sanguisuga/js/scripts/subsplease.js
blob: dd9566e2ee15e86df724da7063bf173d995a74db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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;
};