Remove redundant self.base

This commit is contained in:
Nimesh Ghelani 2016-06-08 02:57:04 +05:30
parent 21eba1e2be
commit e6303ad964

View file

@ -207,7 +207,7 @@ class Record(object):
@property @property
def base(self): def base(self):
return self.shuffledb.base return self.shuffledb.path
@property @property
def tracks(self): def tracks(self):
@ -534,7 +534,7 @@ class Playlist(Record):
class Shuffler(object): class Shuffler(object):
def __init__(self, path, voiceover=False, playlist_voiceover=False, rename=False, trackgain=0, auto_playlists=None): def __init__(self, path, voiceover=False, playlist_voiceover=False, rename=False, trackgain=0, auto_playlists=None):
self.path, self.base = self.determine_base(path) self.path = os.path.abspath(path)
self.tracks = [] self.tracks = []
self.albums = [] self.albums = []
self.artists = [] self.artists = []
@ -560,12 +560,6 @@ class Shuffler(object):
print "Artists", self.artists print "Artists", self.artists
print "Playlists", self.lists print "Playlists", self.lists
def determine_base(self, path):
base = os.path.abspath(path)
# while not os.path.ismount(base):
# base = os.path.dirname(base)
return base, base
def populate(self): def populate(self):
self.tunessd = TunesSD(self) self.tunessd = TunesSD(self)
for (dirpath, dirnames, filenames) in os.walk(self.path): for (dirpath, dirnames, filenames) in os.walk(self.path):
@ -588,7 +582,7 @@ class Shuffler(object):
self.lists.append(os.path.abspath(dirpath)) self.lists.append(os.path.abspath(dirpath))
def write_database(self): def write_database(self):
with open(os.path.join(self.base, "iPod_Control", "iTunes", "iTunesSD"), "wb") as f: with open(os.path.join(self.path, "iPod_Control", "iTunes", "iTunesSD"), "wb") as f:
f.write(self.tunessd.construct()) f.write(self.tunessd.construct())
# #