예제 #1
0
def sing_text():
    if request.method == 'POST':
        song_name = request.form['song_name']
        if song_name is 'Random':
            song_name = None

        song_file = text_to_song_file(request.form['text'], song_name=song_name)
        base = os.path.basename(song_file)
        new_path = os.path.join(os.path.abspath('.'), 'static', base)
        os.rename(song_file, new_path)
        return render_template('sing.html', song='/static/%s' % base)
    else:
        return render_template('sing.html', song=None, beatmaps=BEATMAPS.keys())
예제 #2
0
    def sing(self, text, tweet_id, username):
        #mock singing
        #upload to soundcloud
        
        song_file = text_to_song_file(text, tweet_id)
        #song_file = '/tmp/test.wav'

        dt = datetime.datetime.now().strftime('%a %b %d %l %p')
        title = '%s\'s tweet, %s' % (username, dt)
        description = '@%s tweeted "%s", and @SingThatTweet sang it' % (username, text)

        song_url = upload_sc.upload(song_file, title, description)
        tweet_song(username, title, song_url)