Merge branch 'develop' into albums-cache

This commit is contained in:
Sumner Evans
2019-10-27 21:36:17 -06:00
7 changed files with 60 additions and 6 deletions

View File

@@ -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

View File

@@ -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
^^^^^^^^^^^^^^^^^^^^

15
flatpak/Dockerfile Normal file
View File

@@ -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

View File

@@ -130,6 +130,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)

View File

@@ -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:

View File

@@ -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}')

View File

@@ -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: