24 lines
377 B
JavaScript
24 lines
377 B
JavaScript
|
"use strict";
|
||
|
|
||
|
const glob = require('glob');
|
||
|
|
||
|
class FileBackend {
|
||
|
constructor(config) {
|
||
|
this.config = config;
|
||
|
}
|
||
|
|
||
|
find(tag, callback) {
|
||
|
glob('media/' + tag + ' - *.mp3', (err, files) => {
|
||
|
if (files.length > 0) {
|
||
|
callback(files[0]);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = function(config) {
|
||
|
return new FileBackend(config);
|
||
|
};
|
||
|
|
||
|
// vim:ts=2 sw=2 et:
|