From b12a662d27b700158e66943253b79c230566e8b9 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 29 Nov 2010 21:20:15 +0100 Subject: song: cosmetics --- nephilim/song.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/nephilim/song.py b/nephilim/song.py index 0cf3b5c..eb5fedb 100644 --- a/nephilim/song.py +++ b/nephilim/song.py @@ -22,27 +22,29 @@ from string import Template from common import sec2min class Song(dict): - """Song provides a dictionary-like wrapper around song metadata. - Its instances _shouldn't_ be stored, use SongRef or PlaylistEntryRef for that. - Access '?tag' to get always at least an empty string. """ - + """ + Song provides a dictionary-like wrapper around song metadata. + Its instances are generated by MPClient, don't instantiate it + directly. + Its instances _shouldn't_ be stored, use SongRef or PlaylistEntryRef for that. + Access '?tag' to get always at least an empty string. + """ + + #### PUBLIC #### def __init__(self, data = {}): dict.__init__(self) for key in data: dict.__setitem__(self, key.lower(), data[key]) if not 'file' in self: self['file'] = '' - def __eq__(self, other): if not isinstance(other, Song): return NotImplemented return self['file'] == other['file'] - def __ne__(self, other): if not isinstance(other, Song): return NotImplemented return self['file'] != other['file'] - def __getitem__(self, key): key = key.lower() try: @@ -71,7 +73,6 @@ class Song(dict): return os.path.dirname(self['file']) raise KeyError - def __contains__(self, item): if dict.__contains__(self, item.lower()): return True @@ -80,7 +81,6 @@ class Song(dict): return True except KeyError: return False - def __nonzero__(self): return bool(self['file']) -- cgit v1.2.3