From 5f45683e6937f13107775aa3434f7fcd01ebd9d6 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 11 Jun 2013 12:11:15 -0700 Subject: Fix offline scrobbling in case of deeper trees + non mp3s --- .../src/github/daneren2005/dsub/service/OfflineMusicService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'subsonic-android/src') diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java index 85d91b21..a9d18c5c 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java @@ -444,12 +444,15 @@ public class OfflineMusicService extends RESTMusicService { scrobbleSearchCriteria = scrobbleSearchCriteria.substring(1); } - scrobbleSearchCriteria = scrobbleSearchCriteria.replace(".complete", "").replace(".partial", "").replace(".mp3", ""); + scrobbleSearchCriteria = scrobbleSearchCriteria.replace(".complete", "").replace(".partial", ""); + int index = scrobbleSearchCriteria.lastIndexOf("."); + scrobbleSearchCriteria = index == -1 ? scrobbleSearchCriteria : scrobbleSearchCriteria.substring(0, index); 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)+"\""; + String artist = "artist:\"" + details[0] + "\""; + String title = details[details.length - 1]; + title = "title:\"" + title.substring(title.indexOf('-') + 1) + "\""; scrobbleSearchCriteria = artist + " AND " + title; -- cgit v1.2.3