mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-27 06:37:56 +02:00
Move the JSPF playlist code into public module
This commit is contained in:
parent
0f5cb49b4c
commit
e1c9fb6076
11 changed files with 367 additions and 56 deletions
86
pkg/jspf/extensions.go
Normal file
86
pkg/jspf/extensions.go
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
Copyright © 2023 Philipp Wolfer <phw@uploadedlobster.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package jspf
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
// The identifier for the MusicBrainz / ListenBrainz JSPF playlist extension
|
||||
MusicBrainzPlaylistExtensionId = "https://musicbrainz.org/doc/jspf#playlist"
|
||||
// The identifier for the MusicBrainz / ListenBrainz JSPF track extension
|
||||
MusicBrainzTrackExtensionId = "https://musicbrainz.org/doc/jspf#track"
|
||||
)
|
||||
|
||||
// MusicBrainz / ListenBrainz JSPF track extension
|
||||
//
|
||||
// This extension allows storing additional metadata for playlists.
|
||||
//
|
||||
// See "https://musicbrainz.org/doc/jspf#playlist"
|
||||
type MusicBrainzPlaylistExtension struct {
|
||||
// The ListenBrainz user who created this playlist.
|
||||
Creator string `json:"added_by,omitempty"`
|
||||
// Which ListenBrainz user was the playlist generated for? This is for music
|
||||
// recommendation bots generating playlists for users.
|
||||
CreatedFor string `json:"created_for,omitempty"`
|
||||
// Who are the ListenBrainz users who have access to edit this playlist?
|
||||
Collaborators []string `json:"collaborators,omitempty"`
|
||||
// This field identifies a playlist, using the identifier syntax,
|
||||
// from which this playlist was copied from.
|
||||
CopiedFrom string `json:"copied_from,omitempty"`
|
||||
// If the source playlist that this playlist has been copied from has been
|
||||
// deleted, this field will be set to true and the copied_from field will not
|
||||
// be returned.
|
||||
CopiedFromDeleted bool `json:"copied_from_deleted,omitempty"`
|
||||
// Indicates if this playlist is public or private. Must contain the value
|
||||
// "true" or "false".
|
||||
Public string `json:"public,omitempty"`
|
||||
// The timestamp for when this playlist was last modified.
|
||||
LastModifiedAt time.Time `json:"last_modified_at,omitempty"`
|
||||
// This dict allows a playlist creator to submit additional track metadata
|
||||
// that may be used by playlist generation tools. The content of this field
|
||||
// is defined by the playlist generation tools and is beyond the scope of
|
||||
// this document.
|
||||
AdditionalMetadata map[string]any `json:"additional_metadata,omitempty"`
|
||||
}
|
||||
|
||||
// MusicBrainz / ListenBrainz JSPF track extension
|
||||
//
|
||||
// This extension allows storing additional metadata for tracks.
|
||||
//
|
||||
// See "https://musicbrainz.org/doc/jspf#track"
|
||||
type MusicBrainzTrackExtension struct {
|
||||
// The timestamp for when this track was added to the playlist.
|
||||
AddedAt time.Time `json:"added_at,omitempty"`
|
||||
// The ListenBrainz user who added this track.
|
||||
AddedBy string `json:"added_by,omitempty"`
|
||||
// The MusicBrainz ID URI for the release that contained this track.
|
||||
ReleaseIdentifier string `json:"release_identifier,omitempty"`
|
||||
// A list of MusicBrainz Artist URIs that identify the artist that are part
|
||||
// of the MusicBrainz artist credit id for this track.
|
||||
ArtistIdentifiers []string `json:"artist_identifiers,omitempty"`
|
||||
// This dict allows a playlist creator to submit additional track metadata
|
||||
// that may be used by playlist generation tools. The content of this field
|
||||
// is defined by the playlist generation tools and is beyond the scope of
|
||||
// this document.
|
||||
AdditionalMetadata map[string]any `json:"additional_metadata,omitempty"`
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue