We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 5ef00fa3 authored by Mike Sheldon's avatar Mike Sheldon

Provide a message when we run out of content in libredroid and bump the...

Provide a message when we run out of content in libredroid and bump the version number ready for release
parent 438bd291
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fm.libre.droid" package="fm.libre.droid"
android:versionCode="3" android:versionCode="4"
android:versionName="1.2"> android:versionName="1.4">
<application android:icon="@drawable/icon" android:label="@string/app_name"> <application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".LibreDroid" <activity android:name=".LibreDroid"
android:label="@string/app_name" android:label="@string/app_name"
......
...@@ -185,6 +185,11 @@ public class LibreService extends Service implements OnBufferingUpdateListener, ...@@ -185,6 +185,11 @@ public class LibreService extends Service implements OnBufferingUpdateListener,
public void play() { public void play() {
if (this.currentSong >= this.playlist.size()) { if (this.currentSong >= this.playlist.size()) {
this.getPlaylist(); this.getPlaylist();
if(this.playlist.size() == 0) {
Toast.makeText(this, "Sorry, this station doesn't appear to have any more content.", Toast.LENGTH_LONG).show();
this.stop();
return;
}
} }
this.playing = true; this.playing = true;
this.buffering = true; this.buffering = true;
...@@ -279,6 +284,7 @@ public class LibreService extends Service implements OnBufferingUpdateListener, ...@@ -279,6 +284,7 @@ public class LibreService extends Service implements OnBufferingUpdateListener,
public void getPlaylist() { public void getPlaylist() {
try { try {
String xspf = this.httpGet("http://alpha.libre.fm/radio/xspf.php?sk=" + this.sessionKey + "&desktop=1.0"); String xspf = this.httpGet("http://alpha.libre.fm/radio/xspf.php?sk=" + this.sessionKey + "&desktop=1.0");
Log.d("libredroid", "Fetching playlist from: http://alpha.libre.fm/radio/xspf.php?sk=" + this.sessionKey + "&desktop=1.0");
this.playlist.parse(xspf); this.playlist.parse(xspf);
} catch (Exception ex) { } catch (Exception ex) {
Log.w("libredroid", "Unable to process playlist: " + ex.getMessage()); Log.w("libredroid", "Unable to process playlist: " + ex.getMessage());
......
...@@ -62,7 +62,7 @@ public class Playlist extends DefaultHandler { ...@@ -62,7 +62,7 @@ public class Playlist extends DefaultHandler {
} }
public void endElement(String uri, String name, String qName) throws SAXException { public void endElement(String uri, String name, String qName) throws SAXException {
if (name.equals("track")) { if (name.equals("track") && !this.processingSong.location.equals("")) {
this.playlist.add(this.processingSong); this.playlist.add(this.processingSong);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment