diff --git a/ocarina/body/footer/__init__.py b/ocarina/body/footer/__init__.py index 7eb28202..7e639b3f 100644 --- a/ocarina/body/footer/__init__.py +++ b/ocarina/body/footer/__init__.py @@ -61,9 +61,9 @@ def on_pause(): tiny.on_pause() detailed.on_pause() -def on_load(): - tiny.on_load() - detailed.on_load() +def on_load(attrs): + tiny.on_load(attrs) + detailed.on_load(attrs) def on_like(like): detailed.nowplaying.on_like(like) diff --git a/ocarina/body/footer/detailed.py b/ocarina/body/footer/detailed.py index ed3f5282..1674e790 100644 --- a/ocarina/body/footer/detailed.py +++ b/ocarina/body/footer/detailed.py @@ -73,6 +73,5 @@ def on_pause(): PAUSE.hide() load_attrs = ("title", "artist", "album", "year", "lenstr", "count", "like") -def on_load(): - attrs = libsaria.sources.get_attrs(*load_attrs) - nowplaying.on_load(*attrs) +def on_load(attrs): + nowplaying.on_load(attrs) diff --git a/ocarina/body/footer/nowplaying.py b/ocarina/body/footer/nowplaying.py index 9494009f..811329bc 100644 --- a/ocarina/body/footer/nowplaying.py +++ b/ocarina/body/footer/nowplaying.py @@ -67,12 +67,12 @@ def on_like(like): button.toggle_call_unconnected(DISLIKE, _on_like1, like) button.toggle_call_unconnected(LIKE, _on_like0, like) -def on_load(title, artist, album, year, lenstr, count, like): - TITLE.set_text(title) - ARTIST.set_text("by %s" % artist) - ALBUM.set_text("from %s" % album) - YEAR.set_text("Year: %s" % year) - LENGTH.set_text("Length: %s" % lenstr) - COUNT.set_text("Play count: %s" % count) +def on_load(attrs): + TITLE.set_text(attrs["title"]) + ARTIST.set_text("by %s" % attrs["artist"]) + ALBUM.set_text("from %s" % attrs["album"]) + YEAR.set_text("Year: %s" % attrs["year"]) + LENGTH.set_text("Length: %s" % attrs["lenstr"]) + COUNT.set_text("Play count: %s" % attrs["count"]) set_art("images/ocarina.png") - on_like(like) + on_like(attrs["like"]) diff --git a/ocarina/body/footer/tiny.py b/ocarina/body/footer/tiny.py index c6042052..b06cf5b5 100644 --- a/ocarina/body/footer/tiny.py +++ b/ocarina/body/footer/tiny.py @@ -59,9 +59,7 @@ def on_pause(): PLAY.show() PAUSE.hide() -load_attrs = ("title", "artist", "lenstr") -def on_load(): - title, artist, lenstr = libsaria.sources.get_attrs(*load_attrs) - now_playing.set_text("%s by %s" % (title, artist)) - duration.set_text(" / %s" % lenstr) +def on_load(attrs): + now_playing.set_text("%s by %s" % (attrs["title"], attrs["artist"])) + duration.set_text(" / %s" % attrs["lenstr"]) set_art("images/ocarina.png") diff --git a/ocarina/body/image.py b/ocarina/body/image.py index 0c5caf1e..15ee8255 100644 --- a/ocarina/body/image.py +++ b/ocarina/body/image.py @@ -76,7 +76,7 @@ class Image(gtk.EventBox): def clicked(self, widget, event): if event.button != 1: return - id = sources.get_attrs("id") + id = sources.get_cur_id() if id == -1: return path = fsselect.select_file("Select an image") diff --git a/ocarina/callbacks.py b/ocarina/callbacks.py index 35b9ad8e..5f8d2fc2 100644 --- a/ocarina/callbacks.py +++ b/ocarina/callbacks.py @@ -17,7 +17,7 @@ def on_pause(): callbacks.on_pause = on_pause def on_load(file, attrs): - footer.on_load() + footer.on_load(attrs) queue.refresh() body.cur_page_goto() libsaria.path.lastfm.get_artwork(file) @@ -28,7 +28,7 @@ def on_like(like): callbacks.on_like = on_like def on_get_art(path, id): - cur_id = libsaria.sources.get_attrs("id") + cur_id = libsaria.sources.get_cur_id() if [id] != cur_id: path = "images/ocarina.png" footer.set_art(path) diff --git a/ocarina/sources/listview.py b/ocarina/sources/listview.py index 2e2341da..3923b702 100644 --- a/ocarina/sources/listview.py +++ b/ocarina/sources/listview.py @@ -95,7 +95,7 @@ class ListView(gtk.TreeView): self.thaw() def goto(self, *args): - id = libsaria.sources.get_attrs("id")[0] + id = libsaria.sources.get_cur_id() if id == -1: # Bad id return vis = self.get_visible_rect()