diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..88b5471 --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Package: sonist +Version: 1.0.0 +Section: X11 +Architecture: all +Author: Yutent +Maintainer: Yutent +Depends: gir1.2-gtk-3.0, python-mutagen +Priority: optional +Installed-Size: 5644 +Homepage: https://github.com/app-cat/sonist-gtk +Description: Sonist - 基于mpd后端的音乐播放器. + 高颜值且轻量的 MPD GUI客户端. \ No newline at end of file diff --git a/usr/lib/sonist/about_app.py b/usr/lib/sonist/about_app.py index fc101ce..5b5da4d 100644 --- a/usr/lib/sonist/about_app.py +++ b/usr/lib/sonist/about_app.py @@ -1,10 +1,11 @@ #!/usr/bin/env python3 -import gi +import gi, sys gi.require_version('Gtk', '3.0') +from gi.repository import Gtk, GdkPixbuf -from gi.repository import Gtk +from assets import image_dict class AboutWindow(Gtk.AboutDialog): @@ -14,7 +15,11 @@ class AboutWindow(Gtk.AboutDialog): self.set_keep_above(True) self.set_program_name('Sonist Gtk') - self.set_logo_icon_name('google-chrome') + if sys.platform == 'linux': + self.set_logo_icon_name('sonist') + else: + self.set_logo(GdkPixbuf.Pixbuf.new_from_file(image_dict['sonist'])) + self.set_license_type(Gtk.License.MIT_X11) self.set_version('0.1.0') self.set_website('https://github.com/app-cat/sonist-gtk') diff --git a/usr/lib/sonist/assets.py b/usr/lib/sonist/assets.py index 35f32d9..a80d707 100644 --- a/usr/lib/sonist/assets.py +++ b/usr/lib/sonist/assets.py @@ -6,9 +6,8 @@ import os lib_dir = os.getenv('SONIST_LIB_DIR') or '' image_dict = { - "album": f"{lib_dir}/usr/share/sonist/album.png", + "sonist": f"{lib_dir}/usr/share/sonist/sonist.png", "all": f"{lib_dir}/usr/share/sonist/all.png", - "avatar": f"{lib_dir}/usr/share/sonist/avatar.jpg", "disk": f"{lib_dir}/usr/share/sonist/disk.png", "handler": f"{lib_dir}/usr/share/sonist/handler.png", "handler_a": f"{lib_dir}/usr/share/sonist/handler_a.png", diff --git a/usr/lib/sonist/sonist.py b/usr/lib/sonist/sonist.py index 08e1214..59d38a5 100755 --- a/usr/lib/sonist/sonist.py +++ b/usr/lib/sonist/sonist.py @@ -1,13 +1,8 @@ #!/usr/bin/env python3 -import gi, sys, os, threading, time, re, json -# import dbus -# import dbus.service, dbus.mainloop.glib -from pprint import pprint as print - +import gi, sys, os, re, json gi.require_version('Gtk', '3.0') - from gi.repository import Gtk from utils import run_async @@ -17,7 +12,7 @@ from about_app import AboutWindow from preferences import PreferencesWindow from mpd import MPDClient -app_id = 'fun.wkit.sonist' +APP_ID = 'fun.wkit.sonist' home_dir = os.getenv('HOME') @@ -36,7 +31,7 @@ def get_music_dir(): class Application(Gtk.Application): def __init__(self): - Gtk.Application.__init__(self, application_id = app_id) + Gtk.Application.__init__(self, application_id = APP_ID) self.music_dir = get_music_dir() self.album_cache_dir = f"{home_dir}/.cache/sonist/album" @@ -102,33 +97,10 @@ class Application(Gtk.Application): def quit_all(self): self.remove_window(self.window) -""" class ApplicationService(dbus.service.Object): - def __init__(self, app): - self.app = app - bus_name = dbus.service.BusName(app_id, bus = dbus.SessionBus()) - dbus.service.Object.__init__(self, bus_name, '/') - @dbus.service.method(app_id) - def call_app(self): - self.app.present() - """ - if __name__ == "__main__": - # dbus.mainloop.glib.DBusGMainLoop(set_as_default = True) - # bus = dbus.SessionBus() - - # try: - # obj = bus.get_object(app_id, '/') - # obj.call_app() - # sys.exit(0) - # except dbus.DBusException: - # pass - - app = Application() - - # ApplicationService(app) app.run(sys.argv) diff --git a/usr/lib/sonist/ui/image.py b/usr/lib/sonist/ui/image.py index 1adbd38..4e97654 100644 --- a/usr/lib/sonist/ui/image.py +++ b/usr/lib/sonist/ui/image.py @@ -51,7 +51,6 @@ class ScaleImage(Gtk.Image): w = self.origin.get_width() h = self.origin.get_height() _size = min(w, h) # 按小边裁剪成正方形 - # size = min(size, _size) # 缩放按最小值来 self.width = size self.height = size diff --git a/usr/lib/sonist/window.py b/usr/lib/sonist/window.py index 5abffb5..fffef44 100644 --- a/usr/lib/sonist/window.py +++ b/usr/lib/sonist/window.py @@ -53,7 +53,7 @@ class SonistWindow(Gtk.Window): self.set_opacity(0.9) - self.set_background_image(image_dict['album']) + self.set_background_image(image_dict['disk']) layout = Gtk.Layout() @@ -111,7 +111,7 @@ class SonistWindow(Gtk.Window): provider = Gtk.CssProvider() css = f""" #SonistWindow {{ - background-image: url('{image_dict['album']}'); + background-image: url('{image_dict['disk']}'); background-size: 100% 100%; background-position: center; }} @@ -333,7 +333,7 @@ class SonistWindow(Gtk.Window): @idle def update_album(self, filepath = None): - self.set_background_image(filepath or image_dict['album']) + self.set_background_image(filepath or image_dict['disk']) self.album.reset(filepath, True).set_radius(64) diff --git a/usr/share/applications/sonist.desktop b/usr/share/applications/sonist.desktop new file mode 100644 index 0000000..8a65a0a --- /dev/null +++ b/usr/share/applications/sonist.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Sonist Music Player +Comment[zh_CN]=Sonist 音乐播放器 +Exec=sonist +Icon=sonist +Terminal=false +X-MultipleArgs=false +Type=Application +Categories=Music; \ No newline at end of file diff --git a/usr/share/sonist/album.png b/usr/share/icons/hicolor/128x128/apps/sonist.png similarity index 100% rename from usr/share/sonist/album.png rename to usr/share/icons/hicolor/128x128/apps/sonist.png diff --git a/usr/share/icons/hicolor/256x256/apps/sonist.png b/usr/share/icons/hicolor/256x256/apps/sonist.png new file mode 100644 index 0000000..68d768f Binary files /dev/null and b/usr/share/icons/hicolor/256x256/apps/sonist.png differ diff --git a/usr/share/icons/hicolor/scalable/apps/sonist.svg b/usr/share/icons/hicolor/scalable/apps/sonist.svg new file mode 100644 index 0000000..e9c005c --- /dev/null +++ b/usr/share/icons/hicolor/scalable/apps/sonist.svg @@ -0,0 +1,19 @@ + + 512x512 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/usr/share/sonist/sonist.png b/usr/share/sonist/sonist.png new file mode 100644 index 0000000..130f214 Binary files /dev/null and b/usr/share/sonist/sonist.png differ