mirror of
https://github.com/nims11/IPod-Shuffle-4g.git
synced 2025-12-08 00:18:01 +09:00
more enum use
This commit is contained in:
parent
d4a9a145be
commit
767f371637
1 changed files with 4 additions and 10 deletions
|
|
@ -469,7 +469,7 @@ class PlaylistHeader(Record):
|
||||||
playlist.populate(i)
|
playlist.populate(i)
|
||||||
construction = playlist.construct(tracks)
|
construction = playlist.construct(tracks)
|
||||||
if playlist["number_of_songs"] > 0:
|
if playlist["number_of_songs"] > 0:
|
||||||
if playlist["listtype"] == 3:
|
if playlist["listtype"] == PlaylistType.PODCAST.value:
|
||||||
podcastlistcount += 1
|
podcastlistcount += 1
|
||||||
playlistcount += 1
|
playlistcount += 1
|
||||||
chunks += [construction]
|
chunks += [construction]
|
||||||
|
|
@ -518,12 +518,6 @@ class Playlist(Record):
|
||||||
self.listtype = PlaylistType.ALL_SONGS
|
self.listtype = PlaylistType.ALL_SONGS
|
||||||
self.listtracks = tracks
|
self.listtracks = tracks
|
||||||
|
|
||||||
def set_audiobook(self):
|
|
||||||
self.listtype = PlaylistType.AUDIOBOOK
|
|
||||||
|
|
||||||
def set_podcast(self):
|
|
||||||
self.listtype = PlaylistType.PODCAST
|
|
||||||
|
|
||||||
def populate_m3u(self, data):
|
def populate_m3u(self, data):
|
||||||
listtracks = []
|
listtracks = []
|
||||||
for i in data:
|
for i in data:
|
||||||
|
|
@ -555,7 +549,7 @@ class Playlist(Record):
|
||||||
# would generate duplicated playlists. That is intended and "wont fix".
|
# would generate duplicated playlists. That is intended and "wont fix".
|
||||||
# Empty folders (inside the music path) will generate an error -> "wont fix".
|
# Empty folders (inside the music path) will generate an error -> "wont fix".
|
||||||
if "/iPod_Control/Podcasts/" in playlistpath:
|
if "/iPod_Control/Podcasts/" in playlistpath:
|
||||||
self.set_podcast()
|
self.listtype = PlaylistType.PODCAST
|
||||||
listtracks = []
|
listtracks = []
|
||||||
for (dirpath, dirnames, filenames) in os.walk(playlistpath):
|
for (dirpath, dirnames, filenames) in os.walk(playlistpath):
|
||||||
dirnames.sort()
|
dirnames.sort()
|
||||||
|
|
@ -619,8 +613,8 @@ class Playlist(Record):
|
||||||
for i in self.listtracks:
|
for i in self.listtracks:
|
||||||
path = self.ipod_to_path(i)
|
path = self.ipod_to_path(i)
|
||||||
position = -1
|
position = -1
|
||||||
if self["listtype"] == 1 and "/iPod_Control/Podcasts/" in path:
|
if PlaylistType.ALL_SONGS == self.listtype and "/iPod_Control/Podcasts/" in path:
|
||||||
print ('not including podcast in master playlist: {}'.format(path))
|
# exclude podcasts from the "All Songs" playlist
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
position = tracks.index(path)
|
position = tracks.index(path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue