ultrasonic-app-subsonic-and.../ultrasonic/src/main/java/org/moire/ultrasonic/service/MusicService.kt

194 lines
5.6 KiB
Kotlin
Raw Normal View History

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
import android.graphics.Bitmap
2021-05-26 23:25:56 +02:00
import java.io.InputStream
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
import org.moire.ultrasonic.domain.Indexes
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
import org.moire.ultrasonic.domain.UserInfo
2021-05-27 11:18:29 +02:00
@Suppress("TooManyFunctions")
2021-05-26 23:17:52 +02:00
interface MusicService {
@Throws(Exception::class)
fun ping()
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun isLicenseValid(): Boolean
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getGenres(refresh: Boolean): List<Genre>?
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)
fun getIndexes(musicFolderId: String?, refresh: Boolean): Indexes
2013-04-06 21:47:24 +02:00
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getArtists(refresh: Boolean): Indexes
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)
fun getArtist(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 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
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getPodcastsChannels(refresh: Boolean): List<PodcastsChannel>
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getPlaylists(refresh: Boolean): List<Playlist>
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun createPlaylist(id: String, name: String, entries: List<MusicDirectory.Entry>)
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun deletePlaylist(id: String)
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?
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun scrobble(id: String, submission: Boolean)
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getAlbumList(type: String, size: Int, offset: Int, musicFolderId: String?): MusicDirectory
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getAlbumList2(
type: String,
size: Int,
offset: Int,
musicFolderId: String?
): MusicDirectory
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
@Throws(Exception::class)
fun getCoverArt(
entry: MusicDirectory.Entry?,
size: Int,
saveToFile: Boolean,
highQuality: Boolean
): Bitmap?
2013-04-06 21:47:24 +02:00
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getAvatar(username: String?, size: Int, saveToFile: Boolean, highQuality: Boolean): Bitmap?
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(
song: MusicDirectory.Entry,
offset: Long,
maxBitrate: Int
): Pair<InputStream, Boolean>
2013-04-06 21:47:24 +02:00
2021-05-26 23:17:52 +02:00
// TODO: Refactor and remove this call (see RestMusicService implementation)
@Throws(Exception::class)
fun getVideoUrl(id: String, useFlash: Boolean): String?
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
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getShares(refresh: Boolean): List<Share>
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getChatMessages(since: Long?): List<ChatMessage?>?
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun addChatMessage(message: String)
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getBookmarks(): List<Bookmark?>?
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun deleteBookmark(id: String)
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun createBookmark(id: String, position: Int)
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getVideos(refresh: Boolean): MusicDirectory?
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getUser(username: String): UserInfo
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun createShare(ids: List<String>, description: String?, expires: Long?): List<Share>
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun deleteShare(id: String)
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun updateShare(id: String, description: String?, expires: Long?)
2021-05-26 23:17:52 +02:00
@Throws(Exception::class)
fun getPodcastEpisodes(podcastChannelId: String?): MusicDirectory?
2021-05-26 23:25:56 +02:00
}