def setUp(self): song = Song() song.title = "Basket Case" song.file_path = "burgle/data/pandora/Basket Case.mp3" artist = Artist() artist.name = 'Green Day' artist.save() song.artist = artist album = Album() album.title = 'Dookie' album.save() song.album = album song.station_id = int('21312') song.save() genre = Genre() genre.name = 'Rock' genre.save() song.genres.add(genre)
def setUp(self): seed = str(random.randint(1, 100000)) song = Song() song.title = 'Basket Case' pandora_url = 'http://audio-dc6-t1-1.pandora.com/access/6394738923373318898?version=4&lid=55475035&token=ltvKtTCJqaVK0%2FRsqx6FVl92LrWl3riBZtqhXMaoAQGBaZ5CflwAEnJO%2B7CSl%2FFyxIkYLmsL31krBpS3lnPj0PBX0UkSU0BFmh6BBO2wsUwUWvwFu2hyUHpWaJLcL7eJtEl08SKzQswNULEPr3V0R5JD64rB0ANyYc4YeDVSMs9m%2Fo5PITxWQlermntRbN1B2cGg4mi%2BOxQEHWnbwwoRKeQG6c0mv1qHasdMQXJrXc%2FxoUJM7az1yklTPW8LUnmaRho%2BxYBWhmJ5XBjMQtBt89moJVNfi9Cx08fUBf2GU369d63N1HACf86Nt1rcKRgS6NhaBngwjBPeJY0XBR76JesF%2BBQJHUKR' song.audio_url = pandora_url artist = Artist() artist.name = 'Green Day' artist.save() song.artist = artist album = Album() album.title = 'TestAlbum-' + str(seed) album.save() song.album = album song.station_id = int(seed) song.save() genre = Genre() genre.name = 'Rock' genre.save() song.genres.add(genre)
def setUp(self): for i in range(10): seed = str(random.randint(1, 100000)) song = Song() song.title = 'Demo' song.audio_url = 'test/music/demo.mp3' artist = Artist() artist.name = 'TestArtist-' + seed artist.save() song.artist = artist album = Album() album.title = 'TestAlbum-' + seed album.save() song.album = album song.station_id = int(seed) song.save() genre = Genre() genre.name = 'TestGenre-' + seed genre.save() song.genres.add(genre) self.test_songs.append(song)
from music.models import Album,Song album1.song_set.all() album1 = Album.objects.get(pk=1) album1.artist song = Song() song.album = album1 song.file_type = 'mp3' song.song_title = 'I love my boyfirend' song.save() album1.song_set.all() album1.song_set.create(song_title = 'I love bacon',file_type = 'mp3') album1.song_set.create(song_title = 'Bucky is Lucky',file_type = 'mp3') album1.song_set.create(song_title = 'Ice Cream',file_type = 'mp3') song = album1.song_set.create(song_title = 'Ice Cream',file_type = 'mp3') song.album song.song_title album1.song_set.all() album1.song_set.count() %hist -f CreateSong2.py