Esempio n. 1
0
def load():
    album = Album()
    album.name = "100 Kotlu"
    album.actors = [
            "Krishna", 
            "Baladitya", 
            "Syerabhanu", 
            "Brahmanandam"
        ]
    album.music_directors = ["Vandemataram Srinivas"]
    album.directors = ["maruthi"]
    album.imageUrl = "http://rgamedia.blob.core.windows.net/raagaimg/r_img/catalog/cd/a/a0001232.jpg"
    album.save()
    
    print album.to_json()
    
    song = Song()
    
    song.album = album
    song.title = "Chirunayyu"
    song.genre  = None
    
    song.lyricists = [
                    "Surisetty Ramarao"
                ]
    
    song.singers =  [
                    "Malathi"
                ]
    song.rating = 10
    song.save()
    
    print song.to_json()
	def load_playlist(self,csv):
		vals = csv.split(",")
		s = Song()
		s.songid = vals[0]
		s.userid = vals[1]	#For readability, mainly
		s.title = vals[2]
		s.artist = vals[3]
		s.mood = vals[4]
		s.genre = vals[5]
		return s
	def pl_from_csv(self,csv):
		vals = csv.split(",")
		s = Song()
		s.songid = vals[0]
		s.userid = vals[1]	#For readability, mainly
		s.title = vals[2]
		s.artist = vals[3]
		s.mood = vals[4]
		s.genre = vals[5]
		s.tempo = vals[6]
		return s
	def reco_from_csv(self,csv):
		vals = csv.split(",")
		s = Song()
		s.songid = vals[0]
		#Ignore 	vals[1]
		s.mood = vals[2]
		s.genre = vals[3]
		s.userid = vals[4]
		s.album = vals[5]
		s.artist = vals[6]
		s.title = vals[7]
		
		
		return s
Esempio n. 5
0
	def reco_from_csv(self,csv):
		vals = csv.split(",")
		s = Song()
		s.songid = vals[0]
		#Ignore 	vals[1]
		s.mood = vals[2]
		s.genre = vals[3]
		s.userid = vals[4]
		s.album = vals[5]
		s.artist = vals[6]
		s.title = vals[7]
		
		
		return s
Esempio n. 6
0
from models import storage

input_artist = input('Artist: ')
input_song = input('Song: ')
db_songs = {}
for song in storage.all(Song).values():
    db_songs[song.title] = song
if db_songs.get(input_song) is None:
    input_genre = input('Genre: ')
    image = input('image_url: ')
    lyrics = input('lyrics: ')
    song = Song()
    song.artist = input_artist
    song.title = input_song
    song.lyrics = lyrics
    song.genre = input_genre
    song.image_url = image
else:
    song = db_songs[input_song]
words = input('words: ')
word_list = map(str, words.strip('[]').split(','))
db_words = {}
for word in storage.all(Word).values():
    db_words[word.text] = word
for item in word_list:
    if db_words.get(item) is None:
        word = Word()
        word.text = item
        word.save()
        song.words.append(word)
    else: