Documentation ¶
Overview ¶
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.
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 ¶
- Constants
- type Artist
- type Client
- func (c Client) GetFeedback(user string, status int, offset int) (result GetFeedbackResult, err error)
- func (c Client) GetListens(user string, maxTime time.Time, minTime time.Time) (result GetListensResult, err error)
- func (c Client) Lookup(recordingName string, artistName string) (result LookupResult, err error)
- func (c Client) SendFeedback(feedback Feedback) (result StatusResult, err error)
- func (c Client) SubmitListens(listens ListenSubmission) (result StatusResult, err error)
- type ErrorResult
- type Feedback
- type GetFeedbackResult
- type GetListenPayload
- type GetListensResult
- type Listen
- type ListenBrainzApiBackend
- func (b *ListenBrainzApiBackend) ExportListens(oldestTimestamp time.Time, results chan models.ListensResult, ...)
- func (b *ListenBrainzApiBackend) ExportLoves(oldestTimestamp time.Time, results chan models.LovesResult, ...)
- func (b *ListenBrainzApiBackend) FinishImport() error
- func (b *ListenBrainzApiBackend) FromConfig(config *config.ServiceConfig) models.Backend
- func (b *ListenBrainzApiBackend) ImportListens(export models.ListensResult, importResult models.ImportResult, ...) (models.ImportResult, error)
- func (b *ListenBrainzApiBackend) ImportLoves(export models.LovesResult, importResult models.ImportResult, ...) (models.ImportResult, error)
- func (b *ListenBrainzApiBackend) Name() string
- func (b *ListenBrainzApiBackend) Options() []models.BackendOption
- func (b *ListenBrainzApiBackend) StartImport() error
- type ListenSubmission
- type LookupResult
- type MbidMapping
- type StatusResult
- type Track
Constants ¶
const ( DefaultItemsPerGet = 25 MaxItemsPerGet = 1000 MaxListensPerRequest = 1000 )
const ( PlayingNow listenType = "playing_now" Single listenType = "single" Import listenType = "import" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { HttpClient *resty.Client MaxResults int }
func (Client) GetFeedback ¶
func (Client) GetListens ¶
func (Client) Lookup ¶
func (c Client) Lookup(recordingName string, artistName string) (result LookupResult, err error)
func (Client) SendFeedback ¶
func (c Client) SendFeedback(feedback Feedback) (result StatusResult, err error)
func (Client) SubmitListens ¶
func (c Client) SubmitListens(listens ListenSubmission) (result StatusResult, err error)
type ErrorResult ¶
type Feedback ¶
type Feedback struct { Created int64 `json:"created,omitempty"` RecordingMbid string `json:"recording_mbid,omitempty"` RecordingMsid string `json:"recording_msid,omitempty"` Score int `json:"score,omitempty"` TrackMetadata *Track `json:"track_metadata,omitempty"` UserName string `json:"user_id,omitempty"` }
type GetFeedbackResult ¶
type GetListenPayload ¶
type GetListensResult ¶
type GetListensResult struct {
Payload GetListenPayload `json:"payload"`
}
type Listen ¶
type ListenBrainzApiBackend ¶
type ListenBrainzApiBackend struct {
// contains filtered or unexported fields
}
func (*ListenBrainzApiBackend) ExportListens ¶
func (b *ListenBrainzApiBackend) ExportListens(oldestTimestamp time.Time, results chan models.ListensResult, progress chan models.Progress)
func (*ListenBrainzApiBackend) ExportLoves ¶
func (b *ListenBrainzApiBackend) ExportLoves(oldestTimestamp time.Time, results chan models.LovesResult, progress chan models.Progress)
func (*ListenBrainzApiBackend) FinishImport ¶
func (b *ListenBrainzApiBackend) FinishImport() error
func (*ListenBrainzApiBackend) FromConfig ¶
func (b *ListenBrainzApiBackend) FromConfig(config *config.ServiceConfig) models.Backend
func (*ListenBrainzApiBackend) ImportListens ¶
func (b *ListenBrainzApiBackend) ImportListens(export models.ListensResult, importResult models.ImportResult, progress chan models.Progress) (models.ImportResult, error)
func (*ListenBrainzApiBackend) ImportLoves ¶
func (b *ListenBrainzApiBackend) ImportLoves(export models.LovesResult, importResult models.ImportResult, progress chan models.Progress) (models.ImportResult, error)
func (*ListenBrainzApiBackend) Name ¶
func (b *ListenBrainzApiBackend) Name() string
func (*ListenBrainzApiBackend) Options ¶ added in v0.3.0
func (b *ListenBrainzApiBackend) Options() []models.BackendOption
func (*ListenBrainzApiBackend) StartImport ¶
func (b *ListenBrainzApiBackend) StartImport() error
type ListenSubmission ¶
type ListenSubmission struct { ListenType listenType `json:"listen_type"` Payload []Listen `json:"payload"` }
type LookupResult ¶
type MbidMapping ¶
type StatusResult ¶
type StatusResult struct {
Status string `json:"status"`
}
type Track ¶
type Track struct { TrackName string `json:"track_name,omitempty"` ArtistName string `json:"artist_name,omitempty"` ReleaseName string `json:"release_name,omitempty"` AdditionalInfo map[string]any `json:"additional_info,omitempty"` MbidMapping *MbidMapping `json:"mbid_mapping,omitempty"` }