Documentation ¶
Overview ¶
Copyright © 2023 Philipp Wolfer <phw@uploadedlobster.com>
This file is part of Scotty.
Scotty is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Scotty is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Scotty. If not, see <https://www.gnu.org/licenses/>.
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.
Index ¶
- type AdditionalInfo
- type Backend
- type BackendOption
- type Entity
- type ExportResult
- type ImportBackend
- type ImportResult
- type Listen
- type ListensExport
- type ListensImport
- type ListensList
- type ListensResult
- type LogEntry
- type LogEntryType
- type Love
- type LovesExport
- type LovesImport
- type LovesList
- type LovesResult
- type MBID
- type OptionType
- type Progress
- type Track
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdditionalInfo ¶
type Backend ¶
type Backend interface { // Return the name of the interface Name() string // Initialize the backend from a config. FromConfig(config *config.ServiceConfig) Backend // Return configuration options Options() []BackendOption }
A listen service backend. All listen services must implement this interface.
type BackendOption ¶ added in v0.3.0
type ExportResult ¶ added in v0.3.0
type ImportBackend ¶
type ImportResult ¶
type ImportResult struct { TotalCount int ImportCount int LastTimestamp time.Time ImportLog []LogEntry // Error is only set if an unrecoverable import error occurred Error error }
func (*ImportResult) Log ¶ added in v0.4.0
func (i *ImportResult) Log(t LogEntryType, msg string)
func (*ImportResult) Update ¶
func (i *ImportResult) Update(from ImportResult)
func (*ImportResult) UpdateTimestamp ¶
func (i *ImportResult) UpdateTimestamp(newTime time.Time)
Sets LastTimestamp to newTime, if newTime is newer than LastTimestamp
type ListensExport ¶
type ListensExport interface { Backend // Returns a list of all listens newer then oldestTimestamp. // The returned list of listens is supposed to be ordered by the // Listen.ListenedAt timestamp, with the oldest entry first. ExportListens(oldestTimestamp time.Time, results chan ListensResult, progress chan Progress) }
Must be implemented by services supporting the export of listens.
type ListensImport ¶
type ListensImport interface { ImportBackend // Imports the given list of listens. ImportListens(export ListensResult, importResult ImportResult, progress chan Progress) (ImportResult, error) }
Must be implemented by services supporting the import of listens.
type ListensList ¶
type ListensList []Listen
func (ListensList) Len ¶
func (l ListensList) Len() int
func (ListensList) Less ¶
func (l ListensList) Less(i, j int) bool
func (ListensList) NewerThan ¶
func (l ListensList) NewerThan(t time.Time) ListensList
Returns a new ListensList with only elements that are newer than t.
func (ListensList) Swap ¶
func (l ListensList) Swap(i, j int)
type ListensResult ¶
type ListensResult ExportResult[ListensList]
type LogEntry ¶ added in v0.4.0
type LogEntry struct { Type LogEntryType Message string }
type LogEntryType ¶ added in v0.4.0
type LogEntryType string
const ( Info LogEntryType = "Info" Warning LogEntryType = "Warning" Error LogEntryType = "Error" )
type LovesExport ¶
type LovesExport interface { Backend // Returns a list of all loves newer then oldestTimestamp. // The returned list of listens is supposed to be ordered by the // Love.Created timestamp, with the oldest entry first. ExportLoves(oldestTimestamp time.Time, results chan LovesResult, progress chan Progress) }
Must be implemented by services supporting the export of loves.
type LovesImport ¶
type LovesImport interface { ImportBackend // Imports the given list of loves. ImportLoves(export LovesResult, importResult ImportResult, progress chan Progress) (ImportResult, error) }
Must be implemented by services supporting the import of loves.
type LovesResult ¶
type LovesResult ExportResult[LovesList]
type OptionType ¶ added in v0.3.0
type OptionType string
const ( Bool OptionType = "bool" Secret OptionType = "secret" String OptionType = "string" Int OptionType = "int" )
type Progress ¶
func (Progress) FromImportResult ¶
func (p Progress) FromImportResult(result ImportResult) Progress
type Track ¶
type Track struct { TrackName string ReleaseName string ArtistNames []string TrackNumber int DiscNumber int Duration time.Duration ISRC string RecordingMbid MBID ReleaseMbid MBID ReleaseGroupMbid MBID ArtistMbids []MBID WorkMbids []MBID Tags []string AdditionalInfo AdditionalInfo }
func (Track) ArtistName ¶
func (*Track) FillAdditionalInfo ¶
func (t *Track) FillAdditionalInfo()
Updates AdditionalInfo to have standard fields as defined by ListenBrainz