X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Flib%2Ftrack.py;h=a774a4ceafdceeb7ec7c0c5c57d819c20a35d378;hb=d4e415f6ca4516f2403e582a05facda72db3c322;hp=1bed098f851cee6dd08d1601a3d34265bbd62bcd;hpb=2eb13c85fe72ade75193b589748920615fbb22d2;p=mpd-sima.git diff --git a/sima/lib/track.py b/sima/lib/track.py index 1bed098..a774a4c 100644 --- a/sima/lib/track.py +++ b/sima/lib/track.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2009, 2010, 2011, 2013, 2014 Jack Kaliko +# Copyright (c) 2009, 2010, 2011, 2013, 2014, 2015 Jack Kaliko # Copyright (c) 2009 J. Alexander Treuman (Tag collapse method) # Copyright (c) 2008 Rick van Hattem # @@ -23,7 +23,7 @@ import time -from .meta import Artist +from .meta import Artist, SEPARATOR class Track: """ @@ -60,10 +60,10 @@ class Track: continue if isinstance(value, list): self.collapsed_tags.append(tag) - self.__dict__.update({tag: ', '.join(set(value))}) + self.__dict__.update({tag: SEPARATOR.join(set(value))}) def __repr__(self): - return '%s(artist="%s", album="%s", title="%s", filename="%s")' % ( + return '%s(artist="%s", album="%s", title="%s", file="%s")' % ( self.__class__.__name__, self.artist, self.album, @@ -99,6 +99,8 @@ class Track: return hash(self) != hash(other) def __bool__(self): + if not self._file: + return False return not self._empty @property @@ -129,6 +131,11 @@ class Track: @property def Artist(self): """Get artist object from track""" + if not self.artist: + if not self.musicbrainz_artistid: + return Artist(name='[unknown]', + mbid='125ec42a-7229-4250-afc5-e057484327fe') + return Artist(name='[unknown]', **self.__dict__) return Artist(**self.__dict__) # VIM MODLINE