Make lbry.getMediaType() able to use MIME type as well as file name

This commit is contained in:
Alex Liebowitz 2016-09-02 04:48:01 -04:00
parent b39d313776
commit bc129eb347

View file

@ -283,7 +283,10 @@ lbry.imagePath = function(file)
return lbry.rootPath + '/img/' + file;
}
lbry.getMediaType = function(filename) {
lbry.getMediaType = function(contentType, fileName) {
if (contentType) {
return /^[^/]+/.exec(contentType);
} else {
var dotIndex = filename.lastIndexOf('.');
if (dotIndex == -1) {
return 'unknown';
@ -300,6 +303,7 @@ lbry.getMediaType = function(filename) {
return 'unknown';
}
}
}
lbry.stop = function(callback) {
lbry.call('stop', {}, callback);