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