Skip to content

Commit

Permalink
Fix WiMP support
Browse files Browse the repository at this point in the history
  • Loading branch information
evl committed Sep 7, 2011
1 parent 9ff3189 commit 2c92c53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/utils.js
Expand Up @@ -11,4 +11,8 @@ String.prototype.format = function() {

String.prototype.repeat = function(num) {
return new Array(++num).join(this);
};
};

String.prototype.capitalize = function() {
return this[0].toUpperCase() + this.substr(1);
}
6 changes: 3 additions & 3 deletions oaz.js
Expand Up @@ -161,8 +161,8 @@ store('oaz.sqlite3', function(err, db) {

// WiMP
bot.watch_for(/wimp\.no\/(artist|album|track)\/\d+/, function(message) {
var type = matches[1][0].toUpperCase() + matches[1].substr(1);
var options = {uri: 'http://' + matches[0]};
var options = {uri: 'http://' + message.match_data[0]};
var type = message.match_data[1];

request(options, function(err, response, body) {
if (response.statusCode == 200) {
Expand All @@ -171,7 +171,7 @@ store('oaz.sqlite3', function(err, db) {

if (matches) {
var title = matches[1];
message.say('{0}: {1}'.format(bold('Spotify ' + type), title));
message.say('{0}: {1}'.format(bold('WiMP ' + type.capitalize()), title));
}
}
});
Expand Down

0 comments on commit 2c92c53

Please sign in to comment.