From 338bcf38bb593d9b83d99b40c28b5023715751ae Mon Sep 17 00:00:00 2001 From: ze0s <43699394+zze0s@users.noreply.github.com> Date: Mon, 6 Jan 2025 22:09:26 +0100 Subject: [PATCH] feat(releases): improve collections/website/streaming service parsing (#1923) * feat(releases): improve collections/website/streaming service parsing * feat(releases): add more streaming services --- internal/domain/release_test.go | 35 +++++++++++++++++++++++++ internal/domain/releasetags.go | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/internal/domain/release_test.go b/internal/domain/release_test.go index f89cd95..9040793 100644 --- a/internal/domain/release_test.go +++ b/internal/domain/release_test.go @@ -1103,6 +1103,41 @@ func TestRelease_Hash(t *testing.T) { }, want: "63b5d87abe5fb49131785de426708d31", }, + { + name: "29", + fields: fields{ + TorrentName: "That Other Show 2023 S01E01 2160p WEB-DL DTS-HD 5.1 HEVC-GROUP", + }, + want: "2b4fbd68007c73664cdf9c1abb33fba9", + }, + { + name: "30", + fields: fields{ + TorrentName: "That Other Show 2023 S01E01 2160p ATVP WEB-DL DTS-HD 5.1 HEVC-GROUP", + }, + want: "a1ad6c5ef96a50e5c3df434ec118185a", + }, + { + name: "31", + fields: fields{ + TorrentName: "That Other Show 2023 S01E01 2160p MA WEB-DL DTS-HD 5.1 HEVC-GROUP", + }, + want: "d2976631b738bcd974e02af2c0b680a1", + }, + { + name: "32", + fields: fields{ + TorrentName: "That Other Show 2023 S01E01 2160p DSNP WEB-DL DTS-HD MA 5.1 HEVC-GROUP", + }, + want: "aff58872541a8050146375ca76ea9fe7", + }, + { + name: "33", + fields: fields{ + TorrentName: "That Other Show 2023 S01E01 2160p MA WEB-DL DTS-HD MA 5.1 HEVC-GROUP", + }, + want: "6d97a50010e7532478f8f4f9c469b885", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/internal/domain/releasetags.go b/internal/domain/releasetags.go index c415cce..78dc349 100644 --- a/internal/domain/releasetags.go +++ b/internal/domain/releasetags.go @@ -7,6 +7,9 @@ import ( "fmt" "regexp" "strconv" + + "github.com/moistari/rls" + "github.com/moistari/rls/taginfo" ) var types map[string][]*TagInfo @@ -264,6 +267,49 @@ func init() { info.re = regexp.MustCompile(`(?i)(?:` + info.RE() + `)`) } } + + var extraTagInfos = map[string][]*taginfo.Taginfo{} + + extraCollections := [][]string{ + {"4OD", "4OD", "(?-i:4OD)", "", "", ""}, + {"ABEMA", "Abema", "(?-i:ABEMA)", "", "", ""}, + {"ADN", "Animation Digital Network", "(?-i:ADN)", "", "", ""}, + {"AUBC", "Australian Broadcasting Corporation", "", "", "", ""}, + {"AUViO", "French AUViO", "(?-i:AUViO)", "", "", ""}, + {"Bilibili", "Bilibili", "(?-i:Bilibili)", "", "", ""}, + {"CRiT", "Criterion Channel", "(?-i:CRiT)", "", "", ""}, + {"FOD", "Fuji Television On Demand", "(?-i:FOD)", "", "", ""}, + {"HIDIVE", "HIDIVE", "(?-i:HIDIVE)", "", "", ""}, + {"ITVX", "ITVX aka ITV", "", "", "", ""}, + {"MA", "Movies Anywhere", "(?-i:MA)", "", "", ""}, + {"MY5", "MY5 aka Channel 5", "", "", "", ""}, + {"MyCanal", "French Groupe Canal+", "(?-i:MyCanal)", "", "", ""}, + {"NOW", "Now", "(?-i:NOW)", "", "", ""}, + {"NLZ", "Dutch NLZiet", "(?-i:NLZ|NLZiet)", "", "", ""}, + {"OViD", "OViD", "(?-i:OViD)", "", "", ""}, + {"STRP", "Star+", "(?-i:STRP)", "", "", ""}, + {"U-NEXT", "U-NEXT", "(?-i:U-NEXT)", "", "", ""}, + {"TVer", "TVer", "(?-i:TVer)", "", "", ""}, + {"TVING", "TVING", "(?-i:TVING)", "", "", ""}, + {"VIU", "VIU", "(?-i:VIU)", "", "", ""}, + {"VDL", "Videoland", "(?-i:VDL)", "", "", ""}, + {"VRV", "VRV", "(?-i:VRV)", "", "", ""}, + {"Pathe", "Pathé Thuis", "(?-i:Pathe)", "", "", ""}, + {"SALTO", "SALTO", "(?-i:SALTO)", "", "", ""}, + {"SHOWTIME", "SHOWTIME", "(?-i:SHO|SHOWTIME)", "", "", ""}, + {"SYFY", "SYFY", "(?-i:SYFY)", "", "", ""}, + {"QUIBI", "QUIBI", "(?-i:QIBI|QUIBI)", "", "", ""}, + } + + for _, collection := range extraCollections { + inf, err := taginfo.New(collection[0], collection[1], collection[2], collection[3], collection[4], collection[5]) + if err != nil { + //log.Fatal(err) + } + extraTagInfos["collection"] = append(extraTagInfos["collection"], inf) + } + + rls.DefaultParser = rls.NewTagParser(taginfo.All(extraTagInfos), rls.DefaultLexers()...) } type TagInfo struct {