@require_admin
@api_handle_error_with_json
def delete_videos(request):
 paths = OrderedSet(json.loads((request.body or '{}')).get('paths', []))
 lang = json.loads((request.body or '{}')).get('lang', 'en')
 youtube_ids = get_download_youtube_ids(paths, language=lang, downloaded=True)
 num_deleted = 0
 for id in youtube_ids:
  if delete_downloaded_files(id):
   num_deleted += 1
 annotate_content_models_by_youtube_id(youtube_ids=youtube_ids.keys(), language=lang)
 return JsonResponseMessageSuccess((_('Deleted %(num_videos)s video(s) successfully.') % {'num_videos': num_deleted}))

@ require_admin @ api_handle_error_with_json def delete_videos ( request ) : paths = OrderedSet ( json . loads ( ( request . body or '{}' ) ) . get ( 'paths' , [ ] ) ) lang = json . loads ( ( request . body or '{}' ) ) . get ( 'lang' , 'en' ) youtube_ids = get_download_youtube_ids ( paths , language = lang , downloaded = True ) num_deleted = 0 for id in youtube_ids : if delete_downloaded_files ( id ) : num_deleted += 1 annotate_content_models_by_youtube_id ( youtube_ids = youtube_ids . keys ( ) , language = lang ) return JsonResponseMessageSuccess ( ( _ ( 'Deleted %(num_videos)s video(s) successfully.' ) % { 'num_videos' : num_deleted } ) )
api endpoint for deleting videos .