| Artist.h | | Artist.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNES
S FOR A * | | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNES
S FOR A * | |
| * PARTICULAR PURPOSE. See the GNU General Public License for more details.
* | | * PARTICULAR PURPOSE. See the GNU General Public License for more details.
* | |
| *
* | | *
* | |
| * You should have received a copy of the GNU General Public License along
with * | | * You should have received a copy of the GNU General Public License along
with * | |
| * this program. If not, see <http://www.gnu.org/licenses/>.
* | | * this program. If not, see <http://www.gnu.org/licenses/>.
* | |
| **************************************************************************
**************/ | | **************************************************************************
**************/ | |
| | | | |
| #ifndef ECHONEST_ARTIST_H | | #ifndef ECHONEST_ARTIST_H | |
| #define ECHONEST_ARTIST_H | | #define ECHONEST_ARTIST_H | |
| | | | |
|
| | | #include "ArtistTypes.h" | |
| | | #include "Config.h" | |
| #include "echonest_export.h" | | #include "echonest_export.h" | |
|
| | | #include "TypeInformation.h" | |
| | | #include "Song.h" | |
| | | | |
| #include <QDebug> | | #include <QDebug> | |
| #include <QSharedData> | | #include <QSharedData> | |
| #include <QUrl> | | #include <QUrl> | |
|
| #include "Config.h" | | | |
| #include "ArtistTypes.h" | | | |
| #include "Song.h" | | | |
| | | | |
| class QNetworkReply; | | class QNetworkReply; | |
| class ArtistData; | | class ArtistData; | |
| class Term; | | class Term; | |
| namespace Echonest{ | | namespace Echonest{ | |
| | | | |
| class Biography; | | class Biography; | |
| class Catalog; | | class Catalog; | |
| | | | |
| class Artist; | | class Artist; | |
| | | | |
| skipping to change at line 51 | | skipping to change at line 52 | |
| * This encapsulates an Echo Nest artist---it always holds the basic in
fo of artist id and | | * This encapsulates an Echo Nest artist---it always holds the basic in
fo of artist id and | |
| * artist name, and can be queried for more data. | | * artist name, and can be queried for more data. | |
| * | | * | |
| * It is also possible to fetch more information from a given artist na
me or ID by creating an Artist | | * It is also possible to fetch more information from a given artist na
me or ID by creating an Artist | |
| * object yourself and calling the fetch() functions directly. | | * object yourself and calling the fetch() functions directly. | |
| */ | | */ | |
| class ECHONEST_EXPORT Artist | | class ECHONEST_EXPORT Artist | |
| { | | { | |
| | | | |
| public: | | public: | |
|
| enum ArtistInformationFlag { | | | |
| NoInformation = 0x0000, | | | |
| Audio = 0x0001, | | | |
| Biographies = 0x0002, | | | |
| Blogs = 0x0004, | | | |
| Familiarity = 0x0008, | | | |
| Hotttnesss = 0x0010, | | | |
| Images = 0x0020, | | | |
| News = 0x0040, | | | |
| Reviews = 0x0080, | | | |
| Terms = 0x0100, | | | |
| Urls = 0x200, | | | |
| Videos = 0x0400, | | | |
| MusicBrainzEntries = 0x0800, | | | |
| SevenDigitalEntries = 0x1000, | | | |
| PlaymeEntries = 0x2000 | | | |
| }; | | | |
| Q_DECLARE_FLAGS( ArtistInformation, ArtistInformationFlag ) | | | |
| | | | |
| enum TermSorting { | | enum TermSorting { | |
| Weight, | | Weight, | |
| Frequency | | Frequency | |
| } ; | | } ; | |
| | | | |
| /** | | /** | |
| * The following are the various search parameters to the search()
and similar() functions. | | * The following are the various search parameters to the search()
and similar() functions. | |
| * | | * | |
| * Not all are acceptable for each API call, check the API documen
tation at | | * Not all are acceptable for each API call, check the API documen
tation at | |
| * http://developer.echonest.com/docs/v4/artist.html#search for d
etails. | | * http://developer.echonest.com/docs/v4/artist.html#search for d
etails. | |
| | | | |
| skipping to change at line 92 | | skipping to change at line 74 | |
| * - name QVector< QString > A li
st of artist names to be searched (e.g. [Weezer, the beatles ,the beatles^0
.5]) | | * - name QVector< QString > A li
st of artist names to be searched (e.g. [Weezer, the beatles ,the beatles^0
.5]) | |
| * - description QVector< QString > A li
st of descriptors [ alt-rock,-emo,harp^2 ] | | * - description QVector< QString > A li
st of descriptors [ alt-rock,-emo,harp^2 ] | |
| * - results 0 < results < 200, (Default=15) The
number of results desired | | * - results 0 < results < 200, (Default=15) The
number of results desired | |
| * - min_results 0 < results < 200, (Default=0) Indi
cates the minimum number of results to be returned regardless of constraint
s | | * - min_results 0 < results < 200, (Default=0) Indi
cates the minimum number of results to be returned regardless of constraint
s | |
| * - max_familiarity 0.0 < familiarity < 1.0 The
maximum familiarity for returned artists | | * - max_familiarity 0.0 < familiarity < 1.0 The
maximum familiarity for returned artists | |
| * - min_familiarity 0.0 < familiarity < 1.0 The
minimum familiarity for returned artists | | * - min_familiarity 0.0 < familiarity < 1.0 The
minimum familiarity for returned artists | |
| * - max_hotttnesss 0.0 < hotttnesss < 1.0 The
maximum hotttnesss for returned artists | | * - max_hotttnesss 0.0 < hotttnesss < 1.0 The
maximum hotttnesss for returned artists | |
| * - min_hotttness 0.0 < hotttnesss < 1.0 The
minimum hotttnesss for returned artists | | * - min_hotttness 0.0 < hotttnesss < 1.0 The
minimum hotttnesss for returned artists | |
| * - reverse [true, false] If t
rue, return artists that are disimilar to the seeds | | * - reverse [true, false] If t
rue, return artists that are disimilar to the seeds | |
| * -sort QString How
to sort the results. Options: familiarity-asc, hotttnesss-asc, familiarity-
desc, hotttnesss-desc. | | * -sort QString How
to sort the results. Options: familiarity-asc, hotttnesss-asc, familiarity-
desc, hotttnesss-desc. | |
|
| | | * | |
| */ | | */ | |
| enum SearchParam { | | enum SearchParam { | |
| Id, | | Id, | |
| Name, | | Name, | |
| Results, | | Results, | |
| Description, | | Description, | |
| FuzzyMatch, | | FuzzyMatch, | |
| MaxFamiliarity, | | MaxFamiliarity, | |
| MinFamiliarity, | | MinFamiliarity, | |
| MaxHotttnesss, | | MaxHotttnesss, | |
| MinHotttnesss, | | MinHotttnesss, | |
| Reverse, | | Reverse, | |
|
| Sort | | Sort, | |
| | | IdSpace | |
| }; | | }; | |
| typedef QPair< Echonest::Artist::SearchParam, QVariant > SearchPara
mEntry; | | typedef QPair< Echonest::Artist::SearchParam, QVariant > SearchPara
mEntry; | |
| typedef QVector< SearchParamEntry > SearchParams; | | typedef QVector< SearchParamEntry > SearchParams; | |
| | | | |
| Artist(); | | Artist(); | |
| Artist( const QByteArray& id, const QString& name ); | | Artist( const QByteArray& id, const QString& name ); | |
| explicit Artist( const QString& name ); | | explicit Artist( const QString& name ); | |
| | | | |
| Artist( const Artist& other ); | | Artist( const Artist& other ); | |
| Artist& operator=( const Artist& artist ); | | Artist& operator=( const Artist& artist ); | |
| | | | |
| skipping to change at line 217 | | skipping to change at line 201 | |
| QUrl musicbrainzUrl() const; | | QUrl musicbrainzUrl() const; | |
| void setMusicbrainzUrl( const QUrl& url ); | | void setMusicbrainzUrl( const QUrl& url ); | |
| | | | |
| /** | | /** | |
| * Videos related to this artist. | | * Videos related to this artist. | |
| */ | | */ | |
| VideoList videos() const; | | VideoList videos() const; | |
| void setVideos( const VideoList& ); | | void setVideos( const VideoList& ); | |
| | | | |
| /** | | /** | |
|
| | | * The list of foreign ids for this artist, if fetched. | |
| | | */ | |
| | | ForeignIds foreignIds() const; | |
| | | void setForeignIds( const ForeignIds& ids ); | |
| | | | |
| | | /** | |
| * Fetch a list of audio documents found on the web that are relate
d to this artist. | | * Fetch a list of audio documents found on the web that are relate
d to this artist. | |
| * | | * | |
| * @param numResults Limit how many results are returned | | * @param numResults Limit how many results are returned | |
| * @param offset The offset of the results, if paging through resul
ts in increments. | | * @param offset The offset of the results, if paging through resul
ts in increments. | |
| */ | | */ | |
| QNetworkReply* fetchAudio( int numResults = 0, int offset = -1 ) co
nst; | | QNetworkReply* fetchAudio( int numResults = 0, int offset = -1 ) co
nst; | |
| | | | |
| /** | | /** | |
| * Fetch a list of biographies for this artist from various places
on the web. | | * Fetch a list of biographies for this artist from various places
on the web. | |
| */ | | */ | |
| | | | |
| skipping to change at line 259 | | skipping to change at line 249 | |
| QNetworkReply* fetchImages( const QString& license = QString(), int
numResults = 0, int offset = -1 ) const; | | QNetworkReply* fetchImages( const QString& license = QString(), int
numResults = 0, int offset = -1 ) const; | |
| | | | |
| /** | | /** | |
| * Fetch a list of news articles found on the web related to this a
rtist. | | * Fetch a list of news articles found on the web related to this a
rtist. | |
| */ | | */ | |
| QNetworkReply* fetchNews( bool highRelevanceOnly = false, int numRe
sults = 0, int offset = -1 ) const; | | QNetworkReply* fetchNews( bool highRelevanceOnly = false, int numRe
sults = 0, int offset = -1 ) const; | |
| | | | |
| /** | | /** | |
| * Fetch any number of pieces of artist information all at once. | | * Fetch any number of pieces of artist information all at once. | |
| */ | | */ | |
|
| QNetworkReply* fetchProfile( ArtistInformation information ) const; | | QNetworkReply* fetchProfile( ArtistInformation information = Artist
Information() ) const; | |
| | | | |
| /** | | /** | |
| * Fetch reviews related to the artist. | | * Fetch reviews related to the artist. | |
| */ | | */ | |
| QNetworkReply* fetchReviews( int numResults = 0, int offset = -1 )
const; | | QNetworkReply* fetchReviews( int numResults = 0, int offset = -1 )
const; | |
| | | | |
| /** | | /** | |
| * Fetch a list of songs created by this artist. | | * Fetch a list of songs created by this artist. | |
|
| * | | | |
| * The idspace can be used to specify what idspace to return the re | | | |
| sults in, if none is specifed, The Echo Nest song identifiers | | | |
| * are used. If limitToIdSpace is true, then only results in the | | | |
| requested idspace are returned. | | | |
| */ | | */ | |
|
| QNetworkReply* fetchSongs( ArtistInformation idspace = NoInformatio
n, bool limitToIdSpace = false, int numResults = 0, int offset = -1 ) const
; | | QNetworkReply* fetchSongs( int numResults = 0, int offset = -1 ) co
nst; | |
| | | | |
| /** | | /** | |
| * Fetch a list of the most descriptive terms for this artist. | | * Fetch a list of the most descriptive terms for this artist. | |
| */ | | */ | |
| QNetworkReply* fetchTerms( TermSorting sorting = Frequency ) const; | | QNetworkReply* fetchTerms( TermSorting sorting = Frequency ) const; | |
| | | | |
| /** | | /** | |
| * Fetch links to the artist's official site, MusicBrainz site, MyS
pace site, Wikipedia article, Amazon list, and iTunes page. | | * Fetch links to the artist's official site, MusicBrainz site, MyS
pace site, Wikipedia article, Amazon list, and iTunes page. | |
| */ | | */ | |
| QNetworkReply* fetchUrls() const; | | QNetworkReply* fetchUrls() const; | |
| | | | |
| skipping to change at line 314 | | skipping to change at line 301 | |
| * | | * | |
| * Boosting: This method can take multiple seed artists. You an giv
e a seed artist more or less weight by boosting the artist. A boost is an | | * Boosting: This method can take multiple seed artists. You an giv
e a seed artist more or less weight by boosting the artist. A boost is an | |
| * affinity for a seed that gives it more or less weight when maki
ng calculations based on the argument. In case seeds are not meant to be eq
ually | | * affinity for a seed that gives it more or less weight when maki
ng calculations based on the argument. In case seeds are not meant to be eq
ually | |
| * valued, the boost can help clarify where along a spectrum each
argument falls. The boost is a positive floating point value, where 1 gives
the normal | | * valued, the boost can help clarify where along a spectrum each
argument falls. The boost is a positive floating point value, where 1 gives
the normal | |
| * weight. It is signified by appending a caret and weight to the
argument. | | * weight. It is signified by appending a caret and weight to the
argument. | |
| * | | * | |
| * See http://developer.echonest.com/docs/v4/artist.html#similar fo
r boosting examples. | | * See http://developer.echonest.com/docs/v4/artist.html#similar fo
r boosting examples. | |
| * | | * | |
| * Call parseSimilar() once the returned QNetworkReply* has emitted
its finished() signal | | * Call parseSimilar() once the returned QNetworkReply* has emitted
its finished() signal | |
| */ | | */ | |
|
| static QNetworkReply* fetchSimilar( const SearchParams& params, Art
istInformation information = NoInformation, int numResults = 0, int offset
= -1 ); | | static QNetworkReply* fetchSimilar( const SearchParams& params, Art
istInformation information = ArtistInformation(), int numResults = 0, int
offset = -1 ); | |
| | | | |
| /** | | /** | |
| * Search for artists. | | * Search for artists. | |
| * | | * | |
| * Warning: If limit is set to true, at least one idspace must also
be provided. | | * Warning: If limit is set to true, at least one idspace must also
be provided. | |
| * | | * | |
| * One of name or description is required, but only one can be used
in a query at one time | | * One of name or description is required, but only one can be used
in a query at one time | |
| * | | * | |
| */ | | */ | |
|
| static QNetworkReply* search( const SearchParams& params, ArtistInf
ormation information = NoInformation, bool limit = false ); | | static QNetworkReply* search( const SearchParams& params, ArtistInf
ormation information = ArtistInformation(), bool limit = false ); | |
| | | | |
| /** | | /** | |
| * Fetch a list of the current top artists in terms of hotttnesss. | | * Fetch a list of the current top artists in terms of hotttnesss. | |
| * | | * | |
| * Warning If limit is set to true, at least one idspace must also
be provided in the bucket parameter. | | * Warning If limit is set to true, at least one idspace must also
be provided in the bucket parameter. | |
| * | | * | |
| */ | | */ | |
|
| static QNetworkReply* topHottt( ArtistInformation information = NoI
nformation, int numResults = 0, int offset = -1, bool limit = false ); | | static QNetworkReply* topHottt( ArtistInformation information = Art
istInformation(), int numResults = 0, int offset = -1, bool limit = false )
; | |
| | | | |
| /** | | /** | |
| * Fetch a list of the top overall terms. | | * Fetch a list of the top overall terms. | |
| */ | | */ | |
| static QNetworkReply* topTerms( int numResults = 15 ); | | static QNetworkReply* topTerms( int numResults = 15 ); | |
| | | | |
| /** | | /** | |
| * Parse the result of a fetchSimilar() call, which returns a list
of artists similar to the | | * Parse the result of a fetchSimilar() call, which returns a list
of artists similar to the | |
| * original pair. | | * original pair. | |
| */ | | */ | |
| | | | |
| skipping to change at line 364 | | skipping to change at line 351 | |
| | | | |
| /** | | /** | |
| * Parse the result of a top terms query. | | * Parse the result of a top terms query. | |
| */ | | */ | |
| static TermList parseTopTerms( QNetworkReply* ) throw( ParseError )
; | | static TermList parseTopTerms( QNetworkReply* ) throw( ParseError )
; | |
| | | | |
| private: | | private: | |
| QUrl setupQuery( const QByteArray& methodName, int numResults = 0,
int start = -1 ) const; | | QUrl setupQuery( const QByteArray& methodName, int numResults = 0,
int start = -1 ) const; | |
| | | | |
| static QByteArray searchParamToString( SearchParam param ); | | static QByteArray searchParamToString( SearchParam param ); | |
|
| static void addQueryInformation( QUrl& url, ArtistInformation parts
); | | static void addQueryInformation( QUrl& url, ArtistInformation infor
mation ); | |
| | | | |
| QSharedDataPointer<ArtistData> d; | | QSharedDataPointer<ArtistData> d; | |
| | | | |
| friend class Catalog; | | friend class Catalog; | |
| }; | | }; | |
| | | | |
| ECHONEST_EXPORT QDebug operator<<(QDebug d, const Echonest::Artist& art
ist); | | ECHONEST_EXPORT QDebug operator<<(QDebug d, const Echonest::Artist& art
ist); | |
| | | | |
|
| Q_DECLARE_OPERATORS_FOR_FLAGS(Artist::ArtistInformation) | | | |
| } // namespace | | } // namespace | |
| | | | |
|
| Q_DECLARE_METATYPE(Echonest::Artist) | | Q_DECLARE_METATYPE( Echonest::Artist ) | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 16 change blocks. |
| 36 lines changed or deleted | | 20 lines changed or added | |
|
| AudioSummary.h | | AudioSummary.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| | | | |
| #ifndef ECHONEST_AUDIOSUMMARY_H | | #ifndef ECHONEST_AUDIOSUMMARY_H | |
| #define ECHONEST_AUDIOSUMMARY_H | | #define ECHONEST_AUDIOSUMMARY_H | |
| | | | |
| #include "echonest_export.h" | | #include "echonest_export.h" | |
| | | | |
| #include <QSharedData> | | #include <QSharedData> | |
| #include <QDebug> | | #include <QDebug> | |
| #include "Util.h" | | #include "Util.h" | |
| #include "Util.h" | | #include "Util.h" | |
|
| | | #include "Config.h" | |
| | | | |
| class QNetworkReply; | | class QNetworkReply; | |
| class QNetworkReply; | | class QNetworkReply; | |
| class AudioSummaryData; | | class AudioSummaryData; | |
| | | | |
| namespace Echonest{ | | namespace Echonest{ | |
| | | | |
| /** | | /** | |
| * This encapsulates the audio summary of an Echo Nest track or song. | | * This encapsulates the audio summary of an Echo Nest track or song. | |
| * | | * | |
| | | | |
| skipping to change at line 113 | | skipping to change at line 114 | |
| * use this method to begin the fetch. One the returned QNetworkRe
ply* | | * use this method to begin the fetch. One the returned QNetworkRe
ply* | |
| * has emitted the finished() signal, call parseFullAnalysis. | | * has emitted the finished() signal, call parseFullAnalysis. | |
| */ | | */ | |
| QNetworkReply* fetchFullAnalysis() const; | | QNetworkReply* fetchFullAnalysis() const; | |
| | | | |
| /** | | /** | |
| * Parses the result of a fetchFullAnalysis() call. This contains | | * Parses the result of a fetchFullAnalysis() call. This contains | |
| * information such as mode, fadein/fadeout, confidence metrics, | | * information such as mode, fadein/fadeout, confidence metrics, | |
| * and the division of the song into bars, beats, sections, and se
gments. | | * and the division of the song into bars, beats, sections, and se
gments. | |
| */ | | */ | |
|
| void parseFullAnalysis( QNetworkReply* reply ); | | void parseFullAnalysis( QNetworkReply* reply ) throw( ParseError ); | |
| | | | |
| /// The following methods *ALL REQUIRE THAT parseFullAnalysis be ca
lled first* | | /// The following methods *ALL REQUIRE THAT parseFullAnalysis be ca
lled first* | |
| | | | |
| /** | | /** | |
| * How long it took to analyze this track. | | * How long it took to analyze this track. | |
| */ | | */ | |
| qreal analysisTime() const; | | qreal analysisTime() const; | |
| void setAnalysisTime( qreal time ); | | void setAnalysisTime( qreal time ); | |
| | | | |
| /** | | /** | |
| * The version of the analyzer used on this track. | | * The version of the analyzer used on this track. | |
| */ | | */ | |
| QString analyzerVersion() const; | | QString analyzerVersion() const; | |
| void setAnalyzerVersion( QString version ); | | void setAnalyzerVersion( QString version ); | |
| | | | |
| /** | | /** | |
| * Detailed status information about the analysis | | * Detailed status information about the analysis | |
| */ | | */ | |
|
| Analysis::AnalysisStatus detailedStatus() const; | | QString detailedStatus() const; | |
| void setDetailedStatus( Analysis::AnalysisStatus status ); | | void setDetailedStatus( const QString& status ); | |
| | | | |
| /** | | /** | |
| * The status code of the analysis | | * The status code of the analysis | |
| */ | | */ | |
| int analysisStatus() const; | | int analysisStatus() const; | |
| void setAnalysisStatus( int status ); | | void setAnalysisStatus( int status ); | |
| | | | |
| /** | | /** | |
| * The timestamp of the analysis. | | * The timestamp of the analysis. | |
| */ | | */ | |
| | | | |
| skipping to change at line 231 | | skipping to change at line 232 | |
| */ | | */ | |
| TatumList tatums() const; | | TatumList tatums() const; | |
| void setTatums( const TatumList& tatums ); | | void setTatums( const TatumList& tatums ); | |
| | | | |
| /** | | /** | |
| * List of segments in the track with associated acoustic data. | | * List of segments in the track with associated acoustic data. | |
| */ | | */ | |
| SegmentList segments() const; | | SegmentList segments() const; | |
| void setSegments( const SegmentList& segments ); | | void setSegments( const SegmentList& segments ); | |
| | | | |
|
| void setAnalysisUrl( const QString& analysisUrl ); | | void setAnalysisUrl( const QUrl& analysisUrl ); | |
| | | | |
| private: | | private: | |
| QSharedDataPointer<AudioSummaryData> d; | | QSharedDataPointer<AudioSummaryData> d; | |
| }; | | }; | |
| | | | |
| ECHONEST_EXPORT QDebug operator<<(QDebug d, const Echonest::AudioSummar
y& summary); | | ECHONEST_EXPORT QDebug operator<<(QDebug d, const Echonest::AudioSummar
y& summary); | |
| | | | |
| } // namespace | | } // namespace | |
| #endif | | #endif | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 5 lines changed or added | |
|
| Catalog.h | | Catalog.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| * this program. If not, see <http://www.gnu.org/licenses/>.
* | | * this program. If not, see <http://www.gnu.org/licenses/>.
* | |
| **************************************************************************
**************/ | | **************************************************************************
**************/ | |
| | | | |
| #ifndef ECHONEST_CATALOG_H | | #ifndef ECHONEST_CATALOG_H | |
| #define ECHONEST_CATALOG_H | | #define ECHONEST_CATALOG_H | |
| | | | |
| #include "Artist.h" | | #include "Artist.h" | |
| #include "CatalogUpdateEntry.h" | | #include "CatalogUpdateEntry.h" | |
| #include "echonest_export.h" | | #include "echonest_export.h" | |
| #include "Song.h" | | #include "Song.h" | |
|
| | | #include "TypeInformation.h" | |
| #include "Util.h" | | #include "Util.h" | |
| | | | |
| #include <QSharedDataPointer> | | #include <QSharedDataPointer> | |
| #include <QString> | | #include <QString> | |
| #include "CatalogSong.h" | | #include "CatalogSong.h" | |
| #include "CatalogArtist.h" | | #include "CatalogArtist.h" | |
| | | | |
| class QNetworkReply; | | class QNetworkReply; | |
| class CatalogData; | | class CatalogData; | |
| | | | |
| | | | |
| skipping to change at line 127 | | skipping to change at line 128 | |
| | | | |
| /** | | /** | |
| * Fetch the full list of data from this catalog. It is possible to spe
cify specific audio | | * Fetch the full list of data from this catalog. It is possible to spe
cify specific audio | |
| * information that you wish to have included with each item. Use the
appropriate artist- or | | * information that you wish to have included with each item. Use the
appropriate artist- or | |
| * song-specific method calls in order to achieve this. | | * song-specific method calls in order to achieve this. | |
| * | | * | |
| * \param info The list of desired information to be included with each
item. | | * \param info The list of desired information to be included with each
item. | |
| * \param results How many results to return in total | | * \param results How many results to return in total | |
| * \param start The index of the first result | | * \param start The index of the first result | |
| */ | | */ | |
|
| QNetworkReply* readArtistCatalog( Artist::ArtistInformation info = Arti | | QNetworkReply* readArtistCatalog( ArtistInformation info = ArtistInform | |
| st::NoInformation, int results = 30, int start = -1 ) const; | | ation(), int results = 30, int start = -1 ) const; | |
| QNetworkReply* readSongCatalog( Song::SongInformation info = Song::NoIn | | QNetworkReply* readSongCatalog( SongInformation info = SongInformation( | |
| formation, int results = 30, int start = -1 ) const; | | ), int results = 30, int start = -1 ) const; | |
| | | | |
| /** | | /** | |
| * Deletes this catalog from The Echo Nest. Only the API key used to cr
eate a catalog can delete it. | | * Deletes this catalog from The Echo Nest. Only the API key used to cr
eate a catalog can delete it. | |
| */ | | */ | |
| QNetworkReply* deleteCatalog() const; | | QNetworkReply* deleteCatalog() const; | |
| | | | |
| /** | | /** | |
| * Create a new catalog with the given name and type. | | * Create a new catalog with the given name and type. | |
| * | | * | |
| * Parse the finished QNetworkReply with parseCreate() | | * Parse the finished QNetworkReply with parseCreate() | |
| | | | |
| skipping to change at line 214 | | skipping to change at line 215 | |
| static QByteArray parseTicket( QNetworkReply* ) throw( Echonest::ParseE
rror ); | | static QByteArray parseTicket( QNetworkReply* ) throw( Echonest::ParseE
rror ); | |
| | | | |
| /** | | /** | |
| * Parse the result of a create() call. | | * Parse the result of a create() call. | |
| */ | | */ | |
| static Catalog parseCreate( QNetworkReply* reply ) throw( Echonest::Par
seError ); | | static Catalog parseCreate( QNetworkReply* reply ) throw( Echonest::Par
seError ); | |
| private: | | private: | |
| static QNetworkReply* updatePrivate( QUrl&, const CatalogUpdateEntries&
entries ); | | static QNetworkReply* updatePrivate( QUrl&, const CatalogUpdateEntries&
entries ); | |
| QNetworkReply* readPrivate( QUrl& url, int results, int start ) const; | | QNetworkReply* readPrivate( QUrl& url, int results, int start ) const; | |
| static void addLimits( QUrl&, int results, int start ); | | static void addLimits( QUrl&, int results, int start ); | |
|
| static QNetworkReply* doPost( const QUrl& url ); | | | |
| QSharedDataPointer< CatalogData > d; | | QSharedDataPointer< CatalogData > d; | |
| }; | | }; | |
| | | | |
| ECHONEST_EXPORT QDebug operator<<(QDebug d, const Catalog &catalog); | | ECHONEST_EXPORT QDebug operator<<(QDebug d, const Catalog &catalog); | |
| | | | |
|
| } | | }; | |
| | | | |
| | | Q_DECLARE_METATYPE( Echonest::Catalog ) | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 4 change blocks. |
| 6 lines changed or deleted | | 8 lines changed or added | |
|
| CatalogItem.h | | CatalogItem.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNE
SS FOR A * | | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNE
SS FOR A * | |
| * PARTICULAR PURPOSE. See the GNU General Public License for more details
. * | | * PARTICULAR PURPOSE. See the GNU General Public License for more details
. * | |
| *
* | | *
* | |
| * You should have received a copy of the GNU General Public License along
with * | | * You should have received a copy of the GNU General Public License along
with * | |
| * this program. If not, see <http://www.gnu.org/licenses/>.
* | | * this program. If not, see <http://www.gnu.org/licenses/>.
* | |
| *************************************************************************
***************/ | | *************************************************************************
***************/ | |
| | | | |
| #ifndef ECHONEST_CATALOG_ITEM_H | | #ifndef ECHONEST_CATALOG_ITEM_H | |
| #define ECHONEST_CATALOG_ITEM_H | | #define ECHONEST_CATALOG_ITEM_H | |
| | | | |
|
| | | #include "CatalogUpdateEntry.h" | |
| #include "echonest_export.h" | | #include "echonest_export.h" | |
| #include "Util.h" | | #include "Util.h" | |
|
| | | | |
| | | #include <QMetaType> | |
| #include <QSharedPointer> | | #include <QSharedPointer> | |
| #include <QDateTime> | | #include <QDateTime> | |
| | | | |
| class CatalogItemData; | | class CatalogItemData; | |
| | | | |
| namespace Echonest { | | namespace Echonest { | |
| | | | |
| /** | | /** | |
| * Since catalog items can be artists or songs, and we don't know sometimes
until after we parse them, | | * Since catalog items can be artists or songs, and we don't know sometimes
until after we parse them, | |
| * but we need to gather a list of them. A poor man's traits class? A rich
man's interface? Far from either. | | * but we need to gather a list of them. A poor man's traits class? A rich
man's interface? Far from either. | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 59 | |
| | | | |
| /** | | /** | |
| * The foreign id of this item in the catalog. e.g. CAOFUDS12BB066268E:
artist:ARUI8651187B9ACF52 | | * The foreign id of this item in the catalog. e.g. CAOFUDS12BB066268E:
artist:ARUI8651187B9ACF52 | |
| * | | * | |
| * See The Echo Nest API docs for more information. | | * See The Echo Nest API docs for more information. | |
| */ | | */ | |
| QByteArray foreignId() const; | | QByteArray foreignId() const; | |
| void setForeignId( const QByteArray& id ); | | void setForeignId( const QByteArray& id ); | |
| | | | |
| /** | | /** | |
|
| * The request name used when this item was requested. | | * The request that generated this catalog item | |
| */ | | */ | |
|
| QString requestName() const; | | CatalogUpdateEntry request() const; | |
| void setRequestName( const QString& name ); | | void setRequest( const CatalogUpdateEntry& request ); | |
| | | | |
| /** | | | |
| * The request id used when this item was requested. | | | |
| */ | | | |
| QByteArray requestId() const; | | | |
| void setRequestId( const QByteArray& id ); | | | |
| | | | |
| /** | | /** | |
| * The date and time when this item was added to the catalog | | * The date and time when this item was added to the catalog | |
| */ | | */ | |
| QDateTime dateAdded() const; | | QDateTime dateAdded() const; | |
| void setDateAdded( const QDateTime& dt ); | | void setDateAdded( const QDateTime& dt ); | |
| | | | |
| /** | | /** | |
| * The rating of this item. | | * The rating of this item. | |
| */ | | */ | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 87 | |
| * The play count of this item. | | * The play count of this item. | |
| */ | | */ | |
| int playCount() const; | | int playCount() const; | |
| void setPlayCount( int count ); | | void setPlayCount( int count ); | |
| | | | |
| protected: | | protected: | |
| QSharedPointer<CatalogItemData> dd; | | QSharedPointer<CatalogItemData> dd; | |
| }; | | }; | |
| | | | |
| typedef QVector< CatalogItem > CatalogItems; | | typedef QVector< CatalogItem > CatalogItems; | |
|
| } | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 5 change blocks. |
| 10 lines changed or deleted | | 7 lines changed or added | |
|
| CatalogUpdateEntry.h | | CatalogUpdateEntry.h | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| class CatalogUpdateEntryData; | | class CatalogUpdateEntryData; | |
| | | | |
| namespace Echonest { | | namespace Echonest { | |
| | | | |
| /** | | /** | |
| * This rather simple struct collects information about a status update | | * This rather simple struct collects information about a status update | |
| */ | | */ | |
| typedef QVector< QPair< QByteArray, QString > > CatalogStatusItem; | | typedef QVector< QPair< QByteArray, QString > > CatalogStatusItem; | |
| typedef struct CatalogStatusStruct { | | typedef struct CatalogStatusStruct { | |
| CatalogTypes::TicketStatus status; | | CatalogTypes::TicketStatus status; | |
|
| | | QString details; | |
| | | | |
| int items_updated; | | int items_updated; | |
| CatalogStatusItem items; // List of [ item_id, info ] | | CatalogStatusItem items; // List of [ item_id, info ] | |
| | | | |
| CatalogStatusStruct() : status( CatalogTypes::Unknown ), items_updated(
-1 ) {} | | CatalogStatusStruct() : status( CatalogTypes::Unknown ), items_updated(
-1 ) {} | |
| } CatalogStatus; | | } CatalogStatus; | |
| | | | |
| /** | | /** | |
| * This class described a catalog entry for use in the Catalog update() cal
l. | | * This class described a catalog entry for use in the Catalog update() cal
l. | |
| * All data fields are optional except Action, and only the ones specified
will be sent. | | * All data fields are optional except Action, and only the ones specified
will be sent. | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 59 | |
| class ECHONEST_EXPORT CatalogUpdateEntry | | class ECHONEST_EXPORT CatalogUpdateEntry | |
| { | | { | |
| public: | | public: | |
| CatalogUpdateEntry(); | | CatalogUpdateEntry(); | |
| CatalogUpdateEntry( CatalogTypes::Action action ); | | CatalogUpdateEntry( CatalogTypes::Action action ); | |
| virtual ~CatalogUpdateEntry(); | | virtual ~CatalogUpdateEntry(); | |
| CatalogUpdateEntry( const CatalogUpdateEntry& other ); | | CatalogUpdateEntry( const CatalogUpdateEntry& other ); | |
| CatalogUpdateEntry& operator=( const CatalogUpdateEntry& ); | | CatalogUpdateEntry& operator=( const CatalogUpdateEntry& ); | |
| | | | |
| /** | | /** | |
|
| | | * Optional, the item id for the catalog entry. hash( catalog_id + item | |
| | | _id ) | |
| | | * MUST be unique. If this is not set, a unique id will be generated i | |
| | | nternally. | |
| | | */ | |
| | | QByteArray itemId() const; | |
| | | void setItemId( const QByteArray& id ); | |
| | | | |
| | | /** | |
| * The type of action that this item represents, required. | | * The type of action that this item represents, required. | |
| */ | | */ | |
| CatalogTypes::Action action() const; | | CatalogTypes::Action action() const; | |
| void setAction( CatalogTypes::Action action ); | | void setAction( CatalogTypes::Action action ); | |
| | | | |
| /** | | /** | |
| * The Echo Nest fingerprint. | | * The Echo Nest fingerprint. | |
| */ | | */ | |
| QByteArray fingerprint() const; | | QByteArray fingerprint() const; | |
| void setFingerpring( const QByteArray& id ); | | void setFingerpring( const QByteArray& id ); | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 10 lines changed or added | |
|
| Playlist.h | | Playlist.h | |
| | | | |
| skipping to change at line 100 | | skipping to change at line 100 | |
| PickModeDescending, | | PickModeDescending, | |
| PickKeyDescending | | PickKeyDescending | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * The various parameters that can be passed to the playlist buildi
ng | | * The various parameters that can be passed to the playlist buildi
ng | |
| * functions. | | * functions. | |
| */ | | */ | |
| enum PlaylistParam { | | enum PlaylistParam { | |
| Type, /// The type of playlist to generate. Value is the Dynami
cPlaylist::ArtistTypeEnum enum | | Type, /// The type of playlist to generate. Value is the Dynami
cPlaylist::ArtistTypeEnum enum | |
|
| Format, /// Either xml (default) or xspf. If the result is xspf
, the raw xspf playlist is returned, else the xml is parsed and exposed pro
grammatically. | | Format, /// Either xml (default) or xspf. If the result is xspf
, the raw xspf playlist is returned, else the xml is parsed and exposed pro
grammatically. If using XSPF, you must specify a catalog, the tracks bucket
, and limit = true | |
| Pick, /// How the artists are picked for each artist in Artis
tType playlists. Value is Playlist::ArtistPick enum value. | | Pick, /// How the artists are picked for each artist in Artis
tType playlists. Value is Playlist::ArtistPick enum value. | |
| Variety, /// 0 < variety < 1 The maximum variety of arti
sts to be represented in the playlist. A higher number will allow for more
variety in the artists. | | Variety, /// 0 < variety < 1 The maximum variety of arti
sts to be represented in the playlist. A higher number will allow for more
variety in the artists. | |
| ArtistId, /// ID(s) of seed artist(s) for the playlist | | ArtistId, /// ID(s) of seed artist(s) for the playlist | |
| Artist, /// Artist names of seeds for playlist | | Artist, /// Artist names of seeds for playlist | |
|
| | | ArtistSeedCatalog, /// ID of seed artist catalog for the playli
st | |
| SongId, /// IDs of seed songs for the playlist | | SongId, /// IDs of seed songs for the playlist | |
| Description, /// Textual description for sort of songs that can
be included in the playlist | | Description, /// Textual description for sort of songs that can
be included in the playlist | |
| Results, /// 0-100, how many sonsg to include in the playlist,
default 15 | | Results, /// 0-100, how many sonsg to include in the playlist,
default 15 | |
| MaxTempo, /// 0.0 < tempo < 500.0 (BPM) The maximum tempo
for any included songs | | MaxTempo, /// 0.0 < tempo < 500.0 (BPM) The maximum tempo
for any included songs | |
| MinTempo, /// 0.0 < tempo < 500.0 (BPM) the minimum tempo
for any included songs | | MinTempo, /// 0.0 < tempo < 500.0 (BPM) the minimum tempo
for any included songs | |
| MaxDuration, /// 0.0 < duration < 3600.0 (seconds) the ma
ximum duration of any song on the playlist | | MaxDuration, /// 0.0 < duration < 3600.0 (seconds) the ma
ximum duration of any song on the playlist | |
| MinDuration, /// 0.0 < duration < 3600.0 (seconds) the mi
nimum duration of any song on the playlist | | MinDuration, /// 0.0 < duration < 3600.0 (seconds) the mi
nimum duration of any song on the playlist | |
| MaxLoudness, /// -100.0 < loudness < 100.0 (dB) the maximum lo
udness of any song on the playlist | | MaxLoudness, /// -100.0 < loudness < 100.0 (dB) the maximum lo
udness of any song on the playlist | |
| MinLoudness, /// -100.0 < loudness < 100.0 (dB) the minimum lo
udness of any song on the playlist | | MinLoudness, /// -100.0 < loudness < 100.0 (dB) the minimum lo
udness of any song on the playlist | |
| MinDanceability, /// 0 < danceability < 1 a measure of the min
imum danceability of the song | | MinDanceability, /// 0 < danceability < 1 a measure of the min
imum danceability of the song | |
| | | | |
| skipping to change at line 130 | | skipping to change at line 131 | |
| ArtistMaxHotttnesss, /// 0.0 < hotttnesss < 1.0 the maximum h
otttnesss for artists in the playlist | | ArtistMaxHotttnesss, /// 0.0 < hotttnesss < 1.0 the maximum h
otttnesss for artists in the playlist | |
| ArtistMinHotttnesss, /// 0.0 < hotttnesss < 1.0 the maximum h
otttnesss for artists in the playlist | | ArtistMinHotttnesss, /// 0.0 < hotttnesss < 1.0 the maximum h
otttnesss for artists in the playlist | |
| SongMaxHotttnesss, /// 0.0 < hotttnesss < 1.0 the maximum hot
ttnesss for songs in the playlist | | SongMaxHotttnesss, /// 0.0 < hotttnesss < 1.0 the maximum hot
ttnesss for songs in the playlist | |
| SongMinHotttnesss, /// 0.0 < hotttnesss < 1.0 the maximum hot
ttnesss for songs in the playlist | | SongMinHotttnesss, /// 0.0 < hotttnesss < 1.0 the maximum hot
ttnesss for songs in the playlist | |
| ArtistMinLongitude, /// -180.0 < longitude < 180.0 the min
imum longitude for the location of artists in the playlist | | ArtistMinLongitude, /// -180.0 < longitude < 180.0 the min
imum longitude for the location of artists in the playlist | |
| ArtistMaxLongitude, /// -180.0 < longitude < 180.0 the max
imum longitude for the location of artists in the playlist | | ArtistMaxLongitude, /// -180.0 < longitude < 180.0 the max
imum longitude for the location of artists in the playlist | |
| ArtistMinLatitude, /// -90.0 < latitude < 90.0 the minimum lat
itude for the location of artists in the playlist | | ArtistMinLatitude, /// -90.0 < latitude < 90.0 the minimum lat
itude for the location of artists in the playlist | |
| ArtistMaxLatitude, /// -90.0 < latitude < 90.0 the maximum lati
tude for the location of artists in the playlist | | ArtistMaxLatitude, /// -90.0 < latitude < 90.0 the maximum lati
tude for the location of artists in the playlist | |
| Mode, /// (minor, major) 0, 1 the mode of songs in the play
list | | Mode, /// (minor, major) 0, 1 the mode of songs in the play
list | |
| Key, /// (c, c-sharp, d, e-flat, e, f, f-sharp, g, a-flat, a, b
-flat, b) 0 - 11 the key of songs in the playlist | | Key, /// (c, c-sharp, d, e-flat, e, f, f-sharp, g, a-flat, a, b
-flat, b) 0 - 11 the key of songs in the playlist | |
|
| SongInformation, /// what sort of song information should be re
turned. Should be an Echonest::Song::SongInformation object | | SongInformation, /// what sort of song information should be re
turned. Should be an Echonest::SongInformation object | |
| Sort, /// SortingType enum, the type of sorting to use, | | Sort, /// SortingType enum, the type of sorting to use, | |
| Limit, /// true, false if true songs will be limited to thos
e that appear in the catalog specified by the id: bucket | | Limit, /// true, false if true songs will be limited to thos
e that appear in the catalog specified by the id: bucket | |
| Audio, /// true, false, if true songs will be limited to those
that have associated audio | | Audio, /// true, false, if true songs will be limited to those
that have associated audio | |
|
| DMCA /// true, false Only valid for dynamic playlists. Sets | | DMCA, /// true, false Only valid for dynamic playlists. Sets | |
| if playlist will follow DMCA rules (see web api doc for details) | | if playlist will follow DMCA rules (see web api doc for details) | |
| | | 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 ca | |
| | | ll for the next track in the chain. Please note that this sidesteps libecho | |
| | | nest's handling of the tracks. | |
| }; | | }; | |
| | | | |
| typedef QPair< PlaylistParam, QVariant > PlaylistParamData; | | typedef QPair< PlaylistParam, QVariant > PlaylistParamData; | |
| typedef QVector< PlaylistParamData > PlaylistParams; | | typedef QVector< PlaylistParamData > PlaylistParams; | |
| | | | |
| DynamicPlaylist(); | | DynamicPlaylist(); | |
| virtual ~DynamicPlaylist(); | | virtual ~DynamicPlaylist(); | |
| DynamicPlaylist( const DynamicPlaylist& other ); | | DynamicPlaylist( const DynamicPlaylist& other ); | |
| DynamicPlaylist& operator=( const DynamicPlaylist& playlist ); | | DynamicPlaylist& operator=( const DynamicPlaylist& playlist ); | |
| | | | |
| | | | |
| skipping to change at line 185 | | skipping to change at line 187 | |
| * | | * | |
| * If the playlist has no more songs, the returned song object will
be have no name nor id. | | * If the playlist has no more songs, the returned song object will
be have no name nor id. | |
| * | | * | |
| * @param rating The rating for the song that was just played. Rang
es from 1 (lowest) to 5 (highest) | | * @param rating The rating for the song that was just played. Rang
es from 1 (lowest) to 5 (highest) | |
| * | | * | |
| */ | | */ | |
| QNetworkReply* fetchNextSong( int rating = -1); | | QNetworkReply* fetchNextSong( int rating = -1); | |
| Song parseNextSong( QNetworkReply* reply ); | | Song parseNextSong( QNetworkReply* reply ); | |
| | | | |
| /** | | /** | |
|
| * Generate a static playlist, according to the desired criteria. | | * Generate a static playlist, according to the desired criteria. U | |
| | | se parseXSPFPlaylist if | |
| | | * you pass format=xspf to \c staticPlaylist(). | |
| */ | | */ | |
| static QNetworkReply* staticPlaylist( const PlaylistParams& params
); | | static QNetworkReply* staticPlaylist( const PlaylistParams& params
); | |
| static SongList parseStaticPlaylist( QNetworkReply* reply ) throw(
ParseError ); | | static SongList parseStaticPlaylist( QNetworkReply* reply ) throw(
ParseError ); | |
| | | | |
|
| | | /** | |
| | | * Parse an xspf playlist. Returns the full xspf content with no mo | |
| | | difications. | |
| | | */ | |
| | | static QByteArray parseXSPFPlaylist( QNetworkReply* reply ) throw( | |
| | | ParseError ); | |
| | | | |
| private: | | private: | |
| static QByteArray playlistParamToString( PlaylistParam param ); | | static QByteArray playlistParamToString( PlaylistParam param ); | |
| static QNetworkReply* generateInternal( const PlaylistParams& param
s, const QByteArray& type ); | | static QNetworkReply* generateInternal( const PlaylistParams& param
s, const QByteArray& type ); | |
| static QByteArray playlistSortToString(SortingType sorting); | | static QByteArray playlistSortToString(SortingType sorting); | |
| static QByteArray playlistArtistPickToString(ArtistPick pick); | | static QByteArray playlistArtistPickToString(ArtistPick pick); | |
| | | | |
| QSharedDataPointer<DynamicPlaylistData> d; | | QSharedDataPointer<DynamicPlaylistData> d; | |
| }; | | }; | |
| | | | |
| ECHONEST_EXPORT QDebug operator<<(QDebug d, const Echonest::DynamicPlay
list& playlist); | | ECHONEST_EXPORT QDebug operator<<(QDebug d, const Echonest::DynamicPlay
list& playlist); | |
| | | | |
|
| } // namespace | | }; // namespace | |
| | | | |
| | | Q_DECLARE_METATYPE( Echonest::DynamicPlaylist ) | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 7 change blocks. |
| 6 lines changed or deleted | | 23 lines changed or added | |
|
| Song.h | | Song.h | |
| | | | |
| skipping to change at line 22 | | skipping to change at line 22 | |
| *
* | | *
* | |
| * You should have received a copy of the GNU General Public License along
with * | | * You should have received a copy of the GNU General Public License along
with * | |
| * this program. If not, see <http://www.gnu.org/licenses/>.
* | | * this program. If not, see <http://www.gnu.org/licenses/>.
* | |
| **************************************************************************
**************/ | | **************************************************************************
**************/ | |
| | | | |
| #ifndef ECHONEST_SONG_H | | #ifndef ECHONEST_SONG_H | |
| #define ECHONEST_SONG_H | | #define ECHONEST_SONG_H | |
| | | | |
| #include "echonest_export.h" | | #include "echonest_export.h" | |
| #include "Track.h" | | #include "Track.h" | |
|
| | | #include "TypeInformation.h" | |
| | | | |
| #include <QSharedData> | | #include <QSharedData> | |
| #include <QHash> | | #include <QHash> | |
| #include <QVariant> | | #include <QVariant> | |
| #include <QDebug> | | #include <QDebug> | |
| #include <QVector> | | #include <QVector> | |
| #include "Config.h" | | #include "Config.h" | |
| | | | |
| class QNetworkReply; | | class QNetworkReply; | |
| class SongData; | | class SongData; | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 50 | |
| /** | | /** | |
| * This encapsulates an Echo Nest song---use it if you wish to get informat
ion about a song, | | * This encapsulates an Echo Nest song---use it if you wish to get informat
ion about a song, | |
| * search for a song, etc. | | * search for a song, etc. | |
| * | | * | |
| * This class is implicitly shared. | | * This class is implicitly shared. | |
| */ | | */ | |
| class ECHONEST_EXPORT Song | | class ECHONEST_EXPORT Song | |
| { | | { | |
| | | | |
| public: | | public: | |
|
| enum SongInformationFlag { | | | |
| AudioSummaryInformation = 0x01, | | | |
| Tracks = 0x02, | | | |
| Hotttnesss = 0x04, | | | |
| ArtistHotttnesss = 0x08, | | | |
| ArtistFamiliarity = 0x10, | | | |
| ArtistLocation = 0x20, | | | |
| | | | |
| NoInformation = 0x40 | | | |
| }; | | | |
| Q_DECLARE_FLAGS( SongInformation, SongInformationFlag ) | | | |
| | | | |
| enum SearchParam { | | enum SearchParam { | |
| Title, | | Title, | |
| Artist, | | Artist, | |
| Combined, | | Combined, | |
| Description, | | Description, | |
| ArtistId, | | ArtistId, | |
| Results, | | Results, | |
| MaxTempo, | | MaxTempo, | |
| MinTempo, | | MinTempo, | |
| | | | |
| skipping to change at line 88 | | skipping to change at line 78 | |
| MaxFamiliarity, | | MaxFamiliarity, | |
| MinFamiliarity, | | MinFamiliarity, | |
| MaxHotttnesss, | | MaxHotttnesss, | |
| MinHotttnesss, | | MinHotttnesss, | |
| MaxLongitude, | | MaxLongitude, | |
| MinLongitude, | | MinLongitude, | |
| MaxEnergy, | | MaxEnergy, | |
| MinEnergy, | | MinEnergy, | |
| Mode, | | Mode, | |
| Key, | | Key, | |
|
| Sort | | Sort, | |
| }; | | }; | |
| typedef QPair< Echonest::Song::SearchParam, QVariant > SearchParamData; | | typedef QPair< Echonest::Song::SearchParam, QVariant > SearchParamData; | |
| typedef QVector< SearchParamData > SearchParams; | | typedef QVector< SearchParamData > SearchParams; | |
| | | | |
| Song(); | | Song(); | |
| Song( const QByteArray& id, const QString& title, const QByteArray& artis
tId, const QString& artistName ); | | Song( const QByteArray& id, const QString& title, const QByteArray& artis
tId, const QString& artistName ); | |
| Song( const Song& other ); | | Song( const Song& other ); | |
| Song& operator=(const Song& song); | | Song& operator=(const Song& song); | |
| virtual ~Song(); | | virtual ~Song(); | |
| | | | |
| | | | |
| skipping to change at line 125 | | skipping to change at line 115 | |
| /** | | /** | |
| * The following require fetching from The Echo Nest, so call | | * The following require fetching from The Echo Nest, so call | |
| * fetchInformation() with the type of data you want first. | | * fetchInformation() with the type of data you want first. | |
| * | | * | |
| * If you ask for this information before calling parseInformation() | | * If you ask for this information before calling parseInformation() | |
| * with the respective data, the result is undefined. | | * with the respective data, the result is undefined. | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * The full audio summary and analysis of this song. | | * The full audio summary and analysis of this song. | |
|
| | | * | |
| | | * NOTE: This will return a copy of the AudioSummary object, which | |
| | | * is implicitly shared. If you make modifications to the returned | |
| | | * summary, for example by calling parseFullAnalysis(), it will det | |
| | | ach | |
| | | * and you will have to call setAudioSummary() to save the changes | |
| | | back | |
| | | * to this Song object. | |
| */ | | */ | |
| AudioSummary audioSummary() const; | | AudioSummary audioSummary() const; | |
| void setAudioSummary( const AudioSummary& summary ); | | void setAudioSummary( const AudioSummary& summary ); | |
| | | | |
| /** | | /** | |
| * The associated Track objects with acoustic track information | | * The associated Track objects with acoustic track information | |
| */ | | */ | |
| QVector< Track > tracks() const; | | QVector< Track > tracks() const; | |
| void setTracks( const QVector< Track >& tracks ); | | void setTracks( const QVector< Track >& tracks ); | |
| | | | |
| | | | |
| skipping to change at line 156 | | skipping to change at line 152 | |
| | | | |
| /** | | /** | |
| * The familiarity metric of this song's artist. | | * The familiarity metric of this song's artist. | |
| */ | | */ | |
| qreal artistFamiliarity() const; | | qreal artistFamiliarity() const; | |
| void setArtistFamiliarity( qreal artistFamiliarity ); | | void setArtistFamiliarity( qreal artistFamiliarity ); | |
| | | | |
| /** | | /** | |
| * The location of this artist. | | * The location of this artist. | |
| */ | | */ | |
|
| QString artistLocation() const; | | ArtistLocation artistLocation() const; | |
| void setArtistLocation( const QString& artistLocation ); | | void setArtistLocation( const ArtistLocation& artistLocation ); | |
| | | | |
| /** | | /** | |
| * This fetches the data from The Echo Nest for the requested data, so i
t | | * This fetches the data from The Echo Nest for the requested data, so i
t | |
| * returns a QNetworkReply*. When the finished() signal is emitted | | * returns a QNetworkReply*. When the finished() signal is emitted | |
| * from the QNetworkReply object call parseInformation() to save the | | * from the QNetworkReply object call parseInformation() to save the | |
| * data back to this Song object. | | * data back to this Song object. | |
| * | | * | |
| */ | | */ | |
|
| QNetworkReply* fetchInformation( SongInformation parts ) const; | | QNetworkReply* fetchInformation( SongInformation information = SongInform
ation() ) const; | |
| | | | |
| /** | | /** | |
| * Search for a song from The Echo Nest with the given search parameters.
See | | * Search for a song from The Echo Nest with the given search parameters.
See | |
| * http://developer.echonest.com/docs/v4/song.html#search for a descript
ion of the | | * http://developer.echonest.com/docs/v4/song.html#search for a descript
ion of the | |
| * parameters and data types. | | * parameters and data types. | |
| * | | * | |
| * The result will contain the requested information from the SongInforma
tion flags, and | | * The result will contain the requested information from the SongInforma
tion flags, and | |
| * can be extracted in the parseSearch() function. | | * can be extracted in the parseSearch() function. | |
| * | | * | |
| */ | | */ | |
|
| static QNetworkReply* search( const SearchParams& params, SongInformation
parts ); | | static QNetworkReply* search( const SearchParams& params, SongInformation
information = SongInformation() ); | |
| | | | |
| /** | | /** | |
| * Parse the result of the fetchInformation() call. | | * Parse the result of the fetchInformation() call. | |
| * For each requested SongInformationFlag in the original request, the re
spective | | * For each requested SongInformationFlag in the original request, the re
spective | |
| * data will be saved to this Song object. | | * data will be saved to this Song object. | |
| */ | | */ | |
| void parseInformation( QNetworkReply* reply ) throw( ParseError ); | | void parseInformation( QNetworkReply* reply ) throw( ParseError ); | |
| | | | |
| /** | | /** | |
| * Parse the result of the search() call. | | * Parse the result of the search() call. | |
| | | | |
| skipping to change at line 204 | | skipping to change at line 200 | |
| * TODO | | * TODO | |
| * static QNetworkReply* identify( ) const; | | * static QNetworkReply* identify( ) const; | |
| */ | | */ | |
| | | | |
| QString toString() const; | | QString toString() const; | |
| | | | |
| friend class DynamicPlaylist; | | friend class DynamicPlaylist; | |
| friend class Catalog; // for access to searchParamToString | | friend class Catalog; // for access to searchParamToString | |
| private: | | private: | |
| static QByteArray searchParamToString( SearchParam param ); | | static QByteArray searchParamToString( SearchParam param ); | |
|
| static void addQueryInformation( QUrl& url, SongInformation parts ); | | static void addQueryInformation( QUrl& url, SongInformation information
); | |
| | | | |
| QSharedDataPointer<SongData> d; | | QSharedDataPointer<SongData> d; | |
| }; | | }; | |
| | | | |
| typedef QVector< Song > SongList; | | typedef QVector< Song > SongList; | |
| | | | |
| ECHONEST_EXPORT QDebug operator<<(QDebug d, const Song &song); | | ECHONEST_EXPORT QDebug operator<<(QDebug d, const Song &song); | |
| | | | |
|
| Q_DECLARE_OPERATORS_FOR_FLAGS(Song::SongInformation) | | }; // namespace | |
| | | | |
| } // namespace | | | |
| | | | |
|
| Q_DECLARE_METATYPE( Echonest::Song::SongInformation ) | | Q_DECLARE_METATYPE( Echonest::Song ) | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 10 change blocks. |
| 21 lines changed or deleted | | 17 lines changed or added | |
|
| Track.h | | Track.h | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 52 | |
| * A Track encapsulates the audio analysis from The Echo Nest. | | * A Track encapsulates the audio analysis from The Echo Nest. | |
| * | | * | |
| * This class is implicitly shared. | | * This class is implicitly shared. | |
| * | | * | |
| */ | | */ | |
| class ECHONEST_EXPORT Track | | class ECHONEST_EXPORT Track | |
| { | | { | |
| public: | | public: | |
| | | | |
| Track(); | | Track(); | |
|
| | | explicit Track( const QByteArray& id ); | |
| Track( const Track& other ); | | Track( const Track& other ); | |
| Track& operator=( const Track& track ); | | Track& operator=( const Track& track ); | |
| ~Track(); | | ~Track(); | |
| | | | |
| /** | | /** | |
| * The track's artist. | | * The track's artist. | |
| */ | | */ | |
| QString artist() const; | | QString artist() const; | |
| void setArtist( const QString& artist ); | | void setArtist( const QString& artist ); | |
| | | | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 112 | |
| int samplerate() const; | | int samplerate() const; | |
| void setSamplerate( int samplerate ); | | void setSamplerate( int samplerate ); | |
| | | | |
| /** | | /** | |
| * The bitrate of the track | | * The bitrate of the track | |
| */ | | */ | |
| int bitrate() const; | | int bitrate() const; | |
| void setBitrate( int ); | | void setBitrate( int ); | |
| | | | |
| /** | | /** | |
|
| | | * If this track is fetched from a tracks bucket of a song search, the fo | |
| | | llowing information | |
| | | * will be populated for some id spaces. | |
| | | */ | |
| | | | |
| | | /** | |
| | | * The catalog this track is from, if not a native Echo Nest track | |
| | | */ | |
| | | QString catalog() const; | |
| | | void setCatalog( const QString& catalog ); | |
| | | | |
| | | /** | |
| | | * The foreign id of this track, that is in the \c catalog catalog. | |
| | | */ | |
| | | QByteArray foreignId() const; | |
| | | void setForeignId( const QByteArray& id ); | |
| | | | |
| | | /** | |
| | | * The release image associated with this track | |
| | | */ | |
| | | QUrl releaseImage() const; | |
| | | void setReleaseImage( const QUrl& imgUrl ); | |
| | | | |
| | | /** | |
| | | * The preview url for this track, if it exists | |
| | | */ | |
| | | QUrl previewUrl() const; | |
| | | void setPreviewUrl( const QUrl& preview ); | |
| | | | |
| | | /** | |
| * The analysis status | | * The analysis status | |
| */ | | */ | |
| Analysis::AnalysisStatus status() const; | | Analysis::AnalysisStatus status() const; | |
| void setStatus( Analysis::AnalysisStatus ); | | void setStatus( Analysis::AnalysisStatus ); | |
| | | | |
| /** | | /** | |
| * The full audio summary of the track. This contains information about t
he track's bars, | | * The full audio summary of the track. This contains information about t
he track's bars, | |
| * beats, sections, and detailed segment information as well as more met
adata about the song's | | * beats, sections, and detailed segment information as well as more met
adata about the song's | |
| * acoustic properties. | | * acoustic properties. | |
| * | | * | |
| * Information about how to interpret the results of the audio summary c
an be found here: | | * Information about how to interpret the results of the audio summary c
an be found here: | |
| * http://developer.echonest.com/docs/v4/_static/AnalyzeDocumentation_
2.2.pdf | | * http://developer.echonest.com/docs/v4/_static/AnalyzeDocumentation_
2.2.pdf | |
|
| | | * | |
| | | * NOTE: This will return a copy of the AudioSummary object, which | |
| | | * is implicitly shared. If you make modifications to the returned | |
| | | * summary, for example by calling parseFullAnalysis(), it will det | |
| | | ach | |
| | | * and you will have to call setAudioSummary() to save the changes | |
| | | back | |
| | | * to this Song object. | |
| */ | | */ | |
| AudioSummary audioSummary() const; | | AudioSummary audioSummary() const; | |
| void setAudioSummary( const AudioSummary& summary ); | | void setAudioSummary( const AudioSummary& summary ); | |
| | | | |
| /** | | /** | |
| * Get a track object from the md5 hash of a song's contents. | | * Get a track object from the md5 hash of a song's contents. | |
| * | | * | |
| * Call parseProfile() to get the track itself once the | | * Call parseProfile() to get the track itself once the | |
| * QNetworkReply() emits the finished() signal. | | * QNetworkReply() emits the finished() signal. | |
| */ | | */ | |
| | | | |
| skipping to change at line 179 | | skipping to change at line 215 | |
| * Call this function after the QNetworkReply* object returned | | * Call this function after the QNetworkReply* object returned | |
| * from the parse*, upload*, and analyze* emits its finished() signal | | * from the parse*, upload*, and analyze* emits its finished() signal | |
| */ | | */ | |
| static Track parseProfile( QNetworkReply* ) throw( ParseError ); | | static Track parseProfile( QNetworkReply* ) throw( ParseError ); | |
| | | | |
| private: | | private: | |
| | | | |
| QSharedDataPointer<TrackData> d; | | QSharedDataPointer<TrackData> d; | |
| }; | | }; | |
| | | | |
|
| | | typedef QVector<Track> Tracks; | |
| ECHONEST_EXPORT QDebug operator<<(QDebug d, const Echonest::Track& track); | | ECHONEST_EXPORT QDebug operator<<(QDebug d, const Echonest::Track& track); | |
| | | | |
| } // namespace | | } // namespace | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 4 change blocks. |
| 0 lines changed or deleted | | 40 lines changed or added | |
|