OBJECT:
'use strict';
var slotIndexes = [
{
'slot' : 'live',
'index': 0
},
{
'slot' : 'achtziger',
'index': 1
},
{
'slot' : 'neunziger',
'index': 2
},
{
'slot' : 'relax',
'index': 3
},
{
'slot' : 'rock',
'index': 4
},
{
'slot' : 'brandneu',
'index': 5
},
{
'slot' : 'black and dance',
'index': 6
},
{
'slot' : 'deutsche hits',
'index': 7
},
// RECOUNT INDEXES IN CASE OF ENABLING WEIHNACHTSHITS
// {
// 'slot' : 'weihnachtshits',
// 'index': 8
// },
// RECOUNT INDEXES IN CASE OF ENABLING WEIHNACHTSHITS
{
'slot' : 'berlin club',
'index': 8
},
{
'slot' : 'fetenhits',
'index': 9
},
{
'slot' : 'news',
'index': 10
},
{
'slot' : 'nachrichten',
'index': 10
}
];
module.exports = slotIndexes;
SEARCHING:
var slotIndexes = require('./slotIndexes');
function getIndexBySlot(slot) {
return slotIndexes.filter(
function(slotIndexes){ return slotIndexes.slot == slot }
);
};
...
var indexFound = getIndexBySlot(channel);
...
if ("undefined" !== typeof indexFound[0]) {
console.log('DEBUG -> ' + this.handler.state + ' Slot found!');
this.attributes['index'] = indexFound[0].index;
this.attributes['offsetInMilliseconds'] = 0;
}