Overview

Request 271 (accepted)

please disable on default and explicitly enable for 12.1

Submit package home:pansenma...es:Multimedia / libechonest to package Multimedia / libechonest

libechonest.spec Changed
x
 
1
@@ -1,9 +1,9 @@
2
 # vim: set sw=4 ts=4 et nu:
3
 
4
 Name:               libechonest
5
-Version:            1.2.0
6
-%define soname 1.2
7
-%define shlib  1_2
8
+Version:            2.0.1
9
+%define soname 2.0
10
+%define shlib  2_0
11
 Release:            0.pm.1
12
 Summary:            Qt Library for Communicating with The Echo Nest
13
 Source:             http://pwsp.cleinias.com/libechonest-%{version}.tar.bz2
14
libechonest-1.2.0.tar.bz2/CMakeLists.txt -> libechonest-2.0.1.tar.bz2/CMakeLists.txt Changed
32
 
1
@@ -16,9 +16,9 @@
2
 
3
 include( ${QT_USE_FILE} )
4
 
5
-set( ECHONEST_LIB_MAJOR_VERSION "1" )
6
-set( ECHONEST_LIB_MINOR_VERSION "2" )
7
-set( ECHONEST_LIB_PATCH_VERSION "0" )
8
+set( ECHONEST_LIB_MAJOR_VERSION "2" )
9
+set( ECHONEST_LIB_MINOR_VERSION "0" )
10
+set( ECHONEST_LIB_PATCH_VERSION "1" )
11
 set( ECHONEST_LIB_VERSION "${ECHONEST_LIB_MAJOR_VERSION}.${ECHONEST_LIB_MINOR_VERSION}.${ECHONEST_LIB_PATCH_VERSION}" )
12
 
13
 set( ECHONEST_LIB_VERSION_SONAME "${ECHONEST_LIB_MAJOR_VERSION}.${ECHONEST_LIB_MINOR_VERSION}")
14
@@ -26,11 +26,16 @@
15
 if (CMAKE_COMPILER_IS_GNUCXX)
16
     ADD_DEFINITIONS( -Wall -Wundef -Wcast-align -Wchar-subscripts -Wpointer-arith
17
        -Wwrite-strings -Wpacked -Wformat-security -Wmissing-format-attribute
18
-       -Wold-style-cast -Woverloaded-virtual -Wnon-virtual-dtor -Werror )
19
+       -Wold-style-cast -Woverloaded-virtual -Wnon-virtual-dtor )
20
     if ( NOT WIN32 )
21
         add_definitions( -fvisibility=hidden )
22
     endif()
23
 
24
+    # disable -Werror on ARM since Qt containers cause a lot of alignment warnings
25
+    if ( NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm" )
26
+        add_definitions( -Werror )
27
+    endif()
28
+
29
 # to be added:
30
 #       -Wshadow
31
 # FIXME we might want this one back in, but Qt 4.4.3 spits gazillions of warnings with it on Linux-64:
32
libechonest-1.2.0.tar.bz2/Doxyfile.in -> libechonest-2.0.1.tar.bz2/Doxyfile.in Changed
10
 
1
@@ -2,7 +2,7 @@
2
 # Project related configuration options, copied from ${KDE_SRC}/kdesdk/scripts/kdedoxygen.sh
3
 #---------------------------------------------------------------------------
4
 PROJECT_NAME           = libechonest
5
-PROJECT_NUMBER         = 0.1.1
6
+PROJECT_NUMBER         = 2.0.1
7
 OUTPUT_DIRECTORY       = apidocs
8
 CREATE_SUBDIRS         = NO
9
 OUTPUT_LANGUAGE        = English
10
libechonest-1.2.0.tar.bz2/README -> libechonest-2.0.1.tar.bz2/README Changed
26
 
1
@@ -1,7 +1,7 @@
2
 libechonest
3
 ===========
4
 
5
-libechonest is a collection of C++/Qt classes designed to make a developer's life 
6
+libechonest is a collection of C++/Qt classes designed to make a developer's life
7
 easy when trying to use the APIs provided by The Echo Nest. More information about
8
 the APIs can be found here:
9
 
10
@@ -32,7 +32,7 @@
11
 ===============
12
 The c++ API is meant to be as close to the Echo Nest API as possible. All Echo Nest
13
 API functions have been copied into their respective c++ equivalents, and string values
14
-converted to enums where reasonable. 
15
+converted to enums where reasonable.
16
 
17
 See the unit tests in tests/ for examples on how to use the classes.
18
 
19
@@ -50,5 +50,5 @@
20
 leo
21
 
22
 -------
23
-This README, and libechonest in general, is inspired from Max Howell's liblastfm,
24
+This README, and libechonest in general, is inspired by Max Howell's liblastfm,
25
  at http://www.github.com/mxcl/liblastfm.
26
libechonest-1.2.0.tar.bz2/TODO -> libechonest-2.0.1.tar.bz2/TODO Changed
8
 
1
@@ -1,4 +1,5 @@
2
 TODO list
3
 ========
4
+* Implement DynamicPlaylist::parseInfo
5
 * Add parsing of catalog ticket items. NOTE: I am unable to get any ticket items in my catalog/status calls, so skipping this for now
6
-* iImplement Catalog::parseDelete
7
+* Implement Catalog::parseDelete
8
libechonest-1.2.0.tar.bz2/src/Artist.cpp -> libechonest-2.0.1.tar.bz2/src/Artist.cpp Changed
46
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -359,7 +359,7 @@
9
 
10
     Echonest::Artist::SearchParams::const_iterator iter = params.constBegin();
11
     for( ; iter < params.constEnd(); ++iter )
12
-        url.addQueryItem( QLatin1String( searchParamToString( iter->first ) ), iter->second.toString().replace( QLatin1Char( ' ' ), QLatin1Char( '+' ) ) );
13
+        url.addEncodedQueryItem( searchParamToString( iter->first ), Echonest::escapeSpacesAndPluses( iter->second.toString() ) );
14
 
15
     return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
16
 }
17
@@ -403,7 +403,7 @@
18
 
19
     Echonest::Artist::SearchParams::const_iterator iter = params.constBegin();
20
     for( ; iter < params.constEnd(); ++iter )
21
-        url.addQueryItem( QLatin1String( searchParamToString( iter->first ) ), iter->second.toString().replace( QLatin1Char( ' ' ), QLatin1Char( '+' ) ) );
22
+        url.addEncodedQueryItem( searchParamToString( iter->first ), Echonest::escapeSpacesAndPluses( iter->second.toString() ) );
23
     url.addEncodedQueryItem( "limit", limit ? "true" : "false" );
24
     addQueryInformation( url, information );
25
 
26
@@ -446,7 +446,7 @@
27
 {
28
     QUrl url = Echonest::baseGetQuery( "artist", "suggest" );
29
     QString realname = name;
30
-    url.addQueryItem( QLatin1String( "name" ), realname.replace( QLatin1Char( ' ' ), QLatin1Char( '+' ) ) );
31
+    url.addEncodedQueryItem( "name", Echonest::escapeSpacesAndPluses( realname ) );
32
     url.addEncodedQueryItem( "results", QByteArray::number( results ) );
33
 
34
     return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
35
@@ -540,9 +540,7 @@
36
     if( !d->id.isEmpty() )
37
         url.addEncodedQueryItem( "id", d->id );
38
     else if( !d->name.isEmpty() ) {
39
-        QString name = d->name;
40
-        name.replace( QLatin1Char( ' ' ), QLatin1Char( '+' ) );
41
-        url.addQueryItem( QLatin1String( "name" ), name );
42
+        url.addEncodedQueryItem( "name", Echonest::escapeSpacesAndPluses( d->name ) );
43
     } else {
44
         qWarning() << "Artist method" << methodName << "called on an artist object without name or id!";
45
         return QUrl();
46
libechonest-1.2.0.tar.bz2/src/Artist.h -> libechonest-2.0.1.tar.bz2/src/Artist.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/ArtistTypes.cpp -> libechonest-2.0.1.tar.bz2/src/ArtistTypes.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/ArtistTypes.h -> libechonest-2.0.1.tar.bz2/src/ArtistTypes.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/ArtistTypes_p.h -> libechonest-2.0.1.tar.bz2/src/ArtistTypes_p.h Changed
71
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -29,7 +29,7 @@
9
 {
10
 public:
11
     AudioFileData() {}
12
-    AudioFileData( const AudioFileData& other ) {
13
+    AudioFileData( const AudioFileData& other ) : QSharedData( other ) {
14
         title = other.title;
15
         artist = other.artist;
16
         url = other.url;
17
@@ -54,7 +54,7 @@
18
 {
19
 public:
20
     BiographyData() {}
21
-    BiographyData( const BiographyData& other ) {
22
+    BiographyData( const BiographyData& other ) : QSharedData( other ) {
23
         url = other.url;
24
         text = other.text;
25
         site = other.site;
26
@@ -71,7 +71,7 @@
27
 {
28
 public:
29
     BlogData() {}
30
-    BlogData( const BlogData& other ) {
31
+    BlogData( const BlogData& other ) : QSharedData( other ) {
32
         name = other.name;
33
         url = other.url;
34
         date_posted = other.date_posted;
35
@@ -92,7 +92,7 @@
36
 {
37
 public:
38
     ArtistImageData() {}
39
-    ArtistImageData( const ArtistImageData& other ) {
40
+    ArtistImageData( const ArtistImageData& other ) : QSharedData( other ) {
41
         url = other.url;
42
         license = other.license;
43
     }
44
@@ -105,7 +105,7 @@
45
 {
46
 public:
47
     ReviewData() {}
48
-    ReviewData( const ReviewData& other ) {
49
+    ReviewData( const ReviewData& other ) : QSharedData( other ) {
50
         name = other.name;
51
         url = other.url;
52
         summary = other.summary;
53
@@ -130,7 +130,7 @@
54
 {
55
 public:
56
     TermData() {}
57
-    TermData( const TermData& other ) {   
58
+    TermData( const TermData& other ) : QSharedData( other ) {   
59
         name = other.name;
60
         frequency = other.frequency;
61
         weight = other.weight;
62
@@ -145,7 +145,7 @@
63
 {
64
 public:
65
     VideoData() {}
66
-    VideoData( const VideoData& other ) {
67
+    VideoData( const VideoData& other ) : QSharedData( other ) {
68
         title = other.title;
69
         url = other.url;
70
         site = other.site;
71
libechonest-1.2.0.tar.bz2/src/Artist_p.h -> libechonest-2.0.1.tar.bz2/src/Artist_p.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -33,7 +33,7 @@
9
 public:
10
     ArtistData() : familiarity( -1 ), hotttnesss( -1 ) {}
11
     ArtistData( const QByteArray& id, const QString& name ) : id( id ), name( name ), familiarity( -1 ), hotttnesss( -1 ) {}
12
-    ArtistData(const ArtistData& other)
13
+    ArtistData(const ArtistData& other) : QSharedData( other )
14
     {
15
         id = other.id;
16
         name = other.name;
17
libechonest-1.2.0.tar.bz2/src/AudioSummary.cpp -> libechonest-2.0.1.tar.bz2/src/AudioSummary.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/AudioSummary.h -> libechonest-2.0.1.tar.bz2/src/AudioSummary.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/AudioSummary_p.h -> libechonest-2.0.1.tar.bz2/src/AudioSummary_p.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -27,7 +27,7 @@
9
     AudioSummaryData() : key( -1 ), tempo( -1 ), mode( -1 ), time_signature( -1 ), duration( -1 ), loudness( -1 ), samplerate( -1 ), danceability( -1 ), energy( -1 ),
10
                          analysis_time( -1 ), status( -1 ), timestamp( -1 ), end_of_fade_in( -1 ), key_confidence( -1 ), mode_confidence( -1 ), num_samples( -1 ),
11
                          start_of_fade_out( -1 ), tempo_confidence( -1 ), time_signature_confidence( -1 ) {}
12
-    AudioSummaryData(const AudioSummaryData& other)
13
+    AudioSummaryData(const AudioSummaryData& other) : QSharedData( other )
14
     {
15
         key = other.key;
16
         tempo = other.tempo;
17
libechonest-1.2.0.tar.bz2/src/CMakeLists.txt -> libechonest-2.0.1.tar.bz2/src/CMakeLists.txt Changed
12
 
1
@@ -40,10 +40,6 @@
2
 
3
 QT4_WRAP_CPP( ${LIBECHONEST_H} )
4
 
5
-if (CMAKE_COMPILER_IS_GNUCXX)
6
-    add_definitions( -Werror )
7
-endif (CMAKE_COMPILER_IS_GNUCXX)
8
-
9
 SET( OS_SPECIFIC_LINK_LIBRARIES "" )
10
 IF( APPLE OR MINGW )
11
   SET( OS_SPECIFIC_LINK_LIBRARIES ${QJSON_LIBRARIES} )
12
libechonest-1.2.0.tar.bz2/src/Catalog.cpp -> libechonest-2.0.1.tar.bz2/src/Catalog.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/Catalog.h -> libechonest-2.0.1.tar.bz2/src/Catalog.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -218,7 +218,7 @@
9
 
10
 ECHONEST_EXPORT QDebug operator<<(QDebug d, const Catalog &catalog);
11
 
12
-};
13
+}
14
 
15
 Q_DECLARE_METATYPE( Echonest::Catalog )
16
 
17
libechonest-1.2.0.tar.bz2/src/CatalogArtist.cpp -> libechonest-2.0.1.tar.bz2/src/CatalogArtist.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/CatalogArtist.h -> libechonest-2.0.1.tar.bz2/src/CatalogArtist.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -44,7 +44,7 @@
9
 
10
 typedef QVector< CatalogArtist > CatalogArtists;
11
 
12
-};
13
+}
14
 
15
 Q_DECLARE_METATYPE( Echonest::CatalogArtist )
16
 #endif
17
libechonest-1.2.0.tar.bz2/src/CatalogItem.cpp -> libechonest-2.0.1.tar.bz2/src/CatalogItem.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/CatalogItem.h -> libechonest-2.0.1.tar.bz2/src/CatalogItem.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
-  * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+  * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
   *                                                                                      *
6
   * This program is free software; you can redistribute it and/or modify it under        *
7
   * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -84,7 +84,7 @@
9
 };
10
 
11
 typedef QVector< CatalogItem > CatalogItems;
12
-};
13
+}
14
 
15
 
16
 #endif
17
libechonest-1.2.0.tar.bz2/src/CatalogItem_p.h -> libechonest-2.0.1.tar.bz2/src/CatalogItem_p.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -31,7 +31,7 @@
9
 public:
10
     CatalogItemData() {}
11
     
12
-    CatalogItemData(const CatalogItemData& other)
13
+    CatalogItemData(const CatalogItemData& other) : QSharedData( other )
14
     {
15
         foreign_id = other.foreign_id;
16
         request = other.request;
17
libechonest-1.2.0.tar.bz2/src/CatalogSong.cpp -> libechonest-2.0.1.tar.bz2/src/CatalogSong.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/CatalogSong.h -> libechonest-2.0.1.tar.bz2/src/CatalogSong.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -42,7 +42,7 @@
9
 };
10
 
11
 typedef QVector< CatalogSong > CatalogSongs;
12
-};
13
+}
14
 
15
 
16
 Q_DECLARE_METATYPE( Echonest::CatalogSong )
17
libechonest-1.2.0.tar.bz2/src/CatalogUpdateEntry.cpp -> libechonest-2.0.1.tar.bz2/src/CatalogUpdateEntry.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/CatalogUpdateEntry.h -> libechonest-2.0.1.tar.bz2/src/CatalogUpdateEntry.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/CatalogUpdateEntry_p.h -> libechonest-2.0.1.tar.bz2/src/CatalogUpdateEntry_p.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -30,7 +30,7 @@
9
                           favoriteSet( false ), bannedSet( false ) 
10
     {}
11
     
12
-    CatalogUpdateEntryData( const CatalogUpdateEntryData& other ) {
13
+    CatalogUpdateEntryData( const CatalogUpdateEntryData& other ) : QSharedData( other ) {
14
         item_id = other.item_id;
15
         action = other.action;
16
         fp_code = other.fp_code;
17
libechonest-1.2.0.tar.bz2/src/Catalog_p.h -> libechonest-2.0.1.tar.bz2/src/Catalog_p.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -27,7 +27,7 @@
9
 {
10
 public:
11
     CatalogData() : total( 0 ), resolved( 0 ) {}
12
-    CatalogData( const CatalogData& other ) {
13
+    CatalogData( const CatalogData& other ) : QSharedData( other ) {
14
         name = other.name;
15
         id = other.id;
16
         type = other.type;
17
libechonest-1.2.0.tar.bz2/src/Config.cpp -> libechonest-2.0.1.tar.bz2/src/Config.cpp Changed
29
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  * Copyright (c) 2011 Jeff Mitchell <mitchell@kde.org>                                  *
6
  *                                                                                      *
7
  * This program is free software; you can redistribute it and/or modify it under        *
8
@@ -115,6 +115,7 @@
9
     ConfigPrivate()
10
     {
11
         threadNamHash QThread::currentThread()  = new QNetworkAccessManager();
12
+        ourNamSet.insert( QThread::currentThread() );
13
     }
14
 
15
     ~ConfigPrivate()
16
@@ -169,7 +170,12 @@
17
         oldNam = d->threadNamHash currThread ;
18
 
19
     if( oldNam == nam )
20
+    {
21
+        // If we're being passed back our own NAM, assume they want to
22
+        // ensure that we don't delete it out from under them
23
+        d->ourNamSet.remove( currThread );
24
         return;
25
+    }
26
 
27
     d->threadNamHash currThread  = nam;
28
     d->ourNamSet.remove( currThread );
29
libechonest-1.2.0.tar.bz2/src/Config.h -> libechonest-2.0.1.tar.bz2/src/Config.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/Generator.cpp -> libechonest-2.0.1.tar.bz2/src/Generator.cpp Changed
116
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -27,7 +27,7 @@
9
 QByteArray Echonest::Generator::catalogEntriesToJson( const Echonest::CatalogUpdateEntries& items )
10
 {
11
     QJson::Serializer s;
12
-    
13
+
14
     QVariant itms = catalogEntriesToVariant( items );
15
     QByteArray serialized = s.serialize( itms );
16
 //    qDebug() << "Serialized:" << serialized;
17
@@ -37,7 +37,7 @@
18
 QByteArray Echonest::Generator::catalogEntryToJson( const Echonest::CatalogUpdateEntry& item )
19
 {
20
     QJson::Serializer s;
21
-    
22
+
23
     QVariant itm = catalogEntryToVariant( item );
24
     QByteArray serialized = s.serialize( itm );
25
    // qDebug() << "Serialized:" << serialized;
26
@@ -51,7 +51,8 @@
27
     QVariantList itemList;
28
     foreach( const Echonest::CatalogUpdateEntry& item, items )
29
         itemList << catalogEntryToVariant( item );
30
-    
31
+
32
+    qDebug() << "Generated " << itemList.size() << "entries to catalog variant!";
33
     return itemList;
34
 }
35
 
36
@@ -59,60 +60,60 @@
37
 {
38
     QVariantMap itemMap;
39
     QVariantMap itm;
40
-    
41
+
42
     itemMap QLatin1String( "action" )  = Echonest::catalogUpdateActionToLiteral( item.action() );
43
-    
44
+
45
     if( item.itemId().isEmpty() )
46
         itm QLatin1String( "item_id" )  = QUuid::createUuid().toString().replace( QLatin1Char( '{' ), QString() ).replace( QLatin1Char( '}' ), QString() );
47
     else
48
         itm QLatin1String( "item_id" )  = item.itemId();
49
-    
50
+
51
     if( !item.fingerprint().isEmpty() )
52
         itm QLatin1String( "fp_code" )  = item.fingerprint();
53
-    
54
+
55
     if( !item.songId().isEmpty() )
56
         itm QLatin1String( "song_id" )  = item.songId();
57
-    
58
+
59
     if( !item.songName().isEmpty() )
60
         itm QLatin1String( "song_name" )  = item.songName();
61
-    
62
+
63
     if( !item.artistId().isEmpty() )
64
         itm QLatin1String( "artist_id" )  = item.artistId();
65
-    
66
+
67
     if( !item.artistName().isEmpty() )
68
         itm QLatin1String( "artist_name" )  = item.artistName();
69
-    
70
+
71
     if( !item.release().isEmpty() )
72
         itm QLatin1String( "release" )  = item.release();
73
-    
74
+
75
     if( !item.genre().isEmpty() )
76
         itm QLatin1String( "genre" )  = item.genre();
77
-    
78
+
79
     if( item.trackNumber() > -1 )
80
         itm QLatin1String( "track_number" )  = item.trackNumber();
81
-    
82
+
83
     if( item.discNumber() > -1 )
84
         itm QLatin1String( "disc_number" )  = item.discNumber();
85
-    
86
+
87
     if( !item.url().isEmpty() )
88
         itm QLatin1String( "url" )  = item.url();
89
-    
90
+
91
     if( item.favoriteSet() )
92
         itm QLatin1String( "favorite" )  = item.favorite();
93
-    
94
+
95
     if( item.bannedSet() )
96
         itm QLatin1String( "banned" )  = item.banned();
97
-    
98
+
99
     if( item.playCount() > -1 )
100
         itm QLatin1String( "play_count" )  = item.playCount();
101
-    
102
+
103
     if( item.skipCount() > -1 )
104
         itm QLatin1String( "skip_count" )  = item.skipCount();
105
-    
106
+
107
     if( item.rating() > -1 )
108
         itm QLatin1String( "rating" )  = item.rating();
109
-    
110
+
111
     itemMap QLatin1String( "item" )  = itm;
112
-    
113
+
114
     return itemMap;
115
 }
116
libechonest-1.2.0.tar.bz2/src/Generator_p.h -> libechonest-2.0.1.tar.bz2/src/Generator_p.h Changed
18
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -34,7 +34,7 @@
9
 QVariantList catalogEntriesToVariant( const CatalogUpdateEntries& items );
10
 QVariant catalogEntryToVariant( const CatalogUpdateEntry& item );
11
 
12
-};
13
+}
14
 
15
-};
16
+}
17
 #endif
18
libechonest-1.2.0.tar.bz2/src/Parsing.cpp -> libechonest-2.0.1.tar.bz2/src/Parsing.cpp Changed
87
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -837,6 +837,40 @@
9
     return sessionId;
10
 }
11
 
12
+Echonest::SongList Echonest::Parser::parseDynamicLookahead( QXmlStreamReader& xml ) throw( Echonest::ParseError )
13
+{
14
+    if( xml.atEnd() || xml.tokenType() != QXmlStreamReader::StartElement )
15
+        throw Echonest::ParseError( Echonest::UnknownParseError );
16
+
17
+    Echonest::SongList lookahead;
18
+
19
+    // Might not be any
20
+    if ( xml.name() != "lookahead" )
21
+        return lookahead;
22
+
23
+    while( !xml.atEnd() && ( xml.name() == "lookahead" && xml.tokenType() == QXmlStreamReader::StartElement ) ) {
24
+        // Read each lookahead track
25
+        Echonest::Song song;
26
+        while( !xml.atEnd() && ( xml.name() != "lookahead" || xml.tokenType() != QXmlStreamReader::EndElement ) ) {
27
+            if( xml.name() == "id" && xml.isStartElement() )
28
+                song.setId( xml.readElementText().toLatin1() );
29
+            else if( xml.name() == "title" && xml.isStartElement() )
30
+                song.setTitle( xml.readElementText() );
31
+            else if( xml.name() == "artist_id" && xml.isStartElement() )
32
+                song.setArtistId( xml.readElementText().toLatin1() );
33
+            else if( xml.name() == "artist_name" && xml.isStartElement() )
34
+                song.setArtistName( xml.readElementText() );
35
+
36
+            xml.readNext();
37
+        }
38
+        lookahead.append(song);
39
+
40
+        xml.readNext();
41
+    }
42
+
43
+    return lookahead;
44
+}
45
+
46
 // Catalogs parseCatalogList( QXmlStreamReader& xml ) throw( ParseError );
47
 Echonest::Catalogs Echonest::Parser::parseCatalogList( QXmlStreamReader& xml ) throw( Echonest::ParseError )
48
 {
49
@@ -1123,6 +1157,11 @@
50
 
51
     while( xml.name() != "response" || !xml.isEndElement() ) {
52
 //         qDebug() << "Parsing part of session info:" << xml.name() << xml.isStartElement();
53
+        // TODO
54
+    /** Sample output:
55
+     http://files.lfranchi.com/echonest_dynamic_info.xml
56
+
57
+
58
         if( xml.name() == "terms" && xml.isStartElement() ) {
59
             info.terms = parseTopTermList( xml );
60
             continue;
61
@@ -1153,7 +1192,7 @@
62
         } else if( xml.name() == "history" && xml.isStartElement() ) {
63
             info.history = parseSessionSongItem( xml, QLatin1String( "history" ) );
64
             continue;
65
-        }
66
+        }*/
67
         xml.readNext();
68
     }
69
     return info;
70
@@ -1176,7 +1215,8 @@
71
     }
72
     return rules;
73
 }
74
-
75
+/*
76
+ * TODO port to API v2
77
 QVector< Echonest::SessionItem > Echonest::Parser::parseSessionSongItem( QXmlStreamReader& xml, const QString& type ) throw( Echonest::ParseError )
78
 {
79
     if( xml.atEnd() || xml.name() != type || xml.tokenType() != QXmlStreamReader::StartElement )
80
@@ -1210,5 +1250,5 @@
81
         xml.readNext();
82
     }
83
     return items;
84
-}
85
+}*/
86
 
87
libechonest-1.2.0.tar.bz2/src/Parsing_p.h -> libechonest-2.0.1.tar.bz2/src/Parsing_p.h Changed
30
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -94,6 +94,7 @@
9
     License parseLicense( QXmlStreamReader& xml ) throw( ParseError );
10
 
11
     QByteArray parsePlaylistSessionId( QXmlStreamReader& xml ) throw( ParseError );
12
+    SongList parseDynamicLookahead( QXmlStreamReader& xml ) throw( ParseError );
13
 
14
     // Catalog functions
15
     Catalogs parseCatalogList( QXmlStreamReader& xml ) throw( ParseError );
16
@@ -112,10 +113,10 @@
17
 
18
     SessionInfo parseSessionInfo( QXmlStreamReader& xml ) throw( ParseError );
19
     QVector< QString > parseRulesList( QXmlStreamReader& xml ) throw( ParseError );
20
-    QVector< SessionItem > parseSessionSongItem( QXmlStreamReader& xml, const QString& type ) throw( ParseError );
21
+//     QVector< SessionItem > parseSessionSongItem( QXmlStreamReader& xml, const QString& type ) throw( ParseError );
22
 
23
-};
24
-};
25
+}
26
+}
27
 
28
 #endif
29
 
30
libechonest-1.2.0.tar.bz2/src/Playlist.cpp -> libechonest-2.0.1.tar.bz2/src/Playlist.cpp Changed
312
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -43,13 +43,13 @@
9
     return *this;
10
 }
11
 
12
-QNetworkReply* Echonest::DynamicPlaylist::start(const Echonest::DynamicPlaylist::PlaylistParams& params) const
13
+QNetworkReply* Echonest::DynamicPlaylist::create(const Echonest::DynamicPlaylist::PlaylistParams& params) const
14
 {
15
     // params are the same, if user passes in format parsing will throw, but it should be expected..
16
-    return generateInternal( params, "dynamic" );
17
+    return generateInternal( params, "dynamic/create" );
18
 }
19
 
20
-Echonest::Song Echonest::DynamicPlaylist::parseStart(QNetworkReply* reply) throw( Echonest::ParseError )
21
+void Echonest::DynamicPlaylist::parseCreate(QNetworkReply* reply) throw( Echonest::ParseError )
22
 {
23
     Echonest::Parser::checkForErrors( reply );
24
     QByteArray data = reply->readAll();
25
@@ -58,14 +58,14 @@
26
 
27
     Echonest::Parser::readStatus( xml );
28
     d->sessionId = Echonest::Parser::parsePlaylistSessionId( xml );
29
-    Echonest::SongList songs = Echonest::Parser::parseSongList( xml );
30
-    if( !songs.size() == 1 )
31
-        throw Echonest::ParseError( UnknownParseError );
32
 
33
-    d->currentSong = songs.front();
34
 
35
-    reply->deleteLater();
36
-    return d->currentSong;
37
+    Q_ASSERT( !d->sessionId.isEmpty() );
38
+}
39
+
40
+QNetworkReply* Echonest::DynamicPlaylist::restart(const Echonest::DynamicPlaylist::PlaylistParams& params) const
41
+{
42
+    return generateInternal( params, "dynamic/restart" );
43
 }
44
 
45
 QByteArray Echonest::DynamicPlaylist::sessionId() const
46
@@ -88,47 +88,139 @@
47
     d->currentSong = song;
48
 }
49
 
50
-QNetworkReply* Echonest::DynamicPlaylist::fetchNextSong(int rating) const
51
+QNetworkReply* Echonest::DynamicPlaylist::next( int results, int lookahead ) const
52
 {
53
-    QUrl url = Echonest::baseGetQuery( "playlist", "dynamic" );
54
+    QUrl url = Echonest::baseGetQuery( "playlist/dynamic", "next" );
55
     url.addEncodedQueryItem( "session_id", d->sessionId );
56
+    url.addEncodedQueryItem( "results", QByteArray::number( results ) );
57
+    url.addEncodedQueryItem( "lookahead", QByteArray::number( lookahead ) );
58
 
59
-    if( rating > 0 )
60
-        url.addEncodedQueryItem( "rating", QByteArray::number( rating ) );
61
+    return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
62
+}
63
+
64
+QNetworkReply* Echonest::DynamicPlaylist::fetchInfo() const
65
+{
66
+    QUrl url = Echonest::baseGetQuery( "playlist/dynamic", "info" );
67
+    url.addEncodedQueryItem( "session_id", d->sessionId );
68
 
69
     return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
70
+}
71
+
72
+
73
+Echonest::DynamicPlaylist::FetchPair Echonest::DynamicPlaylist::parseNext(QNetworkReply* reply) throw( Echonest::ParseError )
74
+{
75
+    Echonest::Parser::checkForErrors( reply );
76
 
77
+//     const QByteArray data = reply->readAll();
78
+//     qDebug() << data;
79
+    QXmlStreamReader xml( reply->readAll() );
80
+
81
+    Echonest::Parser::readStatus( xml );
82
+
83
+    Echonest::SongList lookahead = Echonest::Parser::parseDynamicLookahead( xml );
84
+    Echonest::SongList results = Echonest::Parser::parseSongList( xml );
85
+
86
+    reply->deleteLater();
87
+
88
+    return qMakePair(results, lookahead);
89
 }
90
 
91
-QNetworkReply* Echonest::DynamicPlaylist::fetchNextSong(const DynamicControls& controls) const
92
+QNetworkReply* Echonest::DynamicPlaylist::feedback(const Echonest::DynamicPlaylist::DynamicFeedback& feedback) const
93
 {
94
-    QUrl url = Echonest::baseGetQuery( "playlist", "dynamic" );
95
+    QUrl url = Echonest::baseGetQuery( "playlist/dynamic", "feedback" );
96
     url.addEncodedQueryItem( "session_id", d->sessionId );
97
 
98
-    DynamicControls::const_iterator iter = controls.begin();
99
-    for( ; iter != controls.end(); ++iter ) {
100
-        QString value = iter->second;
101
-        url.addEncodedQueryItem( dynamicControlToString( iter->first ), value.replace( QLatin1Char( ' ' ), QLatin1Char( '+' ) ).toUtf8() );
102
+    foreach( const Echonest::DynamicPlaylist::DynamicFeedbackParamData& param, feedback ) {
103
+        url.addEncodedQueryItem(dynamicFeedbackToString(param.first), param.second);
104
     }
105
 
106
     return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
107
 }
108
 
109
-QNetworkReply* Echonest::DynamicPlaylist::fetchSessionInfo() const
110
+void Echonest::DynamicPlaylist::parseFeedback(QNetworkReply* reply) const throw( Echonest::ParseError )
111
 {
112
-    QUrl url = Echonest::baseGetQuery( "playlist", "session_info" );
113
+    Echonest::Parser::checkForErrors( reply );
114
+
115
+    QXmlStreamReader xml( reply->readAll() );
116
+
117
+    Echonest::Parser::readStatus( xml );
118
+
119
+    reply->deleteLater();
120
+}
121
+
122
+QNetworkReply* Echonest::DynamicPlaylist::steer(const Echonest::DynamicPlaylist::PlaylistParams& steerParams) const
123
+{
124
+    QUrl url = Echonest::baseGetQuery( "playlist/dynamic", "steer" );
125
     url.addEncodedQueryItem( "session_id", d->sessionId );
126
 
127
+    foreach( const Echonest::DynamicPlaylist::PlaylistParamData& param, steerParams ) {
128
+        // HACK ARG min/max functions for steering are min_foo_bar, but params for static/initial seeds are foo_min_bar. can't reuse :(
129
+        QByteArray str;
130
+        switch ( param.first )
131
+        {
132
+            case Echonest::DynamicPlaylist::ArtistMinFamiliarity:
133
+                str = "min_artist_familiarity";
134
+                break;
135
+            case Echonest::DynamicPlaylist::ArtistMaxFamiliarity:
136
+                str = "max_artist_familiarity";
137
+                break;
138
+            case Echonest::DynamicPlaylist::ArtistMinHotttnesss:
139
+                str = "min_artist_hotttnesss";
140
+                break;
141
+            case Echonest::DynamicPlaylist::ArtistMaxHotttnesss:
142
+                str = "max_artist_hotttnesss";
143
+                break;
144
+            case Echonest::DynamicPlaylist::SongMinHotttnesss:
145
+                str = "min_song_hotttnesss";
146
+                break;
147
+            case Echonest::DynamicPlaylist::SongMaxHotttnesss:
148
+                str = "max_song_hotttnesss";
149
+                break;
150
+            case Echonest::DynamicPlaylist::MinEnergy:
151
+                str = "min_energy";
152
+                break;
153
+            case Echonest::DynamicPlaylist::MaxEnergy:
154
+                str = "max_energy";
155
+                break;
156
+            case Echonest::DynamicPlaylist::MinDanceability:
157
+                str = "min_danceability";
158
+                break;
159
+            case Echonest::DynamicPlaylist::MaxDanceability:
160
+                str = "max_danceability";
161
+                break;
162
+            case Echonest::DynamicPlaylist::MinLoudness:
163
+                str = "min_loudness";
164
+                break;
165
+            case Echonest::DynamicPlaylist::MaxLoudness:
166
+                str = "max_loudness";
167
+                break;
168
+            case Echonest::DynamicPlaylist::MinTempo:
169
+                str = "min_tempo";
170
+                break;
171
+            case Echonest::DynamicPlaylist::MaxTempo:
172
+                str = "max_tempo";
173
+                break;
174
+            default:
175
+                str = playlistParamToString( param.first );
176
+        }
177
+        url.addEncodedQueryItem(str, param.second.toString().toUtf8());
178
+    }
179
+
180
     return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
181
 }
182
 
183
-
184
-Echonest::Song Echonest::DynamicPlaylist::parseNextSong(QNetworkReply* reply)
185
+void Echonest::DynamicPlaylist::parseSteer(QNetworkReply* reply) const throw( Echonest::ParseError )
186
 {
187
-    return parseStart( reply );
188
+    Echonest::Parser::checkForErrors( reply );
189
+
190
+    QXmlStreamReader xml( reply->readAll() );
191
+
192
+    Echonest::Parser::readStatus( xml );
193
+
194
+    reply->deleteLater();
195
 }
196
 
197
-Echonest::SessionInfo Echonest::DynamicPlaylist::parseSessionInfo(QNetworkReply* reply) throw( Echonest::ParseError )
198
+Echonest::SessionInfo Echonest::DynamicPlaylist::parseInfo(QNetworkReply* reply) throw( Echonest::ParseError )
199
 {
200
     Echonest::Parser::checkForErrors( reply );
201
 
202
@@ -141,6 +233,26 @@
203
 
204
 }
205
 
206
+QNetworkReply* Echonest::DynamicPlaylist::deleteSession() const
207
+{
208
+    QUrl url = Echonest::baseGetQuery( "playlist/dynamic", "delete" );
209
+    url.addEncodedQueryItem( "session_id", d->sessionId );
210
+
211
+    return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
212
+}
213
+
214
+void Echonest::DynamicPlaylist::parseDeleteSession(QNetworkReply* reply)
215
+{
216
+    Echonest::Parser::checkForErrors( reply );
217
+
218
+    QXmlStreamReader xml( reply->readAll() );
219
+
220
+    Echonest::Parser::readStatus( xml );
221
+
222
+    d->sessionId.clear();
223
+
224
+    reply->deleteLater();
225
+}
226
 
227
 QNetworkReply* Echonest::DynamicPlaylist::staticPlaylist(const Echonest::DynamicPlaylist::PlaylistParams& params)
228
 {
229
@@ -208,11 +320,11 @@
230
         } else if( iter->first == SongInformation ){
231
             Echonest::Song::addQueryInformation( url, Echonest::SongInformation( iter->second.value< Echonest::SongInformation >() ) );
232
         } else {
233
-            url.addQueryItem( QLatin1String( playlistParamToString( iter->first ) ), iter->second.toString().replace( QLatin1Char( ' ' ), QLatin1Char( '+' ) ) );
234
+            url.addEncodedQueryItem( playlistParamToString( iter->first ), Echonest::escapeSpacesAndPluses( iter->second.toString() ) );
235
         }
236
     }
237
 
238
-    qDebug() << "Creating playlist URL" << url;
239
+//     qDebug() << "Creating playlist URL" << url;
240
     return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
241
 }
242
 
243
@@ -305,6 +417,24 @@
244
             return "style";
245
         case Echonest::DynamicPlaylist::Adventurousness :
246
             return "adventurousness";
247
+        case Echonest::DynamicPlaylist::MoreLikeThis :
248
+            return "more_like_this";
249
+        case Echonest::DynamicPlaylist::LessLikeThis :
250
+            return "less_like_this";
251
+        case Echonest::DynamicPlaylist::TargetTempo :
252
+            return "target_tempo";
253
+        case Echonest::DynamicPlaylist::TargetDanceability :
254
+            return "target_danceability";
255
+        case Echonest::DynamicPlaylist::TargetEnergy :
256
+            return "target_energy";
257
+        case Echonest::DynamicPlaylist::TargetLoudness :
258
+            return "target_loudness";
259
+        case Echonest::DynamicPlaylist::TargetArtistFamiliarity :
260
+            return "target_artist_familiarity";
261
+        case Echonest::DynamicPlaylist::TargetArtistHotttnesss :
262
+            return "target_artist_hotttnesss";
263
+        case Echonest::DynamicPlaylist::TargetSongHotttnesss :
264
+            return "target_song_hotttnesss";
265
     }
266
     return QByteArray();
267
 }
268
@@ -397,24 +527,32 @@
269
     return QByteArray();
270
 }
271
 
272
-QByteArray Echonest::DynamicPlaylist::dynamicControlToString(Echonest::DynamicPlaylist::DynamicControlItem control)
273
+QByteArray Echonest::DynamicPlaylist::dynamicFeedbackToString(Echonest::DynamicPlaylist::DynamicFeedbackParam param)
274
 {
275
-    switch( control )
276
+    switch( param )
277
     {
278
-        case Steer:
279
-            return "steer";
280
-        case SteerDescription:
281
-            return "steer_description";
282
-        case Rating:
283
-            return "rating";
284
-        case Ban:
285
-            return "ban";
286
+        case BanArtist:
287
+            return "ban_artist";
288
+        case FavoriteArtist:
289
+            return "favorite_artist";
290
+        case BanSong:
291
+            return "ban_song";
292
+        case FavoriteSong:
293
+            return "favorite_song";
294
+        case SkipSong:
295
+            return "skip_song";
296
+        case PlaySong:
297
+            return "play_song";
298
+        case UnplaySong:
299
+            return "unplay_song";
300
+        case RateSong:
301
+            return "rate_song";
302
         default:
303
+            Q_ASSERT(false);
304
             return "";
305
     }
306
 }
307
 
308
-
309
 QDebug Echonest::operator<<(QDebug d, const Echonest::DynamicPlaylist& playlist)
310
 {
311
     d << QString::fromLatin1( "DynamicPlaylist(%1, %2)" ).arg( QLatin1String( playlist.sessionId() ), playlist.currentSong().toString() );
312
libechonest-1.2.0.tar.bz2/src/Playlist.h -> libechonest-2.0.1.tar.bz2/src/Playlist.h Changed
231
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -33,35 +33,23 @@
9
 namespace Echonest{
10
 
11
     typedef struct {
12
-        qreal served_time;
13
-        QByteArray artist_id;
14
-        QByteArray id;
15
-        QString artist_name;
16
-        QString title;
17
-        int rating;
18
-    } SessionItem;
19
-
20
-    typedef struct {
21
-        TermList terms;
22
-        SongList seed_songs;
23
-//         description .. what data is in here?
24
-        Artists banned_artists;
25
-        QVector< QString > rules;
26
         QByteArray session_id;
27
-        Artists seeds;
28
-        QVector< SessionItem > skipped_songs;
29
-        QVector< SessionItem > banned_songs;
30
-        QString playlist_type;
31
-        Catalogs seed_catalogs;
32
-        QVector< SessionItem > rated_songs;
33
-        QVector< SessionItem > history;
34
+        Artists banned_artists;
35
+        Artists favorited_artists;
36
+        SongList banned_songs;
37
+        SongList favorited_songs;
38
+        QVariantMap options;
39
+        QVariantMap ratingsMap;
40
+        // TODO favorites_map
41
+        // TODO constraints
42
+
43
     } SessionInfo;
44
 
45
     /**
46
      * This encapsulates an Echo Nest dynamic playlist. It contains a playlist ID and
47
      *  the current song, and can fetch the next song.
48
      *
49
-     *  See http://developer.echonest.com/docs/v4/playlist.html#dynamic
50
+     *  See http://developer.echonest.com/docs/v4/playlist.html
51
      *   for more information
52
      */
53
     class ECHONEST_EXPORT DynamicPlaylist
54
@@ -175,25 +163,39 @@
55
             ChainXSPF, /// true, false    If true, returns an xspf for this dynamic playlist with 2 items. The second item will be a link to the API call for the next track in the chain. Please note that this sidesteps libechonest's handling of the tracks.
56
             Mood, /// A mood to limit this playlist to, for example "happy" or "sad". Multiples of this param are okay. See the method Artist::listTerms for details on what moods are currently available
57
             Style, /// A style to limit this playlist to, for example "happy" or "sad". Multiples of this param are okay. See the method Artist::listTerms for details on what styles are currently available
58
-            Adventurousness
59
+            Adventurousness, /// A value of 0 means no adventurousness, only known and preferred music will be played. A value of 1 means high adventurousness, mostly unknown music will be played. This parameter only applies to catalog and catalog-radio type playlists.
60
+            MoreLikeThis, /// When steering: Supply a song id to steer this session towards. Can be boosted from 0-5 like so: SO12341234^2. Default is 1
61
+            LessLikeThis, /// When steering: Supply a song id to steer this session away from. Can be boosted from 0-5 like so: SO12341234^2. Default is 1
62
+            TargetTempo, /// When steering: 0.0 < tempo < 500. (BPM). Target a desired tempo for the songs in this dynamic playlist session
63
+            TargetLoudness, /// When steering: -100. < loudness < 100. (BPM)dB. Target a desired loudness for the songs in this dynamic playlist session
64
+            TargetDanceability, /// When steering: 0.0 < danceability < 1. Target a desired danceability for the songs in this dynamic playlist session
65
+            TargetEnergy, /// When steering: 0.0 < energy < 1.Target a desired energy for the songs in this dynamic playlist session
66
+            TargetSongHotttnesss, /// When steering: 0.0 < song_hotttnesss < 1.Target a desired song_hotttnesss for the songs in this dynamic playlist session
67
+            TargetArtistHotttnesss, /// When steering: 0.0 < artist_hottttnesss < 1.Target a desired artist_hottttnesss for the songs in this dynamic playlist session
68
+            TargetArtistFamiliarity, /// When steering: 0.0 < artist_familiarity < 1.Target a desired energy for the artist_familiarity in this dynamic playlist session
69
         };
70
 
71
-        typedef QPair< PlaylistParam, QVariant > PlaylistParamData;
72
-        typedef QVector< PlaylistParamData > PlaylistParams;
73
-
74
         /**
75
-         * The various controls for a dynamic playlist.
76
-         *
77
-         * Please see The Echo Nest API documentation for more information
78
+         * The types of feedback that can be used to steer a dynamic playlist
79
          */
80
-        enum DynamicControlItem {
81
-          Steer = 0,
82
-          SteerDescription,
83
-          Rating,
84
-          Ban
85
+        enum DynamicFeedbackParam {
86
+            BanArtist, /// Ban this artist from this dynamic session. artist_id, track_id, song_id, "last"
87
+            FavoriteArtist, /// Mark this artist as 'liked' for this session. artist_id, track_id, song_id, "last"
88
+            BanSong, /// Ban this song from this dynamic session. track_id, song_id, "last"
89
+            SkipSong, /// Mark this song as skipped by the user. Will not appear for the rest of the session. track_id, song_id, "last"
90
+            FavoriteSong, /// Mark this song as a favorite. track_id, song_id, "last"
91
+            PlaySong, /// Mark this song as played. Unneeded unless you want to pre-seed a station. track_id, song_id, "last"
92
+            UnplaySong, /// Remove a song from a dynamic session's history. Will not blacklist the song. track_id, song_id, "last"
93
+            RateSong, /// Rate the desired song. track_id, song_id, "last"^0-10. E.g: "last^3" or "TRTLKZV12E5AC92E11^5"
94
         };
95
-        typedef QPair< DynamicControlItem, QString > DynamicControl;
96
-        typedef QVector< DynamicControl > DynamicControls;
97
+
98
+        typedef QPair< PlaylistParam, QVariant > PlaylistParamData;
99
+        typedef QVector< PlaylistParamData > PlaylistParams;
100
+
101
+        typedef QPair< DynamicFeedbackParam, QByteArray > DynamicFeedbackParamData;
102
+        typedef QVector< DynamicFeedbackParamData > DynamicFeedback;
103
+
104
+        typedef QPair< SongList, SongList > FetchPair;
105
 
106
         DynamicPlaylist();
107
         virtual ~DynamicPlaylist();
108
@@ -203,11 +205,21 @@
109
         /**
110
          * Start a dynamic playlist with the given parameters.
111
          *  Once the QNetworkReply has finished, pass it to parseStart()
112
-         *  and the inital song will be populated and returned. The sessionId(), currentSong(),
113
-         *  and fetchNextSong() methods will then be useful.
114
+         *
115
+         *  To fetch tracks, call fetchNextSong(). The info() method can be used
116
+         *   to extract session information
117
+         */
118
+        QNetworkReply* create( const PlaylistParams& params ) const;
119
+        void parseCreate( QNetworkReply* ) throw( ParseError );
120
+
121
+        /**
122
+         * Retart a dynamic playlist with the given parameters.
123
+         *  Once the QNetworkReply has finished, pass it to parseStart()
124
+         *
125
+         * This is the same as start(), except it maintains the history from an
126
+         *  already-existing playing station.
127
          */
128
-        QNetworkReply* start( const PlaylistParams& params ) const;
129
-        Song parseStart( QNetworkReply* ) throw( ParseError );
130
+        QNetworkReply* restart( const PlaylistParams& params ) const;
131
 
132
         /**
133
          * The session id of this dynamic playlist. If the playlist has ended, or has not been started,
134
@@ -225,27 +237,67 @@
135
         void setCurrentSong( const Song& song );
136
 
137
         /**
138
-         * Queries The Echo Nest for the next playable song in this
139
+         * Queries The Echo Nest for the next playable song(s) in this
140
          *  dynamic playlist.
141
          *
142
-         * Once the query has emitted the finished() signal, pass it to parseNextSong(), which will
143
-         *  return the new song to play. It will also set the current song to the newly parsed song.
144
+         * \param @results How many results to return, 1-5. This lets you
145
+         *                 reduce the calls if you need more than one. Default is 1.
146
+         * \param @lookahead The potential next songs (after the results)
147
+         *                   if there is no steering applied. 0-5, default of 0.
148
+         */
149
+        QNetworkReply* next( int results = 1, int lookahead = 0 ) const;
150
+
151
+        /**
152
+         * Return the result of a dynamic/next API call. This will return two lists:
153
+         * the "next" list and the "lookahead" list. Consult the \ref next() docs
154
+         * and The Echo Nest documentation for more information.
155
+         */
156
+        FetchPair parseNext( QNetworkReply* reply ) throw( ParseError );
157
+
158
+        /**
159
+         * Returns feedback to The Echo Nest for the currently playing dynamic
160
+         *  playlist.
161
+         *
162
+         * See The Echo Nest api documentation for complete details.
163
+         *
164
+         * \param feedback A list of feedback items to apply.
165
+         */
166
+        QNetworkReply* feedback(const DynamicFeedback& feedback) const;
167
+
168
+        /**
169
+         * Parses the result of the feedback call.
170
          *
171
-         * If the playlist has no more songs, the returned song object will be have no name nor id.
172
+         * Will throw an exception if the return code is not successful (as other parse methods do).
173
+         */
174
+        void parseFeedback(QNetworkReply* reply) const throw( ParseError );
175
+
176
+        /**
177
+         * Modifies the upcoming tracks in this dynamic playlist session by steering it.
178
          *
179
-         * @param rating The rating for the song that was just played. Ranges from 1 (lowest) to 5 (highest)
180
-         * @param controls The controls to apply when fetching the next track.
181
+         * Steering is additive, and can be reset for a dynamic playlist by calling reset.
182
+         *
183
+         * \param steerParams The desired steering params. Only use the enum values that correspond to valid steering commands.
184
+         */
185
+        QNetworkReply* steer(const PlaylistParams& steerParams) const;
186
+
187
+        /**
188
+         * Parses the result of the steer call.
189
          *
190
+         * Will throw an exception if the return code is not successful (as other parse methods do).
191
          */
192
-        QNetworkReply* fetchNextSong( int rating = -1 ) const;
193
-        QNetworkReply* fetchNextSong( const DynamicControls& controls ) const;
194
-        Song parseNextSong( QNetworkReply* reply );
195
+        void parseSteer(QNetworkReply* reply) const throw( ParseError );
196
 
197
         /**
198
          * Returns a description of this dynamic playlist session
199
          */
200
-        QNetworkReply* fetchSessionInfo() const;
201
-        SessionInfo parseSessionInfo( QNetworkReply* reply ) throw( ParseError );;
202
+        QNetworkReply* fetchInfo() const;
203
+        SessionInfo parseInfo( QNetworkReply* reply ) throw( ParseError );
204
+
205
+        /**
206
+         * Deletes a currently active playlist session. A non-commercial API can have, at most 1,000 active playlist sessions.
207
+         */
208
+        QNetworkReply* deleteSession() const;
209
+        void parseDeleteSession(QNetworkReply* reply);
210
 
211
         /**
212
          * Generate a static playlist, according to the desired criteria. Use parseXSPFPlaylist if
213
@@ -264,7 +316,7 @@
214
         static QNetworkReply* generateInternal( const PlaylistParams& params, const QByteArray& type );
215
         static QByteArray playlistSortToString(SortingType sorting);
216
         static QByteArray playlistArtistPickToString(ArtistPick pick);
217
-        static QByteArray dynamicControlToString(DynamicControlItem control);
218
+        static QByteArray dynamicFeedbackToString(DynamicFeedbackParam param);
219
 
220
         QSharedDataPointer<DynamicPlaylistData> d;
221
     };
222
@@ -272,7 +324,7 @@
223
     ECHONEST_EXPORT QDebug operator<<(QDebug d, const Echonest::DynamicPlaylist& playlist);
224
 
225
 
226
-}; // namespace
227
+} // namespace
228
 
229
 
230
 Q_DECLARE_METATYPE( Echonest::DynamicPlaylist )
231
libechonest-1.2.0.tar.bz2/src/Playlist_p.h -> libechonest-2.0.1.tar.bz2/src/Playlist_p.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -22,7 +22,7 @@
9
 {
10
 public:
11
     DynamicPlaylistData() {}
12
-    DynamicPlaylistData(const DynamicPlaylistData& other)
13
+    DynamicPlaylistData(const DynamicPlaylistData& other) : QSharedData(other)
14
     {
15
         sessionId = other.sessionId;
16
         currentSong = other.currentSong;
17
libechonest-1.2.0.tar.bz2/src/Song.cpp -> libechonest-2.0.1.tar.bz2/src/Song.cpp Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -197,7 +197,7 @@
9
 
10
     SearchParams::const_iterator iter = params.constBegin();
11
     for( ; iter < params.constEnd(); ++iter )
12
-        url.addQueryItem( QLatin1String( searchParamToString( iter->first ) ), iter->second.toString().replace( QLatin1Char( ' ' ), QLatin1Char( '+' ) ) );
13
+        url.addEncodedQueryItem( searchParamToString( iter->first ), Echonest::escapeSpacesAndPluses( iter->second.toString() ) );
14
 
15
     qDebug() << "Creating search URL" << url;
16
     return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
17
libechonest-1.2.0.tar.bz2/src/Song.h -> libechonest-2.0.1.tar.bz2/src/Song.h Changed
26
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -77,7 +77,7 @@
9
       MinEnergy,
10
       Mode,
11
       Key,
12
-      Sort,
13
+      Sort
14
   };
15
   typedef QPair< Echonest::Song::SearchParam, QVariant > SearchParamData;
16
   typedef QVector< SearchParamData > SearchParams;
17
@@ -236,7 +236,7 @@
18
 
19
 ECHONEST_EXPORT QDebug operator<<(QDebug d, const Song &song);
20
 
21
-}; // namespace
22
+} // namespace
23
 
24
 Q_DECLARE_METATYPE( Echonest::Song )
25
 
26
libechonest-1.2.0.tar.bz2/src/Song_p.h -> libechonest-2.0.1.tar.bz2/src/Song_p.h Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -30,7 +30,7 @@
9
 public:
10
     SongData() : hotttnesss( -1 ), artistHotttnesss( -1 ), artistFamiliarity( -1 ) { artistLocation.latitude = -1; artistLocation.longitude = -1; }
11
    
12
-    SongData(const SongData& other)
13
+    SongData(const SongData& other) : QSharedData( other )
14
     {
15
         id = other.id;
16
         title = other.title;
17
libechonest-1.2.0.tar.bz2/src/Track.cpp -> libechonest-2.0.1.tar.bz2/src/Track.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/Track.h -> libechonest-2.0.1.tar.bz2/src/Track.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/src/Track_p.h -> libechonest-2.0.1.tar.bz2/src/Track_p.h Changed
25
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -45,14 +45,14 @@
9
         request.setHeader( QNetworkRequest::ContentTypeHeader, QLatin1String( "application/x-www-form-urlencoded" ) );
10
         return Echonest::Config::instance()->nam()->post( request, data );
11
     }
12
-};
13
+}
14
 
15
 class TrackData : public QSharedData
16
 {
17
 public:
18
     TrackData() {}
19
 
20
-    TrackData(const TrackData& other)
21
+    TrackData(const TrackData& other) : QSharedData( other )
22
     {
23
         analyzer_version = other.analyzer_version;
24
         artist = other.artist;
25
libechonest-1.2.0.tar.bz2/src/TypeInformation.cpp -> libechonest-2.0.1.tar.bz2/src/TypeInformation.cpp Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -42,7 +42,7 @@
9
     QStringList idSpaces;
10
 };
11
 
12
-}; // namespace 
13
+} // namespace 
14
 Echonest::ArtistInformation::ArtistInformation() 
15
     : d_ptr( new Echonest::ArtistInformationPrivate )
16
 {
17
libechonest-1.2.0.tar.bz2/src/TypeInformation.h -> libechonest-2.0.1.tar.bz2/src/TypeInformation.h Changed
26
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -48,7 +48,7 @@
9
             Reviews = 0x0080,
10
             Terms = 0x0100,
11
             Urls = 0x200,
12
-            Videos = 0x0400,
13
+            Videos = 0x0400
14
         };
15
         Q_DECLARE_FLAGS( ArtistInformationFlags, ArtistInformationFlag )
16
         
17
@@ -127,7 +127,7 @@
18
     };
19
     
20
     Q_DECLARE_OPERATORS_FOR_FLAGS(SongInformation::SongInformationFlags)
21
-};
22
+}
23
 
24
 Q_DECLARE_METATYPE( Echonest::ArtistInformation )
25
 Q_DECLARE_METATYPE( Echonest::SongInformation )
26
libechonest-1.2.0.tar.bz2/src/Util.cpp -> libechonest-2.0.1.tar.bz2/src/Util.cpp Changed
33
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -18,6 +18,15 @@
9
 
10
 #include <QString>
11
 
12
+QByteArray Echonest::escapeSpacesAndPluses(const QString& in)
13
+{
14
+    // Echonest wants " " treated as "+", so we force QUrl to encode spaces as +es rather than %20
15
+    QByteArray escaped = QUrl::toPercentEncoding( in, " " );
16
+    escaped.replace( " ", "+" );
17
+    return escaped;
18
+}
19
+
20
+
21
 Echonest::Analysis::AnalysisStatus Echonest::statusToEnum(const QString& status)
22
 {
23
     if( status == QLatin1String("unknown") ) {
24
@@ -115,7 +124,7 @@
25
         return Echonest::CatalogTypes::Update;
26
     else if( type == "skip" )
27
         return Echonest::CatalogTypes::Skip;
28
-    
29
+
30
     return Echonest::CatalogTypes::Update;
31
 }
32
 
33
libechonest-1.2.0.tar.bz2/src/Util.h -> libechonest-2.0.1.tar.bz2/src/Util.h Changed
110
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -30,7 +30,7 @@
9
 namespace Echonest
10
 {
11
     namespace Analysis
12
-    {    
13
+    {
14
         enum AnalysisStatus {
15
             Unknown = 0,
16
             Pending = 1,
17
@@ -38,21 +38,21 @@
18
             Error = 4
19
         };
20
     }
21
-    
22
+
23
     namespace CatalogTypes
24
     {
25
         enum Type {
26
             Artist = 0,
27
             Song = 1
28
         };
29
-        
30
+
31
         enum Action {
32
             Delete,
33
             Update,
34
             Play,
35
             Skip
36
         };
37
-        
38
+
39
         enum TicketStatus {
40
             Unknown = 0,
41
             Pending = 1,
42
@@ -60,7 +60,7 @@
43
             Error = 4
44
         };
45
     }
46
-        
47
+
48
     typedef struct
49
     {
50
         qreal confidence;
51
@@ -84,45 +84,47 @@
52
         qreal start;
53
         QVector< qreal > timbre;
54
     } Segment;
55
-    
56
-    
57
+
58
+
59
     typedef QVector< Bar > BarList;
60
     typedef QVector< Beat > BeatList;
61
     typedef QVector< Section > SectionList;
62
     typedef QVector< Tatum > TatumList;
63
     typedef QVector< Segment > SegmentList;
64
-    
65
+
66
     typedef struct {
67
         QUrl url;
68
         QString attribution;
69
         QString type;
70
     } License;
71
-    
72
+
73
     typedef struct {
74
         QString catalog;
75
         QString foreign_id;
76
     } ForeignId;
77
-    
78
+
79
     typedef struct {
80
         qreal latitude;
81
         qreal longitude;
82
         QString location;
83
     } ArtistLocation;
84
-    
85
+
86
     typedef QVector< ForeignId > ForeignIds;
87
-        
88
+
89
+    QByteArray escapeSpacesAndPluses( const QString& in );
90
+
91
     Analysis::AnalysisStatus statusToEnum( const QString& status );
92
     QString statusToString( Analysis::AnalysisStatus status );
93
-    
94
+
95
     QByteArray catalogTypeToLiteral( CatalogTypes::Type );
96
     CatalogTypes::Type literalToCatalogType( const QByteArray& type );
97
-    
98
+
99
     QByteArray catalogStatusToLiteral( CatalogTypes::TicketStatus );
100
     CatalogTypes::TicketStatus literalToCatalogStatus( const QByteArray& type );
101
-    
102
+
103
     QByteArray catalogUpdateActionToLiteral( CatalogTypes::Action );
104
     CatalogTypes::Action literalToCatalogUpdateAction( const QByteArray& type );
105
-    
106
+
107
     ECHONEST_EXPORT QDebug operator<<(QDebug d, const ForeignId& id);
108
     ECHONEST_EXPORT QDebug operator<<(QDebug d, const ArtistLocation& id);
109
 }
110
libechonest-1.2.0.tar.bz2/src/echonest_export.h -> libechonest-2.0.1.tar.bz2/src/echonest_export.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/tests/ArtistTest.cpp -> libechonest-2.0.1.tar.bz2/tests/ArtistTest.cpp Changed
54
 
1
@@ -1,5 +1,5 @@
2
  /****************************************************************************************
3
-  * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+  * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
   *                                                                                      *
6
   * This program is free software; you can redistribute it and/or modify it under        *
7
   * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -69,7 +69,7 @@
9
     testArtist.parseProfile( reply );
10
 
11
     qDebug() << testArtist.audio().size();
12
-    QVERIFY( testArtist.audio().size() == 5 );
13
+    QVERIFY( testArtist.audio().size() == 2 );
14
 
15
     qDebug() << testArtist.audio().at(0).artist() << testArtist.audio().at(0).date() << testArtist.audio().at(0).id() << testArtist.audio().at(0).length() << testArtist.audio().at(0).release() <<
16
                 testArtist.audio().at(0).title() << testArtist.audio().at(0).url() << testArtist.audio().at(0).title() << testArtist.audio().at(0).link();
17
@@ -104,10 +104,26 @@
18
     testArtist.parseProfile( reply );
19
 
20
     qDebug() << testArtist.biographies().size();
21
-    QVERIFY( testArtist.biographies().size() == 13 );
22
+    QVERIFY( testArtist.biographies().size() > 5 );
23
 
24
 //     qDebug() << testArtist.biographies().at( 0 ).license().type << testArtist.biographies().at( 0 ).site() << testArtist.biographies().at( 0 ).text() << testArtist.biographies().at( 0 ).url();
25
 
26
+    try {
27
+        testArtist = Artist();
28
+        testArtist.setName( QLatin1String( "Florence + The Machine" ) );
29
+        reply = testArtist.fetchBiographies();
30
+        qDebug() << reply->url().toString();
31
+
32
+        loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
33
+        loop.exec();
34
+        testArtist.parseProfile( reply );
35
+
36
+        qDebug() << testArtist.biographies().size();
37
+        QVERIFY( testArtist.biographies().size() > 5 );
38
+    } catch ( Echonest::ParseError& e ) {
39
+        QVERIFY( false );
40
+    }
41
+
42
 }
43
 
44
 
45
@@ -490,7 +506,7 @@
46
     artists.clear();
47
     params.clear();
48
     params.append( Artist::SearchParamEntry( Artist::Name, QLatin1String( "Devo" ) ) );
49
-    params.append( Artist::SearchParamEntry( Artist::Name, QLatin1String( "The New Pornographers" ) ) );
50
+    params.append( Artist::SearchParamEntry( Artist::Name, QLatin1String( "Florence + The Machine" ) ) );
51
     params.append( Artist::SearchParamEntry( Artist::Name, QLatin1String( "Lady Gaga" ) ) );
52
     params.append( Artist::SearchParamEntry( Artist::MinFamiliarity, 0.5 ) );
53
 
54
libechonest-1.2.0.tar.bz2/tests/ArtistTest.h -> libechonest-2.0.1.tar.bz2/tests/ArtistTest.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/tests/CatalogTest.cpp -> libechonest-2.0.1.tar.bz2/tests/CatalogTest.cpp Changed
36
 
1
@@ -1,5 +1,5 @@
2
  /****************************************************************************************
3
-  * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+  * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
   *                                                                                      *
6
   * This program is free software; you can redistribute it and/or modify it under        *
7
   * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -25,7 +25,7 @@
9
 
10
 void CatalogTest::initTestCase()
11
 {
12
-    Echonest::Config::instance()->setAPIKey( "JGJCRKWLXLBZIFAZB" );
13
+    Echonest::Config::instance()->setAPIKey( "JRIHWEP6GPOER2QQ6" );
14
 }
15
 
16
 void CatalogTest::testList()
17
@@ -165,12 +165,12 @@
18
 void CatalogTest::testCreateUpdateDeleteSong()
19
 {
20
 
21
-//     {
22
-//         Echonest::Catalog c( "CAKOHPN131DA98630D" );
23
-//         QNetworkReply* reply = c.deleteCatalog();
24
-//     QEventLoop loop;
25
-//     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
26
-//     loop.exec(); exit(1);}
27
+    {
28
+        Echonest::Catalog c( "CAQBYCW132B7313E1A" );
29
+        QNetworkReply* reply = c.deleteCatalog();
30
+    QEventLoop loop;
31
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
32
+    loop.exec(); exit(1);}
33
 
34
     try {
35
         QNetworkReply* reply = Echonest::Catalog::create( QLatin1String( "unittest_catalog_song_X" ), Echonest::CatalogTypes::Song );
36
libechonest-1.2.0.tar.bz2/tests/CatalogTest.h -> libechonest-2.0.1.tar.bz2/tests/CatalogTest.h Changed
31
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -26,15 +26,18 @@
9
 private slots:
10
     void initTestCase();
11
     void cleanupTestCase();
12
-    
13
+
14
+
15
+    void testCreateUpdateDeleteSong();
16
+
17
     void testList();
18
+private:
19
     void testProfile();
20
     void testRead();
21
     void testStatus();
22
-    void testCreateUpdateDeleteSong();
23
+
24
     void testCreateUpdateDeleteArtist();
25
-    
26
-private:
27
+
28
     Echonest::Catalog m_songC;
29
     Echonest::Catalog m_artistC;
30
 };
31
libechonest-1.2.0.tar.bz2/tests/PlaylistTest.cpp -> libechonest-2.0.1.tar.bz2/tests/PlaylistTest.cpp Changed
372
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -63,6 +63,7 @@
9
     p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Artist, QLatin1String( "tallest man on earth" ) ) );
10
     p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Artist, QLatin1String( "bon iver" ) ) );
11
     p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Artist, QLatin1String( "mumford and sons" ) ) );
12
+    p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Artist, QLatin1String( "Florence + The Machine" ) ) );
13
     p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::ArtistMaxFamiliarity, 0.4 ) );
14
     p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::MinDanceability, 0.7 ) );
15
     p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Type, Echonest::DynamicPlaylist::ArtistType ) );
16
@@ -71,15 +72,16 @@
17
 
18
     QNetworkReply* reply = DynamicPlaylist::staticPlaylist( p );
19
 
20
-    qDebug() << reply->url().toString();
21
-    QCOMPARE( reply->url().toString(), QLatin1String( "http://developer.echonest.com/api/v4/playlist/static?api_key=JGJCRKWLXLBZIFAZB&format=xml&artist=tallest+man+on+earth&artist=bon+iver&artist=mumford+and+sons&artist_max_familiarity=0.4&min_danceability=0.7&type=artist&bucket=song_hotttnesss&bucket=artist_hotttnesss&bucket=artist_familiarity&results=4" ) );
22
+    qDebug() << reply->url().toEncoded();
23
+    QCOMPARE( QLatin1String( reply->url().toEncoded() ), QLatin1String( "http://developer.echonest.com/api/v4/playlist/static?api_key=JGJCRKWLXLBZIFAZB&format=xml&artist=tallest+man+on+earth&artist=bon+iver&artist=mumford+and+sons&artist=Florence+%2B+The+Machine&artist_max_familiarity=0.4&min_danceability=0.7&type=artist&bucket=song_hotttnesss&bucket=artist_hotttnesss&bucket=artist_familiarity&results=4" ) );
24
 
25
     QEventLoop loop;
26
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
27
     loop.exec();
28
     SongList songs = DynamicPlaylist::parseStaticPlaylist( reply );
29
 
30
-    QVERIFY( songs.size() == 4 );
31
+//     qDebug() << "Got songs;" << songs;
32
+    QVERIFY( songs.size() > 1 );
33
     Q_FOREACH( const Song& song, songs ) {
34
         QVERIFY( !song.id().isEmpty() );
35
     }
36
@@ -97,7 +99,7 @@
37
 
38
     reply = DynamicPlaylist::staticPlaylist( p );
39
 
40
-    qDebug() << reply->url().toString();
41
+//     qDebug() << reply->url().toString();
42
     QVERIFY( reply->url().toString() == QLatin1String( "http://developer.echonest.com/api/v4/playlist/static?api_key=JGJCRKWLXLBZIFAZB&format=xml&description=70s&description=folk^2&artist_min_familiarity=0.4&max_tempo=100&mode=0&type=artist-description&style=acoustic&bucket=audio_summary&bucket=song_hotttnesss&bucket=artist_hotttnesss&bucket=artist_familiarity&results=7" ) );
43
 
44
     QEventLoop loop2;
45
@@ -108,7 +110,7 @@
46
     QVERIFY( songs.size() == 7 );
47
     Q_FOREACH( const Song& song, songs ) {
48
         QVERIFY( !song.id().isEmpty() );
49
-        qDebug() << song << song.audioSummary();
50
+//         qDebug() << song << song.audioSummary();
51
         QVERIFY( song.audioSummary().duration() > 0 );
52
     }
53
 
54
@@ -161,37 +163,44 @@
55
     p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Mood, QLatin1String( "sad" ) ) );
56
 
57
     DynamicPlaylist playlist;
58
-    QNetworkReply* reply = playlist.start( p );
59
+    QNetworkReply* reply = playlist.create( p );
60
 
61
     qDebug() << reply->url().toString();
62
-    QCOMPARE( reply->url().toString(), QLatin1String( "http://developer.echonest.com/api/v4/playlist/dynamic?api_key=JGJCRKWLXLBZIFAZB&format=xml&artist=tallest+man+on+earth&artist=fleet+foxes&artist=johnny+cash&artist=crosby,+stills,+nash+and+young&type=artist-radio&artist_min_hotttnesss=0.6&artist_max_familiarity=0.4&mood=sad" ) );
63
+    QCOMPARE( reply->url().toString(), QLatin1String( "http://developer.echonest.com/api/v4/playlist/dynamic/create?api_key=JGJCRKWLXLBZIFAZB&format=xml&artist=tallest+man+on+earth&artist=fleet+foxes&artist=johnny+cash&artist=crosby,+stills,+nash+and+young&type=artist-radio&artist_min_hotttnesss=0.6&artist_max_familiarity=0.4&mood=sad" ) );
64
 
65
     QEventLoop loop;
66
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
67
     loop.exec();
68
-    Song song = playlist.parseStart( reply );
69
+    playlist.parseCreate( reply );
70
+
71
+    reply = playlist.next( 1 );
72
+
73
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
74
+    loop.exec();
75
+
76
+    Song song = playlist.parseNext( reply ).first.first();
77
+//     qDebug() << "next:" << song;
78
 
79
-    qDebug() << "next:" << song;
80
     QVERIFY( !song.id().isEmpty() );
81
     QVERIFY( !song.title().isEmpty() );
82
 
83
-    reply = playlist.fetchNextSong( 1 );
84
+    reply = playlist.next( 1 );
85
 
86
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
87
     loop.exec();
88
-    song = playlist.parseNextSong( reply );
89
+    song = playlist.parseNext( reply ).first.first();
90
 
91
-    qDebug() << "next:" << song;
92
+//     qDebug() << "next:" << song;
93
     QVERIFY( !song.id().isEmpty() );
94
     QVERIFY( !song.title().isEmpty() );
95
 
96
-    reply = playlist.fetchNextSong( 1 );
97
+    reply = playlist.next( 1 );
98
 
99
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
100
     loop.exec();
101
-    song = playlist.parseNextSong( reply );
102
+    song = playlist.parseNext( reply ).first.first();
103
 
104
-    qDebug() << "next:" << song;
105
+//     qDebug() << "next:" << song;
106
     QVERIFY( !song.id().isEmpty() );
107
     QVERIFY( !song.title().isEmpty() );
108
 }
109
@@ -212,71 +221,90 @@
110
     p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::SongInformation, QVariant::fromValue( Echonest::SongInformation( Echonest::SongInformation::AudioSummaryInformation | Echonest::SongInformation::Hotttnesss | Echonest::SongInformation::ArtistHotttnesss | Echonest::SongInformation::ArtistFamiliarity ) ) ) );
111
 
112
     DynamicPlaylist playlist;
113
-    QNetworkReply* reply = playlist.start( p );
114
+    QNetworkReply* reply = playlist.create( p );
115
 
116
     qDebug() << reply->url().toString();
117
-    QVERIFY( reply->url().toString() == QLatin1String( "http://developer.echonest.com/api/v4/playlist/dynamic?api_key=JGJCRKWLXLBZIFAZB&format=xml&artist=pink+floyd^-1&artist=the+who&artist=queen&artist=led+zeppelin^2&artist=-the+beatles&type=artist&artist_min_hotttnesss=0.7&artist_max_familiarity=0.3&min_loudness=-10&mode=1&bucket=audio_summary&bucket=song_hotttnesss&bucket=artist_hotttnesss&bucket=artist_familiarity" ) );
118
+    QCOMPARE( reply->url().toString(), QLatin1String( "http://developer.echonest.com/api/v4/playlist/dynamic/create?api_key=JGJCRKWLXLBZIFAZB&format=xml&artist=pink+floyd^-1&artist=the+who&artist=queen&artist=led+zeppelin^2&artist=-the+beatles&type=artist&artist_min_hotttnesss=0.7&artist_max_familiarity=0.3&min_loudness=-10&mode=1&bucket=audio_summary&bucket=song_hotttnesss&bucket=artist_hotttnesss&bucket=artist_familiarity" ) );
119
 
120
     QEventLoop loop;
121
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
122
     loop.exec();
123
-    Song song = playlist.parseStart( reply );
124
+    playlist.parseCreate( reply );
125
+
126
+    reply = playlist.next( 1 );
127
+
128
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
129
+    loop.exec();
130
+    Echonest::Song song = playlist.parseNext( reply ).first.first();
131
 
132
-    qDebug() << "next:" << song;
133
+//     qDebug() << "next:" << song;
134
     QVERIFY( !song.id().isEmpty() );
135
     QVERIFY( !song.title().isEmpty() );
136
 
137
     // GET NEXT
138
-    reply = playlist.fetchNextSong( 1 );
139
+    reply = playlist.next( 1 );
140
 
141
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
142
     loop.exec();
143
-    song = playlist.parseNextSong( reply );
144
+    song = playlist.parseNext( reply ).first.first();
145
 
146
-    qDebug() << "next:" << song;
147
+//     qDebug() << "next:" << song;
148
     QVERIFY( !song.id().isEmpty() );
149
     QVERIFY( !song.title().isEmpty() );
150
 
151
     // GET NEXT
152
-    reply = playlist.fetchNextSong( 1 );
153
+    reply = playlist.next( 1 );
154
 
155
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
156
     loop.exec();
157
-    song = playlist.parseNextSong( reply );
158
+    song = playlist.parseNext( reply ).first.first();
159
 
160
-    qDebug() << "next:" << song;
161
+//     qDebug() << "next:" << song;
162
     QVERIFY( !song.id().isEmpty() );
163
     QVERIFY( !song.title().isEmpty() );
164
 
165
     // GET NEXT
166
-    DynamicPlaylist::DynamicControls controls;
167
-    controls.append( DynamicPlaylist::DynamicControl( DynamicPlaylist::Steer, QLatin1String( "energy^2" ) ) );
168
-    controls.append( DynamicPlaylist::DynamicControl( DynamicPlaylist::Rating, QLatin1String( "4" ) ) );
169
-    reply = playlist.fetchNextSong( controls );
170
-    qDebug() << "Control URL:" << reply->url().toString();
171
+    DynamicPlaylist::PlaylistParams steering;
172
+    steering.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::TargetEnergy, QLatin1String( ".8" ) ) );
173
+    steering.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::ArtistMinFamiliarity, QLatin1String( ".5" ) ) );
174
+
175
+    reply = playlist.steer( steering );
176
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
177
     loop.exec();
178
-    song = playlist.parseNextSong( reply );
179
-    qDebug() << "next steered:" << song;
180
+    playlist.parseSteer( reply );
181
+
182
+    reply = playlist.next( 1 );
183
+//     qDebug() << "Control URL:" << reply->url().toString();
184
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
185
+    loop.exec();
186
+    song = playlist.parseNext( reply ).first.first();
187
+//     qDebug() << "next steered:" << song;
188
     QVERIFY( !song.id().isEmpty() );
189
     QVERIFY( !song.title().isEmpty() );
190
 
191
     // GET NEXT
192
-    controls.clear();
193
-//     controls.append( DynamicPlaylist::DynamicControl( DynamicPlaylist::SteerDescription, QLatin1String( "harp^2" ) ) ); // TODO API gives error atm
194
-    controls.append( DynamicPlaylist::DynamicControl( DynamicPlaylist::Ban, QLatin1String( "artist" ) ) );
195
-    controls.append( DynamicPlaylist::DynamicControl( DynamicPlaylist::Ban, QLatin1String( "song" ) ) );
196
-    reply = playlist.fetchNextSong( controls );
197
-    qDebug() << "Control URL:" << reply->url().toString();
198
+    steering.clear();
199
+    steering.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::TargetLoudness, QLatin1String( ".9" ) ) );
200
+    steering.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::MoreLikeThis, QLatin1String( "last" ) ) );
201
+
202
+    reply = playlist.steer( steering );
203
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
204
     loop.exec();
205
-    song = playlist.parseNextSong( reply );
206
-    qDebug() << "next steered:" << song;
207
+    playlist.parseSteer( reply );
208
+
209
+    playlist.next();
210
+
211
+    reply = playlist.next( 1 );
212
+//     qDebug() << "Control URL:" << reply->url().toString();
213
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
214
+    loop.exec();
215
+    song = playlist.parseNext( reply ).first.first();
216
+//     qDebug() << "next steered:" << song;
217
     QVERIFY( !song.id().isEmpty() );
218
     QVERIFY( !song.title().isEmpty() );
219
 
220
-    // GET INFO
221
-    reply = playlist.fetchSessionInfo();
222
+    // GET INFO TODO
223
+    /*reply = playlist.fetchSessionInfo();
224
     qDebug() << "session info URL:" << reply->url().toString();
225
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
226
     loop.exec();
227
@@ -307,25 +335,131 @@
228
     QVERIFY( !info.session_id.isEmpty() );
229
 
230
     QVERIFY( !song.id().isEmpty() );
231
-    QVERIFY( !song.title().isEmpty() );
232
+    QVERIFY( !song.title().isEmpty() );*/
233
     QByteArray oldId = playlist.sessionId();
234
     // now reset it
235
     p.clear();
236
     p.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Type, Echonest::DynamicPlaylist::ArtistRadioType ) );
237
     p.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Artist, QLatin1String( "pink floyd" ) ) );
238
-    reply = playlist.start( p );
239
+    reply = playlist.create( p );
240
     qDebug() << reply->url().toString();
241
 
242
     loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
243
     loop.exec();
244
-    song = playlist.parseNextSong( reply );
245
-    qDebug() << "new:" << song << song.artistFamiliarity() << song.artistHotttnesss();
246
+    playlist.parseCreate( reply );
247
+
248
+    reply = playlist.next();
249
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
250
+    loop.exec();
251
+
252
+    song = playlist.parseNext( reply ).first.first();
253
+//     qDebug() << "new:" << song << song.artistFamiliarity() << song.artistHotttnesss();
254
 
255
     QVERIFY( !song.id().isEmpty() );
256
     QVERIFY( !song.title().isEmpty() );
257
     QVERIFY( song.artistHotttnesss() == -1 ); // make sure we are in a new playlist, and we didn't ask for this info so it shouldn't be there
258
     QVERIFY( song.artistFamiliarity() == -1 ); // make sure we are in a new playlist, and we didn't ask for this info so it shouldn't be there
259
 
260
+    reply = playlist.deleteSession();
261
+
262
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
263
+    loop.exec();
264
+
265
+    playlist.parseDeleteSession(reply);
266
+    Q_ASSERT(playlist.sessionId().isEmpty());
267
+
268
+}
269
+
270
+void PlaylistTest::testNewDynamicAPI()
271
+{
272
+    DynamicPlaylist::PlaylistParams p;
273
+    p.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Artist, QLatin1String( "frightened rabbit" ) ) );
274
+    p.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Artist, QLatin1String( "wilco" ) ) );
275
+    p.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Artist, QLatin1String( "the tallest man on earth" ) ) );
276
+    p.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Artist, QLatin1String( "noah and the whale" ) ) );
277
+    p.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::ArtistMaxFamiliarity, QLatin1String( ".4" ) ) );
278
+    p.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Key, QLatin1String( "3" ) ) );
279
+    p.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Type, Echonest::DynamicPlaylist::ArtistRadioType ) );
280
+
281
+    DynamicPlaylist playlist;
282
+    QNetworkReply* reply = playlist.create( p );
283
+
284
+//     qDebug() << reply->url().toString();
285
+    QCOMPARE( reply->url().toString(), QLatin1String( "http://developer.echonest.com/api/v4/playlist/dynamic/create?api_key=JGJCRKWLXLBZIFAZB&format=xml&artist=frightened+rabbit&artist=wilco&artist=the+tallest+man+on+earth&artist=noah+and+the+whale&artist_max_familiarity=.4&key=3&type=artist-radio" ) );
286
+
287
+    QEventLoop loop;
288
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
289
+    loop.exec();
290
+    playlist.parseCreate( reply );
291
+
292
+    reply = playlist.next( 2 );
293
+
294
+//     qDebug() << reply->url().toString();
295
+    QCOMPARE( reply->url().toString(), QString( QLatin1String( "http://developer.echonest.com/api/v4/playlist/dynamic/next?api_key=JGJCRKWLXLBZIFAZB&format=xml&session_id=%1&results=2&lookahead=0" ) ).arg( QString::fromLatin1( playlist.sessionId() ) ) );
296
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
297
+    loop.exec();
298
+
299
+    QPair< SongList, SongList > ret;
300
+    ret = playlist.parseNext( reply );
301
+
302
+    QCOMPARE( ret.first.size(), 2 );
303
+    QCOMPARE( ret.second.size(), 0 );
304
+
305
+    QVERIFY( !ret.first.at( 0 ).id().isNull() );
306
+    QVERIFY( !ret.first.at( 0 ).title().isNull() );
307
+    QVERIFY( !ret.first.at( 1 ).id().isNull() );
308
+    QVERIFY( !ret.first.at( 1 ).title().isNull() );
309
+
310
+    DynamicPlaylist::DynamicFeedback feedback;
311
+    feedback.append( DynamicPlaylist::DynamicFeedbackParamData( DynamicPlaylist::FavoriteArtist, "last" ) );
312
+    feedback.append( DynamicPlaylist::DynamicFeedbackParamData( DynamicPlaylist::FavoriteSong, "last" ) );
313
+    reply = playlist.feedback( feedback );
314
+
315
+//     qDebug() << reply->url().toString();
316
+    QString u = QString::fromUtf8( "http://developer.echonest.com/api/v4/playlist/dynamic/feedback?api_key=JGJCRKWLXLBZIFAZB&format=xml&session_id=%1&favorite_artist=last&favorite_song=last" );
317
+    QCOMPARE( reply->url().toString(), u.arg( QString::fromUtf8( playlist.sessionId() ) ) );
318
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
319
+    loop.exec();
320
+    playlist.parseFeedback( reply );
321
+
322
+    DynamicPlaylist::PlaylistParams steering;
323
+    steering.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::MoreLikeThis, QLatin1String( "SONRAMP13775DE8214^4" ) ) );
324
+    steering.append( DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Mood, QLatin1String( "happy^2" ) ) );
325
+
326
+    reply = playlist.steer( steering );
327
+
328
+//     qDebug() << reply->url().toString();
329
+    u = QString::fromUtf8( "http://developer.echonest.com/api/v4/playlist/dynamic/steer?api_key=JGJCRKWLXLBZIFAZB&format=xml&session_id=%1&more_like_this=SONRAMP13775DE8214^4&mood=happy^2" );
330
+    QCOMPARE( reply->url().toString(), u.arg( QString::fromUtf8( playlist.sessionId() ) ) );
331
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
332
+    loop.exec();
333
+    playlist.parseSteer( reply );
334
+
335
+    reply = playlist.next( 3, 3 );
336
+
337
+//     qDebug() << reply->url().toString();
338
+    u = QString::fromUtf8( "http://developer.echonest.com/api/v4/playlist/dynamic/next?api_key=JGJCRKWLXLBZIFAZB&format=xml&session_id=%1&results=3&lookahead=3" );
339
+    QCOMPARE( reply->url().toString(), u.arg( QString::fromUtf8( playlist.sessionId() ) ) );
340
+    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
341
+    loop.exec();
342
+
343
+    ret = playlist.parseNext( reply );
344
+
345
+    QCOMPARE( ret.first.size(), 3 );
346
+    QCOMPARE( ret.second.size(), 3 );
347
+
348
+    QVERIFY( !ret.first.at( 0 ).id().isNull() );
349
+    QVERIFY( !ret.first.at( 0 ).title().isNull() );
350
+    QVERIFY( !ret.first.at( 1 ).id().isNull() );
351
+    QVERIFY( !ret.first.at( 1 ).title().isNull() );
352
+    QVERIFY( !ret.first.at( 2 ).id().isNull() );
353
+    QVERIFY( !ret.first.at( 2 ).title().isNull() );
354
+    QVERIFY( !ret.second.at( 0 ).id().isNull() );
355
+    QVERIFY( !ret.second.at( 0 ).title().isNull() );
356
+    QVERIFY( !ret.second.at( 1 ).id().isNull() );
357
+    QVERIFY( !ret.second.at( 1 ).title().isNull() );
358
+    QVERIFY( !ret.second.at( 2 ).id().isNull() );
359
+    QVERIFY( !ret.second.at( 2 ).title().isNull() );
360
 }
361
 
362
 void PlaylistTest::testDynamicChainXSPF()
363
@@ -349,7 +483,7 @@
364
     p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Limit, true ) );
365
 
366
     DynamicPlaylist playlist;
367
-    QNetworkReply* reply = playlist.start( p );
368
+    QNetworkReply* reply = playlist.create( p );
369
 
370
     qDebug() << reply->url().toString();
371
 //     QVERIFY( reply->url().toString() == QLatin1String( "http://developer.echonest.com/api/v4/playlist/dynamic?api_key=JGJCRKWLXLBZIFAZB&artist=pink+floyd^-1&artist=the+who&artist=queen&artist=led+zeppelin^2&artist=-the+beatles&type=artist&artist_min_hotttnesss=0.7&artist_max_familiarity=0.3&min_loudness=-10&mode=1&chain_xspf=true&format=xspf&bucket=audio_summary&bucket=song_hotttnesss&bucket=artist_hotttnesss&bucket=artist_familiarity" ) );
372
libechonest-1.2.0.tar.bz2/tests/PlaylistTest.h -> libechonest-2.0.1.tar.bz2/tests/PlaylistTest.h Changed
23
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -24,12 +24,13 @@
9
     Q_OBJECT
10
 private slots:
11
     void initTestCase();
12
-    
13
+
14
     void testStatic1();
15
     void testStatic2();
16
     void testStaticXSPF();
17
     void testDynamic1();
18
     void testDynamic2();
19
+    void testNewDynamicAPI();
20
     void testDynamicChainXSPF();
21
 };
22
 
23
libechonest-1.2.0.tar.bz2/tests/SongTest.cpp -> libechonest-2.0.1.tar.bz2/tests/SongTest.cpp Changed
30
 
1
@@ -1,5 +1,5 @@
2
  /****************************************************************************************
3
-  * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+  * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
   *                                                                                      *
6
   * This program is free software; you can redistribute it and/or modify it under        *
7
   * the terms of the GNU General Public License as published by the Free Software        *
8
@@ -48,10 +48,10 @@
9
     QVERIFY( !songs.isEmpty() );
10
     for(int i = 0; i < songs.size(); i++) {
11
         Echonest::Song song = songs.value(i);
12
-        QLatin1String title = ( i == 0 ? QLatin1String( "float on" ) : QLatin1String( "blame it on the tetons" ) );
13
+        QLatin1String title = QLatin1String( "float on" );
14
         QCOMPARE( song.title().toLower(), title );
15
         QCOMPARE( song.artistName().toLower(), QLatin1String( "modest mouse" ) );
16
-        QCOMPARE( song.artistLocation().location.toLower(), QLatin1String( "issaquah" ) );
17
+        QCOMPARE( song.artistLocation().location.toLower(), QLatin1String( "issaquah, wa, us" ) );
18
         QCOMPARE( song.hotttnesss(), -1. );
19
         qDebug() << song.hotttnesss() << song.artistHotttnesss() << song.artistFamiliarity() << song.artistLocation();
20
 
21
@@ -131,7 +131,7 @@
22
     QVERIFY( songs.size() > 0 );
23
     QCOMPARE( songs.first().artistName(), QLatin1String( "Bon Iver" ) );
24
     QCOMPARE( songs.first().artistId(), QByteArray( "ARKDTAM1187FB54026" ) );
25
-    QCOMPARE( songs.first().title(), QLatin1String( "Flume" ) );
26
+    QCOMPARE( songs.first().title(), QLatin1String( "01 Flume" ) );
27
     QCOMPARE( songs.first().id(), QByteArray( "SOJEVHC12A8C13C3E5" ) );
28
 }
29
 
30
libechonest-1.2.0.tar.bz2/tests/SongTest.h -> libechonest-2.0.1.tar.bz2/tests/SongTest.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  *                                                                                      *
6
  * This program is free software; you can redistribute it and/or modify it under        *
7
  * the terms of the GNU General Public License as published by the Free Software        *
8
libechonest-1.2.0.tar.bz2/tests/TrackTest.cpp -> libechonest-2.0.1.tar.bz2/tests/TrackTest.cpp Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  * Copyright (c) 2011 Jeff Mitchell <mitchell@kde.org>                                  *
6
  *                                                                                      *
7
  * This program is free software; you can redistribute it and/or modify it under        *
8
libechonest-1.2.0.tar.bz2/tests/TrackTest.h -> libechonest-2.0.1.tar.bz2/tests/TrackTest.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /****************************************************************************************
3
- * Copyright (c) 2010 Leo Franchi <lfranchi@kde.org>                                    *
4
+ * Copyright (c) 2010-2012 Leo Franchi <lfranchi@kde.org>                               *
5
  * Copyright (c) 2011 Jeff Mitchell <mitchell@kde.org>                                  *
6
  *                                                                                      *
7
  * This program is free software; you can redistribute it and/or modify it under        *
8
libechonest-2.0.1.tar.bz2/tests/test_data/License.txt Added
16
 
1
@@ -0,0 +1,13 @@
2
+
3
+Track      |   License URL
4
+----------------------------------------------
5
+ 01        |   http://artlibre.org/licence.php/lal.html
6
+ 02        |   http://artlibre.org/licence.php/lal.html
7
+ 03        |   http://artlibre.org/licence.php/lal.html
8
+ 04        |   http://artlibre.org/licence.php/lal.html
9
+ 05        |   http://artlibre.org/licence.php/lal.html
10
+ 06        |   http://artlibre.org/licence.php/lal.html
11
+ 07        |   http://artlibre.org/licence.php/lal.html
12
+ 08        |   http://artlibre.org/licence.php/lal.html
13
+ 09        |   http://artlibre.org/licence.php/lal.html
14
+ artwork   |   http://artlibre.org/licence.php/lal.html
15
\ No newline at end of file
16
Refresh

No build results available

Refresh

No rpmlint results available

Request History
Dominik Schmidt's avatar

pansenmann created request over 11 years ago

please disable on default and explicitly enable for 12.1


Peter Linnell's avatar

mrdocs accepted request over 12 years ago