Skip to content

Commit 42627d7

Browse files
authored
v2.5.9: Album Art 3.0 becomes faster - Bugfixes (#6724)
1 parent 347c093 commit 42627d7

File tree

4 files changed

+81
-62
lines changed

4 files changed

+81
-62
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### v2.5.8~20241231
2+
* Album Art 3.0 becomes faster.
3+
* Bugfixes.
4+
15
### v2.5.8~20241230
26
* Album Art 3.0 settings now accessible via the applet context menu.
37

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5584,8 +5584,8 @@ class WebRadioReceiverAndRecorder extends TextIconApplet {
55845584
global.settings.set_strv(ENABLED_DESKLETS_KEY, enabledDesklets);
55855585
this.show_desklet = false;
55865586
this.desklet_is_activated = false;
5587-
const desklet_path = HOME_DIR+"/.local/share/cinnamon/desklets/AlbumArt3.0@claudiux"
5588-
spawnCommandLineAsync("rm -rf "+desklet_path);
5587+
//~ const desklet_path = HOME_DIR+"/.local/share/cinnamon/desklets/AlbumArt3.0@claudiux"
5588+
//~ spawnCommandLineAsync("rm -rf "+desklet_path);
55895589
}
55905590

55915591
setup_desklet() {

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

Lines changed: 74 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class AlbumArtRadio30 extends Desklet.Desklet {
2121
this.metadata = metadata;
2222
this.update_id = null;
2323
this.old_image_path = null;
24+
this.isLooping = true;
2425

2526
this.dir = "file://"+GLib.get_home_dir()+"/.config/Radio3.0/song-art";
2627
this.shuffle = false;
@@ -43,24 +44,26 @@ class AlbumArtRadio30 extends Desklet.Desklet {
4344
}
4445

4546
on_setting_changed() {
46-
if (this.update_id) {
47-
try {
48-
if (Mainloop.source_remove(this.update_id)) this.update_id = null;
49-
}
50-
catch(e) {
51-
this.update_id = null;
52-
} finally {
53-
this.update_id = null;
54-
}
55-
}
47+
this.isLooping = false;
48+
//~ if (this.update_id) {
49+
//~ try {
50+
//~ if (Mainloop.source_remove(this.update_id)) this.update_id = null;
51+
//~ }
52+
//~ catch(e) {
53+
//~ this.update_id = null;
54+
//~ } finally {
55+
//~ this.update_id = null;
56+
//~ }
57+
//~ }
5658

5759
this._setup_dir_monitor();
5860
if (this.currentPicture) {
5961
this.currentPicture.destroy();
6062
}
61-
//~ if (this._photoFrame) {
62-
this._photoFrame.destroy();
63-
//~ }
63+
if (this._photoFrame) {
64+
this._photoFrame.destroy();
65+
}
66+
this.isLooping = true;
6467
this.setup_display();
6568
}
6669

@@ -89,9 +92,9 @@ class AlbumArtRadio30 extends Desklet.Desklet {
8992
this.dir_monitor_id = this.dir_monitor.connect('changed', Lang.bind(this, this.on_setting_changed));
9093
}
9194

92-
on_desklet_added_to_desktop(userEnabled) {
93-
this.actor.reactive = true;
94-
}
95+
//~ on_desklet_added_to_desktop(userEnabled) {
96+
//~ this.actor.reactive = true;
97+
//~ }
9598

9699
on_desklet_removed() {
97100
if (this.dir_monitor) {
@@ -101,16 +104,18 @@ class AlbumArtRadio30 extends Desklet.Desklet {
101104
}
102105
this.dir_monitor_id = null;
103106

104-
if (this.update_id) {
105-
try {
106-
if (Mainloop.source_remove(this.update_id)) this.update_id = null;
107-
}
108-
catch(e) {
109-
this.update_id = null;
110-
} finally {
111-
this.update_id = null;
112-
}
113-
}
107+
this.isLooping = false;
108+
109+
//~ if (this.update_id) {
110+
//~ try {
111+
//~ if (Mainloop.source_remove(this.update_id)) this.update_id = null;
112+
//~ }
113+
//~ catch(e) {
114+
//~ this.update_id = null;
115+
//~ } finally {
116+
//~ this.update_id = null;
117+
//~ }
118+
//~ }
114119
}
115120

116121
_scan_dir(dir) {
@@ -142,26 +147,28 @@ class AlbumArtRadio30 extends Desklet.Desklet {
142147
this._bin.set_size(this.width, this.height);
143148

144149
this._images = [];
145-
this._photoFrame.set_child(this._bin);
146-
this.setContent(this._photoFrame);
147-
148-
if (this.effect == 'black-and-white') {
149-
let effect = new Clutter.DesaturateEffect();
150-
this._bin.add_effect(effect);
151-
} else if (this.effect == 'sepia') {
152-
let color = new Clutter.Color();
153-
color.from_hls(17.0, 0.59, 0.4);
154-
let colorize_effect = new Clutter.ColorizeEffect(color);
155-
let contrast_effect = new Clutter.BrightnessContrastEffect();
156-
let desaturate_effect = new Clutter.DesaturateEffect();
157-
desaturate_effect.set_factor(0.41);
158-
contrast_effect.set_brightness_full(0.1, 0.1, 0.1);
159-
contrast_effect.set_contrast_full(0.1, 0.1, 0.1);
160-
this._bin.add_effect(colorize_effect);
161-
this._bin.add_effect(contrast_effect);
162-
this._bin.add_effect(desaturate_effect);
150+
if (this._photoFrame) {
151+
this._photoFrame.set_child(this._bin);
152+
this.setContent(this._photoFrame);
163153
}
164154

155+
//~ if (this.effect == 'black-and-white') {
156+
//~ let effect = new Clutter.DesaturateEffect();
157+
//~ this._bin.add_effect(effect);
158+
//~ } else if (this.effect == 'sepia') {
159+
//~ let color = new Clutter.Color();
160+
//~ color.from_hls(17.0, 0.59, 0.4);
161+
//~ let colorize_effect = new Clutter.ColorizeEffect(color);
162+
//~ let contrast_effect = new Clutter.BrightnessContrastEffect();
163+
//~ let desaturate_effect = new Clutter.DesaturateEffect();
164+
//~ desaturate_effect.set_factor(0.41);
165+
//~ contrast_effect.set_brightness_full(0.1, 0.1, 0.1);
166+
//~ contrast_effect.set_contrast_full(0.1, 0.1, 0.1);
167+
//~ this._bin.add_effect(colorize_effect);
168+
//~ this._bin.add_effect(contrast_effect);
169+
//~ this._bin.add_effect(desaturate_effect);
170+
//~ }
171+
165172
if (this.dir_file.query_exists(null)) {
166173
this._scan_dir(this.dir);
167174

@@ -174,6 +181,7 @@ class AlbumArtRadio30 extends Desklet.Desklet {
174181
}
175182

176183
_update_loop() {
184+
if (!this.isLooping) return false;
177185
this._update();
178186
//~ if (this.update_id) {
179187
//~ try {
@@ -190,7 +198,10 @@ class AlbumArtRadio30 extends Desklet.Desklet {
190198
//~ } else {
191199
//~ this.update_id = Mainloop.timeout_add_seconds(this.delay, Lang.bind(this, this._update_loop));
192200
//~ }
193-
this.update_id = Mainloop.timeout_add_seconds(this.delay, Lang.bind(this, this._update_loop));
201+
if (this.isLooping)
202+
this.update_id = Mainloop.timeout_add_seconds(this.delay, Lang.bind(this, this._update_loop));
203+
else
204+
return false;
194205
}
195206

196207
_size_pic(image) {
@@ -253,21 +264,25 @@ class AlbumArtRadio30 extends Desklet.Desklet {
253264
let _transition = "easeNone";
254265
if (this.fade_effect != "None")
255266
_transition = "easeOut"+this.fade_effect;
256-
Tweener.addTween(this._bin, {
257-
opacity: 255, //0,
258-
time: 0, //this.fade_delay,
259-
transition: _transition, //'easeInSine',
260-
onComplete: () => {
261-
this._bin.set_child(this.currentPicture);
262-
Tweener.addTween(this._bin, {
263-
opacity: 0, //255,
264-
time: this.fade_delay,
265-
transition: _transition, //'easeInSine',
266-
});
267-
}
268-
});
267+
if (this._bin) {
268+
Tweener.addTween(this._bin, {
269+
opacity: 255, //0,
270+
time: 0, //this.fade_delay,
271+
transition: _transition, //'easeInSine',
272+
onComplete: () => {
273+
if (this._bin) {
274+
this._bin.set_child(this.currentPicture);
275+
Tweener.addTween(this._bin, {
276+
opacity: 0, //255,
277+
time: this.fade_delay,
278+
transition: _transition, //'easeInSine',
279+
});
280+
}
281+
}
282+
});
283+
}
269284
} else {
270-
this._bin.set_child(this.currentPicture);
285+
if (this._bin) this._bin.set_child(this.currentPicture);
271286
}
272287
//~ if (old_pic) {
273288
//~ old_pic.destroy();

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.5.8",
4+
"version": "2.5.9",
55
"uuid": "Radio3.0@claudiux",
66
"name": "Radio3.0",
77
"author": "claudiux",

0 commit comments

Comments
 (0)