removed redundant code in source

This commit is contained in:
Hazel Noack
2025-10-07 16:45:52 +02:00
parent be16925ab4
commit acce599f2d
2 changed files with 46 additions and 14 deletions

View File

@@ -12,20 +12,6 @@ type SourceType struct {
RegexSong *regexp.Regexp
}
var SourceTypes = []SourceType{
{Name: "Youtube", Regex: regexp.MustCompile(`(?i)\b(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})\b`)},
{Name: "Musify", Regex: regexp.MustCompile(`(?i)https?://musify\.club/(artist|track|release)/[a-z\-0-9]+`)},
}
func GetSourceType(name string) *SourceType {
for i, st := range SourceTypes {
if st.Name == name {
return &SourceTypes[i]
}
}
panic("couldn't find source type for " + name)
}
type ObjectType string
const SongSource = ObjectType("song")