<commit_before>/**
 *  Copyright (c) 2015 Salama AB
 *  All rights reserved
 *  Contact: <EMAIL>
 *  Website: http://www.aksalj.me
 *
 *  Project : streama
 *  File : movie
 *  Date : 8/7/15 3:41 PM
 *  Description :
 *
 */
'use strict';
var express = require('express');
var marshal = require('../services/streama/marshaller');
var MovieModel = require("../models").Movie;

var router = express.Router();


router.get('/', function(req, res) {
  MovieModel.find({}, function(err, movies) {
    if(err) {
      console.error(err);
      movies = [];
    }
    marshal.sendJson(res, movies);
  });
});

router.get("/show.json", function(req, res) {
  var id = req.query.id;
  MovieModel.findOne({_id: id}, function(err, movie) {
    if(err){
      console.error(err);
      res.sendStatus(404);
    } else {
      marshal.sendVideoJson(res, movie);
    }
  })
});

router.post("/save.json", function(req, res) {<commit_msg>Get movie videos only on /movie.jso<commit_after>/**
 *  Copyright (c) 2015 Salama AB
 *  All rights reserved
 *  Contact: <EMAIL>
 *  Website: http://www.aksalj.me
 *
 *  Project : streama
 *  File : movie
 *  Date : 8/7/15 3:41 PM
 *  Description :
 *
 */
'use strict';
var express = require('express');
var marshal = require('../services/streama/marshaller');
var MovieModel = require("../models").Movie;
var VideoModel = require("../models").Video;

var router = express.Router();


router.get('/', function(req, res) {
  VideoModel.find({_type: "Movie"}, function(err, movies) {
    if(err) {
      console.error(err);
      movies = [];
    }
    marshal.sendJson(res, movies);
  });
});

router.get("/show.json", function(req, res) {
  var id = req.query.id;
  MovieModel.findOne({_id: id}, function(err, movie) {
    if(err){
      console.error(err);
      res.sendStatus(404);
    } else {
      marshal.sendVideoJson(res, movie);
    }
  })
});

router.post("/save.json", function(req, res) {
{'fraction_non_alphanumeric': 0.18753246753246752, 'fraction_numerical': 0.014545454545454545, 'mean_word_length': 3.141935483870968, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5130934', 'n_tokens_mistral': 693, 'n_tokens_neox': 666, 'n_words': 141}