2013-04-06 21:47:24 +02:00
|
|
|
/*
|
2021-05-26 23:17:52 +02:00
|
|
|
* MusicService.kt
|
|
|
|
* Copyright (C) 2009-2021 Ultrasonic developers
|
|
|
|
*
|
|
|
|
* Distributed under terms of the GNU GPLv3 license.
|
2013-04-06 21:47:24 +02:00
|
|
|
*/
|
2021-05-26 23:17:52 +02:00
|
|
|
package org.moire.ultrasonic.service
|
|
|
|
|
2021-05-26 23:25:56 +02:00
|
|
|
import java.io.InputStream
|
2022-03-27 14:57:07 +02:00
|
|
|
import org.moire.ultrasonic.domain.Album
|
2021-06-20 16:31:08 +02:00
|
|
|
import org.moire.ultrasonic.domain.Artist
|
2021-05-26 23:17:52 +02:00
|
|
|
import org.moire.ultrasonic.domain.Bookmark
|
|
|
|
import org.moire.ultrasonic.domain.ChatMessage
|
|
|
|
import org.moire.ultrasonic.domain.Genre
|
2021-06-20 16:31:08 +02:00
|
|
|
import org.moire.ultrasonic.domain.Index
|
2021-05-26 23:17:52 +02:00
|
|
|
import org.moire.ultrasonic.domain.JukeboxStatus
|
|
|
|
import org.moire.ultrasonic.domain.Lyrics
|
|
|
|
import org.moire.ultrasonic.domain.MusicDirectory
|
|
|
|
import org.moire.ultrasonic.domain.MusicFolder
|
|
|
|
import org.moire.ultrasonic.domain.Playlist
|
|
|
|
import org.moire.ultrasonic.domain.PodcastsChannel
|
|
|
|
import org.moire.ultrasonic.domain.SearchCriteria
|
|
|
|
import org.moire.ultrasonic.domain.SearchResult
|
|
|
|
import org.moire.ultrasonic.domain.Share
|
2022-03-27 14:57:07 +02:00
|
|
|
import org.moire.ultrasonic.domain.Track
|
2021-05-26 23:17:52 +02:00
|
|
|
import org.moire.ultrasonic.domain.UserInfo
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-27 11:18:29 +02:00
|
|
|
@Suppress("TooManyFunctions")
|
2021-11-26 17:03:33 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
interface MusicService {
|
|
|
|
@Throws(Exception::class)
|
|
|
|
fun ping()
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun isLicenseValid(): Boolean
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getGenres(refresh: Boolean): List<Genre>?
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun star(id: String?, albumId: String?, artistId: String?)
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun unstar(id: String?, albumId: String?, artistId: String?)
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun setRating(id: String, rating: Int)
|
2020-01-13 21:20:52 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getMusicFolders(refresh: Boolean): List<MusicFolder>
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
2021-06-20 16:31:08 +02:00
|
|
|
fun getIndexes(musicFolderId: String?, refresh: Boolean): List<Index>
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
2021-06-20 16:31:08 +02:00
|
|
|
fun getArtists(refresh: Boolean): List<Artist>
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getMusicDirectory(id: String, name: String?, refresh: Boolean): MusicDirectory
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
2022-04-18 07:12:31 +02:00
|
|
|
fun getAlbumsOfArtist(id: String, name: String?, refresh: Boolean): List<Album>
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getAlbum(id: String, name: String?, refresh: Boolean): MusicDirectory
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun search(criteria: SearchCriteria): SearchResult?
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getPlaylist(id: String, name: String): MusicDirectory
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getPodcastsChannels(refresh: Boolean): List<PodcastsChannel>
|
2016-02-26 10:40:52 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getPlaylists(refresh: Boolean): List<Playlist>
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
2022-03-27 14:57:07 +02:00
|
|
|
fun createPlaylist(id: String?, name: String?, tracks: List<Track>)
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun deletePlaylist(id: String)
|
2013-05-16 09:59:55 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun updatePlaylist(id: String, name: String?, comment: String?, pub: Boolean)
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getLyrics(artist: String, title: String): Lyrics?
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun scrobble(id: String, submission: Boolean)
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
2021-11-30 00:46:48 +01:00
|
|
|
fun getAlbumList(
|
|
|
|
type: String,
|
|
|
|
size: Int,
|
|
|
|
offset: Int,
|
|
|
|
musicFolderId: String?
|
2022-03-27 14:57:07 +02:00
|
|
|
): List<Album>
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getAlbumList2(
|
|
|
|
type: String,
|
|
|
|
size: Int,
|
|
|
|
offset: Int,
|
|
|
|
musicFolderId: String?
|
2022-03-27 14:57:07 +02:00
|
|
|
): List<Album>
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getRandomSongs(size: Int): MusicDirectory
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getSongsByGenre(genre: String, count: Int, offset: Int): MusicDirectory
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getStarred(): SearchResult
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getStarred2(): SearchResult
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
/**
|
|
|
|
* Return response [InputStream] and a [Boolean] that indicates if this response is
|
|
|
|
* partial.
|
|
|
|
*/
|
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getDownloadInputStream(
|
2022-03-27 14:57:07 +02:00
|
|
|
song: Track,
|
2021-05-26 23:17:52 +02:00
|
|
|
offset: Long,
|
2021-08-28 11:38:44 +02:00
|
|
|
maxBitrate: Int,
|
|
|
|
save: Boolean
|
2021-05-26 23:17:52 +02:00
|
|
|
): Pair<InputStream, Boolean>
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
2021-06-11 10:42:40 +02:00
|
|
|
fun getVideoUrl(id: String): String?
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun updateJukeboxPlaylist(ids: List<String>?): JukeboxStatus
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun skipJukebox(index: Int, offsetSeconds: Int): JukeboxStatus
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun stopJukebox(): JukeboxStatus
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun startJukebox(): JukeboxStatus
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getJukeboxStatus(): JukeboxStatus
|
2013-04-06 21:47:24 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun setJukeboxGain(gain: Float): JukeboxStatus
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getShares(refresh: Boolean): List<Share>
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getChatMessages(since: Long?): List<ChatMessage?>?
|
2013-05-26 07:19:28 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun addChatMessage(message: String)
|
2013-05-26 07:19:28 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
2021-11-23 20:38:26 +01:00
|
|
|
fun getBookmarks(): List<Bookmark>
|
2013-05-26 07:19:28 +02:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun deleteBookmark(id: String)
|
2013-12-04 07:36:02 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun createBookmark(id: String, position: Int)
|
2013-12-07 03:43:13 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getVideos(refresh: Boolean): MusicDirectory?
|
2013-12-21 06:15:27 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getUser(username: String): UserInfo
|
2013-12-28 01:29:12 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun createShare(ids: List<String>, description: String?, expires: Long?): List<Share>
|
2013-12-28 01:29:12 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun deleteShare(id: String)
|
2014-01-29 08:47:56 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun updateShare(id: String, description: String?, expires: Long?)
|
2016-02-26 10:40:52 +01:00
|
|
|
|
2021-05-26 23:17:52 +02:00
|
|
|
@Throws(Exception::class)
|
|
|
|
fun getPodcastEpisodes(podcastChannelId: String?): MusicDirectory?
|
2021-05-26 23:25:56 +02:00
|
|
|
}
|