]> kaliko git repositories - mpd-sima.git/blobdiff - sima/lib/track.py
Some clean-up in track object
[mpd-sima.git] / sima / lib / track.py
index 93aa350bbc4d24d612e2232e8c7a8d1de19d0a90..c88de6c1b3b9f511691a073c65553c8e2d2afd40 100644 (file)
@@ -1,23 +1,23 @@
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2009, 2010, 2011, 2013 Jack Kaliko <efrim@azylum.org>
+# Copyright (c) 2009, 2010, 2011, 2013 Jack Kaliko <kaliko@azylum.org>
 # Copyright (c) 2009 J. Alexander Treuman (Tag collapse method)
 # Copyright (c) 2008 Rick van Hattem
 #
-#  This file is part of MPD_sima
+#  This file is part of sima
 #
-#  MPD_sima is free software: you can redistribute it and/or modify
+#  sima is free software: you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
 #  the Free Software Foundation, either version 3 of the License, or
 #  (at your option) any later version.
 #
-#  MPD_sima is distributed in the hope that it will be useful,
+#  sima is distributed in the hope that it will be useful,
 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 #  GNU General Public License for more details.
 #
 #  You should have received a copy of the GNU General Public License
-#  along with MPD_sima.  If not, see <http://www.gnu.org/licenses/>.
+#  along with sima.  If not, see <http://www.gnu.org/licenses/>.
 #
 #
 
@@ -27,20 +27,20 @@ import time
 class Track(object):
     """
     Track object.
-    Instanciate with mpd replies.
+    Instanciate with Player replies.
     """
 
-    def __init__(self, file=None, time=0, pos=0, **kwargs):
+    def __init__(self, file=None, time=0, pos=-1, **kwargs):
         self.title = self.artist = self.album = self.albumartist = ''
-        self._pos = pos
-        self.empty = False
+        self.pos = pos
+        self._empty = False
         self._file = file
         if not kwargs:
-            self.empty = True
+            self._empty = True
         self.time = time
         self.__dict__.update(**kwargs)
-        self.tags_to_collapse = list(['artist', 'album', 'title', 'date',
-            'genre', 'albumartist'])
+        self.tags_to_collapse = ['artist', 'album', 'title', 'date',
+                                 'genre', 'albumartist']
         #  have tags been collapsed?
         self.collapse_tags_bool = False
         self.collapsed_tags = list()
@@ -60,12 +60,6 @@ class Track(object):
                 self.collapsed_tags.append(tag)
                 self.__dict__.update({tag: ', '.join(set(value))})
 
-    def get_filename(self):
-        """return filename"""
-        if not self.file:
-            return None
-        return self.file
-
     def __repr__(self):
         return '%s(artist="%s", album="%s", title="%s", filename="%s")' % (
             self.__class__.__name__,
@@ -103,12 +97,7 @@ class Track(object):
         return hash(self) != hash(other)
 
     def __bool__(self):
-        return not self.empty
-
-    @property
-    def pos(self):
-        """return position of track in the playlist"""
-        return int(self._pos)
+        return not self._empty
 
     @property
     def file(self):