[kupfer] plugin.rhythmbox_support: Fix indentation in whole file.
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] plugin.rhythmbox_support: Fix indentation in whole file.
- Date: Tue, 15 Sep 2009 17:53:13 +0000 (UTC)
commit 02e4a9fb6181363083b302695f2175f200191481
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Mon Sep 14 05:09:02 2009 +0200
plugin.rhythmbox_support: Fix indentation in whole file.
kupfer/plugin/rhythmbox_support.py | 112 ++++++++++++++++++------------------
1 files changed, 56 insertions(+), 56 deletions(-)
---
diff --git a/kupfer/plugin/rhythmbox_support.py b/kupfer/plugin/rhythmbox_support.py
index 1b1fcba..b210f85 100644
--- a/kupfer/plugin/rhythmbox_support.py
+++ b/kupfer/plugin/rhythmbox_support.py
@@ -42,67 +42,67 @@ def get_rhythmbox_songs(dbfile, typ="song", keys=NEEDED_KEYS):
return lSongs
def sort_album(album):
- """Sort album in track order"""
- def get_track_number(rec):
- tnr = rec.get("track-number")
- if not tnr: return None
- try:
- tnr = int(tnr)
- except ValueError:
- pass
- return tnr
- album.sort(key=get_track_number)
+ """Sort album in track order"""
+ def get_track_number(rec):
+ tnr = rec.get("track-number")
+ if not tnr: return None
+ try:
+ tnr = int(tnr)
+ except ValueError:
+ pass
+ return tnr
+ album.sort(key=get_track_number)
def sort_album_order(songs):
- """Sort songs in order by album then by track number
+ """Sort songs in order by album then by track number
- >>> songs = [
- ... {"title": "a", "album": "B", "track-number": "2"},
- ... {"title": "b", "album": "A", "track-number": "1"},
- ... {"title": "c", "album": "B", "track-number": "1"},
- ... ]
- >>> sort_album_order(songs)
- >>> [s["title"] for s in songs]
- ['b', 'c', 'a']
- """
- def get_album_order(rec):
- tnr = rec.get("track-number")
- if not tnr: return None
- try:
- tnr = int(tnr)
- except ValueError:
- pass
- return (rec["album"], tnr)
- songs.sort(key=get_album_order)
+ >>> songs = [
+ ... {"title": "a", "album": "B", "track-number": "2"},
+ ... {"title": "b", "album": "A", "track-number": "1"},
+ ... {"title": "c", "album": "B", "track-number": "1"},
+ ... ]
+ >>> sort_album_order(songs)
+ >>> [s["title"] for s in songs]
+ ['b', 'c', 'a']
+ """
+ def get_album_order(rec):
+ tnr = rec.get("track-number")
+ if not tnr: return None
+ try:
+ tnr = int(tnr)
+ except ValueError:
+ pass
+ return (rec["album"], tnr)
+ songs.sort(key=get_album_order)
def parse_rhythmbox_albums(songs):
- albums = {}
- for song in songs:
- song_artist = song["artist"]
- if not song_artist:
- continue
- song_album = song["album"]
- if not song_album:
- continue
- album = albums.get(song_album, [])
- album.append(song)
- albums[song_album] = album
- # sort album in track order
- for album in albums:
- sort_album(albums[album])
- return albums
+ albums = {}
+ for song in songs:
+ song_artist = song["artist"]
+ if not song_artist:
+ continue
+ song_album = song["album"]
+ if not song_album:
+ continue
+ album = albums.get(song_album, [])
+ album.append(song)
+ albums[song_album] = album
+ # sort album in track order
+ for album in albums:
+ sort_album(albums[album])
+ return albums
def parse_rhythmbox_artists(songs):
- artists = {}
- for song in songs:
- song_artist = song["artist"]
- if not song_artist:
- continue
- artist = artists.get(song_artist, [])
- artist.append(song)
- artists[song_artist] = artist
- # sort in album + track order
- for artist in artists:
- sort_album_order(artists[artist])
- return artists
+ artists = {}
+ for song in songs:
+ song_artist = song["artist"]
+ if not song_artist:
+ continue
+ artist = artists.get(song_artist, [])
+ artist.append(song)
+ artists[song_artist] = artist
+ # sort in album + track order
+ for artist in artists:
+ sort_album_order(artists[artist])
+ return artists
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]