Documentation ¶
Overview ¶
Package model contains the data models of the Karman. Models together with services provide the core business logic of Karman.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { Model // Type identifies the content type of the file, as specified by the user. Type mediatype.MediaType // File metadata is calculated automatically Size int64 // read only Checksum []byte // read only Duration time.Duration // only audio and videos Width int // only images and videos Height int // only images and videos }
File represents a single media file that can be used by songs.
type Model ¶
type Model struct { // The unique identifier for this instance. UUID uuid.UUID // These dates will only be set to non-zero values if the instance has been created or soft-deleted respectively. // These fields can be set manually, but should be considered read-only in most cases. CreatedAt time.Time UpdatedAt time.Time DeletedAt time.Time }
Model is a base type that contains shared fields for all model types. Usually you don't need to interact with this type directly.
type Song ¶
type Song struct { Model ultrastar.Song Artists []string // InUpload indicates whether this song belongs to an upload. InUpload bool // read only // Changes to File references of a song will not be updated when the song is updated. // The same goes for the Song.*FileName fields. AudioFile *File // read only CoverFile *File // read only VideoFile *File // read only BackgroundFile *File // read only TxtFileName string // read only }
Song is the base model of Karman. A Song instance represents a single, singable UltraStar song.
type Upload ¶
type Upload struct { Model State UploadState // read only // The total number of songs found in an upload. // -1 if not yet known. SongsTotal int // read only // The number of songs processed (out of the total number of songs). // -1 if processing has not started yet. SongsProcessed int // read only // The number of errors that occurred during processing. Errors int }
Upload represents a batch upload of potentially many songs at once. An Upload acts like a write-only file share that a user can upload files to. After all files have been uploaded the upload can be marked to be processed by the Karman system. After processing has finished, it is possible to fetch all songs found in the upload.
type UploadProcessingError ¶
type UploadProcessingError struct { // The file in which the error occurred. File string // The error message. Message string }
A UploadProcessingError indicates some error that occurred during processing of an upload.
func (*UploadProcessingError) Error ¶
func (err *UploadProcessingError) Error() string
Error returns the error message of the error.
type UploadState ¶
type UploadState string
UploadState indicates in which processing state an upload currently is.
const ( // UploadStateOpen indicates that an upload has not been scheduled for processing yet. UploadStateOpen UploadState = "open" // UploadStatePending indicates that an upload has been marked for processing, but processing has not started yet. UploadStatePending UploadState = "pending" // UploadStateProcessing indicates that an upload is currently being processed. UploadStateProcessing UploadState = "processing" // UploadStateDone indicates that processing has finished. UploadStateDone UploadState = "done" )