<commit_before>/*global require, module, console, __dirname */
/*jslint unparam: true, sloppy: true, vars: true */

var swig = require("swig"),
    request = require("request")

/**
 * Lekeri a buszmenetrendet es osszallitja a sablont.
 *
 * @returns {{getResponse: getResponse}}
 */
module.exports = function () {

    /**
     * Lekeri a kovetkezo busz indulasat es visszaadja
     * a feldolgozott sablonfajlt.
     *
     * @param function callback
     *
     * @return String
     */
    var getResponse = function (callback) {
        var requestOptions = {
            url: "http://futar.bkk.hu/bkk-utvonaltervezo-api/ws/otp/api/where/arrivals-and-departures-for-stop.json?stopId=BKK_F00002&onlyDepartures=1&minutesBefore=0&minutesAfter=20",
            json: true
        };

        // Adatok lekerese a Futartol.
        request(requestOptions, function (error, response, data) {
            if (200 != response.statusCode) {
                console.error("Hibas valasz erkezett a BKK Futartol:\n");
                console.error(response.body);
                return;
            }

            var timestamp = data.data.entry.stopTimes[0].arrivalTime * 1000,
                date = new Date(timestamp),
                m = "0" + date.getMinutes(),
                time = date.getHours() + ':' + m.substr(m.length-2),
                template = swig.compileFile(__dirname + '/assets/templates/index.html'),
                output = template({
                    route: data.data.references.routes.BKK_1780.shortName,
                    time: time,
                    timestamp: timestamp
                });
            callback(output);
        });
    };

    return {
        getResponse: getResponse
    };<commit_msg>Futar szerint becsult ido kijelzese.<commit_after>/*global require, module, console, __dirname */
/*jslint unparam: true, sloppy: true, vars: true */

var swig = require("swig"),
    request = require("request")

/**
 * Lekeri a buszmenetrendet es osszallitja a sablont.
 *
 * @returns {{getResponse: getResponse}}
 */
module.exports = function () {

    /**
     * Lekeri a kovetkezo busz indulasat es visszaadja
     * a feldolgozott sablonfajlt.
     *
     * @param function callback
     *
     * @return String
     */
    var getResponse = function (callback) {
        var requestOptions = {
            url: "http://futar.bkk.hu/bkk-utvonaltervezo-api/ws/otp/api/where/arrivals-and-departures-for-stop.json?stopId=BKK_F00002&onlyDepartures=1&minutesBefore=0&minutesAfter=20",
            json: true
        };

        // Adatok lekerese a Futartol.
        request(requestOptions, function (error, response, data) {
            if (200 != response.statusCode) {
                console.error("Hibas valasz erkezett a BKK Futartol:\n");
                console.error(response.body);
                return;
            }

            var timestamp = data.data.entry.stopTimes[0].predictedArrivalTime * 1000,
                date = new Date(timestamp),
                m = "0" + date.getMinutes(),
                time = date.getHours() + ':' + m.substr(m.length-2),
                template = swig.compileFile(__dirname + '/assets/templates/index.html'),
                output = template({
                    route: data.data.references.routes.BKK_1780.shortName,
                    time: time,
                    timestamp: timestamp
                });
            callback(output);
        });
    };

    return {
        getResponse: getResponse
    };
{'fraction_non_alphanumeric': 0.12001140250855188, 'fraction_numerical': 0.013112884834663626, 'mean_word_length': 1.9290484140233723, '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': '3775489', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1057, 'n_words': 208}