예제 #1
0
def search_videos():
    a_list = []
    form = SearchForm()
    if form.validate_on_submit():
        a_search = form.search.data
        a_list = yt_service.search_videos(a_search)
    return render_template("searchYoutube.html", title="Search Youtube", form=form, search_list=a_list)
예제 #2
0
def dirble():
    form = SearchForm()
    my_search_results = {}
    if form.validate_on_submit():
        search = form.search.data
        my_search_results = ds.search(search)
    return render_template("/dirble.html", title="Radio Streams", form=form, my_search_results=my_search_results)
예제 #3
0
def converter():
    collected_audios = Content.query.all()
    my_audios = {}
    for c in collected_audios:
        my_audios[c.c_audio] = str("/converter/" + str(c.c_id))
    form = SearchForm()
    if form.validate_on_submit():
        a_search = form.search.data
        a_format = form.radios.data
        content = Content.query.filter_by(c_link=a_search, c_format=a_format).first()
        if content is None:
            #TODO: fix exceptions
            a_link, a_audio, a_format = yt_service.get_audio(a_search, a_format)
            content = Content(a_link, a_audio, a_format)
            db.add(content)
            db.commit()
        return redirect("converter/"+ str(content.c_id))
    return render_template("converter.html", title="Download Audio", form=form, my_audios=my_audios)