Merge branch 'BenjaminSchaaf/sublime-music-ampache-compatibility'
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
:alt: Sublime Music Logo
|
||||
|
||||
Sublime Music is a native, GTK3
|
||||
`Subsonic`_/`Airsonic`_/`Revel`_/`Gonic`_/`Navidrome`_/\*sonic client for the
|
||||
`Subsonic`_/`Airsonic`_/`Revel`_/`Gonic`_/`Navidrome`_/`Ampache`_/\*sonic client for the
|
||||
Linux Desktop.
|
||||
|
||||
.. _Subsonic: http://www.subsonic.org/pages/index.jsp
|
||||
@@ -10,6 +10,7 @@ Linux Desktop.
|
||||
.. _Revel: https://gitlab.com/robozman/revel
|
||||
.. _Gonic: https://github.com/sentriz/gonic
|
||||
.. _Navidrome: https://www.navidrome.org/
|
||||
.. _Ampache: http://ampache.org/
|
||||
|
||||
.. figure:: https://gitlab.com/sublime-music/sublime-music/-/raw/master/docs/_static/screenshots/play-queue.png
|
||||
:align: center
|
||||
|
@@ -1183,9 +1183,9 @@ class AdapterManager:
|
||||
def _strip_ignored_articles(
|
||||
use_ground_truth_adapter: bool, ignored_articles: Set[str], string: str
|
||||
) -> str:
|
||||
first_word, *rest = string.split(maxsplit=1)
|
||||
if first_word in ignored_articles:
|
||||
return rest[0]
|
||||
parts = string.split(maxsplit=1)
|
||||
if len(parts) > 1 and parts[0] in ignored_articles:
|
||||
return parts[1]
|
||||
return string
|
||||
|
||||
_S = TypeVar("_S")
|
||||
|
@@ -592,8 +592,12 @@ class SubsonicAdapter(Adapter):
|
||||
def delete_playlist(self, playlist_id: str):
|
||||
self._get_json(self._make_url("deletePlaylist"), id=playlist_id)
|
||||
|
||||
def get_cover_art_uri(self, cover_art_id: str, scheme: str, size: int) -> str:
|
||||
params = {"id": cover_art_id, "size": size, **self._get_params()}
|
||||
def get_cover_art_uri(self, cover_art: str, scheme: str, size: int) -> str:
|
||||
# Some servers return a full URL instead of an ID
|
||||
if cover_art.startswith("http://") or cover_art.startswith("https://"):
|
||||
return cover_art
|
||||
|
||||
params = {"id": cover_art, "size": size, **self._get_params()}
|
||||
return self._make_url("getCoverArt") + "?" + urlencode(params)
|
||||
|
||||
def get_song_file_uri(self, song_id: str, schemes: Iterable[str]) -> str:
|
||||
|
@@ -17,10 +17,12 @@ from dateutil import parser
|
||||
|
||||
from .. import api_objects as SublimeAPI
|
||||
|
||||
# Translation map
|
||||
# Translation map for encoding/decoding API results. For instance some servers
|
||||
# may return a string where an integer is required.
|
||||
decoder_functions = {
|
||||
datetime: (lambda s: parser.parse(s) if s else None),
|
||||
timedelta: (lambda s: timedelta(seconds=s) if s else None),
|
||||
timedelta: (lambda s: timedelta(seconds=float(s)) if s else None),
|
||||
int: (lambda s: int(s) if s else None),
|
||||
}
|
||||
encoder_functions = {
|
||||
datetime: (lambda d: datetime.strftime(d, "%Y-%m-%dT%H:%M:%S.%f%z") if d else None),
|
||||
|
Reference in New Issue
Block a user