I would like to transcode user uploaded videos using celery. I think first
I should upload the video, and spawn a celery task for transcoding.

Maybe something like this in the tasks.py:

    subprocess.call('ffmpeg -i path/.../original path/.../output')
>

Just completed First steps with celery
<http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html#first-steps>,
so confused how to do so in the `views.py` and `tasks.py`. Also is it a
good solution? I would really appreciate your help and advice. Thank you.

models.py:

    class Video(models.Model):
>         user = models.ForeignKey(User)
>         title = models.CharField(max_length=100)
>         original = models.FileField(upload_to=get_upload_file_name)
>         mp4_480 = models.FileField(upload_to=get_upload_file_name)
>         mp4_720 = models.FileField(upload_to=get_upload_file_name)
>         privacy = models.CharField(max_length=1,choices=PRIVACY,
> default='F')
>         pub_date = models.DateTimeField(auto_now_add=True, auto_now=False)
>

my incomplete views.py:


    @login_required
>     def upload_video(request):
>         if request.method == 'POST':
>             form = VideoForm(request.POST, request.FILES)
>             if form.is_valid():
>                 if form.cleaned_data:
>                     user = request.user
>                     #
>                     #
>                     # No IDEA WHAT TO DO NEXT
>                     #
>                     #
>                     return HttpResponseRedirect('/')
>
>         else:
>             form = VideoForm()
>             return render(request, 'upload_video.html', {
>                 'form':form
>                 })
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGoz%3D_qCx%2BbSnOfNFLYiufqUUES3S3T9y4GXoZiaBV9tyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to