Exemplo n.º 1
0
 def sync_artist(self, artist_name):
     artist_by_name = Artist.objects.filter(name=artist_name);        
     if not artist_by_name:
         new_artist = Artist()
         new_artist.name = artist_name
         new_artist.save()
         return new_artist
     return artist_by_name[0]
Exemplo n.º 2
0
 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) 
Exemplo n.º 3
0
 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) 
Exemplo n.º 4
0
 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)