mirror of
https://github.com/chibicitiberiu/ytsm.git
synced 2024-02-24 05:43:31 +00:00
Merge pull request #87 from cyberjacob/watch-all-videos
Allow watching of all videos in a channel, folder, or other view sequentially
This commit is contained in:
@ -4,9 +4,11 @@ from django.http import HttpRequest, StreamingHttpResponse, FileResponse
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.views import View
|
||||
from django.views.generic import DetailView
|
||||
from django.db.models import Sum
|
||||
|
||||
from YtManagerApp.models import Video
|
||||
|
||||
import datetime
|
||||
|
||||
class VideoDetailView(LoginRequiredMixin, DetailView):
|
||||
template_name = 'YtManagerApp/video.html'
|
||||
@ -18,6 +20,11 @@ class VideoDetailView(LoginRequiredMixin, DetailView):
|
||||
if video is not None:
|
||||
context['video_mime'] = mime
|
||||
|
||||
if self.request.GET.get('next'):
|
||||
up_next_videos = self.request.GET.get('next').split(',')
|
||||
context['up_next_count'] = len(up_next_videos)
|
||||
context['up_next_duration'] = str(datetime.timedelta(seconds=Video.objects.filter(id__in=up_next_videos).aggregate(Sum('duration'))['duration__sum']))
|
||||
|
||||
return context
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user