diff --git a/io.github.nokse22.high-tide.json b/io.github.nokse22.high-tide.json index 44112ab..ad95a14 100644 --- a/io.github.nokse22.high-tide.json +++ b/io.github.nokse22.high-tide.json @@ -25,6 +25,45 @@ "*.a" ], "modules" : [ + { + "name": "python3-mpris_server", + "buildsystem": "simple", + "build-commands": [ + "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"mpris_server\" --no-build-isolation" + ], + "sources": [ + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/84/b7/6ec57841fb67c98f52fc8e4a2d96df60059637cba077edc569a302a8ffc7/Unidecode-1.3.8-py3-none-any.whl", + "sha256": "d130a61ce6696f8148a3bd8fe779c99adeb4b870584eeb9526584e9aa091fd39" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/68/8a/b08dd0b946f0843cba782e3784cd979c33f144e5e7c37fb0162dc47acd43/emoji-1.7.0.tar.gz", + "sha256": "65c54533ea3c78f30d0729288998715f418d7467de89ec258a31c0ce8660a1d1" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/b0/46/28c2ea8b0f338400fc821c938dd15d6c4c9564c6198ff9fd09bfd9b7b0ea/mpris_server-0.4.2-py2.py3-none-any.whl", + "sha256": "4b34e732f6f0c6b9a6a03d3a3d9962a5e538c67ddda2051991216a1bae626ec0" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/1c/41/91955188e97c7b85fbaac6bbf4e33de028899e0aa31bdce99b1afe2eeb17/pycairo-1.26.0.tar.gz", + "sha256": "2dddd0a874fbddb21e14acd9b955881ee1dc6e63b9c549a192d613a907f9cbeb" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/92/56/27148014c2f85ce70332f18612f921f682395c7d4e91ec103783be4fce00/pydbus-0.6.0-py2.py3-none-any.whl", + "sha256": "66b80106352a718d80d6c681dc2a82588048e30b75aab933e4020eb0660bf85e" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/f9/9e/6bab1ed3bd878f0912d9a0600c21f3d88bab0e8a8d4c3ce50f5cf336faaf/pygobject-3.48.2.tar.gz", + "sha256": "c3c0a7afbe5b2c1c64dc0530109b4dd571085153dbedfbccb8ec7c5ad233f977" + } + ] + }, { "name" : "python3-requests", "buildsystem" : "simple", diff --git a/meson.build b/meson.build index 0d33785..16bb63d 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('tidal', +project('high-tide', version: '0.1.0', meson_version: '>= 0.62.0', default_options: [ 'warning_level=2', 'werror=false', ], diff --git a/src/lib/player_object.py b/src/lib/player_object.py index 87bebe3..1b81816 100644 --- a/src/lib/player_object.py +++ b/src/lib/player_object.py @@ -100,6 +100,8 @@ def get_track_list(self, thing): # Converts albums, playlists, mixes in a list o tracks = thing.tracks() elif isinstance(thing, Playlist): tracks = thing.tracks() + elif isinstance(thing, Artist): + tracks = thing.top_tracks() else: # For radios tracks = thing diff --git a/src/main.py b/src/main.py index 84986d8..62b322a 100644 --- a/src/main.py +++ b/src/main.py @@ -25,7 +25,7 @@ gi.require_version('Gst', '1.0') from gi.repository import Gtk, Gio, Adw, Gdk -from .window import TidalWindow +from .window import HighTideWindow from tidalapi.media import Quality @@ -159,7 +159,7 @@ def do_activate(self): """ self.win = self.props.active_window if not self.win: - self.win = TidalWindow(application=self) + self.win = HighTideWindow(application=self) self.win.present() def on_about_action(self, widget, _): diff --git a/src/meson.build b/src/meson.build index 4dd2174..2d80042 100644 --- a/src/meson.build +++ b/src/meson.build @@ -12,7 +12,7 @@ gnome.compile_resources('high-tide', python = import('python') conf = configuration_data() -conf.set('PYTHON', python.find_installation('python3').path()) +conf.set('PYTHON', python.find_installation('python3').full_path()) conf.set('VERSION', meson.project_version()) conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir'))) conf.set('pkgdatadir', pkgdatadir) @@ -31,6 +31,7 @@ tidal_sources = [ 'main.py', 'window.py', 'login.py', + 'mpris.py', ] install_data(tidal_sources, install_dir: moduledir) diff --git a/src/window.py b/src/window.py index 945b338..d3bd23d 100644 --- a/src/window.py +++ b/src/window.py @@ -25,6 +25,12 @@ from gi.repository import Gst, GLib +from .mpris import Adapter +from mpris_server.adapters import MprisAdapter +from mpris_server.events import EventAdapter +from mpris_server.server import Server +from mpris_server import Metadata + import base64 import json @@ -57,8 +63,8 @@ from .widgets.generic_track_widget import GenericTrackWidget @Gtk.Template(resource_path='/io/github/nokse22/high-tide/window.ui') -class TidalWindow(Adw.ApplicationWindow): - __gtype_name__ = 'TidalWindow' +class HighTideWindow(Adw.ApplicationWindow): + __gtype_name__ = 'HighTideWindow' # homepage_box = Gtk.Template.Child() split_view = Gtk.Template.Child() @@ -114,6 +120,11 @@ def __init__(self, **kwargs): self.select_quality(self.settings.get_int("quality")) + mpris = Server('high-tide', adapter=Adapter()) + # player.mpris_adapter = EventAdapter(root=mpris.root, player=mpris.player) + # player.mpris_server = mpris + mpris.publish() + self.current_mix = None self.player_object.current_song_index = 0 self.previous_time = 0 diff --git a/src/window.ui b/src/window.ui index 9913b83..a19b154 100644 --- a/src/window.ui +++ b/src/window.ui @@ -2,7 +2,7 @@ -