Skip to content

Commit 0e6f825

Browse files
author
Chris Bellew
committed
Added ability to play single song; Fixed bug where playback url was returning nothing, in the case of Roku clients; Fixed bugs where search would hang when scanning a server that has 0 music/tv/movie sections.
1 parent 90e8744 commit 0e6f825

File tree

9 files changed

+425
-18
lines changed

9 files changed

+425
-18
lines changed

AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.atomjack.vcfpht"
4-
android:versionCode="2"
5-
android:versionName="1.2" >
4+
android:versionCode="3"
5+
android:versionName="1.3" >
66

77
<uses-permission android:name="com.mohammadag.googlesearchapi.permission.ACCESS_GGOGLE_SEARCH_API" />
88
<uses-permission android:name="android.permission.INTERNET" />

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ Below are examples of what to say to Google Now to trigger playback. Sentence fr
3232

3333
"**Watch the latest episode of** *The Walking Dead*" - uses Plex's "on deck"
3434

35+
36+
### For Music:
37+
"**Listen to** *Black Sands* **by** *Bonobo*" - Listen to <song> by <artist>

res/layout/now_playing_music.xml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@+id/background"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent" >
6+
7+
<ImageView
8+
android:id="@+id/nowPlayingImage"
9+
android:layout_width="match_parent"
10+
android:layout_height="match_parent"
11+
android:layout_centerInParent="true"
12+
android:tileMode="repeat"
13+
android:layout_alignParentTop="true"
14+
android:layout_marginLeft="14dp" />
15+
16+
<TextView
17+
android:id="@+id/nowPlayingAlbum"
18+
android:layout_width="wrap_content"
19+
android:layout_height="wrap_content"
20+
android:layout_alignLeft="@+id/nowPlayingArtist"
21+
android:layout_alignParentRight="true"
22+
android:layout_centerVertical="true"
23+
android:textSize="20sp" />
24+
25+
<TextView
26+
android:id="@+id/nowPlayingTitle"
27+
android:layout_width="wrap_content"
28+
android:layout_height="wrap_content"
29+
android:layout_alignLeft="@+id/nowPlayingAlbum"
30+
android:layout_alignParentRight="true"
31+
android:layout_below="@+id/nowPlayingAlbum"
32+
android:layout_marginTop="18dp"
33+
android:textSize="18sp" />
34+
35+
<TextView
36+
android:id="@+id/nowPlayingArtist"
37+
android:layout_width="wrap_content"
38+
android:layout_height="wrap_content"
39+
android:layout_above="@+id/nowPlayingAlbum"
40+
android:layout_alignLeft="@+id/nowPlayingOnClient"
41+
android:layout_alignParentRight="true"
42+
android:layout_marginBottom="26dp"
43+
android:textSize="24sp" />
44+
45+
<TextView
46+
android:id="@+id/nowPlayingOnClient"
47+
android:layout_width="wrap_content"
48+
android:layout_height="wrap_content"
49+
android:layout_above="@+id/nowPlayingArtist"
50+
android:layout_alignLeft="@+id/nowPlayingImage"
51+
android:layout_marginBottom="28dp"
52+
android:layout_marginLeft="14dp"
53+
android:text="@string/now_playing_on"
54+
android:textColor="@color/white" />
55+
56+
</RelativeLayout>

src/com/atomjack/vcfpht/GoogleSearchPlexControlApplication.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public void onSuccess(String response) {
5050
if(mc.directories.get(i).getType().equals("show")) {
5151
server.addTvSection(mc.directories.get(i).getKey());
5252
}
53+
if(mc.directories.get(i).getType().equals("artist")) {
54+
server.addMusicSection(mc.directories.get(i).getKey());
55+
}
5356
}
5457
Log.v(MainActivity.TAG, "title1: " + mc.title1);
5558
if(mc.directories != null)

src/com/atomjack/vcfpht/GoogleSearchReceiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class GoogleSearchReceiver extends BroadcastReceiver {
1212
public void onReceive(Context context, Intent intent) {
1313
String queryText = intent.getStringExtra(GoogleSearchApi.KEY_QUERY_TEXT).toLowerCase();
1414

15-
if(queryText.startsWith("watch") || queryText.startsWith("resume watching")) {
15+
if(queryText.startsWith("watch") || queryText.startsWith("resume watching") || queryText.startsWith("listen to")) {
1616
Intent i = new Intent(context, PlayMediaActivity.class);
1717
i.putExtra("ORIGIN", "GoogleSearchReceiver");
1818
i.putExtra("queryText", queryText);

0 commit comments

Comments
 (0)