parsers/parsers.go

126 lines
2.9 KiB
Go
Raw Normal View History

2022-08-04 00:05:19 +02:00
package parsers
2022-08-15 16:43:27 +02:00
import "git.milar.in/nyaanime/model"
2022-08-04 00:05:19 +02:00
/*
how to get all torrent names on a nyaa page:
let s = "";
2022-08-15 16:43:27 +02:00
document.querySelectorAll("tr > td:nth-child(2) > a:not(.comments)").forEach(element => {
2022-08-04 00:05:19 +02:00
s += element.textContent + "\n";
})
console.log(s);
*/
var Parsers = []model.Parser{
{
Identity: "Erai-Raws",
2022-12-07 19:57:40 +01:00
TorrentParser: RegexTorrentParser(
`^\[Erai-raws\] (.*) - (.*?) (?:END )?(?:\[v\d+\])?\[(.*?)p\](?:\[HEVC\])?(?:\[Multiple Subtitle\])?(?:\s(\[.*?\]+)?|\[[A-Z0-9]{8}\]\.mkv)$`,
2022-08-04 18:13:41 +02:00
TorrentParseOptions{
2022-08-15 13:06:19 +02:00
Name: 1,
Episode: 2,
Resolution: 3,
Subtitles: 4,
SubtitleParser: SquareBracketsLanguageParser,
DefaultLanguages: []string{"ja"},
2022-08-04 18:13:41 +02:00
},
2022-08-04 00:05:19 +02:00
),
2022-12-07 20:25:13 +01:00
FileParser: RegexFileParser(
`^\[Erai-raws\] (.*?) - (\d+?) .*?\.mkv$`,
FileParseOptions{
Name: 1,
Episode: 2,
},
),
2022-08-04 00:05:19 +02:00
},
2022-08-25 18:21:45 +02:00
{
Identity: "SubsPlease",
2022-12-07 19:57:40 +01:00
TorrentParser: RegexTorrentParser(
2022-08-25 18:21:45 +02:00
`^\[SubsPlease\] (.*) - (\d+?) \((.*?)\) \[.*?\].mkv$`,
TorrentParseOptions{
Name: 1,
Episode: 2,
Resolution: 3,
DefaultLanguages: []string{"ja"},
DefaultSubtitles: []string{"en"},
},
),
2022-12-07 20:25:13 +01:00
FileParser: RegexFileParser(
`^\[SubsPlease\] (.*?) - (\d+?) .*?\.mkv$`,
FileParseOptions{
Name: 1,
Episode: 2,
},
),
2022-08-25 18:21:45 +02:00
},
2022-08-25 18:35:41 +02:00
{
Identity: "PuyaSubs!",
2022-12-07 19:57:40 +01:00
TorrentParser: RegexTorrentParser(
2022-08-25 18:35:41 +02:00
`^\[PuyaSubs!\] (.*) - (\d+?) \[ESP-ENG\]\[(.*?)\]\[.*?\]\.mkv$`,
TorrentParseOptions{
Name: 1,
Episode: 2,
Resolution: 3,
DefaultLanguages: []string{"ja"},
DefaultSubtitles: []string{"en"},
},
),
2022-12-07 20:25:13 +01:00
FileParser: RegexFileParser(
`^\[PuyaSubs!\] (.*?) - (\d+?) .*?\.mkv$`,
FileParseOptions{
Name: 1,
Episode: 2,
},
),
2023-01-17 12:31:44 +01:00
// tag 0th audio stream as japanese language and copy all other streams unchanged into output file
FileEncoding: "-map 0 -c:v copy -c:a copy -c:s copy -metadata:s:a:0 language=jpn",
2022-08-25 18:35:41 +02:00
},
{
Identity: "NanakoRaws-JP",
TorrentParser: RegexTorrentParser(
`^\[NanakoRaws\] (.*?) - (\d+?)(?:v\d+)?(?: END)? \((.*?)p\)(?: \(.*?\))?\.mkv \(include JPsub\)`,
TorrentParseOptions{
Name: 1,
Episode: 2,
Resolution: 3,
DefaultLanguages: []string{"ja"},
DefaultSubtitles: []string{"ja"},
},
),
FileParser: RegexFileParser(
`^\[NanakoRaws\] (.*?) - (\d+?)(?:v\d+)?(?: END)? \((.*?)p\)(?: \(.*?\))?\.mkv`,
FileParseOptions{
Name: 1,
Episode: 2,
},
),
},
2023-01-19 10:36:17 +01:00
{
Identity: "Ohys-Raws",
TorrentParser: RegexTorrentParser(
`^\[Ohys-Raws\] (.*?) - (\d+?) \(.*? \d+x(\d+?) .*?\)(?: v2)?\.mp4$`,
TorrentParseOptions{
Name: 1,
Episode: 2,
Resolution: 3,
DefaultLanguages: []string{"ja"},
DefaultSubtitles: []string{},
},
),
FileParser: RegexFileParser(
`^\[Ohys-Raws\] (.*) - (.*?) (?:END )?\(.*?\)\.mp4$`,
FileParseOptions{
Name: 1,
Episode: 2,
},
),
},
2022-08-04 00:05:19 +02:00
}