Exemplo n.º 1
0
    def upload_file(self):
        form = UploadEpgForm()
        if form.validate_on_submit():
            file_handle = form.file.data
            content = file_handle.read().decode('utf-8')
            url_set = set()
            for line in content.split():
                url_set.add(line.strip())

            for uniq in url_set:
                epg = Epg()
                epg.uri = uniq
                epg.save()

        return redirect(url_for('EpgView:epg'))
Exemplo n.º 2
0
 def upload_urls(self):
     form = UploadEpgForm()
     return render_template('epg/upload_urls.html', form=form)