예제 #1
0
def delete_videos(request):
    """
    API endpoint for deleting videos.
    """
    youtube_ids = simplejson.loads(request.raw_post_data or "{}").get("youtube_ids", [])
    for id in youtube_ids:
        # Delete the file on disk
        delete_downloaded_files(id)

        # Delete the file in the database
        VideoFile.objects.filter(youtube_id=id).delete()

    return JsonResponse({})
예제 #2
0
def delete_videos(request):
    """
    API endpoint for deleting videos.
    """
    youtube_ids = simplejson.loads(request.raw_post_data
                                   or "{}").get("youtube_ids", [])
    for id in youtube_ids:
        # Delete the file on disk
        delete_downloaded_files(id)

        # Delete the file in the database
        VideoFile.objects.filter(youtube_id=id).delete()

    return JsonResponse({})
예제 #3
0
파일: api_views.py 프로젝트: mjptak/ka-lite
def delete_videos(request):
    youtube_ids = simplejson.loads(request.raw_post_data or "{}").get("youtube_ids", [])
    for id in youtube_ids:
        # Delete the file on disk
        delete_downloaded_files(id)

        # Delete the file in the database
        videofile = get_object_or_None(VideoFile, youtube_id=id)
        if videofile:
            videofile.cancel_download = True
            videofile.flagged_for_download = False
            videofile.flagged_for_subtitle_download = False
            videofile.save()

        # Refresh the cache
        invalidate_all_pages_related_to_video(video_id=id)

    return JsonResponse({})
예제 #4
0
def delete_videos(request):
    youtube_ids = simplejson.loads(request.raw_post_data
                                   or "{}").get("youtube_ids", [])
    for id in youtube_ids:
        # Delete the file on disk
        delete_downloaded_files(id)

        # Delete the file in the database
        videofile = get_object_or_None(VideoFile, youtube_id=id)
        if videofile:
            videofile.cancel_download = True
            videofile.flagged_for_download = False
            videofile.flagged_for_subtitle_download = False
            videofile.save()

        # Refresh the cache
        invalidate_all_pages_related_to_video(video_id=id)

    return JsonResponse({})