Is the set of mood labels provided by gracenote finite?
How can we access the full list of all those potential labels?
Thank you
Finally, I found the complete list from one of the Gracenote's App.
Level 1 moodId and moodData:
<string name="id65322">Peaceful</string>
<string name="id65323">Romantic</string>
<string name="id65324">Sentimental</string>
<string name="id42942">Tender</string>
<string name="id42946">Easygoing</string>
<string name="id65325">Yearning</string>
<string name="id42954">Sophisticated</string>
<string name="id42947">Sensual</string>
<string name="id65326">Cool</string>
<string name="id65327">Gritty</string>
<string name="id42948">Somber</string>
<string name="id42949">Melancholy</string>
<string name="id65328">Serious</string>
<string name="id65329">Brooding</string>
<string name="id42953">Fiery</string>
<string name="id42955">Urgent</string>
<string name="id42951">Defiant</string>
<string name="id42958">Aggressive</string>
<string name="id65330">Rowdy</string>
<string name="id42960">Excited</string>
<string name="id42961">Energizing</string>
<string name="id42945">Empowering</string>
<string name="id65331">Stirring</string>
<string name="id65332">Lively</string>
<string name="id65333">Upbeat</string>
<string name="id42966">Other</string>
Level 2 moodId and moodData
<string name="id42967">Reverent / Healing</string>
<string name="id42969">Quiet / Introspective</string>
<string name="id65334">Delicate / Tranquil</string>
<string name="id42972">Pastoral / Serene</string>
<string name="id42975">Lush / Romantic</string>
<string name="id42982">Sweet / Sincere</string>
<string name="id65335">Heartfelt Passion</string>
<string name="id42986">Dramatic / Romantic</string>
<string name="id42977">Lyrical Sentimental</string>
<string name="id42978">Gentle Bittersweet</string>
<string name="id42979">Tender / Sincere</string>
<string name="id43009">Cool Melancholy</string>
<string name="id65336">Romantic / Lyrical</string>
<string name="id42974">Refined / Mannered</string>
<string name="id43063">Awakening / Stately</string>
<string name="id65337">Light Groovy</string>
<string name="id42987">Friendly</string>
<string name="id65338">Hopeful / Breezy</string>
<string name="id43073">Cheerful / Playful</string>
<string name="id65339">Charming / Easygoing</string>
<string name="id43060">Sensitive / Exploring</string>
<string name="id65340">Energetic Yearning</string>
<string name="id65341">Energetic Dreamy</string>
<string name="id43046">Bittersweet Pop</string>
<string name="id42985">Smoky / Romantic</string>
<string name="id43015">Intimate Bittersweet</string>
<string name="id43017">Suave / Sultry</string>
<string name="id43018">Dark Playful</string>
<string name="id65342">Soft Soulful</string>
<string name="id42990">Sensual Groove</string>
<string name="id42992">Intimate</string>
<string name="id42993">Dreamy Pulse</string>
<string name="id43008">Cool Confidence</string>
<string name="id42988">Casual Groove</string>
<string name="id43010">Dark Groovy</string>
<string name="id43006">Wary / Defiant</string>
<string name="id43003">Depressed / Lonely</string>
<string name="id43004">Sober / Determined</string>
<string name="id43005">Gritty / Soulful</string>
<string name="id43011">Strumming Yearning</string>
<string name="id42994">Dark Cosmic</string>
<string name="id42995">Enigmatic / Mysterious</string>
<string name="id42996">Creepy / Ominous</string>
<string name="id42997">Solemn / Spiritual</string>
<string name="id42971">Mysterious / Dreamy</string>
<string name="id42999">Wistful / Forlorn</string>
<string name="id65343">Light Melancholy</string>
<string name="id43001">Sad / Soulful</string>
<string name="id43022">Thrilling</string>
<string name="id65344">Melodramatic</string>
<string name="id43023">Serious / Cerebral</string>
<string name="id43012">Hypnotic Rhythm</string>
<string name="id65345">Energetic Melancholy</string>
<string name="id43028">Alienated / Brooding</string>
<string name="id65346">Evocative / Intriguing</string>
<string name="id43025">Dreamy Brooding</string>
<string name="id65347">Dark Sparkling Lyrical</string>
<string name="id43013">Fiery Groove</string>
<string name="id43016">Passionate Rhythm</string>
<string name="id65348">Energetic Abstract Groove</string>
<string name="id43019">Dark Urgent</string>
<string name="id65349">Dark Pop</string>
<string name="id65350">Dark Pop Intensity</string>
<string name="id65351">Energetic Anxious</string>
<string name="id43030">Heavy Brooding</string>
<string name="id43036">Hard Dark Excitement</string>
<string name="id43037">Hard Positive Excitement</string>
<string name="id43007">Attitude / Defiant</string>
<string name="id65352">Dark Hard Beat</string>
<string name="id43032">Heavy Triumphant</string>
<string name="id43033">Chaotic / Intense</string>
<string name="id43034">Aggressive Power</string>
<string name="id43035">Driving Dark Groove</string>
<string name="id65353">Wild / Rowdy</string>
<string name="id43039">Ramshackle / Rollicking</string>
<string name="id43040">Confident / Tough</string>
<string name="id65354">Loud Celebratory</string>
<string name="id43042">Happy Excitement</string>
<string name="id65355">Upbeat Pop Groove</string>
<string name="id43053">Euphoric Energy</string>
<string name="id43050">Arousing Groove</string>
<string name="id43051">Heavy Beat</string>
<string name="id65356">Abstract Beat</string>
<string name="id43056">Edgy / Sexy</string>
<string name="id42983">Dramatic Emotion</string>
<string name="id43057">Powerful / Heroic</string>
<string name="id43058">Idealistic / Stirring</string>
<string name="id43059">Strong / Stable</string>
<string name="id43061">Jubilant / Soulful</string>
<string name="id43062">Triumphant / Rousing</string>
<string name="id43064">Focused Sparkling</string>
<string name="id43065">Invigorating / Joyous</string>
<string name="id43067">Showy / Rousing</string>
<string name="id43068">"Playful / Swingin'"</string>
<string name="id43070">Exuberant / Festive</string>
<string name="id43071">Lusty / Jaunty</string>
<string name="id65357">Happy / Soulful</string>
<string name="id43048">Carefree Pop</string>
<string name="id43072">Party / Fun</string>
<string name="id43076">Soulful / Easygoing</string>
I hope, it will help someone!
It is finite. There are 25 Level One moods and 100 Level Two moods. One can think that there are four level two more descriptive moods for every Level One mood.
Sorry I don't know the the full list, but you can get a String of the mood description this way:
GNDescriptor[] trackLevelMoods = bestResponse.getMood();
for(GNDescriptor trackMood: trackLevelMoods){
String moodDescriptor = trackMood.getData();
String moodId = trackMood.getId();
}
For the record here is how to access the 2 mood levels for a specific track using pygn:
import pygn
clientID = 'yourid#'
userID = pygn.register(clientID)
pygn.searchTrack(clientID, userID, 'James Blake', 'overgrown', 'overgrown')['mood']
Still won't give me the list of all possible moods though...
I'm afraid pygn does not support iterating moods (or other 'list based' data like genres).
However, this functionality is present in the GNSDK. There are plans to release an updated version of this SDK with a python wrapper early next year.
if you still want to retrieve all GraceNote moods I found a way with GNSDK, using the following code:
//listElements(1) will return the values from GNDataLevel1
//listElements(2) will return the values from GNDataLevel2
new GnList(GnListType.kListTypeMoods, locale, user).listElements(1);
Related
Recently, I discovered that <ComboBox>—and other controls—can have an <items> element underneath them .
How can I populate, or add items right to a control in the FXML markup?
(One use case for this might be to make the FXML semi-functional as a mockup to show to stakeholders.)
Research proves that it's done with a combination of the fx:value and fx:factory attributes. These seem to have been added in JavaFX 8 JavaFX 2.
Below, I'll cite the mechanisms and then give some examples.
🦶🔫 Warning:
Note, as #fabian does, that though this works well in the short term for something like a prototype or mockup, adding items directly to the FXML breaks the separation between model and view—and that may likely be an undesired result in the long term.
The Mechanisms
fx:value
The fx:value attribute can be used to initialize an instance of a type that does not have a default constructor but provides a static valueOf(String) method. For example, java.lang.String as well as each of the primitive wrapper types define a valueOf() method and can be constructed in FXML as follows:
<String fx:value="Hello, World!"/>
<Double fx:value="1.0"/>
<Boolean fx:value="false"/>
Custom classes that define a static valueOf(String) method can also be constructed this way.
Source: JavaFX 2 Introduction to FXML
fx:factory
The fx:factory attribute is another means of creating objects whose classes do not have a default constructor. The value of the attribute is the name of a static, no-arg factory method for producing class instances. For example, the following markup creates an instance of an observable array list, populated with three string values:
<FXCollections fx:factory="observableArrayList">
<String fx:value="A"/>
<String fx:value="B"/>
<String fx:value="C"/>
</FXCollections>
Source: JavaFX 2 Introduction to FXML
Some Examples:
ComboBox
<ComboBox value="One">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="Three"/>
<String fx:value="Two"/>
<String fx:value="One"/>
</FXCollections>
</items>
</ComboBox>
CheckComboBox
The ControlsFX Controls are a little different:
<CheckComboBox>
<items>
<String fx:value="One"/>
<String fx:value="Two"/>
<String fx:value="Three"/>
</items>
</CheckComboBox>
TableView
TableView gets a little more complicated because it needs CellValueFactorys to know which part of the Person to show in each column.
<TableView prefHeight="200.0" prefWidth="200.0">
<columns>
<TableColumn text="Name">
<cellValueFactory>
<PropertyValueFactory property="name" />
</cellValueFactory>
</TableColumn>
<TableColumn text="Comment">
<cellValueFactory>
<PropertyValueFactory property="comment" />
</cellValueFactory>
</TableColumn>
</columns>
<items>
<FXCollections fx:factory="observableArrayList">
<Person name="Jacob" comment="Hey!"/>
<Person name="Isabella" comment="Dude, we're in FXML!"/>
<Person name="Ethan" comment="No way!"/>
</FXCollections>
</items>
</TableView>
I have defined the combo Box in javaFX FXML file now i want to define it's function to get the value of Combo Box and use it in my code.
The FXML file is
<ComboBox fx:id="select_pc" promptText="Select PC">
<HBox.margin>
<Insets left="20.0" top="35.0" />
</HBox.margin>
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="ForkLift" />
<String fx:value="Gates" />
</FXCollections>
</items>
</ComboBox>
now can anybody tell me how to write a function to take the value of combo Box and use it in the String form
How can I move this to FXML?
hBox.getProperties().put("key", "value");
You can do
<HBox>
<properties key="value"/>
</HBox>
as in the documentation.
The variation
<HBox>
<properties>
<key>
<String fx:value="value"/>
</key>
</properties>
</HBox>
might be useful if the value you want is a more complex object:
<HBox>
<properties>
<character>
<String fx:value="Arthur Dent"/>
</character>
<actor>
<Actor firstName="Simon" lastName="Jones"/>
</actor>
<properties>
</HBox>
is equivalent to
Actor actor = new Actor();
actor.setFirstName("Simon");
actor.setLastName("Jones");
HBox hbox = new HBox();
hbox.getProperties().put("character", "Arthur Dent");
hbox.getProperties().put("actor", actor);
Person.java:
#XStreamAlias("person")
public class Person {
#XStreamAlias("id")
private Long personProfileId;
private String lastName;
private String firstName;
private String middleName;
private String nameSuffix;
private String namePrefix;
// etc ...
}
Spring configuration:
<bean id="contentNegotiationManager"
class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorPathExtension" value="false" />
<property name="favorParameter" value="true" />
<property name="ignoreAcceptHeader" value="true" />
<property name="useJaf" value="false" />
<property name="defaultContentType" value="application/xml" />
<property name="mediaTypes">
<map>
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
</map>
</property>
</bean>
<bean
class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="order" value="1" />
<property name="contentNegotiationManager" ref="contentNegotiationManager" />
<property name="defaultViews">
<list>
<bean
class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" />
<bean class="org.springframework.web.servlet.view.xml.MarshallingView">
<constructor-arg>
<bean class="org.springframework.oxm.xstream.XStreamMarshaller" />
</constructor-arg>
</bean>
</list>
</property>
</bean>
<mvc:annotation-driven
content-negotiation-manager="contentNegotiationManager" />
A call to http://mycompany.com:8080/myapp/persons?format=xml returns:
<?xml version="1.0" encoding="UTF-8"?>
<list>
<com.example.myapp.model.Person>
<personProfileId>1</personProfileId>
<lastName>McCartney</lastName>
<firstName>James</firstName>
<middleName>Paul</middleName>
</com.example.myapp.model.Person>
<com.example.myapp.model.Person>
<personProfileId>2</personProfileId>
<lastName>Lennon</lastName>
<firstName>John</firstName>
<middleName>Winston</middleName>
</com.example.myapp.model.Person>
<com.example.myapp.model.Person>
<personProfileId>3</personProfileId>
<lastName>Starkey</lastName>
<firstName>Richard</firstName>
</com.example.myapp.model.Person>
<com.example.myapp.model.Person>
<personProfileId>4</personProfileId>
<lastName>Harrison</lastName>
<firstName>George</firstName>
</com.example.myapp.model.Person>
</list>
I would expect it to return:
<?xml version="1.0" encoding="UTF-8"?>
<list>
<Person>
<id>1</id>
<lastName>McCartney</lastName>
<firstName>James</firstName>
<middleName>Paul</middleName>
</Person>
<Person>
<id>2</id>
<lastName>Lennon</lastName>
<firstName>John</firstName>
<middleName>Winston</middleName>
</Person>
<Person>
<id>3</id>
<lastName>Starkey</lastName>
<firstName>Richard</firstName>
</Person>
<Person>
<id>4</id>
<lastName>Harrison</lastName>
<firstName>George</firstName>
</Person>
</list>
It seems like XStream is correctly being called to marshall the object to XML, but that the #XStreamAlias annotations are being ignored. Is there some further configuration needed to get this to work?
I was trying to figure out this same thing (though with a Spring Boot project) and found an alternative: autodetectAnnotations.
xstreamMarshaller.setAutodetectAnnotations(true);
See this project, add the above line to the Application.java.
Figured it out. The annotated classes need to be explicitly identified to the XStreamMarshaller.
<property name="defaultViews">
<list>
<bean
class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" />
<bean class="org.springframework.web.servlet.view.xml.MarshallingView">
<constructor-arg>
<bean class="org.springframework.oxm.xstream.XStreamMarshaller">
<property name="annotatedClasses">
<array>
<value>com.example.myapp.model.Person</value>
</array>
</property></bean>
</constructor-arg>
</bean>
</list>
</property>
As per XStream documentation https://x-stream.github.io/annotations-tutorial.html
you have to use xstream.processAnnotations(MyPOJO.class);
My class:
public class Employee {
private String firstName;
private String lastName;
private Department department;
//with getters and setters
}
My employee-validation.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<validation xmlns="http://www.springmodules.org/validation/bean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost:8080/BVF http://localhost:8080/BVF/validation.xsd">
<class name="Employee">
<validator class="EmployeeValidator"/>
<property name="firstName">
<not-blank message="FirstName cannot be left blank"/>
<length min="5" max="20" message="First Name Length cannot be less than 5 or more than 20"/>
</property>
<property name="lastName">
<not-blank message="LastName cannot be left balnk"/>
<length min="5" max="20" message="Last Name Length cannot be less than 5 or more than 20"/>
</property>
<property name="department.name">
<not-blank message="Name cannot be blank"/>
<length min="5" max="20" message="Name Length cannot be less than 5 or more than 20"/>
</property>
<property name="department.pinCode">
<not-blank message="Pin Code cannot be left blank"/>
<regexp expression="^[A-Z\d{1}]\d{4}[\s\-]*\d*$" message="PinCode is invalid"/>
<length min="5" max="10" message="Pincode length should be between 5 and 10"/>
</property>
</class>
</validation>
can someone tell me how i can access the elements of department object, i.e. this part
<property name="department.pinCode">
i have found the solution, which is to use the cascade attribute.