|
Posts: 18
Registered: Feb 07, 2011
|
Posted: 2012-01-29 20:29:04
|
Hello EchoNest!
I'm having trouble getting around with Catalog API and jEN, specifically ArtistCatalog and favoring/unfavoring an artist. The problem is, that the jEN seems to try "favorite" as an action which isn't supported by the EchoNest API.
Let's say I create a new ArtistCatalog, then update it with an ArtistCatalogItem referring to a favored artist - something like:
final ArtistCatalogItem item = new ArtistCatalogItem(...unique ID here...);
item.setArtistID("AR5Z3L01187B99C5A9");
final CatalogUpdater catUpdater = new CatalogUpdater();
catUpdater.update(item);
Then I use the ArtistCatalog as a seed for a dynamic playlist. But how during the show, I could for example unfavor or even ban an artist using jEN? Using CatalogUpdater#ban() or #unfavorite() fails in 'invalid action'.
Best Regards,
Samuli Piela
|
|
|
Posts: 18
Registered: Feb 07, 2011
|
Posted: 2012-02-01 03:58:59
|
While waiting for an answer, I'm gonna hack it and hate it :) So I'm gonna use two separate catalogs, one for likes, one for dislikes and then use them both for playlist seeding. We'll see how that goes.
|
|
|
Posts: 18
Registered: Feb 07, 2011
|
Posted: 2012-02-01 12:13:25
|
Well, that didn't quite work either. Got internal server errors when trying to use seed_catalog=X...&seed_catalog=-Y..
So there, I fixed it:
package com.echonest.api.v4;
import java.util.HashMap;
import java.util.Map;
/**
* A quick'n'dirty work-around for implementing catalog ban while using jEN
*
* @author Samuli Piela
*/
public class HackCatalogUpdater extends CatalogUpdater {
public void ban(final CatalogItem item) {
final Map<String, Object> opMap = this.getOpMap("update", item);
((Map<String, Object>) opMap.get("item")).put("banned", Boolean.TRUE);
super.arry.add(opMap);
}
private Map<String, Object> getOpMap(final String action, final CatalogItem item) {
final Map<String, Object> opMap = new HashMap<String, Object>();
opMap.put("action", action);
opMap.put("item", item.getMap());
return opMap;
}
}
Then I create a dynamic playlist using the catalog as seed_catalog but still, when I ban an artist on the catalog, the dynamic playlist does occasionally return a song from that artist. catalog/read also displays 'banned' as true.
So the question is: How to do this the right way? Does updating the catalog also update the dynamic playlist automatically or do I have to create a new dynamic playlist after I've updated the catalog?
125Best Regards,
Samuli Piela125
|
|
|
Posts: 18
Registered: Feb 07, 2011
|
Posted: 2012-02-01 12:18:37
|
... Just to make myself absolutely clear, I mean:
1. Create ArtistCatalog with one artist
2. Dynamic playlist using ArtistCatalog as a seed
3. Next song.
4. Ban an artist, update ArtistCatalog
5. ... Has the active dynamic playlist session been adjusted accordingly?
s.
|
|
|
Posts: 713
Registered: Sep 08, 2008
|
Posted: 2012-02-01 13:45:52
|
Hi Playmedia - glad to see you were able to make some progress on the issue. Indeed the Java library is a bit behind the API. Thanks for pushing through. What playlist type are you creating? If you want to create a playlist where banned artists never appear in the playlist you need to create a playlist of type 'catalog' or 'catalog-radio'. -- Paul
|
|
|
Posts: 18
Registered: Feb 07, 2011
|
Posted: 2012-02-01 14:02:00
|
Hi Paul, thanks for the reply! Yes, I'm using catalog-radio. I think what I'd just like to know now, is if this is the right way to do it and if the changes made to the seed catalog, reflect the active dynamic playlist session instead of recreating the playlist on every catalog update...
I'm thinking to do the rating the same way with the hack.
Btw. I also read in the forums that you can use simultaneously song and artist catalogs as seeds for a dynamic playlist. I could use the song catalog for rating... Hmm..
|
|
|
Posts: 713
Registered: Sep 08, 2008
|
Posted: 2012-02-01 14:17:37
|
Ah I understand now what you are trying to do. In the current release, when the dynamic playlist session is started, the seed catalog is processed and any ratings and bans are incorporated into the playlist session. However, updates to a catalog after the playlist has started are not seen by the playlist session. Once a playlist session has started the only way to ban an artist is via the the playlisting api directly. In the near future we will be pushing out some upgrades that make it easier to tie playlist sessions with active catalog updates. Hope this helps. - Paul
|
|
|
Posts: 18
Registered: Feb 07, 2011
|
Posted: 2012-02-01 14:23:43
|
All right then. This answers my question perfectly. So I'll just need to work with the playlist steering while it's being active. Great. Thanks Paul!
|
|
|
Posts: 18
Registered: Feb 07, 2011
|
Posted: 2012-02-01 15:08:13
|
Damn.. I wish I could steer the playlist by adding an artist.. Now it'll reset it :/
|
|