From 1eba5e87d1f65931e916773c7d840269a6dbf78b Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Sat, 19 Oct 2019 21:23:42 -0600 Subject: [PATCH 1/5] Added some Installation instruction placeholders --- README.rst | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 95dba12..e94553f 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,20 @@ Features Installation ------------ -TODO +**Via the AUR**: + +Install the ``sublime-music`` package. Example using ``yay``:: + + TODO + +**Via Flatpak**: + +TODO: make a link to the flathub repo so that you can just click on it and go to +the software center for the app. + +**Via PyPi**:: + + TODO Development Setup ----------------- @@ -33,6 +46,13 @@ Requirements: - Python 3.7 - GTK3 +- GLib + +Install the Sublime Music app locally (commands may differ from what is +described below, this is merely an outline):: + + pip install -e . --user + pip install -r dev-requirements.txt Building the flatpak ^^^^^^^^^^^^^^^^^^^^ From 835f15bbae7ae0fd68b4e08e121b82625cb780d0 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Sun, 20 Oct 2019 17:10:59 -0600 Subject: [PATCH 2/5] Added dockerfile for Flatpak build --- flatpak/Dockerfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 flatpak/Dockerfile diff --git a/flatpak/Dockerfile b/flatpak/Dockerfile new file mode 100644 index 0000000..bad2ebf --- /dev/null +++ b/flatpak/Dockerfile @@ -0,0 +1,15 @@ +FROM fedora:30 + +MAINTAINER robozman "https://gitlab.com/robozman" + +VOLUME [ "/sys/fs/cgroup", "/tmp", "/run" ] + + +RUN dnf -y update && \ + dnf install -y flatpak flatpak-builder ostree fuse wget curl elfutils dconf git bzip2 bzr python3 python3-pip && \ + dnf clean all + +RUN flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo + +RUN flatpak install -y org.gnome.Platform//3.32 && \ + flatpak install -y org.gnome.Sdk//3.32 From ce96017b6d736918e53e8832307f8f32044405a2 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Sun, 27 Oct 2019 19:34:41 -0600 Subject: [PATCH 3/5] Update image location in CI script --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f73496d..f13c3f4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,15 +47,15 @@ build: - dist/* build_flatpak: - image: registry.gitlab.com/robozman/libremsonic/libremsonic/build:latest + image: registry.gitlab.com/sumner/sublime-music/sublime-music/build:latest stage: build script: - cd flatpak - ./flatpak_build.sh artifacts: - name: "libremsonic-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA" + name: "sublime-music-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA" paths: - - flatpak/libremsonic.flatpak + - flatpak/sublime.flatpak deploy_pypi: image: python:3.6-alpine From e1851041082c682678c5faacb837a015af80239e Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Sun, 27 Oct 2019 19:35:19 -0600 Subject: [PATCH 4/5] Added option to disable cert verification --- sublime/cache_manager.py | 1 + sublime/config.py | 3 +++ sublime/server/server.py | 16 ++++++++++++++-- sublime/ui/configure_servers.py | 3 +++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sublime/cache_manager.py b/sublime/cache_manager.py index 9f8a11f..bd48ad7 100644 --- a/sublime/cache_manager.py +++ b/sublime/cache_manager.py @@ -126,6 +126,7 @@ class CacheManager(metaclass=Singleton): hostname=server_config.server_address, username=server_config.username, password=server_config.password, + disable_cert_verify=server_config.disable_cert_verify, ) self.download_limiter_semaphore = threading.Semaphore( self.app_config.concurrent_download_limit) diff --git a/sublime/config.py b/sublime/config.py index a1ba223..b4ef21b 100644 --- a/sublime/config.py +++ b/sublime/config.py @@ -12,6 +12,7 @@ class ServerConfiguration: password: str browse_by_tags: bool sync_enabled: bool + disable_cert_verify: bool def __init__( self, @@ -23,6 +24,7 @@ class ServerConfiguration: password='', browse_by_tags=False, sync_enabled=True, + disable_cert_verify=False, ): self.name = name self.server_address = server_address @@ -32,6 +34,7 @@ class ServerConfiguration: self.password = password self.browse_by_tags = browse_by_tags self.sync_enabled = sync_enabled + self.disable_cert_verify = disable_cert_verify class AppConfiguration: diff --git a/sublime/server/server.py b/sublime/server/server.py index cb1c0e5..91da792 100644 --- a/sublime/server/server.py +++ b/sublime/server/server.py @@ -58,11 +58,19 @@ class Server: * The ``server`` module is stateless. The only thing that it does is allow the module's user to query the *sonic server via the API. """ - def __init__(self, name: str, hostname: str, username: str, password: str): + def __init__( + self, + name: str, + hostname: str, + username: str, + password: str, + disable_cert_verify: bool, + ): self.name: str = name self.hostname: str = hostname self.username: str = username self.password: str = password + self.disable_cert_verify: bool = disable_cert_verify def _get_params(self) -> Dict[str, str]: """See Subsonic API Introduction for details.""" @@ -89,7 +97,11 @@ class Server: if type(v) == datetime: params[k] = int(cast(datetime, v).timestamp() * 1000) - result = requests.get(url, params=params) + result = requests.get( + url, + params=params, + verify=not self.disable_cert_verify, + ) # TODO make better if result.status_code != 200: raise Exception(f'[FAIL] get: {url} status={result.status_code}') diff --git a/sublime/ui/configure_servers.py b/sublime/ui/configure_servers.py index 18d04d2..32c1289 100644 --- a/sublime/ui/configure_servers.py +++ b/sublime/ui/configure_servers.py @@ -23,6 +23,7 @@ class EditServerDialog(EditFormDialog): boolean_fields = [ ('Browse by tags', 'browse_by_tags'), ('Sync enabled', 'sync_enabled'), + ('Do not verify certificate', 'disable_cert_verify'), ] def __init__(self, *args, **kwargs): @@ -209,6 +210,8 @@ class ConfigureServersDialog(Gtk.Dialog): password=dialog.data['password'].get_text(), browse_by_tags=dialog.data['browse_by_tags'].get_active(), sync_enabled=dialog.data['sync_enabled'].get_active(), + disable_cert_verify=dialog.data['disable_cert_verify'] + .get_active(), ) if add: From 8911d8886b41ea8a3c6a6d6f0f266eece2046cd5 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Sun, 27 Oct 2019 19:54:04 -0600 Subject: [PATCH 5/5] Fixed error with MPRIS when no song is playing --- sublime/dbus_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sublime/dbus_manager.py b/sublime/dbus_manager.py index e2c157b..9733b61 100644 --- a/sublime/dbus_manager.py +++ b/sublime/dbus_manager.py @@ -325,7 +325,7 @@ class DBusManager: track_list = changed_props['Tracks'] current_track = ( new_property_dict['org.mpris.MediaPlayer2.Player'] - ['Metadata']['mpris:trackid']) + ['Metadata'].get('mpris:trackid', '')) self.connection.emit_signal( None, '/org/mpris/MediaPlayer2',