def testbench_build_library(): library = [] time = DateTime.now() for i in range(30): song=Song("C:/Folder%d/Artist%d/Title%d.mp3"%(i,i,i)) song[MpMusic.ARTIST] = u"%dArtist The Band"%(i%10) # id will have 10 different A,B,T song[MpMusic.TITLE] = u"%dTitle of The Song"%(i%10) song[MpMusic.ALBUM] = u"%dMonthly Album"%(i%10) song[MpMusic.GENRE] = (u"ROCK",u"POP","ALT")[(i%3)] song[MpMusic.DATEVALUE] = time - (60*60*24*i)# each song is one day older song[MpMusic.DATESTAMP] = DateTime.formatDateTime(song[MusicContainer.DATEVALUE]) song[MpMusic.COMMENT] = "" song[MpMusic.RATING] = i%6 # in 30 songs, 5 of each rating value song[MpMusic.LENGTH] = 15*i song[MpMusic.SONGINDEX] = 0 song[MpMusic.PLAYCOUNT] = i song[MpMusic.SKIPCOUNT] = i song[MpMusic.FILESIZE] = 0 song[MpMusic.FREQUENCY] = 2*i song[MpMusic.BITRATE] = 0 song[MpMusic.SPECIAL] = False song[MpMusic.SELECTED] = False song.update() library.append(song) return library;
def testbench_build_library(): library = [] time = DateTime.now() for i in range(30): song = Song("C:/Folder%d/Artist%d/Title%d.mp3" % (i, i, i)) song[MpMusic.ARTIST] = u"%dArtist The Band" % ( i % 10) # id will have 10 different A,B,T song[MpMusic.TITLE] = u"%dTitle of The Song" % (i % 10) song[MpMusic.ALBUM] = u"%dMonthly Album" % (i % 10) song[MpMusic.GENRE] = (u"ROCK", u"POP", "ALT")[(i % 3)] song[MpMusic.DATEVALUE] = time - (60 * 60 * 24 * i ) # each song is one day older song[MpMusic.DATESTAMP] = DateTime.formatDateTime( song[MusicContainer.DATEVALUE]) song[MpMusic.COMMENT] = "" song[MpMusic.RATING] = i % 6 # in 30 songs, 5 of each rating value song[MpMusic.LENGTH] = 15 * i song[MpMusic.SONGINDEX] = 0 song[MpMusic.PLAYCOUNT] = i song[MpMusic.SKIPCOUNT] = i song[MpMusic.FILESIZE] = 0 song[MpMusic.FREQUENCY] = 2 * i song[MpMusic.BITRATE] = 0 song[MpMusic.SPECIAL] = False song[MpMusic.SELECTED] = False song.update() library.append(song) return library
def newSong(art,ttl,alb,len): song = Song("/usr/music/%s/%s/%s-%s.mp3"%(art,alb,art,ttl)) song[EnumSong.ARTIST] = art song[EnumSong.TITLE ] = ttl song[EnumSong.ALBUM ] = alb song[EnumSong.GENRE ] = len song.update(); return song
def _build_library_(self): data = self.parent.data lib = [] for song in data: path = song.shortPath() path = os.path.join(self.dir,path) copy = Song(song) copy[MpMusic.PATH] = path lib.append(copy) # if the drive we are syncing to contains a copy of the media # player, update its library file. player_path = os.path.join(self.dir[:2]+"\\","Player","user",""); if (os.path.exists(player_path)): musicSave_LIBZ(os.path.join(player_path,"music.libz"),lib,typ=2) else: _path = os.path.join(self.dir,self.parent.playlist_name+".libz") musicSave_LIBZ(path,lib,typ=2)