abhay123lp / tunesremote-plus

Automatically exported from code.google.com/p/tunesremote-plus
0 stars 0 forks source link

Sync from tunesremote-se r55 #67

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Attached is a patch to sync tunesremote+ dacp library to tunesremote-se r55.  
As before I've ensured tunesremote+ builds but have no way to test.

New features:
Radio streams
Control and current status of visualizer and fullscreen (used for visualizer or 
when playing videos)

Notes:
When reading the radio playlist you will be returned the following for each 
stream:
miid - id of stream
minm - name of stream
ascn - description of stream (comments field in itunes).

To find the radio database, the requesthelper now advertises itself as 
client-daap-version 3.10.  This results in an array of databases being returned 
in the database query instead of just one.  As far as I can tell the remote 
uses the mdbk (database kind?) field to determine which is which.
From what I have observed
mdbk 1 = local itunes database
mdbk 2 = shared itunes database on local network
mdbk 100 = radio database
Unfortunately I dont know if the other non-itunes dacp servers are populating 
this property, so there is a chance this patch may break compatibility.  If 
this is the case we could change the test for the local db to be mdbk==1 or 
mdbk not present and db is first in array.

Original issue reported on code.google.com by nick.gl...@lycos.com on 3 Jul 2011 at 9:19

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry that should have been enhancement.

Original comment by nick.gl...@lycos.com on 3 Jul 2011 at 9:19

GoogleCodeExporter commented 8 years ago
Once again this is good stuff. I might have some follow up questions for you!

Original comment by mellowaredev on 4 Jul 2011 at 1:11

GoogleCodeExporter commented 8 years ago
Emailed you some questions that were not quite appropriate to discuss on this 
thread.

Original comment by mellowaredev on 5 Jul 2011 at 1:03

GoogleCodeExporter commented 8 years ago
OK I incorporated your patch and made one minor change in the "mdbk" OTHER 
handling but other than that nothing broke and everything looks good.

I posted the latest BETA in the downloads for people to try before I deploy.

Original comment by mellowaredev on 8 Jul 2011 at 8:30

GoogleCodeExporter commented 8 years ago
No I don't think that will work right.
If controlling an iTunes session that can see a shared db you will end up 
controlling the last shared db in the list only.  I think this would be better:
{{{
      for (Response resp : databases.getNested("avdb").getNested("mlcl").findArray("mlit")) {
         // Local DB - mdbk = 1?
         if (resp.getNumberLong("mdbk") == 1 || !resp.containsValue("mdbk")) {
            this.databaseId = resp.getNumberLong("miid");
            this.databasePersistentId = resp.getNumberHex("mper");
            Log.d(TAG, String.format("found database-id=%s", this.databaseId));

         // Radio DB - mdbk = 100?
         } else if (resp.getNumberLong("mdbk") == 100) {
            this.radioDatabaseName = resp.getString("minm");
            this.radioDatabaseId = resp.getNumberLong("miid");
            this.radioPersistentId = resp.getNumberHex("mper");
            Log.d(TAG, String.format("found radio-database-id=%s", this.radioDatabaseId));

         // Other DB 
         // mdbk = 2 = shared db?
         } else {
            // We have found another database
            // I've seen shared libraries appear here
            Log.d(TAG, "found other-database = " + resp.getString("minm"));
         }
      }
}}}

If the mdbk field is present it follows my new logic.  Otherwise it updates the 
databaseId to whatever it finds.

Original comment by nick.gl...@lycos.com on 8 Jul 2011 at 8:44

GoogleCodeExporter commented 8 years ago
You are right.  I am testing against a server that returns only 1 database.  I 
will update the code as above.

Original comment by mellowaredev on 8 Jul 2011 at 10:00

GoogleCodeExporter commented 8 years ago
!resp.containsValue("mdbk")
should be
!resp.containsKey("mdbk")

Original comment by nick.gl...@lycos.com on 10 Jul 2011 at 5:42

GoogleCodeExporter commented 8 years ago
OK how does this look...

http://code.google.com/p/tunesremote-plus/source/browse/trunk/src/org/tunesremot
e/daap/Session.java?spec=svn83&r=83

Original comment by mellowaredev on 11 Jul 2011 at 12:18

GoogleCodeExporter commented 8 years ago
works for me

Original comment by nick.gl...@lycos.com on 11 Jul 2011 at 8:37

GoogleCodeExporter commented 8 years ago
Released on Android Market v 2.4.1

Original comment by mellowaredev on 24 Aug 2011 at 8:41