From f313378bc3ddc4023b50c9e8fa0af4b72f34cc7c Mon Sep 17 00:00:00 2001 From: Tom Briden Date: Wed, 5 Jun 2013 14:21:24 +0100 Subject: changed to use a proper lucene query from using just artist/title parsed from filename --- .../github/daneren2005/dsub/service/OfflineMusicService.java | 10 ++++++++-- 1 file 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()); -- cgit v1.2.3