Пример #1
0
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;
Пример #2
0
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
Пример #3
0
 def format_datefield(self,FMT,string_index,num_index):
     """
         format a date string, using FMT to format
         the integer value comes from num_index
         the formated string value is stored in string_index
     """
     ds = ""
     try:
         dt = DateTime(FMT)
         if self[num_index]:
             ds = dt.formatDateTime(self[num_index])
     except Exception as e:
         print e
     finally:
         self[string_index] = ds