aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Briden <tom.briden@veritape.com>2013-06-05 14:21:24 +0100
committerTom Briden <tom.briden@veritape.com>2013-06-05 14:21:24 +0100
commitf313378bc3ddc4023b50c9e8fa0af4b72f34cc7c (patch)
tree5054897869625fff9fbe207fad97c1dedc6f86bd
parent081cd153f539a9b0627ec0ceac7fd8e68608f54d (diff)
downloaddsub-f313378bc3ddc4023b50c9e8fa0af4b72f34cc7c.tar.gz
dsub-f313378bc3ddc4023b50c9e8fa0af4b72f34cc7c.tar.bz2
dsub-f313378bc3ddc4023b50c9e8fa0af4b72f34cc7c.zip
changed to use a proper lucene query from using just artist/title parsed from filename
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
index d2f99d0b..9b4dde92 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -422,8 +422,14 @@ public class OfflineMusicService extends RESTMusicService {
if(scrobbleSearchCriteria.startsWith("/"))
scrobbleSearchCriteria = scrobbleSearchCriteria.substring(1);
- scrobbleSearchCriteria = scrobbleSearchCriteria.replace(".complete", "").replace(".partial", "");
- scrobbleSearchCriteria = scrobbleSearchCriteria.replace("/", " ").replace("-", "\\-").replace(".", "\\.");
+ scrobbleSearchCriteria = scrobbleSearchCriteria.replace(".complete", "").replace(".partial", "").replace(".mp3", "");
+ String[] details = scrobbleSearchCriteria.split("/");
+
+ //last.fm only uses artist and track title so broaden the search by just using those. doesn't matter if it find the track on a different album
+ String artist = "artist:\""+details[0]+"\"";
+ String title = "title:\""+details[2].substring(details[2].indexOf('-')+1)+"\"";
+
+ scrobbleSearchCriteria = artist + " AND " + title;
BufferedWriter bw = new BufferedWriter(new FileWriter(offlineScrobblesFile, true));
bw.write(scrobbleSearchCriteria + "," + System.currentTimeMillis());