Exemplo n.º 1
0
 def songs_to_plfile(self):
     for song in self:
         if not song.location:
             continue
         loc = song.location
         # replacing old root with new root in the playlist file
         if self.old_root is not None and self.new_root is not None:
             if loc.startswith(self.old_root):
                 loc = os.path.join(self.new_root,
                            loc[len(self.old_root):].lstrip('/'))
             else:
                 loc = os.path.join(self.new_root, loc.lstrip('/'))
             loc = to_fat_compat(loc)
         target_song = Song(loc)
         target_song.title = song.title
         target_song.artist = song.artist
         target_song.length = song.length
         yield target_song