Use the build system “meson” (close #32)

Replace the build system “setuptools” with “meson”.
This commit is contained in:
coderkun 2022-06-05 18:13:22 +02:00
parent ff0eee8380
commit fac7a85566
37 changed files with 848 additions and 361 deletions

6
.gitignore vendored
View file

@ -3,7 +3,5 @@ __pycache__/
*.py[cod]
*$py.class
# Files created by setuptools
build/
dist/
*.egg-info/
/build/
/install/

View file

@ -12,62 +12,42 @@ Dependencies:
* "GTK":http://www.gtk.org 3 (>= 3.22) ("python-gobject":https://live.gnome.org/PyGObject)
* "Avahi":http://www.avahi.org (optional)
* "python-keyring":http://pypi.python.org/pypi/keyring (optional)
* "python-setuptools":https://pypi.python.org/pypi/setuptools (building)
* "meson":https://mesonbuild.com/ and "ninja":https://ninja-build.org/ (building)
Additionally a "MPD":http://www.musicpd.org server (version >= 0.21.0) is required at runtime.
h2. Building
Build the application with _setuptools_:
Build the application with _meson_ and _ninja_:
bc. $ python3 setup.py build
bc. $ meson build
$ ninja -C build
h2. Running/Testing
For testing the application and running it without (system-wide) installation, donwload/clone the code, build it as described above and then use _setuptools_ to install it for the current user:
For testing the application and running it without (system-wide) installation,
donwload/clone the code, build it with the @--prefix@ option and install it
with @ninja@:
bc. $ python3 setup.py develop --user
bc. $ meson --prefix $(pwd)/install build
$ ninja -C build
$ ninja -C build install
After that you can run it with
After that you can run it with _mesons_ @devenv@ command:
bc. $ ~/.local/bin/mcg
or if _~/.local/bin/_ is on your PATH
bc. $ mcg
bc. $ meson devenv -C build src/mcg
h2. Installing
Install the application system-wide with _setuptools_:
Install the application system-wide with _meson_ (after building):
bc. # python3 setup.py install
bc. $ ninja -C build install
Note: _On Linux using the distributions package manager is the preferred way of installing applications system-wide._
h2. Packaging
Create a distribution package with _setuptools_:
bc. $ python3 setup.py sdist
h2. Cover/image configuration
Since MPD itself does not provide the cover/image/album art binaries, yet, _mcg_ has to look for them itself. In order to find the images a base folder has to be configured on the Connection tab as “Image Directory”. This value can either be a local (absolute) folder (e.g. /home/user/music/) or an http URL (e.g. http://localhost/music/). _mcg_ then adds the (relative) folder of the audio file to this paths and tries different names for the actual file:
# the album name
# “cover”
# “folder”
The following file extensions are used:
# png
# jpg
The first combination that results in an existing file is used as cover image. If no matching file exists, _mcg_ will try to traverse the directory for any image file as fallback—this is done for local paths only though, not for http URLs.
Note: _On Linux using the distributions package manager is the preferred way
of installing applications system-wide._
h2. Screenshots

View file

Before

Width:  |  Height:  |  Size: 7 KiB

After

Width:  |  Height:  |  Size: 7 KiB

7
data/icons/meson.build Normal file
View file

@ -0,0 +1,7 @@
application_id = 'xyz.suruatoel.mcg'
scalable_dir = join_paths('hicolor', 'scalable', 'apps')
install_data(
join_paths(scalable_dir, ('@0@.svg').format(application_id)),
install_dir: join_paths(get_option('datadir'), 'icons', scalable_dir)
)

View file

@ -4,7 +4,7 @@ Name=CoverGrid (mcg)
Comment=CoverGrid for the Music Player Daemon
Keywords=mpd;
Type=Application
Icon=mcg.svg
Icon=xyz.suruatoel.mcg
Exec=mcg
Categories=AudioVideo;
StartupNotify=true

34
data/meson.build Normal file
View file

@ -0,0 +1,34 @@
i18n = import('i18n')
desktop_file = i18n.merge_file(
input: 'mcg.desktop',
output: 'mcg.desktop',
type: 'desktop',
po_dir: '../po',
install: true,
install_dir: join_paths(get_option('datadir'), 'applications')
)
desktop_utils = find_program('desktop-file-validate', required: false)
if desktop_utils.found()
test('Validate desktop file', desktop_utils,
args: [desktop_file]
)
endif
gnome = import('gnome')
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
gnome.compile_resources('mcg',
'xyz.suruatoel.mcg.gresource.xml',
gresource_bundle: true,
install: true,
install_dir: pkgdatadir,
)
install_data('xyz.suruatoel.mcg.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
)
gnome.compile_schemas(depend_files: files('xyz.suruatoel.mcg.gschema.xml'))
subdir('icons')

View file

@ -13,7 +13,7 @@
<property name="version">3.0.2</property>
<property name="comments" translatable="yes">CoverGrid is a client for the Music Player Daemon, focusing on albums instead of single tracks.</property>
<property name="website">http://www.suruatoel.xyz/codes/mcg</property>
<property name="logo-icon-name"/>
<property name="logo-icon-name">xyz.suruatoel.mcg</property>
<property name="license-type">gpl-3-0</property>
<child internal-child="vbox">
<object class="GtkBox">

View file

@ -4,7 +4,7 @@
<requires lib="gtk+" version="3.20"/>
<template class="McgAppWindow" parent="GtkApplicationWindow">
<property name="can-focus">False</property>
<property name="icon-name">mcg</property>
<property name="icon-name">xyz.suruatoel.mcg</property>
<signal name="size-allocate" handler="on_resize" swapped="no"/>
<signal name="window-state-event" handler="on_state" swapped="no"/>
<child>

View file

@ -3,7 +3,6 @@
<gresource prefix="/xyz/suruatoel/mcg">
<file>gtk.css</file>
<file>noise-texture.png</file>
<file>icons/mcg.svg</file>
<file>ui/window.ui</file>
<file>ui/gtk.menu.ui</file>
<file>ui/info-dialog.ui</file>

View file

@ -1,44 +0,0 @@
#!/usr/bin/env python3
import sys
from mcg import Environment
def setup_resources():
from gi.repository import Gio
resource = Gio.resource_load(
Environment.get_data('xyz.suruatoel.mcg.gresource')
)
Gio.Resource._register(resource)
def setup_locale():
import gettext
gettext.bindtextdomain('mcg', Environment.get_locale())
gettext.textdomain('mcg')
def run_application():
from mcg.application import Application
app = Application()
return app.run(sys.argv)
def main():
setup_resources()
setup_locale()
return run_application()
if __name__ == "__main__":
main()
sys.exit(main())

19
meson.build Normal file
View file

@ -0,0 +1,19 @@
project('mcg',
version: '3.0.2',
meson_version: '>= 0.59.0',
default_options: [
'warning_level=2',
'werror=false',
],
)
subdir('data')
subdir('src')
subdir('po')
gnome = import('gnome')
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
update_desktop_database: true,
)

1
po/LINGUAS Normal file
View file

@ -0,0 +1 @@
en de

29
po/POTFILES Normal file
View file

@ -0,0 +1,29 @@
data/xyz.suruatoel.mcg.gschema.xml
data/ui/album-headerbar.ui
data/ui/connection-panel.ui
data/ui/cover-panel.ui
data/ui/cover-toolbar.ui
data/ui/gtk.menu.ui
data/ui/info-dialog.ui
data/ui/library-panel.ui
data/ui/library-toolbar.ui
data/ui/playlist-panel.ui
data/ui/playlist-toolbar.ui
data/ui/server-panel.ui
data/ui/server-toolbar.ui
data/ui/shortcuts-dialog.ui
data/ui/window.ui
src/albumheaderbar.py
src/application.py
src/client.py
src/connectionpanel.py
src/coverpanel.py
src/infodialog.py
src/librarypanel.py
src/main.py
src/playlistpanel.py
src/serverpanel.py
src/shortcutsdialog.py
src/utils.py
src/window.py
src/zeroconf.py

View file

@ -1,11 +1,12 @@
msgid ""
msgstr ""
"Project-Id-Version: CoverGrid (mcg)\n"
"POT-Creation-Date: 2020-10-24 14:41+0200\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-09-05 15:08+0200\n"
"PO-Revision-Date: 2020-10-24 14:41+0200\n"
"Last-Translator: coderkun <olli@suruatoel.xyz>\n"
"Language-Team: \n"
"Language: de\n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@ -13,8 +14,87 @@ msgstr ""
"X-Poedit-Basepath: ../../..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-SearchPath-0: mcg\n"
"X-Poedit-SearchPath-1: data/ui\n"
#: data/xyz.suruatoel.mcg.gschema.xml:11
msgid "MPD host"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:12
msgid "MPD host to connect to"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:16
msgid "MPD port"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:17
msgid "MPD port to connect to"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:21
#, fuzzy
msgid "Connection state"
msgstr "Verbindung"
#: data/xyz.suruatoel.mcg.gschema.xml:22
msgid "State of last connection"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:26
msgid "Window width"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:27
msgid "The window width in pixels."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:31
msgid "Window height"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:32
msgid "The window height in pixels."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:36
msgid "Window maximized"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:37
msgid "Whether or not the window is in maximized state."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:42
msgid "Last selected panel"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:43
msgid "The index of the last selected panel."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:48
msgid "Size of library items"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:49
msgid "The size of items displayed in the library."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:53
msgid "Sort criterium for library items"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:54
msgid "The sort criterium of items displayed in the library."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:58
msgid "Sort type for library items"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:59
msgid "The sort type of items displayed in the library."
msgstr ""
#: data/ui/album-headerbar.ui:17
msgid "Title"
@ -24,27 +104,27 @@ msgstr "Titel"
msgid "Artist"
msgstr "Künstler"
#: data/ui/connection-panel.ui:75
#: data/ui/connection-panel.ui:76
msgid "Enter hostname or IP address"
msgstr "Hostnamen oder IP-Adresse eingeben"
#: data/ui/connection-panel.ui:88
#: data/ui/connection-panel.ui:89
msgid "Enter password or leave blank"
msgstr "Passwort eingeben oder leer lassen"
#: data/ui/connection-panel.ui:117
#: data/ui/connection-panel.ui:118
msgid "Host:"
msgstr "Host:"
#: data/ui/connection-panel.ui:129
#: data/ui/connection-panel.ui:130
msgid "Port:"
msgstr "Port:"
#: data/ui/connection-panel.ui:141
#: data/ui/connection-panel.ui:142
msgid "Password:"
msgstr "Passwort:"
#: data/ui/cover-toolbar.ui:15 data/ui/shortcuts-dialog.ui:101
#: data/ui/cover-toolbar.ui:15 data/ui/shortcuts-dialog.ui:102
msgid "Show the cover in fullscreen mode"
msgstr "Das Cover im Vollbildmodus anzeigen"
@ -72,15 +152,15 @@ msgstr "Bibliothek durchsuchen"
msgid "Connection"
msgstr "Verbindung"
#: data/ui/gtk.menu.ui:40
#: data/ui/gtk.menu.ui:40 src/window.py:113
msgid "Cover"
msgstr "Cover"
#: data/ui/gtk.menu.ui:46
#: data/ui/gtk.menu.ui:46 src/window.py:114
msgid "Playlist"
msgstr "Wiedergabeliste"
#: data/ui/gtk.menu.ui:52
#: data/ui/gtk.menu.ui:52 src/window.py:115
msgid "Library"
msgstr "Bibliothek"
@ -136,7 +216,7 @@ msgstr "nach Titel"
msgid "sort by year"
msgstr "nach Jahr"
#: data/ui/library-toolbar.ui:169 data/ui/shortcuts-dialog.ui:114
#: data/ui/library-toolbar.ui:169 data/ui/shortcuts-dialog.ui:115
msgid "Search the library"
msgstr "Die Bibliothek durchsuchen"
@ -152,116 +232,116 @@ msgstr "Einstellungen und Aktionen"
msgid "remove"
msgstr "entfernen"
#: data/ui/playlist-toolbar.ui:37 data/ui/shortcuts-dialog.ui:88
#: data/ui/playlist-toolbar.ui:37 data/ui/shortcuts-dialog.ui:89
msgid "Clear the playlist"
msgstr "Die Wiedergabeliste leeren"
#: data/ui/server-panel.ui:68
#: data/ui/server-panel.ui:69
msgid "File:"
msgstr "Datei:"
#: data/ui/server-panel.ui:81
#: data/ui/server-panel.ui:82
msgid "Audio:"
msgstr "Audio:"
#: data/ui/server-panel.ui:94
#: data/ui/server-panel.ui:95
msgid "Bitrate:"
msgstr "Bitrate:"
#: data/ui/server-panel.ui:107
#: data/ui/server-panel.ui:108
msgid "Error:"
msgstr "Fehler:"
#: data/ui/server-panel.ui:119 data/ui/server-panel.ui:135
#: data/ui/server-panel.ui:151 data/ui/server-panel.ui:167
#: data/ui/server-panel.ui:120 data/ui/server-panel.ui:136
#: data/ui/server-panel.ui:152 data/ui/server-panel.ui:168
msgid "<i>none</i>"
msgstr "<i>nichts</i>"
#: data/ui/server-panel.ui:208
#: data/ui/server-panel.ui:221
msgid "Status"
msgstr "Status"
#: data/ui/server-panel.ui:287
#: data/ui/server-panel.ui:301
msgid "Albums"
msgstr "Alben"
#: data/ui/server-panel.ui:299
#: data/ui/server-panel.ui:313
msgid "Songs"
msgstr "Songs"
#: data/ui/server-panel.ui:311
#: data/ui/server-panel.ui:325
msgid "Artists"
msgstr "Künstler"
#: data/ui/server-panel.ui:335
#: data/ui/server-panel.ui:349
msgid "Seconds"
msgstr "Sekunden"
#: data/ui/server-panel.ui:382
#: data/ui/server-panel.ui:396
msgid "Seconds played"
msgstr "Sekunden gespielt"
#: data/ui/server-panel.ui:393
#: data/ui/server-panel.ui:407
msgid "Seconds running"
msgstr "Sekunden laufend"
#: data/ui/server-panel.ui:430
#: data/ui/server-panel.ui:465
msgid "Statistics"
msgstr "Statistiken"
#: data/ui/server-panel.ui:500
#: data/ui/server-panel.ui:535
msgid "Audio Devices"
msgstr "Audiogeräte"
#: data/ui/shortcuts-dialog.ui:14
#: data/ui/shortcuts-dialog.ui:15
msgid "General"
msgstr "Allgemein"
#: data/ui/shortcuts-dialog.ui:19
#: data/ui/shortcuts-dialog.ui:20
msgid "Switch to the Connection panel"
msgstr "Zum Verbindungspaneel wechseln"
#: data/ui/shortcuts-dialog.ui:26
#: data/ui/shortcuts-dialog.ui:27
msgid "Switch to the Cover panel"
msgstr "Zum Cover-Paneel wechseln"
#: data/ui/shortcuts-dialog.ui:33
#: data/ui/shortcuts-dialog.ui:34
msgid "Switch to the Playlist panel"
msgstr "Zum Wiedergabelistenpaneel wechseln"
#: data/ui/shortcuts-dialog.ui:40
#: data/ui/shortcuts-dialog.ui:41
msgid "Switch to the Library panel"
msgstr "Zum Bibliothekspaneel wechseln"
#: data/ui/shortcuts-dialog.ui:47
#: data/ui/shortcuts-dialog.ui:48
msgid "Show the keyboard shortcuts"
msgstr "Die Tastenkombinationen anzeigen (dieser Dialog)"
#: data/ui/shortcuts-dialog.ui:54
#: data/ui/shortcuts-dialog.ui:55
msgid "Open the info dialog"
msgstr "Den Infodialog öffnen"
#: data/ui/shortcuts-dialog.ui:61
#: data/ui/shortcuts-dialog.ui:62
msgid "Quit the application"
msgstr "Die Anwendung beenden"
#: data/ui/shortcuts-dialog.ui:69
#: data/ui/shortcuts-dialog.ui:70
msgid "Player"
msgstr "Wiedergabeprogramm"
#: data/ui/shortcuts-dialog.ui:74 data/ui/window.ui:139
#: data/ui/shortcuts-dialog.ui:75 data/ui/window.ui:139
msgid "Connect or disconnect"
msgstr "Die Verbindung herstellen oder trennen"
#: data/ui/shortcuts-dialog.ui:81 data/ui/window.ui:161
#: data/ui/shortcuts-dialog.ui:82 data/ui/window.ui:161
msgid "Switch between play and pause"
msgstr "Zwischen Abspielen und Pause wechseln"
#: data/ui/shortcuts-dialog.ui:96
#: data/ui/shortcuts-dialog.ui:97
msgid "Cover Panel"
msgstr "Cover-Paneel"
#: data/ui/shortcuts-dialog.ui:109
#: data/ui/shortcuts-dialog.ui:110
msgid "Library Panel"
msgstr "Bibliothekspaneel"
@ -273,31 +353,32 @@ msgstr "Zu MPD verbinden"
msgid "Adjust the volume"
msgstr "Die Lautstärke anpassen"
#: mcg/librarypanel.py:421
#: src/librarypanel.py:419
msgid "Loading albums"
msgstr "Alben werden geladen"
#: mcg/librarypanel.py:523
#: src/librarypanel.py:519
msgid "Loading images"
msgstr "Bilder werden geladen"
#: mcg/utils.py:50 mcg/utils.py:67
#: src/utils.py:50 src/utils.py:67
msgid "{} feat. {}"
msgstr "{} mit {}"
#: mcg/utils.py:61
#: src/utils.py:61
msgid "{}:{} minutes"
msgstr "{}:{} Minuten"
#: src/window.py:112
msgid "Server"
msgstr "Server"
#~ msgid "Enter URL or local path"
#~ msgstr "URL oder lokalen Pfad eingeben"
#~ msgid "Image Directory:"
#~ msgstr "Bildordner:"
#~ msgid "Server"
#~ msgstr "Server"
#~ msgid "{} of {} images loaded"
#~ msgstr "{} von {} Bildern geladen"

View file

@ -1,7 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: CoverGrid (mcg)\n"
"POT-Creation-Date: 2020-10-24 14:39+0200\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-09-05 15:08+0200\n"
"PO-Revision-Date: 2020-10-24 14:40+0200\n"
"Last-Translator: coderkun <olli@suruatoel.xyz>\n"
"Language-Team: \n"
@ -15,6 +16,87 @@ msgstr ""
"X-Poedit-SearchPath-0: mcg\n"
"X-Poedit-SearchPath-1: data/ui\n"
#: data/xyz.suruatoel.mcg.gschema.xml:11
msgid "MPD host"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:12
msgid "MPD host to connect to"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:16
msgid "MPD port"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:17
msgid "MPD port to connect to"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:21
#, fuzzy
msgid "Connection state"
msgstr "Connection"
#: data/xyz.suruatoel.mcg.gschema.xml:22
msgid "State of last connection"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:26
msgid "Window width"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:27
msgid "The window width in pixels."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:31
msgid "Window height"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:32
msgid "The window height in pixels."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:36
msgid "Window maximized"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:37
msgid "Whether or not the window is in maximized state."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:42
msgid "Last selected panel"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:43
msgid "The index of the last selected panel."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:48
msgid "Size of library items"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:49
msgid "The size of items displayed in the library."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:53
msgid "Sort criterium for library items"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:54
msgid "The sort criterium of items displayed in the library."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:58
msgid "Sort type for library items"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:59
msgid "The sort type of items displayed in the library."
msgstr ""
#: data/ui/album-headerbar.ui:17
msgid "Title"
msgstr "Title"
@ -23,27 +105,27 @@ msgstr "Title"
msgid "Artist"
msgstr "Artist"
#: data/ui/connection-panel.ui:75
#: data/ui/connection-panel.ui:76
msgid "Enter hostname or IP address"
msgstr "Enter hostname or IP address"
#: data/ui/connection-panel.ui:88
#: data/ui/connection-panel.ui:89
msgid "Enter password or leave blank"
msgstr "Enter password or leave blank"
#: data/ui/connection-panel.ui:117
#: data/ui/connection-panel.ui:118
msgid "Host:"
msgstr "Host:"
#: data/ui/connection-panel.ui:129
#: data/ui/connection-panel.ui:130
msgid "Port:"
msgstr "Port:"
#: data/ui/connection-panel.ui:141
#: data/ui/connection-panel.ui:142
msgid "Password:"
msgstr "Password:"
#: data/ui/cover-toolbar.ui:15 data/ui/shortcuts-dialog.ui:101
#: data/ui/cover-toolbar.ui:15 data/ui/shortcuts-dialog.ui:102
msgid "Show the cover in fullscreen mode"
msgstr "Show the cover in fullscreen mode"
@ -71,15 +153,15 @@ msgstr "Search Library"
msgid "Connection"
msgstr "Connection"
#: data/ui/gtk.menu.ui:40
#: data/ui/gtk.menu.ui:40 src/window.py:113
msgid "Cover"
msgstr "Cover"
#: data/ui/gtk.menu.ui:46
#: data/ui/gtk.menu.ui:46 src/window.py:114
msgid "Playlist"
msgstr "Playlist"
#: data/ui/gtk.menu.ui:52
#: data/ui/gtk.menu.ui:52 src/window.py:115
msgid "Library"
msgstr "Library"
@ -135,7 +217,7 @@ msgstr "by Title"
msgid "sort by year"
msgstr "by Year"
#: data/ui/library-toolbar.ui:169 data/ui/shortcuts-dialog.ui:114
#: data/ui/library-toolbar.ui:169 data/ui/shortcuts-dialog.ui:115
msgid "Search the library"
msgstr "Search the library"
@ -151,116 +233,116 @@ msgstr "Settings and actions"
msgid "remove"
msgstr "remove"
#: data/ui/playlist-toolbar.ui:37 data/ui/shortcuts-dialog.ui:88
#: data/ui/playlist-toolbar.ui:37 data/ui/shortcuts-dialog.ui:89
msgid "Clear the playlist"
msgstr "Clear the playlist"
#: data/ui/server-panel.ui:68
#: data/ui/server-panel.ui:69
msgid "File:"
msgstr "File:"
#: data/ui/server-panel.ui:81
#: data/ui/server-panel.ui:82
msgid "Audio:"
msgstr "Audio:"
#: data/ui/server-panel.ui:94
#: data/ui/server-panel.ui:95
msgid "Bitrate:"
msgstr "Bitrate:"
#: data/ui/server-panel.ui:107
#: data/ui/server-panel.ui:108
msgid "Error:"
msgstr "Error:"
#: data/ui/server-panel.ui:119 data/ui/server-panel.ui:135
#: data/ui/server-panel.ui:151 data/ui/server-panel.ui:167
#: data/ui/server-panel.ui:120 data/ui/server-panel.ui:136
#: data/ui/server-panel.ui:152 data/ui/server-panel.ui:168
msgid "<i>none</i>"
msgstr "<i>none</i>"
#: data/ui/server-panel.ui:208
#: data/ui/server-panel.ui:221
msgid "Status"
msgstr "Status"
#: data/ui/server-panel.ui:287
#: data/ui/server-panel.ui:301
msgid "Albums"
msgstr "Albums"
#: data/ui/server-panel.ui:299
#: data/ui/server-panel.ui:313
msgid "Songs"
msgstr "Songs"
#: data/ui/server-panel.ui:311
#: data/ui/server-panel.ui:325
msgid "Artists"
msgstr "Artists"
#: data/ui/server-panel.ui:335
#: data/ui/server-panel.ui:349
msgid "Seconds"
msgstr "Seconds"
#: data/ui/server-panel.ui:382
#: data/ui/server-panel.ui:396
msgid "Seconds played"
msgstr "Seconds"
#: data/ui/server-panel.ui:393
#: data/ui/server-panel.ui:407
msgid "Seconds running"
msgstr "Seconds running"
#: data/ui/server-panel.ui:430
#: data/ui/server-panel.ui:465
msgid "Statistics"
msgstr "Statistics"
#: data/ui/server-panel.ui:500
#: data/ui/server-panel.ui:535
msgid "Audio Devices"
msgstr "Audio Devices"
#: data/ui/shortcuts-dialog.ui:14
#: data/ui/shortcuts-dialog.ui:15
msgid "General"
msgstr "General"
#: data/ui/shortcuts-dialog.ui:19
#: data/ui/shortcuts-dialog.ui:20
msgid "Switch to the Connection panel"
msgstr "Switch to the Connection panel"
#: data/ui/shortcuts-dialog.ui:26
#: data/ui/shortcuts-dialog.ui:27
msgid "Switch to the Cover panel"
msgstr "Switch to the Cover panel"
#: data/ui/shortcuts-dialog.ui:33
#: data/ui/shortcuts-dialog.ui:34
msgid "Switch to the Playlist panel"
msgstr "Switch to the Playlist panel"
#: data/ui/shortcuts-dialog.ui:40
#: data/ui/shortcuts-dialog.ui:41
msgid "Switch to the Library panel"
msgstr "Switch to the Cover panel"
#: data/ui/shortcuts-dialog.ui:47
#: data/ui/shortcuts-dialog.ui:48
msgid "Show the keyboard shortcuts"
msgstr "Show the keyboard shortcuts (this dialog)"
#: data/ui/shortcuts-dialog.ui:54
#: data/ui/shortcuts-dialog.ui:55
msgid "Open the info dialog"
msgstr "Open the info dialog"
#: data/ui/shortcuts-dialog.ui:61
#: data/ui/shortcuts-dialog.ui:62
msgid "Quit the application"
msgstr "Quit the application"
#: data/ui/shortcuts-dialog.ui:69
#: data/ui/shortcuts-dialog.ui:70
msgid "Player"
msgstr "Player"
#: data/ui/shortcuts-dialog.ui:74 data/ui/window.ui:139
#: data/ui/shortcuts-dialog.ui:75 data/ui/window.ui:139
msgid "Connect or disconnect"
msgstr "Connect or disconnect"
#: data/ui/shortcuts-dialog.ui:81 data/ui/window.ui:161
#: data/ui/shortcuts-dialog.ui:82 data/ui/window.ui:161
msgid "Switch between play and pause"
msgstr "Switch between play and pause"
#: data/ui/shortcuts-dialog.ui:96
#: data/ui/shortcuts-dialog.ui:97
msgid "Cover Panel"
msgstr "Cover Panel"
#: data/ui/shortcuts-dialog.ui:109
#: data/ui/shortcuts-dialog.ui:110
msgid "Library Panel"
msgstr "Library Panel"
@ -272,26 +354,25 @@ msgstr "Connect to MPD"
msgid "Adjust the volume"
msgstr "Adjust the volume"
#: mcg/librarypanel.py:421
#: src/librarypanel.py:419
msgid "Loading albums"
msgstr "Loading albums"
#: mcg/librarypanel.py:523
#: src/librarypanel.py:519
msgid "Loading images"
msgstr "Loading images"
#: mcg/utils.py:50 mcg/utils.py:67
#: src/utils.py:50 src/utils.py:67
msgid "{} feat. {}"
msgstr "{} feat. {}"
#: mcg/utils.py:61
#: src/utils.py:61
msgid "{}:{} minutes"
msgstr "{}:{} minutes"
#, fuzzy
#~| msgid "Connection"
#~ msgid "Connection state"
#~ msgstr "Connection"
#: src/window.py:112
msgid "Server"
msgstr "Server"
#~ msgid "Enter URL or local path"
#~ msgstr "Enter URL or local path"
@ -299,9 +380,6 @@ msgstr "{}:{} minutes"
#~ msgid "Image Directory:"
#~ msgstr "Image Directory:"
#~ msgid "Server"
#~ msgstr "Server"
#~ msgid "{} of {} images loaded"
#~ msgstr "{} of {} images loaded"

373
po/mcg.pot Normal file
View file

@ -0,0 +1,373 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the mcg package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: mcg\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-09-05 15:08+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: data/xyz.suruatoel.mcg.gschema.xml:11
msgid "MPD host"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:12
msgid "MPD host to connect to"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:16
msgid "MPD port"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:17
msgid "MPD port to connect to"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:21
msgid "Connection state"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:22
msgid "State of last connection"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:26
msgid "Window width"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:27
msgid "The window width in pixels."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:31
msgid "Window height"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:32
msgid "The window height in pixels."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:36
msgid "Window maximized"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:37
msgid "Whether or not the window is in maximized state."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:42
msgid "Last selected panel"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:43
msgid "The index of the last selected panel."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:48
msgid "Size of library items"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:49
msgid "The size of items displayed in the library."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:53
msgid "Sort criterium for library items"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:54
msgid "The sort criterium of items displayed in the library."
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:58
msgid "Sort type for library items"
msgstr ""
#: data/xyz.suruatoel.mcg.gschema.xml:59
msgid "The sort type of items displayed in the library."
msgstr ""
#: data/ui/album-headerbar.ui:17
msgid "Title"
msgstr ""
#: data/ui/album-headerbar.ui:34
msgid "Artist"
msgstr ""
#: data/ui/connection-panel.ui:76
msgid "Enter hostname or IP address"
msgstr ""
#: data/ui/connection-panel.ui:89
msgid "Enter password or leave blank"
msgstr ""
#: data/ui/connection-panel.ui:118
msgid "Host:"
msgstr ""
#: data/ui/connection-panel.ui:130
msgid "Port:"
msgstr ""
#: data/ui/connection-panel.ui:142
msgid "Password:"
msgstr ""
#: data/ui/cover-toolbar.ui:15 data/ui/shortcuts-dialog.ui:102
msgid "Show the cover in fullscreen mode"
msgstr ""
#: data/ui/gtk.menu.ui:7
msgid "Connect"
msgstr ""
#: data/ui/gtk.menu.ui:12
msgid "Play"
msgstr ""
#: data/ui/gtk.menu.ui:17
msgid "Clear Playlist"
msgstr ""
#: data/ui/gtk.menu.ui:22
msgid "Toggle Fullscreen"
msgstr ""
#: data/ui/gtk.menu.ui:27
msgid "Search Library"
msgstr ""
#: data/ui/gtk.menu.ui:34
msgid "Connection"
msgstr ""
#: data/ui/gtk.menu.ui:40 src/window.py:113
msgid "Cover"
msgstr ""
#: data/ui/gtk.menu.ui:46 src/window.py:114
msgid "Playlist"
msgstr ""
#: data/ui/gtk.menu.ui:52 src/window.py:115
msgid "Library"
msgstr ""
#: data/ui/gtk.menu.ui:60
msgid "Keyboard Shortcuts"
msgstr ""
#: data/ui/gtk.menu.ui:65
msgid "Info"
msgstr ""
#: data/ui/gtk.menu.ui:70
msgid "Quit"
msgstr ""
#: data/ui/info-dialog.ui:14
msgid ""
"CoverGrid is a client for the Music Player Daemon, focusing on albums "
"instead of single tracks."
msgstr ""
#: data/ui/library-panel.ui:27
msgid "search library"
msgstr ""
#: data/ui/library-panel.ui:166 data/ui/playlist-panel.ui:57
msgid "cancel"
msgstr ""
#: data/ui/library-panel.ui:179 data/ui/library-panel.ui:264
msgid "queue"
msgstr ""
#: data/ui/library-panel.ui:277 data/ui/playlist-panel.ui:168
msgid "play"
msgstr ""
#: data/ui/library-toolbar.ui:76
msgid "Sort"
msgstr ""
#: data/ui/library-toolbar.ui:86
msgid "sort by artist"
msgstr ""
#: data/ui/library-toolbar.ui:102
msgid "sort by title"
msgstr ""
#: data/ui/library-toolbar.ui:118
msgid "sort by year"
msgstr ""
#: data/ui/library-toolbar.ui:169 data/ui/shortcuts-dialog.ui:115
msgid "Search the library"
msgstr ""
#: data/ui/library-toolbar.ui:192 data/ui/playlist-toolbar.ui:15
msgid "Select multiple albums"
msgstr ""
#: data/ui/library-toolbar.ui:214
msgid "Settings and actions"
msgstr ""
#: data/ui/playlist-panel.ui:70 data/ui/playlist-panel.ui:155
msgid "remove"
msgstr ""
#: data/ui/playlist-toolbar.ui:37 data/ui/shortcuts-dialog.ui:89
msgid "Clear the playlist"
msgstr ""
#: data/ui/server-panel.ui:69
msgid "File:"
msgstr ""
#: data/ui/server-panel.ui:82
msgid "Audio:"
msgstr ""
#: data/ui/server-panel.ui:95
msgid "Bitrate:"
msgstr ""
#: data/ui/server-panel.ui:108
msgid "Error:"
msgstr ""
#: data/ui/server-panel.ui:120 data/ui/server-panel.ui:136
#: data/ui/server-panel.ui:152 data/ui/server-panel.ui:168
msgid "<i>none</i>"
msgstr ""
#: data/ui/server-panel.ui:221
msgid "Status"
msgstr ""
#: data/ui/server-panel.ui:301
msgid "Albums"
msgstr ""
#: data/ui/server-panel.ui:313
msgid "Songs"
msgstr ""
#: data/ui/server-panel.ui:325
msgid "Artists"
msgstr ""
#: data/ui/server-panel.ui:349
msgid "Seconds"
msgstr ""
#: data/ui/server-panel.ui:396
msgid "Seconds played"
msgstr ""
#: data/ui/server-panel.ui:407
msgid "Seconds running"
msgstr ""
#: data/ui/server-panel.ui:465
msgid "Statistics"
msgstr ""
#: data/ui/server-panel.ui:535
msgid "Audio Devices"
msgstr ""
#: data/ui/shortcuts-dialog.ui:15
msgid "General"
msgstr ""
#: data/ui/shortcuts-dialog.ui:20
msgid "Switch to the Connection panel"
msgstr ""
#: data/ui/shortcuts-dialog.ui:27
msgid "Switch to the Cover panel"
msgstr ""
#: data/ui/shortcuts-dialog.ui:34
msgid "Switch to the Playlist panel"
msgstr ""
#: data/ui/shortcuts-dialog.ui:41
msgid "Switch to the Library panel"
msgstr ""
#: data/ui/shortcuts-dialog.ui:48
msgid "Show the keyboard shortcuts"
msgstr ""
#: data/ui/shortcuts-dialog.ui:55
msgid "Open the info dialog"
msgstr ""
#: data/ui/shortcuts-dialog.ui:62
msgid "Quit the application"
msgstr ""
#: data/ui/shortcuts-dialog.ui:70
msgid "Player"
msgstr ""
#: data/ui/shortcuts-dialog.ui:75 data/ui/window.ui:139
msgid "Connect or disconnect"
msgstr ""
#: data/ui/shortcuts-dialog.ui:82 data/ui/window.ui:161
msgid "Switch between play and pause"
msgstr ""
#: data/ui/shortcuts-dialog.ui:97
msgid "Cover Panel"
msgstr ""
#: data/ui/shortcuts-dialog.ui:110
msgid "Library Panel"
msgstr ""
#: data/ui/window.ui:108
msgid "Connect to MPD"
msgstr ""
#: data/ui/window.ui:181
msgid "Adjust the volume"
msgstr ""
#: src/librarypanel.py:419
msgid "Loading albums"
msgstr ""
#: src/librarypanel.py:519
msgid "Loading images"
msgstr ""
#: src/utils.py:50 src/utils.py:67
msgid "{} feat. {}"
msgstr ""
#: src/utils.py:61
msgid "{}:{} minutes"
msgstr ""
#: src/window.py:112
msgid "Server"
msgstr ""

3
po/meson.build Normal file
View file

@ -0,0 +1,3 @@
i18n = import('i18n')
i18n.gettext(meson.project_name(), preset: 'glib')

119
setup.py
View file

@ -1,119 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import subprocess
from setuptools import setup
from setuptools.command.build_py import build_py
from setuptools.dist import Distribution
class MCGDistribution(Distribution):
global_options = Distribution.global_options + [
("no-compile-schemas", None, "Don't compile gsettings schemas")
]
def __init__(self, *args, **kwargs):
self.no_compile_schemas = False
super(self.__class__, self).__init__(*args, **kwargs)
class build_mcg(build_py):
def run(self, *args, **kwargs):
self._build_gresources()
if not self.distribution.no_compile_schemas:
self._build_gschemas()
# This will copy the package_data and data_files, so we need to do this
# *after* we've compiled resources and schemas.
super(self.__class__, self).run(*args, **kwargs)
def _build_gresources(self):
print("compiling gresources")
subprocess.run(['glib-compile-resources', 'xyz.suruatoel.mcg.gresource.xml'], cwd='data')
def _build_gschemas(self):
print("compiling gschemas")
subprocess.run(['glib-compile-schemas', 'data'])
setup(
distclass = MCGDistribution,
cmdclass = {
'build_py': build_mcg
},
name = "mcg",
version = '3.0.2',
description = "CoverGrid (mcg) is a client for the Music Player Daemon, focusing on albums instead of single tracks.",
url = "http://www.suruatoel.xyz/codes/mcg",
author = "coderkun",
author_email = "olli@suruatoel.xyz",
license = "GPL",
packages = [
'mcg',
'mcg/data'
],
package_dir = {
'mcg': 'mcg',
'mcg/data': 'data'
},
package_data = {
'mcg': [
'LICENSE',
'README.textile'
],
'mcg/data': [
'xyz.suruatoel.mcg.gresource'
]
},
extras_require = {
'keyring support': ["python-keyring"]
},
entry_points = {
"gui_scripts": [
"mcg = mcg.mcg:main"
]
},
data_files = [
(os.path.join('share', 'applications'), [
"data/mcg.desktop"
]),
(os.path.join('share', 'icons'), [
"data/icons/mcg.svg"
]),
(os.path.join('share', 'glib-2.0', 'schemas'), [
"data/xyz.suruatoel.mcg.gschema.xml",
"data/gschemas.compiled",
]),
(os.path.join('share', 'locale', 'en', 'LC_MESSAGES'), [
'locale/en/LC_MESSAGES/mcg.mo'
]),
(os.path.join('share', 'locale', 'de', 'LC_MESSAGES'), [
'locale/de/LC_MESSAGES/mcg.mo'
])
],
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: X11 Applications :: GTK"
"Intended Audience :: End Users/Desktop"
"License :: OSI Approved :: GNU General Public License (GPL)"
"Operating System :: OS Independent"
"Programming Language :: Python :: 3"
"Topic :: Desktop Environment :: Gnome"
"Topic :: Multimedia :: Sound/Audio"
"Topic :: Multimedia :: Sound/Audio :: Players"
]
)

View file

@ -8,8 +8,8 @@ import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio, Gtk, Gdk, GLib
from mcg.window import Window
from mcg.infodialog import InfoDialog
from .window import Window
from .infodialog import InfoDialog
@ -20,32 +20,14 @@ class Application(Gtk.Application):
DOMAIN = 'mcg'
def _get_option(shortname, longname, description):
option = GLib.OptionEntry()
option.short_name = ord(shortname)
option.long_name = longname
option.description = description
return option
def __init__(self):
Gtk.Application.__init__(self, application_id=Application.ID, flags=Gio.ApplicationFlags.FLAGS_NONE)
super().__init__(application_id=Application.ID, flags=Gio.ApplicationFlags.FLAGS_NONE)
self._window = None
self._info_dialog = None
self._verbosity = logging.WARNING
self.add_main_option_entries([
Application._get_option("v", "verbose", "Be verbose: show info messages"),
Application._get_option("d", "debug", "Enable debugging: show debug messages")
])
self.connect('handle-local-options', self.handle_local_options)
def handle_local_options(self, widget, options):
if options.contains("debug") and options.lookup_value('debug'):
self._verbosity = logging.DEBUG
elif options.contains("verbose") and options.lookup_value('verbose'):
self._verbosity = logging.INFO
return -1
#self.create_action('quit', self.quit, ['<primary>q'])
#self.create_action('about', self.on_about_action)
#self.create_action('preferences', self.on_preferences_action)
def do_startup(self):

View file

@ -13,12 +13,3 @@ from gi.repository import Gtk, GdkPixbuf
@Gtk.Template(resource_path='/xyz/suruatoel/mcg/ui/info-dialog.ui')
class InfoDialog(Gtk.AboutDialog):
__gtype_name__ = 'McgInfoDialog'
def __init__(self):
super().__init__()
self._logger = logging.getLogger(__name__)
self.set_logo(
GdkPixbuf.Pixbuf.new_from_resource("/xyz/suruatoel/mcg/icons/mcg.svg")
)

View file

@ -3,7 +3,7 @@
import gi
gi.require_version('Gtk', '3.0')
import gettext
import locale
import logging
import math
import threading
@ -416,7 +416,7 @@ class LibraryPanel(Gtk.Stack):
def init_albums(self):
self.progress_bar.set_text(gettext.gettext("Loading albums"))
self.progress_bar.set_text(locale.gettext("Loading albums"))
def load_albums(self):
@ -516,7 +516,7 @@ class LibraryPanel(Gtk.Stack):
i += 1
GObject.idle_add(self.progress_bar.set_fraction, i/n)
GObject.idle_add(self.progress_bar.set_text, gettext.gettext("Loading images"))
GObject.idle_add(self.progress_bar.set_text, locale.gettext("Loading images"))
if self._library_stop.is_set():
self._library_lock.release()
return

11
src/main.py Normal file
View file

@ -0,0 +1,11 @@
import sys
import gi
gi.require_version('Gtk', '3.0')
from .application import Application
def main(version):
app = Application()
return app.run(sys.argv)

25
src/mcg.in Executable file
View file

@ -0,0 +1,25 @@
#!@PYTHON@
import os
import sys
import signal
import locale
VERSION = '@VERSION@'
pkgdatadir = '@pkgdatadir@'
localedir = '@localedir@'
sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL)
locale.bindtextdomain('mcg', localedir)
locale.textdomain('mcg')
if __name__ == '__main__':
import gi
from gi.repository import Gio
resource = Gio.Resource.load(os.path.join(pkgdatadir, 'mcg.gresource'))
resource._register()
from mcg import main
sys.exit(main.main(VERSION))

38
src/meson.build Normal file
View file

@ -0,0 +1,38 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
moduledir = join_paths(pkgdatadir, 'mcg')
python = import('python')
conf = configuration_data()
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)
configure_file(
input: 'mcg.in',
output: 'mcg',
configuration: conf,
install: true,
install_dir: get_option('bindir')
)
mcg_sources = [
'__init__.py',
'main.py',
'albumheaderbar.py',
'application.py',
'client.py',
'connectionpanel.py',
'coverpanel.py',
'infodialog.py',
'librarypanel.py',
'playlistpanel.py',
'serverpanel.py',
'shortcutsdialog.py',
'utils.py',
'window.py',
'zeroconf.py',
]
install_data(mcg_sources, install_dir: moduledir)

View file

@ -4,7 +4,7 @@
import gi
gi.require_version('Gtk', '3.0')
import hashlib
import gettext
import locale
import os
import urllib
@ -47,7 +47,7 @@ class Utils:
def create_artists_label(album):
label = ', '.join(album.get_albumartists())
if album.get_artists():
label = gettext.gettext("{} feat. {}").format(
label = locale.gettext("{} feat. {}").format(
label,
", ".join(album.get_artists())
)
@ -58,13 +58,13 @@ class Utils:
minutes = album.get_length() // 60
seconds = album.get_length() - minutes * 60
return gettext.gettext("{}:{} minutes").format(minutes, seconds)
return locale.gettext("{}:{} minutes").format(minutes, seconds)
def create_track_title(track):
title = track.get_title()
if track.get_artists():
title = gettext.gettext("{} feat. {}").format(
title = locale.gettext("{} feat. {}").format(
title,
", ".join(track.get_artists())
)

View file

@ -8,18 +8,19 @@ try:
use_keyring = True
except:
use_keyring = False
import locale
import logging
from gi.repository import Gtk, Gdk, GObject, GLib, Gio
from mcg import client
from mcg.shortcutsdialog import ShortcutsDialog
from mcg.connectionpanel import ConnectionPanel
from mcg.serverpanel import ServerPanel
from mcg.coverpanel import CoverPanel
from mcg.playlistpanel import PlaylistPanel
from mcg.librarypanel import LibraryPanel
from mcg.zeroconf import ZeroconfProvider
from . import client
from .shortcutsdialog import ShortcutsDialog
from .connectionpanel import ConnectionPanel
from .serverpanel import ServerPanel
from .coverpanel import CoverPanel
from .playlistpanel import PlaylistPanel
from .librarypanel import LibraryPanel
from .zeroconf import ZeroconfProvider
@ -108,10 +109,10 @@ class Window(Gtk.ApplicationWindow):
self._panels.append(self._library_panel)
# Stack
self.content_stack.add(self._connection_panel)
self.panel_stack.add_titled(self._server_panel, 'server-panel', "Server")
self.panel_stack.add_titled(self._cover_panel, 'cover-panel', "Cover")
self.panel_stack.add_titled(self._playlist_panel, 'playlist-panel', "Playlist")
self.panel_stack.add_titled(self._library_panel, 'library-panel', "Library")
self.panel_stack.add_titled(self._server_panel, 'server-panel', locale.gettext("Server"))
self.panel_stack.add_titled(self._cover_panel, 'cover-panel', locale.gettext("Cover"))
self.panel_stack.add_titled(self._playlist_panel, 'playlist-panel', locale.gettext("Playlist"))
self.panel_stack.add_titled(self._library_panel, 'library-panel', locale.gettext("Library"))
# Header
self._playlist_panel.get_headerbar_standalone().connect('close', self.on_panel_close_standalone)
self._library_panel.get_headerbar_standalone().connect('close', self.on_panel_close_standalone)