maloja

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

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

View Source
const MaxItemsPerGet = 1000

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	Title   string   `json:"albumtitle"`
	Artists []string `json:"artists"`
}

type Client

type Client struct {
	HttpClient *resty.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(serverUrl string, token string) Client

func (Client) GetScrobbles

func (c Client) GetScrobbles(page int, perPage int) (result GetScrobblesResult, err error)

func (Client) NewScrobble

func (c Client) NewScrobble(scrobble NewScrobble) (result NewScrobbleResult, err error)

type Error

type Error struct {
	Type        string `json:"type"`
	Value       string `json:"value"`
	Description string `json:"desc"`
}

type GenericResult

type GenericResult struct {
	Status string `json:"status"`
}

type GetScrobblesResult

type GetScrobblesResult struct {
	GenericResult
	List       []Scrobble `json:"list"`
	Pagination Pagination `json:"pagination"`
}

type MalojaApiBackend

type MalojaApiBackend struct {
	// contains filtered or unexported fields
}

func (*MalojaApiBackend) ExportListens

func (b *MalojaApiBackend) ExportListens(oldestTimestamp time.Time, results chan models.ListensResult, progress chan models.Progress)

func (*MalojaApiBackend) FinishImport

func (b *MalojaApiBackend) FinishImport() error

func (*MalojaApiBackend) FromConfig

func (b *MalojaApiBackend) FromConfig(config *config.ServiceConfig) models.Backend

func (*MalojaApiBackend) ImportListens

func (b *MalojaApiBackend) ImportListens(export models.ListensResult, importResult models.ImportResult, progress chan models.Progress) (models.ImportResult, error)

func (*MalojaApiBackend) Name

func (b *MalojaApiBackend) Name() string

func (*MalojaApiBackend) Options added in v0.3.0

func (b *MalojaApiBackend) Options() []models.BackendOption

func (*MalojaApiBackend) StartImport

func (b *MalojaApiBackend) StartImport() error

type NewScrobble

type NewScrobble struct {
	Key          string   `json:"key"`
	Artist       string   `json:"artist,omitempty"`
	Artists      []string `json:"artists,omitempty"`
	Title        string   `json:"title"`
	Album        string   `json:"album,omitempty"`
	AlbumArtists []string `json:"albumartists,omitempty"`
	Duration     int64    `json:"duration,omitempty"`
	Length       int64    `json:"length,omitempty"`
	Time         int64    `json:"time,omitempty"`
	Nofix        bool     `json:"nofix,omitempty"`
}

type NewScrobbleResult

type NewScrobbleResult struct {
	GenericResult
	Track       Track  `json:"track"`
	Description string `json:"desc"`
	Error       Error  `json:"error"`
}

type Pagination

type Pagination struct {
	Page     int    `json:"page"`
	PerPage  int    `json:"perpage"`
	NextPage string `json:"next_page"`
	PrevPage string `json:"prev_page"`
}

type Scrobble

type Scrobble struct {
	ListenedAt int64 `json:"time"`
	Duration   int64 `json:"duration"`
	// Maloja sets Origin to the name of the API key
	// prefixed with "client:"
	Origin string `json:"origin"`
	Track  Track  `json:"track"`
}

func (Scrobble) AsListen

func (s Scrobble) AsListen() models.Listen

type Track

type Track struct {
	Title   string   `json:"title"`
	Artists []string `json:"artists"`
	Album   Album    `json:"album"`
	Length  int64    `json:"length"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL