<commit_before>/**
  MeDroid - Multimedia Transcoder Service.
  
  The following input formats are supported:

  images (all image formats supported by imagegraphics)
  videos (all video formats supported by ffmpeg/avconv)
  pdf

  (c) 2013 OptimalBits - MIT Licensed.
*/
"use strict";

var Redis = require("ioredis"),
  Queue = require("bull"),
  util = require("util");

var TranscoderConfig = require("./presets.js");

var JOB_QUEUE_NAME = "Medroid";

//
//  Returns the channel for informing on job progress.
//
function progressChannel(clientId) {
  return "medroid:" + clientId + ":progress:";
}

//------------------------------------------------------------------------------
//
//  Medroid Client
// opts: {
//   redis: {
//     port: 6379,
//     host: localhost
//     opts: {}
//   }
//  }
//------------------------------------------------------------------------------
var Medroid = function Medroid(opts) {
  if (!this) {
    return new Medroid(opts);
  }
  this.clientId = opts.clientId || "default";
  this.jobQueue = Queue(JOB_QUEUE_NAME, opts);

  this.jobQueue.on("error", (err) => {
    console.error("Job Queue Error", err);
  });

  this.resultsQueueName = "Medroid-client-" + this.clientId;
  this.resultsQueue = Queue(this.resultsQueueName, opts);

  this.resultsQueue.on("error", (err) => {
    console.error("Results Queue Error", err);<commit_msg>feat: allow to specify a queue name<commit_after>/**
  MeDroid - Multimedia Transcoder Service.
  
  The following input formats are supported:

  images (all image formats supported by imagegraphics)
  videos (all video formats supported by ffmpeg/avconv)
  pdf

  (c) 2013 OptimalBits - MIT Licensed.
*/
"use strict";

var Redis = require("ioredis"),
  Queue = require("bull"),
  util = require("util");

var TranscoderConfig = require("./presets.js");

//
//  Returns the channel for informing on job progress.
//
function progressChannel(clientId) {
  return "medroid:" + clientId + ":progress:";
}

//------------------------------------------------------------------------------
//
//  Medroid Client
// opts: {
//   redis: {
//     port: 6379,
//     host: localhost
//     opts: {}
//   }
//  }
//------------------------------------------------------------------------------
var Medroid = function Medroid(opts, queueName) {
  if (!this) {
    return new Medroid(opts);
  }

  queueName = queueName || "Medroid";

  this.clientId = opts.clientId || "default";
  this.jobQueue = Queue(queueName, opts);

  this.jobQueue.on("error", (err) => {
    console.error("Job Queue Error", err);
  });

  this.resultsQueueName = "Medroid-client-" + this.clientId;
  this.resultsQueue = Queue(this.resultsQueueName, opts);

  this.resultsQueue.on("error", (err) => {
    console.error("Results Queue Error", err);
{'fraction_non_alphanumeric': 0.24991023339317775, 'fraction_numerical': 0.005745062836624776, 'mean_word_length': 2.144469525959368, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, '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': '386454', 'n_tokens_mistral': 847, 'n_tokens_neox': 816, 'n_words': 210}