/usr/share/cinnamon-screensaver/albumArt.py is in cinnamon-screensaver 3.6.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | #!/usr/bin/python3
from gi.repository import Gio, Gtk
from util import trackers, settings
from baseWindow import BaseWindow
from floating import Floating
from widgets.framedImage import FramedImage
import singletons
class AlbumArt(Floating, BaseWindow):
"""
AlbumArt
It is a child of the Stage's GtkOverlay, and its placement is
controlled by the overlay's child positioning function.
When not Awake, it positions itself around all monitors
using a timer which randomizes its halign and valign properties
as well as its current monitor.
"""
def __init__(self, away_message=None, initial_monitor=0):
super(AlbumArt, self).__init__(initial_monitor)
self.get_style_context().add_class("albumart")
self.set_halign(Gtk.Align.END)
if not settings.get_show_albumart():
return
self.watcher = singletons.MediaPlayerWatcher
self.player = self.watcher.get_best_player()
self.current_url = None
self.image = FramedImage()
self.image.show()
self.image.set_opacity(0.0)
self.add(self.image)
trackers.con_tracker_get().connect(self.image,
"pixbuf-changed",
self.on_pixbuf_changed)
if self.player != None:
trackers.con_tracker_get().connect(self.player,
"metadata-changed",
self.on_metadata_changed)
self.on_metadata_changed(self.player)
def on_pixbuf_changed(self, image, pixbuf):
if image.get_pixbuf() != None:
self.image.set_opacity(1.0)
else:
self.image.set_opacity(0.0)
def on_metadata_changed(self, player):
self.update_image()
def update_image(self):
url = self.player.get_albumart_url()
if url == self.current_url:
return
self.current_url = url
if url == "":
self.image.clear_image()
f = Gio.File.new_for_uri(url)
if f.get_uri_scheme() == "file":
self.image.set_from_path(f.get_path())
elif f.get_uri_scheme() == "http":
self.image.set_from_file(f)
|