cogitare / tunesremote-plus

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

Add Rating Stars On Now Playing Screen #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by pepijn.k...@gmail.com on 19 Dec 2010 at 10:55

GoogleCodeExporter commented 9 years ago
Sorry, was trying to commit a bug through my relatively new phone ;)...

Anyway it should look like this (please edit the original fields):

TITLE: 
As a user, I would like to rate the song thats currently playing.

DESCRIPTION:
Hi,

As a big fan of your product, I would like to suggest to have rating on the 
"currently playing screen". I use MediaMonkey and it would be great to do 
rating while sitting on the couch :D. 
Rating music is becoming more and more important to be able to handle big 
libraries people have nowadays.

What d'ya think?

cheer,
Pepijn Knetsch

Original comment by pepijn.k...@gmail.com on 19 Dec 2010 at 11:04

GoogleCodeExporter commented 9 years ago

Original comment by mellowaredev on 19 Dec 2010 at 4:12

GoogleCodeExporter commented 9 years ago
I mailed Melloware yesterday with pretty much the same feature request. Also, I 
would requiest a widget (4x1/3x1) with stars for rating currently played music 
from the homescreen/lockscreen (thanks to WidgetLocker). 

Original comment by rayner...@gmail.com on 19 Dec 2010 at 5:22

GoogleCodeExporter commented 9 years ago
A widget, awesome! But what do smell here...wait... its... feature creep...! :P

Original comment by pepijn.k...@gmail.com on 19 Dec 2010 at 10:04

GoogleCodeExporter commented 9 years ago
All the current developers have been notified.  We will see if someone wants to 
tackle this issue or maybe a fresh face in the crowd will pick it up and submit 
a patch!

Original comment by mellowaredev on 20 Dec 2010 at 3:02

GoogleCodeExporter commented 9 years ago
Featur creep occurs when basic features are covered and more features are 
implemented just to keep the consumer confidence that a product is still 
evolving. Rating is basic functionality right now deeply missing, and the 
ability to rate from the homescreen is a great comfort. Widgets are also not so 
hard to make, especially when there's pretty much no functionality beyond a 
text field for the currently playing song, eventually an album art if any, and 
some 5 stars. 

Original comment by rayner...@gmail.com on 20 Dec 2010 at 9:33

GoogleCodeExporter commented 9 years ago
raynerape, 

We have never built a widget but you just claimed above they are really easy to 
make.  Why not make the widget and send the patch in??? I would be happy to add 
it to the source code.  That is the the power of FOSS, the code is right here 
no one is hiding anything and anyone can implement a feature if it is approved.

Original comment by mellowaredev on 20 Dec 2010 at 11:45

GoogleCodeExporter commented 9 years ago
Unfortunately I am a user, not a programmer - if I could code it in, I probably 
would because I use remote apps for Android a lot. Apologies if I sounded too 
demanding, but this is an important feature to me. 

Original comment by rayner...@gmail.com on 20 Dec 2010 at 10:35

GoogleCodeExporter commented 9 years ago
Ahh I had assumed you were a developer when you said making widgets was easy.  
My bad on the assumption.

Original comment by mellowaredev on 21 Dec 2010 at 3:00

GoogleCodeExporter commented 9 years ago
What is the status of this? I have a bit of Android development experience and 
would like to give it a go but only if nobody else is looking at it.

Original comment by pepijn.k...@gmail.com on 22 Dec 2010 at 11:05

GoogleCodeExporter commented 9 years ago
As far as I know no one is looking at this issue so if you would like to take a 
shot at it please feel free to do so.

Original comment by mellowaredev on 22 Dec 2010 at 11:42

GoogleCodeExporter commented 9 years ago
I'm sorry to ask this question through this issue (I can't send an email to 
mellowar...@gmail.com), but I'm trying to build your read-only version of 
TunesRemote and it seems that this entry in strings.xml aborts AAPT build:

 <string name="notif_caption">%s - %s</string>

eclipse log:
org.eclipse.core.runtime.CoreException: 'aapt' error. Pre Compiler Build 
aborted.

What are you guys doing to get this building? Is there some developers IRC 
channel to discuss these kind of issues? (Instead of this tedious GoogleCode 
interface)

Original comment by pepijn.k...@gmail.com on 23 Dec 2010 at 9:49

GoogleCodeExporter commented 9 years ago
NO IRC Channel.

I just pulled down the latest code from /trunk and it compiled right away 
giving no warning or errors.

Original comment by mellowaredev on 23 Dec 2010 at 1:57

GoogleCodeExporter commented 9 years ago
Thats interesting... For me it works when I comment-out the whole entry. 
Anyway, I can compile now. Is there a trick to connect to the mediaserver by 
using the emulator? I see the code request in MonkeyTunes, I type it in, but 
TunesRemote stays in the pairing screen.

Original comment by pepijn.k...@gmail.com on 23 Dec 2010 at 2:13

GoogleCodeExporter commented 9 years ago
The emulator will not allow communication on Port 1024 to allow the protocol to 
finish.  Instead on the Pairing Screen click Menu->Manual Pairing and just type 
in the IP Address of your PC running MonkeyTunes and leave the Pin at the 16 
digit 000000000000001 value.  It should pair immediately.

Original comment by mellowaredev on 23 Dec 2010 at 2:15

GoogleCodeExporter commented 9 years ago
Also as a hint the rating values are 0-100 so in MonkeyTunes each star is 20 
points so 0, 20, 40, 60, 80, 100

The HTTP command sent from the device to MonkeyTunes looks like this...

/ctrl-int/1/setproperty?dacp.userrating=60&database-spec='dmap.persistentid:0x39
352B40'&item-spec='dmap.itemid:0x7c97'&session-id=1718634030

The above command should follow the other commands you see in TunesRemote+ and 
the userrating=60 means 3 stars and the other values are the track id etc.  
Should be similar to other commands you find in TunesRemote+

Original comment by mellowaredev on 23 Dec 2010 at 2:24

GoogleCodeExporter commented 9 years ago
Thanks! Emulator works now. Currently looking at class thats responsible for 
the queries.

Original comment by pepijn.k...@gmail.com on 23 Dec 2010 at 2:45

GoogleCodeExporter commented 9 years ago
Its nice code btw

Original comment by pepijn.k...@gmail.com on 23 Dec 2010 at 2:46

GoogleCodeExporter commented 9 years ago
HA!  I didn't write it I just took it over from the original developer Jeff 
Sharkey who abandoned the project when he was hired by Google.

Original comment by mellowaredev on 23 Dec 2010 at 3:00

GoogleCodeExporter commented 9 years ago
Ah Smart from Google...Any idea how to obtain the rating? is it with 
getproperty?

Original comment by pepijn.k...@gmail.com on 23 Dec 2010 at 4:04

GoogleCodeExporter commented 9 years ago
YEs the Rating is included with every track sent back to the device.   So if 
you look in TracksActivity.java you will see this line...

final String trackid = resp.getNumberString("miid");

That gets the unique track ID returned for a track.  The rating is in the field 
"asur" so you could retrieve it like this I think...

final long rating = resp.getNumberLong("asur");

Original comment by mellowaredev on 23 Dec 2010 at 4:28

GoogleCodeExporter commented 9 years ago
hmmm, but that looks like a different kind query where all this info is passed 
back to the device. In Status.java, this info is not passed along, unless we do 
a query explicitly.

Original comment by pepijn.k...@gmail.com on 23 Dec 2010 at 4:52

GoogleCodeExporter commented 9 years ago
You should only be trying to using rating stars on a track info that is loaded. 
 That is how the Apple REmote works.  When you double tap the album cover it 
shows the rest of the tracks of the album and the rating stars there.  There 
should NOT be a separate query, the rating stars of the currently playing track 
are available.  That is how it went and got the Album and Artist etc info.  The 
"asur" info was also passed back in the track.

Original comment by mellowaredev on 23 Dec 2010 at 4:58

GoogleCodeExporter commented 9 years ago
This is what I get back in the reponse hash, when I debug it:

{cana=Uman, caar=6, cavc=1, cann=Atmosphere, canl=Real Ibiza Vol. 4 CD1, 
canp=<npc's>, cast=290800, caps=4, cant=117576, carp=0, asai=1830, cash=0, 
cmvo=28, mstt=200, cmmk=1, caas=2, cmsr=219}

so...no asur. How can I get it without fetching it from server?

Original comment by pepijn.k...@gmail.com on 23 Dec 2010 at 5:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Ahh now you are finally starting to understand why Hyperfine Remote for iTunes 
makes you rate it on the list screen and why Apple Remote does it when you 
double tap the album cover to flip to the list of tracks.  ASUR is only 
returned in the list of tracks for each track and NOT for the response you 
listed above.

ASUR is only available from a tracks response like in the TracksActivity.java.

Now you should be able to determine the current track in the Now Playlist 
because it will be in the tracks list when you double tap the album cover.

Remember at the end of the day we are at the mercy of the Apple protocol and 
the way the "iTunes way of working" or how Apple wants you to work.  
TunesRemote+ and MonkeyTunes are just mere servants pretending to be iTunes and 
Apple Remote.

Original comment by mellowaredev on 24 Dec 2010 at 1:37

GoogleCodeExporter commented 9 years ago
Well, that was my idea: To do a fetch of the song's rating within a background 
thread invoked around the same time the albumart is fetched.

You confused me a bit with the response on comment 22.

Re iTunes dependency: Luckily there is always something like LEGACY, meaning 
iTunes cannot afford big changes to break bwc. ;)

Any hints about unique ID's a song has in the DB?

thanks

Original comment by pepijn.k...@gmail.com on 24 Dec 2010 at 9:15

GoogleCodeExporter commented 9 years ago
not a bad idea.   You will basically have to look at the query the 
TracksActivity is doing but do it just for the current song to retrieve the 
tracks response with the rating in it.

Also this will be done for every incoming song so we are now adding more HTTP 
traffic per every single song played to retrieve this data.   A better way 
might be to do the query the TracksActivity.java is doing and "cache" the 
results.  Then on the Now Playing change just scan through that cache for the 
song your are looking for by the values you have.  That way you don't have to 
re-query you will have the info readily available for the now playing song.

Original comment by mellowaredev on 24 Dec 2010 at 1:05

GoogleCodeExporter commented 9 years ago
I'm not sure about caching, since (at least in my case) I fiddle with the 
ratings at the server side too (in MediaMonkey) when listening to different 
songs.

Most interesting is that I've a query working. But I'm not 100% sure why it 
just returns the song thats currently playing!!

--------- 8< -----------

Response resp = 
RequestHelper.requestParsed(String.format("%s/databases/%d/items?session-id=%s&m
eta=dacp.userrating,daap.userrating&type=music&query='daap.songalbumid:%s'", 
session.getRequestBase(), session.databaseId, session.sessionId, albumId), 
false);

rating = 
resp.getNested("apso").getNested("mlcl").getNested("mlit").getNumberLong("asur")
;

--------- >8 -----------

Original comment by pepijn.k...@gmail.com on 24 Dec 2010 at 1:22

GoogleCodeExporter commented 9 years ago
hmmm, previous snippet doens't always seem to work...sometimes I get asur back 
sometimes not.

Original comment by pepijn.k...@gmail.com on 24 Dec 2010 at 1:29

GoogleCodeExporter commented 9 years ago
The query above should return you the whole album.  Each track is returned in 
the "mlit" and "mclc" field as you can see by the getNEsted() call.  So just 
from eyeing up your code it looks like you are always asking for the first 
track returned in the list.

Original comment by mellowaredev on 24 Dec 2010 at 1:30

GoogleCodeExporter commented 9 years ago
yeah, was expecting that...
I whish there is something like a track ID we could query.

Original comment by pepijn.k...@gmail.com on 24 Dec 2010 at 1:35

GoogleCodeExporter commented 9 years ago
your best bet might just be to follow Apple's UI and have the star rating on 
the double tap of the album cover when its showing the list of tracks for the 
album.

Original comment by mellowaredev on 24 Dec 2010 at 1:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Got it working for MediaMonkey (dunno about iTunes)! The itemid seems to be 
encoded in the GUID (canp) per song. I extract this bytes-wise (byte[12..15]) 
and do a asynchronous (threaded) query for user rating.

Patch is attached.

Original comment by pepijn.k...@gmail.com on 27 Dec 2010 at 9:11

Attachments:

GoogleCodeExporter commented 9 years ago
OK let me try this patch out!

Yes the itemid is in the CANP.  Why Apple chose to have CANP contain 4 
different id's is beyond me!

Great work!

Original comment by mellowaredev on 27 Dec 2010 at 9:57

GoogleCodeExporter commented 9 years ago
btw, the layout of the rating bar may have some TLC...

Op 27-12-2010 22:57, tunesremote-plus@googlecode.com schreef:

Original comment by pepijn.k...@gmail.com on 27 Dec 2010 at 9:59

GoogleCodeExporter commented 9 years ago
OK I loaded the patch but you missed one thing int the patch.  I am getting 
this error...

rating_bar cannot be resolved or is not a field ControlActivity.java    

one this line..

      this.ratingBar = (RatingBar) findViewById(R.id.rating_bar);

So it didn't fine the id.ratingbar in the act_control.xml layout file.  Just 
attach that file.

Original comment by mellowaredev on 27 Dec 2010 at 10:17

GoogleCodeExporter commented 9 years ago
Also you were right, i just reinstalled my Eclipse with the latest Android 2.3 
SDK and it had a problem with that values.xml "notif_caption" that you had.  I 
realized it was not being used anywhere so I removed it.

The old SDK did not give this error so it must have ignored properties that 
were not used.

Original comment by mellowaredev on 27 Dec 2010 at 10:25

GoogleCodeExporter commented 9 years ago
OK, here's the missing layout file.

Original comment by pepijn.k...@gmail.com on 27 Dec 2010 at 11:07

Attachments:

GoogleCodeExporter commented 9 years ago
I have tweaked the UI a bit so it has the same dark background and fades the 
same way the other sections do.  Other than that this looks great!

I have incorporated the patch and released version 2.0.6 on the Android Market. 
 I have also added you as a contributor to this project under the People 
section!

Original comment by mellowaredev on 28 Dec 2010 at 2:59

GoogleCodeExporter commented 9 years ago
Woot! :) Downloading it now...

Original comment by pepijn.k...@gmail.com on 28 Dec 2010 at 3:15

GoogleCodeExporter commented 9 years ago
Thank you guys! Off to check it out now.

Original comment by rayner...@gmail.com on 28 Dec 2010 at 6:51

GoogleCodeExporter commented 9 years ago
Is it just me or the stars don't show at all? I paired with iTunes on Mac, 
started songs with ratings, but saw no stars whatsoever on the main screen. 
Using 2.0.6

Original comment by rayner...@gmail.com on 28 Dec 2010 at 7:13

GoogleCodeExporter commented 9 years ago
Ah Ray, thanks for checking it on iTunes. TBH I've not checked/tested it on 
iTunes, so it might be that there is a bug or something... Let me install 
iTunes (and hope it doesn't crap up my music lib)

Original comment by pepijn.k...@gmail.com on 28 Dec 2010 at 7:22

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I just tested on iTunes and he is right the stars do not show up when connected 
to iTunes but do when connected to MonkeyTunes.

I will re-open this defect.

IT must be the query you are using happens to work in MonkeyTunes but NOT in 
iTunes for the fetchRating() method.  Thus it is returning -1 and not showing 
the stars.

Original comment by mellowaredev on 28 Dec 2010 at 9:37

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This is a lot trickier than MonkeyTunes.  In MT I added that backdoor of 
00000000000001.  

You will have to not use the emulator but debug from your device.  Plug your 
Android in and turn on USB Debugging in your settings.  Then you can simply run 
the app directly from your device while still getting the debug output in 
Eclipse.  That is the best way to test against iTunes.

Original comment by mellowaredev on 28 Dec 2010 at 11:08