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
Exemple #3
0
 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
Exemple #5
0
 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
Exemple #6
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
	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
def insert_init_data():
    
    Album.drop_collection()
    Song.drop_collection()
    
    
    data = json.loads(open("mapped_songs.json","r").read())
    count = 0
    for movie_name in data:
        movie = data[movie_name]
        a = Album()
        a.name = movie_name
        a.directors = movie.get("directors",None)
        a.music_directors = movie.get("music_directors",None)
        a.image_url = movie.get("img",None)
        a.actors = movie.get("actors",None)
        a.save()
        
        
        print "saved :: ", a.name
        for song_title_path  in  movie.get("song_entries",[]):
            if(not song_title_path): continue
            song_title , path  = song_title_path
            s = Song()
            s.title = song_title
#             s.lyricists = song.get("lyricists",None)
#             s.singers = song.get("singers",None)
            s.path = path
            s.album = a
            s.track_n = count
            count +=1
            s.save()
            print "    ", "saved song : " , s.title , s.album 
            
    
    poll = Poll.create_next_poll("telugu")
    print poll.to_json()
    print Poll.get_current_poll("telugu").to_json()        
    
    
    set_max_track()
def insert_init_data():

    Album.drop_collection()
    Song.drop_collection()

    data = json.loads(open("mapped_songs.json", "r").read())
    count = 0
    for movie_name in data:
        movie = data[movie_name]
        a = Album()
        a.name = movie_name
        a.directors = movie.get("directors", None)
        a.music_directors = movie.get("music_directors", None)
        a.image_url = movie.get("img", None)
        a.actors = movie.get("actors", None)
        a.save()

        print "saved :: ", a.name
        for song_title_path in movie.get("song_entries", []):
            if (not song_title_path): continue
            song_title, path = song_title_path
            s = Song()
            s.title = song_title
            #             s.lyricists = song.get("lyricists",None)
            #             s.singers = song.get("singers",None)
            s.path = path
            s.album = a
            s.track_n = count
            count += 1
            s.save()
            print "    ", "saved song : ", s.title, s.album

    poll = Poll.create_next_poll("telugu")
    print poll.to_json()
    print Poll.get_current_poll("telugu").to_json()

    set_max_track()
Exemple #10
0
from models.song import Song
from models.word import Word
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()