Skip to content

Commit 891bcd1

Browse files
authored
AlbumArt3.0 v2.3.3: Improved stability and translation (#1636)
1 parent cdedcd7 commit 891bcd1

File tree

4 files changed

+46
-11
lines changed

4 files changed

+46
-11
lines changed

AlbumArt3.0@claudiux/files/AlbumArt3.0@claudiux/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### v2.3.3~20251106
2+
* Improved stability.
3+
* Improved translation.
4+
15
### v2.3.2~20251101
26
* Improved stability.
37

AlbumArt3.0@claudiux/files/AlbumArt3.0@claudiux/desklet.js

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,23 @@ const ALBUMART_TITLE_FILE = TMP_ALBUMART_DIR + "/title.txt";
3838

3939
const DEL_SONG_ARTS_SCRIPT = DESKLET_DIR + "/scripts/del_song_arts.sh";
4040
const GET_IMAGE_SIZE_SCRIPT = DESKLET_DIR + "/scripts/get-image-size.sh";
41+
const INSTALL_TRANSLATIONS_SCRIPT = DESKLET_DIR + "/scripts/install-translations.sh";
4142

4243

4344
Gettext.bindtextdomain(DESKLET_UUID, HOME_DIR + "/.local/share/locale");
44-
Gettext.bindtextdomain("cinnamon", "/usr/share/locale");
45+
//~ Gettext.bindtextdomain("cinnamon", "/usr/share/locale");
4546

4647
function _(str) {
4748
let customTrans = Gettext.dgettext(DESKLET_UUID, str);
48-
if (customTrans !== str && customTrans.length > 0)
49+
if (customTrans != str && customTrans.length > 0)
4950
return customTrans;
5051

51-
customTrans = Gettext.dgettext("cinnamon", str);
52-
if (customTrans !== str && customTrans.length > 0)
53-
return customTrans;
52+
return str;
53+
//~ customTrans = Gettext.dgettext("cinnamon", str);
54+
//~ if (customTrans !== str && customTrans.length > 0)
55+
//~ return customTrans;
5456

55-
return Gettext.gettext(str);
57+
//~ return Gettext.gettext(str);
5658
}
5759

5860

@@ -61,6 +63,10 @@ class AlbumArtRadio30 extends Desklet.Desklet {
6163
super(metadata, desklet_id);
6264

6365
this.metadata = metadata;
66+
this.instance_id = desklet_id;
67+
68+
//~ Util.spawnCommandLine("bash -c '%s'".format(INSTALL_TRANSLATIONS_SCRIPT));
69+
6470
this._bin = null;
6571
this.update_id = null;
6672
this.old_image_path = null;
@@ -72,6 +78,11 @@ class AlbumArtRadio30 extends Desklet.Desklet {
7278
this.realWidth = 1280;
7379
this.realHeight = 720;
7480

81+
this.MSG_DISPLAY_AT_FULL_SIZE = _("Display Album Art at full size");
82+
this.MSG_DONT_DISPLAY_THIS_IMAGE = _("Do not display this image");
83+
this.MSG_NO_ANY_IMAGE = _("Do not display any new image");
84+
85+
7586
this.shuffle = false;
7687
this.delay = 3;
7788
this.effect = "";
@@ -434,15 +445,15 @@ class AlbumArtRadio30 extends Desklet.Desklet {
434445
if (this.settings.getValue("enable-at-startup"))
435446
Util.spawn(["touch", ALBUMART_ON]);
436447
// Set "Display Album Art at full size" menu item, in top position:
437-
let displayCoverArtInRealSize = new PopupMenu.PopupIconMenuItem(_("Display Album Art at full size"), "view-image-generic-symbolic", St.IconType.SYMBOLIC);
448+
let displayCoverArtInRealSize = new PopupMenu.PopupIconMenuItem(this.MSG_DISPLAY_AT_FULL_SIZE, "view-image-generic-symbolic", St.IconType.SYMBOLIC);
438449
displayCoverArtInRealSize.connect("activate", (event) => {
439450
if (this.currentPicture != null && GLib.file_test(this.currentPicture.path.replace("file://", ""), GLib.FileTest.EXISTS)) {
440451
Util.spawnCommandLine("xdg-open "+this.currentPicture.path);
441452
}
442453
});
443454
this._menu.addMenuItem(displayCoverArtInRealSize, 0); // 0 for top position.
444455

445-
let removeThisImage = new PopupMenu.PopupIconMenuItem(_("Do not display this image"), "dont-show-symbolic", St.IconType.SYMBOLIC);
456+
let removeThisImage = new PopupMenu.PopupIconMenuItem(this.MSG_DONT_DISPLAY_THIS_IMAGE, "dont-show-symbolic", St.IconType.SYMBOLIC);
446457
removeThisImage.connect("activate", (event) => {
447458
Util.spawnCommandLine("bash -c '%s'".format(DEL_SONG_ARTS_SCRIPT));
448459
this.image_path = TRANSPARENT_PNG;
@@ -452,7 +463,7 @@ class AlbumArtRadio30 extends Desklet.Desklet {
452463
});
453464
this._menu.addMenuItem(removeThisImage, 1);
454465

455-
let stopDesklet = new PopupMenu.PopupIconMenuItem(_("Do not display any new image"), "dont-show-any-symbolic", St.IconType.SYMBOLIC);
466+
let stopDesklet = new PopupMenu.PopupIconMenuItem(this.MSG_NO_ANY_IMAGE, "dont-show-any-symbolic", St.IconType.SYMBOLIC);
456467
stopDesklet.connect("activate", (event) => {
457468
Util.spawnCommandLine("bash -c '%s'".format(DEL_SONG_ARTS_SCRIPT));
458469
Util.spawnCommandLine(`rm -f ${ALBUMART_ON}`);
@@ -465,7 +476,21 @@ class AlbumArtRadio30 extends Desklet.Desklet {
465476
}
466477

467478
_loadImage(filePath) {
468-
let image;
479+
//~ global.log("filePath: " + filePath + " - " + filePath.replace("file://", ""));
480+
if (! GLib.file_test(filePath.replace("file://", ""), GLib.FileTest.EXISTS)) {
481+
//~ global.log("file does not exist!");
482+
filePath = "file://" + TRANSPARENT_PNG;
483+
this.realWidth = 1280;
484+
this.realHeight = 720;
485+
image = St.TextureCache.get_default().load_uri_async(filePath, this.width, this.height);
486+
487+
image._notif_id = image.connect('notify::size', (image) => { this._size_pic(image); });
488+
489+
this._size_pic(image);
490+
491+
return image;
492+
}
493+
let image = null;
469494
if (! GLib.file_test(ALBUMART_ON, GLib.FileTest.EXISTS)) {
470495
filePath = "file://" + TRANSPARENT_PNG;
471496
this.realWidth = 1280;

AlbumArt3.0@claudiux/files/AlbumArt3.0@claudiux/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"name": "Album Art for Radio3.0 and Enhanced Sound applets",
55
"description": "A digital photo frame desklet to display an album art, if available",
66
"prevent-decorations": true,
7-
"version": "2.3.2",
7+
"version": "2.3.3",
88
"author": "claudiux"
99
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
cd ~/.local/share/cinnamon/desklets/
4+
cinnamon-xlet-makepot -i AlbumArt3.0@claudiux
5+
6+
exit 0

0 commit comments

Comments
 (0)