A matterbridge bot that detects music links (Spotify, YouTube, Apple Music, etc.) in chat messages and responds with equivalent links on other platforms. Features: - Connects to matterbridge via WebSocket API - Detects links from 7 music services (Spotify, YouTube, Apple, Deezer, etc.) - Uses idonthavespotify API for conversion (no API credentials required) - Automatic reconnection with exponential backoff - Platform setup guide for NixOS deployment Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
// Package services provides types for music service integrations.
|
|
package services
|
|
|
|
// LinkType represents the type of music content.
|
|
type LinkType string
|
|
|
|
const (
|
|
LinkTypeTrack LinkType = "track"
|
|
LinkTypeAlbum LinkType = "album"
|
|
LinkTypeArtist LinkType = "artist"
|
|
LinkTypePlaylist LinkType = "playlist"
|
|
)
|
|
|
|
// ServiceType identifies a music streaming service.
|
|
type ServiceType string
|
|
|
|
const (
|
|
ServiceSpotify ServiceType = "spotify"
|
|
ServiceYouTube ServiceType = "youtube"
|
|
ServiceAppleMusic ServiceType = "apple"
|
|
ServiceDeezer ServiceType = "deezer"
|
|
ServiceSoundCloud ServiceType = "soundcloud"
|
|
ServiceTidal ServiceType = "tidal"
|
|
ServiceBandcamp ServiceType = "bandcamp"
|
|
ServiceQobuz ServiceType = "qobuz"
|
|
)
|
|
|
|
// Track represents a music track with metadata.
|
|
type Track struct {
|
|
Title string
|
|
Artist string
|
|
Album string
|
|
ArtworkURL string
|
|
PreviewURL string
|
|
}
|
|
|
|
// ResolvedLinks contains links to the same content across multiple services.
|
|
type ResolvedLinks struct {
|
|
Type LinkType
|
|
Track *Track
|
|
Links map[ServiceType]string
|
|
}
|
|
|
|
// DetectedLink represents a music link found in a message.
|
|
type DetectedLink struct {
|
|
URL string
|
|
Service ServiceType
|
|
RawMatch string
|
|
}
|