|
|
@ -7,6 +7,8 @@ This file implements the JackIO Python side of Jack Medata as described here: |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
import os.path |
|
|
|
|
|
|
|
#get_thing |
|
|
|
from calfbox._cbox2 import do_cmd |
|
|
|
|
|
|
@ -97,3 +99,67 @@ class Metadata: |
|
|
|
"""port is the portname as string including a client name System:out_1 |
|
|
|
Name however is just the port name, without a client.""" |
|
|
|
Metadata.set_property(port, "http://jackaudio.org/metadata/pretty-name", name) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
def _set_icon_name(port, freeDeskopIconName): |
|
|
|
"""Internal function used in set_icon_small and set_icon_large""" |
|
|
|
if not os.path.splitext(freeDeskopIconName)[0] == freeDeskopIconName: |
|
|
|
raise ValueEror(f"Icon name must not have a file extension. Expected {os.path.splitext(freeDeskopIconName)[0]} but was {freeDeskopIconName}") |
|
|
|
|
|
|
|
if not os.path.basename(freeDeskopIconName) == freeDeskopIconName: |
|
|
|
raise ValueError(f"Icon name must not be path. Expected {os.path.basename(freeDeskopIconName)} but was {freeDeskopIconName}") |
|
|
|
|
|
|
|
self.set_property(port, "http://jackaudio.org/metadata/icon-name", freeDeskopIconName) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
def set_icon_small(port, freeDeskopIconName, base64png): |
|
|
|
""" A value with a MIME type of "image/png;base64" that is an encoding of an |
|
|
|
NxN (with 32 < N <= 128) image to be used when displaying a visual representation of that |
|
|
|
client or port. |
|
|
|
|
|
|
|
The name of the icon for the subject (typically client). |
|
|
|
This is used for looking up icons on the system, possibly with many sizes or themes. Icons |
|
|
|
should be searched for according to the freedesktop Icon |
|
|
|
Theme Specification: |
|
|
|
https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html |
|
|
|
|
|
|
|
The small icon of our JACK client. |
|
|
|
Setting icons to ports seems to be technically possible, but this is not the function |
|
|
|
for port-icons. |
|
|
|
|
|
|
|
This function does not check if base64png has the correct format. |
|
|
|
|
|
|
|
This also sets the name of the icon according to freedesktop specs. |
|
|
|
The name is the basename without extension like so: |
|
|
|
/usr/share/icons/hicolor/32x32/apps/patroneo.png -> "patroneo" |
|
|
|
""" |
|
|
|
|
|
|
|
self.set_property(port, "http://jackaudio.org/metadata/icon-small", base64png, jackPropertyType="image/png;base64") |
|
|
|
self._set_icon_name(port, freeDeskopIconName) |
|
|
|
|
|
|
|
@staticmethod |
|
|
|
def set_icon_large(base64png): |
|
|
|
""" A value with a MIME type of "image/png;base64" that is an encoding of an |
|
|
|
NxN (with N <=32) image to be used when displaying a visual representation of that client |
|
|
|
or port. |
|
|
|
|
|
|
|
The name of the icon for the subject (typically client). |
|
|
|
This is used for looking up icons on the system, possibly with many sizes or themes. Icons |
|
|
|
should be searched for according to the freedesktop Icon |
|
|
|
Theme Specification: |
|
|
|
https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html |
|
|
|
|
|
|
|
The large icon of our JACK client. |
|
|
|
Setting icons to ports seems to be technically possible, but this is not the function |
|
|
|
for port-icons. |
|
|
|
|
|
|
|
This function does not check if base64png has the correct format. |
|
|
|
|
|
|
|
This also sets the name of the icon according to freedesktop specs. |
|
|
|
The name is the basename without extension like so: |
|
|
|
/usr/share/icons/hicolor/32x32/apps/patroneo.png -> "patroneo" |
|
|
|
""" |
|
|
|
self.set_property(port, "http://jackaudio.org/metadata/icon-large", base64png, jackPropertyType="image/png;base64") |
|
|
|
self._set_icon_name(port, freeDeskopIconName) |
|
|
|