Data for a specific song.
425224
def get_song(self, id_):
        """"""
        endpoint = "songs/{id}".format(id=id_)
        return self._make_request(endpoint)
916107
def get_details(self):
        
        title = str(self.get_title()).strip()
        artist = str(self.get_artist()).strip()
        album = str(self.get_album()).strip()
        year = str(self.get_year()).strip()

        return {
            "title": title,
            "artist": artist,
            "album": album,
            "year": year
        }
1054072
def main(input_filename, songname, format, counter):
    

    # open the file & convert to wav
    song_data = AudioSegment.from_file(input_filename, format=format)
    song_data = song_data.set_channels(1)  # convert to mono
    wav_tmp = song_data.export(format="wav")  # write to a tmp file buffer
    wav_tmp.seek(0)
    rate, wav_data = wavfile.read(wav_tmp)

    # extract peaks and compute constellation hashes & offsets
    peaks = resound.get_peaks(np.array(wav_data))
    fingerprints = list(resound.hashes(peaks))  # hash, offset pairs

    if not fingerprints:
        raise RuntimeError("No fingerprints detected in source file - check your parameters passed to Resound.")

    # Combine duplicate keys
    for fp, abs_offset in fingerprints:
        counter[fp].append((abs_offset, songname))

    print "    Identified {} keypoints in '{}'.".format(len(counter), songname)

    return counter
418837
private void parseMetadataItem(Message item) {
        switch (item.getMenuItemType()) {
            case TRACK_TITLE:
                title = ((StringField) item.arguments.get(3)).getValue();
                artworkId = (int) ((NumberField) item.arguments.get(8)).getValue();
                break;

            case ARTIST:
                artist = buildSearchableItem(item);
                break;

            case ORIGINAL_ARTIST:
                originalArtist = buildSearchableItem(item);
                break;

            case REMIXER:
                remixer = buildSearchableItem(item);

            case ALBUM_TITLE:
                album = buildSearchableItem(item);
                break;

            case LABEL:
                label = buildSearchableItem(item);
                break;

            case DURATION:
                duration = (int) ((NumberField) item.arguments.get(1)).getValue();
                break;

            case TEMPO:
                tempo = (int) ((NumberField) item.arguments.get(1)).getValue();
                break;

            case COMMENT:
                comment = ((StringField) item.arguments.get(3)).getValue();
                break;

            case KEY:
                key = buildSearchableItem(item);
                break;

            case RATING:
                rating = (int) ((NumberField)item.arguments.get(1)).getValue();
                break;

            case COLOR_NONE:
            case COLOR_AQUA:
            case COLOR_BLUE:
            case COLOR_GREEN:
            case COLOR_ORANGE:
            case COLOR_PINK:
            case COLOR_PURPLE:
            case COLOR_RED:
            case COLOR_YELLOW:
                color = buildColorItem(item);
                break;

            case GENRE:
                genre = buildSearchableItem(item);
                break;

            case DATE_ADDED:
                dateAdded = ((StringField) item.arguments.get(3)).getValue();
                break;

            case YEAR:
                year = (int) ((NumberField) item.arguments.get(1)).getValue();
                break;

            case BIT_RATE:
                bitRate = (int) ((NumberField) item.arguments.get(1)).getValue();
                break;

            default:
                logger.warn("Ignoring track metadata item with unknown type: {}", item);
        }
    }
685739
def fav_songs(self):
        
        if self._fav_songs is None:
            songs_data = self._api.user_favorite_songs(self.identifier)
            self._fav_songs = []
            if not songs_data:
                return
            for song_data in songs_data:
                song = _deserialize(song_data, NestedSongSchema)
                self._fav_songs.append(song)
        return self._fav_songs
952616
def playlist(self, playlist_id, *, include_songs=False):
		

		playlist_info = next(
			(
				playlist
				for playlist in self.playlists(include_songs=include_songs)
				if playlist['id'] == playlist_id
			),
			None
		)

		return playlist_info
112692
private static function music($music){
        $data = array();
        list(
            $data['title'],
            $data['description'],
            $data['musicurl'],
            $data['hqmusicurl'],
            $data['thumb_media_id'],
        ) = $music;

        return $data;
    }
477292
def select_one_song(songs):
        

        if len(songs) == 1:
            select_i = 0
        else:
            table = PrettyTable(['Sequence', 'Song Name', 'Artist Name'])
            for i, song in enumerate(songs, 1):
                table.add_row([i, song['name'], song['ar'][0]['name']])
            click.echo(table)

            select_i = click.prompt('Select one song', type=int, default=1)
            while select_i < 1 or select_i > len(songs):
                select_i = click.prompt('Error Select! Select Again', type=int)

        song_id, song_name = songs[select_i-1]['id'], songs[select_i-1]['name']
        song = Song(song_id, song_name)
        return song
857531
def download_song_by_id(self, song_id, song_name, folder='.'):
        

        try:
            url = self.crawler.get_song_url(song_id)
            if self.lyric:
                # use old api
                lyric_info = self.crawler.get_song_lyric(song_id)
            else:
                lyric_info = None
            song_name = song_name.replace('/', '')
            song_name = song_name.replace('.', '')
            self.crawler.get_song_by_url(url, song_name, folder, lyric_info)
        except RequestException as exception:
            click.echo(exception)
876607
def _find_playlist(self):
        
        data = None
        if self.id:
            data = self.connection.get_item(
                'find_playlist_by_id', playlist_id=self.id)
        elif self.reference_id:
            data = self.connection.get_item(
                'find_playlist_by_reference_id',
                reference_id=self.reference_id)

        if data:
            self._load(data)
440058
def get_metadata(file_name, client_id, client_secret):
    

    song_name = improve_name(file_name)  # Remove useless words from title
    client_credentials_manager = SpotifyClientCredentials(client_id, client_secret)

    spotify = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
    results = spotify.search(song_name, limit=1)

    results = results['tracks']['items'][0]  # Find top result
    album = results['album']['name']  # Parse json dictionary
    artist = results['album']['artists'][0]['name']
    song_title = results['name']
    album_art = results['album']['images'][0]['url']

    return artist, album, song_title, album_art
595599
def get_soundcloud_data(url):
    

    data = {}

    request = requests.get(url)

    title_tag = request.text.split('<title>')[1].split('</title')[0]
    data['title'] = title_tag.split(' by ')[0].strip()
    data['artist'] = title_tag.split(' by ')[1].split('|')[0].strip()
    # XXX Do more..

    return data
1004691
async def songs(self):
    '''
    '''
    items = []
    for i in await self.items:
      if i.type == 'Audio':
        items.append(i)
      elif hasattr(i, 'songs'):
        items.extend(await i.songs)
    return items
826083
def get_artist_songs(self, id_, sort='title', per_page=20, page=1):
        """"""
        endpoint = "artists/{id}/songs".format(id=id_)
        params = {'sort': sort, 'per_page': per_page, 'page': page}
        return self._make_request(endpoint, params_=params)
1214471
def _join_summary_file(data, summary_filename="msd_summary_file.h5"):
    
    msd = h5py.File(summary_filename)

    # create a lookup table of trackid -> position
    track_lookup = dict((t.encode("utf8"), i) for i, t in enumerate(data['track'].cat.categories))

    # join on trackid to the summary file to get the artist/album/songname
    track_info = np.empty(shape=(len(track_lookup), 4), dtype=np.object)
    with tqdm.tqdm(total=len(track_info)) as progress:
        for song in msd['metadata']['songs']:
            trackid = song[17]
            if trackid in track_lookup:
                pos = track_lookup[trackid]
                track_info[pos] = [x.decode("utf8") for x in (trackid, song[9], song[14], song[18])]
                progress.update(1)

    return track_info
144893
def get_details_spotify(song_name):
    '''
    
    '''

    song_name = improvename.songname(song_name)

    spotify = spotipy.Spotify()
    results = spotify.search(song_name, limit=1)  # Find top result

    log.log_indented('* Finding metadata from Spotify.')

    try:
        album = (results['tracks']['items'][0]['album']
                 ['name'])  # Parse json dictionary
        artist = (results['tracks']['items'][0]['album']['artists'][0]['name'])
        song_title = (results['tracks']['items'][0]['name'])
        try:
            log_indented("* Finding lyrics from Genius.com")
            lyrics = get_lyrics_genius(song_title)
        except:
            log_error("* Could not find lyrics from Genius.com, trying something else")
            lyrics = get_lyrics_letssingit(song_title)

        match_bool, score = matching_details(song_name, song_title, artist)
        if match_bool:
            return artist, album, song_title, lyrics, match_bool, score
        else:
            return None

    except IndexError:
        log.log_error(
            '* Could not find metadata from spotify, trying something else.', indented=True)
        return None
1263546
def get_artists(self, search, start=0, max_items=100):
        
        return self.get_music_service_information('artists', search, start,
                                                  max_items)