removed redundant code in source
This commit is contained in:
parent
be16925ab4
commit
acce599f2d
@ -12,20 +12,6 @@ type SourceType struct {
|
|||||||
RegexSong *regexp.Regexp
|
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
|
type ObjectType string
|
||||||
|
|
||||||
const SongSource = ObjectType("song")
|
const SongSource = ObjectType("song")
|
||||||
|
46
internal/plugin/youtube.go
Normal file
46
internal/plugin/youtube.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package plugin
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"gitea.elara.ws/Hazel/music-kraken/internal/data"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Youtube struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Youtube) Name() string {
|
||||||
|
return "Youtube"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Youtube) Regex() *regexp.Regexp {
|
||||||
|
return regexp.MustCompile(`(?i)\b(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})\b`)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Youtube) RegexAlbum() *regexp.Regexp {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Youtube) RegexArtist() *regexp.Regexp {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Youtube) RegexSong() *regexp.Regexp {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Youtube) FetchAlbum(source data.Source) (data.Album, error) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Youtube) FetchArtist(source data.Source) (data.Artist, error) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Youtube) FetchSong(source data.Source) (data.Song, error) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Youtube) Search(query string) ([]data.MusicObject, error) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user