added compile to fetch
This commit is contained in:
@@ -2,10 +2,19 @@ package plugin
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"gitea.elara.ws/Hazel/music-kraken/internal/data"
|
||||
)
|
||||
|
||||
func extractName(s string) string {
|
||||
parts := strings.Split(s, "/")
|
||||
lastPart := parts[len(parts)-1]
|
||||
hyphenParts := strings.Split(lastPart, "-")
|
||||
result := strings.Join(hyphenParts[:len(hyphenParts)-1], " ")
|
||||
return result
|
||||
}
|
||||
|
||||
type Musify struct {
|
||||
}
|
||||
|
||||
@@ -29,18 +38,24 @@ func (m Musify) RegexSong() *regexp.Regexp {
|
||||
return regexp.MustCompile(`(?i)https?://musify\.club/track/[a-z\-0-9]+`)
|
||||
}
|
||||
|
||||
func (m *Musify) FetchArtist(source data.Source) (data.Artist, error) {
|
||||
panic("unimplemented")
|
||||
func (m Musify) FetchSong(source data.Source) (data.Song, error) {
|
||||
return data.Song{
|
||||
Name: extractName(source.Url),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m *Musify) FetchAlbum(source data.Source) (data.Album, error) {
|
||||
panic("unimplemented")
|
||||
func (m Musify) FetchAlbum(source data.Source) (data.Album, error) {
|
||||
return data.Album{
|
||||
Name: extractName(source.Url),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m *Musify) FetchSong(source data.Source) (data.Song, error) {
|
||||
panic("unimplemented")
|
||||
func (m Musify) FetchArtist(source data.Source) (data.Artist, error) {
|
||||
return data.Artist{
|
||||
Name: extractName(source.Url),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m *Musify) Search(query string) ([]data.MusicObject, error) {
|
||||
func (m Musify) Search(query string) ([]data.MusicObject, error) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user