Skip to content

Commit a26b848

Browse files
author
Chris Bellew
committed
Fixed crash when no current state is retrieved from the timeline. Doing a local scan when logged in to plex shouldn't be a silent one.
1 parent dc372a8 commit a26b848

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

Voice Control For Plex/src/main/java/com/atomjack/vcfp/PlayerState.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.atomjack.vcfp;
22

3+
import com.atomjack.vcfp.model.Timeline;
34
import com.google.android.gms.cast.MediaStatus;
45

56
public enum PlayerState {
@@ -19,6 +20,13 @@ else if(state.equals("buffering"))
1920
return STOPPED;
2021
}
2122

23+
public static PlayerState getState(Timeline t) {
24+
if(t == null)
25+
return STOPPED;
26+
else
27+
return getState(t.state);
28+
}
29+
2230
public static PlayerState getState(int state) {
2331
if(state == MediaStatus.PLAYER_STATE_PLAYING)
2432
return PLAYING;

Voice Control For Plex/src/main/java/com/atomjack/vcfp/RemoteScan.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public static void cancelScan() {
4343
}
4444

4545
public static void refreshResources(String authToken, final RefreshResourcesResponseHandler responseHandler, boolean silent) {
46+
cancel = false;
4647
VoiceControlForPlexApplication.hasDoneClientScan = true;
4748
VoiceControlForPlexApplication.servers = new ConcurrentHashMap<String, PlexServer>();
4849
String url = String.format("https://plex.tv/pms/resources?%s=%s", PlexHeaders.XPlexToken, authToken);

Voice Control For Plex/src/main/java/com/atomjack/vcfp/activities/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public void onSuccess() {
312312
searchDialog.dismiss();
313313
localScan.showPlexServers();
314314
} else
315-
localScan.searchForPlexServers(true);
315+
localScan.searchForPlexServers();
316316
}
317317

318318
@Override

Voice Control For Plex/src/main/java/com/atomjack/vcfp/services/PlexControlService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void onHandleIntent(final Intent intent) {
6565
};
6666
MediaContainer mc = PlexHttpClient.getSync(String.format("http://%s:%s/player/timeline/poll?commandID=0", client.address, client.port), headers);
6767
t = mc.getActiveTimeline();
68-
currentState = PlayerState.getState(t.state);
68+
currentState = PlayerState.getState(t);
6969
}
7070

7171
PlexResponse response = null;

0 commit comments

Comments
 (0)