<commit_before>'use strict';

angular.module('privateTheaterApp')
  .controller('EditmovieCtrl', ['$scope', '$routeParams', '$location', 'Movie', 'Media', function ($scope, $routeParams, $location, Movie, Media) {
    $scope.movie = Movie.get({movieId: $routeParams.movieId});
    $scope.newMedia = new Media();
    $scope.deletable = true;
    $scope.save = function(){
      Movie.update({movieId: $scope.movie.id}, $scope.movie);
    };
    $scope.deleteMovie = function(){
      Movie.delete({movieId: $routeParams.movieId}, function(){
        $location.path('/');
      });
    };
    $scope.createMedia = function(){
      $scope.newMedia.$save({movieId: $scope.movie.id, mediaId: 'new'}, function(media, resp){
        if(!media){
          console.log('Error!', resp);
        }else {
          $scope.movie.medias.push(media);
          $scope.newMedia = new Media();
          $scope.newMedia.quality = '720p';<commit_msg>Adds flash messages todos<commit_after>'use strict';

angular.module('privateTheaterApp')
  .controller('EditmovieCtrl', ['$scope', '$routeParams', '$location', 'Movie', 'Media', function ($scope, $routeParams, $location, Movie, Media) {
    //TODO: Flash errors
    $scope.movie = Movie.get({movieId: $routeParams.movieId});
    $scope.newMedia = new Media();
    $scope.save = function(){
      Movie.update({movieId: $scope.movie.id}, $scope.movie);
    };
    $scope.deleteMovie = function(){
      Movie.delete({movieId: $routeParams.movieId}, function(){
        $location.path('/');
      });
    };
    $scope.createMedia = function(){
      $scope.newMedia.$save({movieId: $scope.movie.id, mediaId: 'new'}, function(media, resp){
        if(!media){
          console.log('Error!', resp);
        }else {
          $scope.movie.medias.push(media);
          $scope.newMedia = new Media();
          $scope.newMedia.quality = '720p';
{'fraction_non_alphanumeric': 0.18943436499466382, 'fraction_numerical': 0.0032017075773745998, 'mean_word_length': 3.2906178489702516, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6195375', 'n_tokens_mistral': 604, 'n_tokens_neox': 571, 'n_words': 107}