From ae12e319a6567f6ee2106117ca3739dc3b2bf65a Mon Sep 17 00:00:00 2001 From: Thomas Menari Date: Tue, 12 Feb 2013 19:38:52 +0000 Subject: [PATCH] show title for found song --- modules/spotify/spotify.js | 5 +++-- modules/spotify/strings.json | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/spotify/spotify.js b/modules/spotify/spotify.js index b018cd9..e10203d 100644 --- a/modules/spotify/spotify.js +++ b/modules/spotify/spotify.js @@ -44,13 +44,14 @@ var spotify = function(dbot) { json: true }, function(error, response, body) { if (!error && response.statusCode == 200) { + var spotify = "\u00039spotify\u000f"; if (_.has(body, 'tracks') && body.tracks[0] && _.has(body.tracks[0], 'href')) { var t = body.tracks[0].href; t = t.replace(/:/g, '/'); t = t.replace(/spotify/, 'http://open.spotify.com'); - event.reply(t); + event.reply(dbot.t("found", {s: spotify, artist: _.map(body.tracks[0].artists, function(a) { return a.name }).join(', '), album: body.tracks[0].album.name, track: body.tracks[0].name, url: t})); } else { - event.reply(dbot.t("not-found", {s: "\u00039spotify\u000f"})); + event.reply(dbot.t("not-found", {s: spotify})); } } }); diff --git a/modules/spotify/strings.json b/modules/spotify/strings.json index e929996..0b0b815 100644 --- a/modules/spotify/strings.json +++ b/modules/spotify/strings.json @@ -8,6 +8,9 @@ "track": { "english": "{s} [track] {artist} - {track} (from {album})" }, + "found": { + "english": "{s} [{url}] {artist} - {track} (from {album})" + }, "not-found": { "english": "{s} No results." }