def main(): filename = "playlist.txt" if len(sys.argv) > 1: filename = sys.argv[1] if not os.path.exists(filename): if platform.system() == "Windows": with open("playlist.txt", 'w') as f: playlist_sample = \ r"""Zouk=c:\musicas\zouk\ Forro=c:\musicas\forro\ SambaLento=c:\musicas\Sambas\samba lento SambaRapido=c:\musicas\Sambas\samba rapido 3 Zouk 2 Forro""" f.write(playlist_sample) f.close() subprocess.check_call("notepad playlist.txt", shell=True) filename = "playlist.txt" else: print("File %s does not exist" % filename) return print("Reading songs from %s " % filename) songs = fetch_songs(filename) out_files = generate_filenames(songs) copy_songs(out_files, 'output') set_ID3(['output' + os.sep + filename for filename, _ in out_files])
def main(): filename = "playlist.txt" if len(sys.argv) > 1: filename = sys.argv[1] if not os.path.exists(filename): if platform.system() == "Windows": with open("playlist.txt", 'w') as f: playlist_sample = \ r"""Zouk=c:\musicas\zouk\ Forro=c:\musicas\forro\ SambaLento=c:\musicas\Sambas\samba lento SambaRapido=c:\musicas\Sambas\samba rapido 3 Zouk 2 Forro""" f.write(playlist_sample) f.close() subprocess.check_call("notepad playlist.txt", shell = True) filename = "playlist.txt" else: print("File %s does not exist" % filename) return print("Reading songs from %s " % filename) songs = fetch_songs(filename) out_files = generate_filenames(songs) copy_songs(out_files, 'output') set_ID3(['output' + os.sep + filename for filename, _ in out_files])
def testFetchSongs(self): songs = fetch_songs("songs/playlist.txt") self.assertEqual(3, len(songs)) self.assertItemsEqual( self.convert_filelist( ["songs/zouk/zouk2.mp3", "songs/zouk/zouk1.mp3"]), songs[0:2]) self.assertEqual(os.path.normpath("songs/forro/forro1.mp3"), songs[2])
def testFetchSongs(self): songs = fetch_songs("songs/playlist.txt") self.assertEqual(3, len(songs)) self.assertItemsEqual(self.convert_filelist( ["songs/zouk/zouk2.mp3", "songs/zouk/zouk1.mp3"]), songs[0:2]) self.assertEqual(os.path.normpath("songs/forro/forro1.mp3"), songs[2])