-
-
Save atl/1029173 to your computer and use it in GitHub Desktop.
pyechonest.artist.extract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/pyechonest/artist.py Thu Jun 16 13:40:52 2011 +0100 | |
+++ b/pyechonest/artist.py Thu Jun 16 13:51:16 2011 +0100 | |
@@ -876,3 +876,28 @@ | |
result = util.callm("%s/%s" % ('artist', 'similar'), kwargs) | |
return [Artist(**util.fix(a_dict)) for a_dict in result['response']['artists']] | |
+def extract(text='', start=0, results=15, buckets=None, limit=False, max_familiarity=None, min_familiarity=None, | |
+ max_hotttnesss=None, min_hotttnesss=None): | |
+ buckets = buckets or [] | |
+ kwargs = {} | |
+ kwargs['text'] = text | |
+ if max_familiarity is not None: | |
+ kwargs['max_familiarity'] = max_familiarity | |
+ if min_familiarity is not None: | |
+ kwargs['min_familiarity'] = min_familiarity | |
+ if max_hotttnesss is not None: | |
+ kwargs['max_hotttnesss'] = max_hotttnesss | |
+ if min_hotttnesss is not None: | |
+ kwargs['min_hotttnesss'] = min_hotttnesss | |
+ if start: | |
+ kwargs['start'] = start | |
+ if results: | |
+ kwargs['results'] = results | |
+ if buckets: | |
+ kwargs['bucket'] = buckets | |
+ if limit: | |
+ kwargs['limit'] = 'true' | |
+ result = util.callm("%s/%s" % ('artist', 'extract'), kwargs) | |
+ return [Artist(**util.fix(a_dict)) for a_dict in result['response']['artists']] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def extract(text='', start=0, results=15, buckets=None, limit=False, max_familiarity=None, min_familiarity=None, | |
max_hotttnesss=None, min_hotttnesss=None): | |
buckets = buckets or [] | |
kwargs = {} | |
kwargs['text'] = text | |
if max_familiarity is not None: | |
kwargs['max_familiarity'] = max_familiarity | |
if min_familiarity is not None: | |
kwargs['min_familiarity'] = min_familiarity | |
if max_hotttnesss is not None: | |
kwargs['max_hotttnesss'] = max_hotttnesss | |
if min_hotttnesss is not None: | |
kwargs['min_hotttnesss'] = min_hotttnesss | |
if start: | |
kwargs['start'] = start | |
if results: | |
kwargs['results'] = results | |
if buckets: | |
kwargs['bucket'] = buckets | |
if limit: | |
kwargs['limit'] = 'true' | |
result = util.callm("%s/%s" % ('artist', 'extract'), kwargs) | |
return [Artist(**util.fix(a_dict)) for a_dict in result['response']['artists']] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment