Skip to content

Commit f036925

Browse files
authored
v2.7.0: You can choose the Quality of the downloaded Album Art (#6747)
1 parent 1af2d6d commit f036925

File tree

20 files changed

+2180
-1701
lines changed

20 files changed

+2180
-1701
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### v2.7.0~20250107
2+
* You can choose the Quality of the downloaded album cover.
3+
* Desklet AlbumArt3.0: New option in context menu to display the Album Art at full size. Middle-clicking on the desklet does the same.
4+
* Bufixes in applet and in desklet.
5+
16
### v2.6.1~20250106
27
* Fixes desklet issue for Cinnamon 6.0.
38

Radio3.0@claudiux/files/Radio3.0@claudiux/applet.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ const QUEUE = 1;
241241
var VERSION, METADATA;
242242

243243
let dummy = _("unassigned"); // Only for translation.
244+
dummy = _("Display Album Art at full size"); // used in desklet.
245+
dummy = undefined;
244246

245247
var radioppConfigFilePath = HOME_DIR + "/.cinnamon/configs/radio@driglu4it/radio@driglu4it.json";
246248
if (!file_test(radioppConfigFilePath, FileTest.EXISTS)) {
@@ -1310,6 +1312,7 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
13101312
}
13111313

13121314
get_user_settings() {
1315+
this.settings.bind("image-resolution", "res", this.reload_songArt.bind(this));
13131316
this.settings.bind("radiopp-is-here", "radiopp_is_here");
13141317
this.radiopp_is_here = radioppConfigFilePath != null;
13151318
this.settings.bind("desklet-x", "desklet_x");
@@ -1737,7 +1740,7 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
17371740
let reg = new RegExp(`rgb[(]([0-9]+),([0-9]+),([0-9]+)[)]`);
17381741
let color = "%s".format(this.settings.getValue("color-on"));
17391742
let [, red, green, blue] = reg.exec(color);
1740-
let alpha_value = Math.ceil(2.55 * this.progress);
1743+
let alpha_value = Math.min(Math.ceil(2.55 * this.progress), 255);
17411744
let alpha = ""+alpha_value;
17421745
this.actor.style = "color: rgba(%s,%s,%s,%s)".format(red, green, blue, alpha);
17431746

@@ -3406,19 +3409,24 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
34063409
this.updateUI();
34073410

34083411
if (!has_no_title)
3409-
this.download_songArt(title);
3412+
this.download_songArt(title, this.res);
34103413

34113414
pid = null;
34123415
}
34133416

3414-
download_songArt(title) {
3417+
download_songArt(title, res="") {
34153418
if (!YTDL_PROGRAM().includes("yt-dlp")) return;
34163419

3417-
let command = '%s/get_song_art.sh "%s"'.format(SCRIPTS_DIR, title);
3420+
let command = '%s/get_song_art.sh "%s" "%s"'.format(SCRIPTS_DIR, title, res);
34183421
//~ log("command: "+command, true);
34193422
spawnCommandLineAsync(command);
34203423
}
34213424

3425+
reload_songArt() {
3426+
if (this.songTitle && this.songTitle.length > 0)
3427+
this.download_songArt(this.songTitle, this.res);
3428+
}
3429+
34223430
change_selected_item() {
34233431
//log("change_selected_item");
34243432
var radios = this.settings.getValue("radios");

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//"use strict";
22
const Main = imports.ui.main;
33
const Gio = imports.gi.Gio;
4+
const PopupMenu = imports.ui.popupMenu;
45
const St = imports.gi.St;
56
const Desklet = imports.ui.desklet;
67
const Lang = imports.lang;
@@ -101,7 +102,7 @@ class AlbumArtRadio30 extends Desklet.Desklet {
101102
this.dir_monitor_loop_is_active = false;
102103

103104
if (this._bin != null) {
104-
this._bin.removeTween();
105+
Tweener.removeTweens(this._bin);
105106
this._bin.destroy_all_children();
106107
this._bin.destroy();
107108
this._bin = null;
@@ -111,7 +112,8 @@ class AlbumArtRadio30 extends Desklet.Desklet {
111112
_scan_dir(dir) {
112113
if (!this.isLooping) return;
113114
let dir_file = Gio.file_new_for_uri(dir);
114-
let fileEnum = dir_file.enumerate_children('standard::type,standard::name,standard::is-hidden', Gio.FileQueryInfoFlags.NONE, null);
115+
//~ let fileEnum = dir_file.enumerate_children('standard::type,standard::name,standard::is-hidden', Gio.FileQueryInfoFlags.NONE, null);
116+
let fileEnum = dir_file.enumerate_children('standard::*', Gio.FileQueryInfoFlags.NONE, null);
115117

116118
let info;
117119
while ((info = fileEnum.next_file(null)) != null) {
@@ -261,6 +263,20 @@ class AlbumArtRadio30 extends Desklet.Desklet {
261263
}
262264
}
263265

266+
/**
267+
* on_desklet_added_to_desktop:
268+
*
269+
* This function is called by deskletManager when the desklet is added to the desktop.
270+
*/
271+
on_desklet_added_to_desktop(userEnabled) {
272+
// Set "Display Album Art at full size" menu item, in top position:
273+
let displayCoverArtInRealSize = new PopupMenu.PopupIconMenuItem(_("Display Album Art at full size"), "image-x-generic-symbolic", St.IconType.SYMBOLIC);
274+
displayCoverArtInRealSize.connect("activate", (event) => {
275+
GLib.spawn_command_line_async("xdg-open "+this.currentPicture.path);
276+
});
277+
this._menu.addMenuItem(displayCoverArtInRealSize, 0); // 0 for top position.
278+
}
279+
264280
_loadImage(filePath) {
265281
try {
266282
let image = St.TextureCache.get_default().load_uri_async(filePath, this.width, this.height);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"description": "The Ultimate Internet Radio Receiver & Recorder for Cinnamon",
33
"max-instances": 1,
4-
"version": "2.6.1",
4+
"version": "2.7.0",
55
"uuid": "Radio3.0@claudiux",
66
"name": "Radio3.0",
77
"author": "claudiux",

0 commit comments

Comments
 (0)