MusicManager Uploader identification
499966
def mac_addr
      case RUBY_PLATFORM
      when /darwin/
        if (m = `ifconfig en0`.match(/ether (\S{17})/))
          m[1].upcase
        end
      when /linux/
        devices = Dir['/sys/class/net/*/address'].reject { |a| a =~ %r{/lo/} }
        dev = devices.first
        File.read(dev).chomp.upcase
      end
    end
1166212
def get_track_scrobbles(self, artist, track, cacheable=False):
        

        params = self._get_params()
        params["artist"] = artist
        params["track"] = track

        seq = []
        for track in _collect_nodes(
            None, self, self.ws_prefix + ".getTrackScrobbles", cacheable, params
        ):
            title = _extract(track, "name")
            artist = _extract(track, "artist")
            date = _extract(track, "date")
            album = _extract(track, "album")
            timestamp = track.getElementsByTagName("date")[0].getAttribute("uts")

            seq.append(
                PlayedTrack(Track(artist, title, self.network), album, date, timestamp)
            )

        return seq
271694
def _parse_album(self, album):
        '''
        
        '''
        if album['CoverArtFilename']:
            cover_url = '%sm%s' % (grooveshark.const.ALBUM_COVER_URL,
                                   album['CoverArtFilename'])
        else:
            cover_url = None
        return Album(
            album['AlbumID'],
            album['Name'],
            album['ArtistID'],
            album['ArtistName'],
            cover_url,
            self.connection)
318277
def get_artist(self):
        
        # pylint: disable=E1101
        assert isinstance(self, (Album, Track))
        return self.client.get_artist(self.artist.id)
685282
def media(self, uri):
        """"""
        try:
            local_path, _ = urllib.request.urlretrieve(uri)
            metadata = mutagen.File(local_path, easy=True)
            if metadata.tags:
                self._tags = metadata.tags
            title = self._tags.get(TAG_TITLE, [])
            self._manager[ATTR_TITLE] = title[0] if len(title) else ''
            artist = self._tags.get(TAG_ARTIST, [])
            self._manager[ATTR_ARTIST] = artist[0] if len(artist) else ''
            album = self._tags.get(TAG_ALBUM, [])
            self._manager[ATTR_ALBUM] = album[0] if len(album) else ''
            local_uri = 'file://{}'.format(local_path)

        # urllib.error.HTTPError
        except Exception:  # pylint: disable=broad-except
            local_uri = uri
        self._player.set_state(Gst.State.NULL)
        self._player.set_property(PROP_URI, local_uri)
        self._player.set_state(Gst.State.PLAYING)
        self.state = STATE_PLAYING
        self._manager[ATTR_URI] = uri
        self._manager[ATTR_DURATION] = self._duration()
        self._manager[ATTR_VOLUME] = self._player.get_property(PROP_VOLUME)
        _LOGGER.info('playing %s (as %s)', uri, local_uri)
635006
def get_stream_auth_by_songid(song_id)
      result = request('getStreamKeyFromSongIDEx',
                       'type' => 0,
                       'prefetch' => false,
                       'songID' => song_id,
                       'country' => @country,
                       'mobile' => false)
      if result == []
        fail GeneralError, 'No data for this song. ' \
             'Maybe Grooveshark banned your IP.'
      end
      result
    end
652963
def album_to_ref(album):
    """"""
    name = ''
    for artist in album.artists:
        if len(name) > 0:
            name += ', '
        name += artist.name
    if (len(name)) > 0:
        name += ' - '
    if album.name:
        name += album.name
    else:
        name += 'Unknown Album'
    return Ref.directory(uri=album.uri, name=name)
871879
public Observable<SoundCloudUser> getArtistProfile() {
        checkState();
        if (mCacheRam.artistProfile != null) {
            return Observable.create(new Observable.OnSubscribe<SoundCloudUser>() {
                @Override
                public void call(Subscriber<? super SoundCloudUser> subscriber) {
                    subscriber.onNext(mCacheRam.artistProfile);
                    subscriber.onCompleted();
                }
            });
        } else {
            return mRetrofitService.getUser(mArtistName)
                    .map(RxParser.PARSE_USER)
                    .map(cacheArtistProfile());
        }
    }
1152036
private ListMultipartUploadsResult listIncompleteUploads(String bucketName, String keyMarker, String uploadIdMarker,
                                                           String prefix, String delimiter, int maxUploads)
    throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
           InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
           InternalException {
    if (maxUploads < 0 || maxUploads > 1000) {
      maxUploads = 1000;
    }

    Map<String,String> queryParamMap = new HashMap<>();
    queryParamMap.put("uploads", "");
    queryParamMap.put("max-uploads", Integer.toString(maxUploads));

    if (prefix != null) {
      queryParamMap.put("prefix", prefix);
    } else {
      queryParamMap.put("prefix", "");
    }

    if (delimiter != null) {
      queryParamMap.put("delimiter", delimiter);
    } else {
      queryParamMap.put("delimiter", "");
    }

    if (keyMarker != null) {
      queryParamMap.put("key-marker", keyMarker);
    }

    if (uploadIdMarker != null) {
      queryParamMap.put("upload-id-marker", uploadIdMarker);
    }

    HttpResponse response = executeGet(bucketName, null, null, queryParamMap);

    ListMultipartUploadsResult result = new ListMultipartUploadsResult();
    result.parseXml(response.body().charStream());
    response.body().close();
    return result;
  }
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
192713
def getTracksForArtistInCollection(artist,user=nil,extras=nil)
      method = 'getTracksForArtistInCollection'
      type = Track
      args = {:artist=>artist}
      args[:user] = user if user
      args[:extras] = extras if extras
      return_object type,method,args
    end
185548
def main():
    

    # Hack related to #58
    if sys.platform == "win32":
        os.system("chcp 65001");

    parser = argparse.ArgumentParser(description='SoundScrape. Scrape an artist from SoundCloud.\n')
    parser.add_argument('artist_url', metavar='U', type=str, nargs='*',
                        help='An artist\'s SoundCloud username or URL')
    parser.add_argument('-n', '--num-tracks', type=int, default=sys.maxsize,
                        help='The number of tracks to download')
    parser.add_argument('-g', '--group', action='store_true',
                        help='Use if downloading tracks from a SoundCloud group')
    parser.add_argument('-b', '--bandcamp', action='store_true',
                        help='Use if downloading from Bandcamp rather than SoundCloud')
    parser.add_argument('-m', '--mixcloud', action='store_true',
                        help='Use if downloading from Mixcloud rather than SoundCloud')
    parser.add_argument('-a', '--audiomack', action='store_true',
                        help='Use if downloading from Audiomack rather than SoundCloud')
    parser.add_argument('-c', '--hive', action='store_true',
                        help='Use if downloading from Hive.co rather than SoundCloud')
    parser.add_argument('-l', '--likes', action='store_true',
                        help='Download all of a user\'s Likes.')
    parser.add_argument('-L', '--login', type=str, default='soundscrape123@mailinator.com',
                        help='Set login')
    parser.add_argument('-d', '--downloadable', action='store_true',
                        help='Only fetch tracks with a Downloadable link.')
    parser.add_argument('-t', '--track', type=str, default='',
                        help='The name of a specific track by an artist')
    parser.add_argument('-f', '--folders', action='store_true',
                        help='Organize saved songs in folders by artists')
    parser.add_argument('-p', '--path', type=str, default='',
                        help='Set directory path where downloads should be saved to')
    parser.add_argument('-P', '--password', type=str, default='soundscraperocks',
                        help='Set password')
    parser.add_argument('-o', '--open', action='store_true',
                        help='Open downloaded files after downloading.')
    parser.add_argument('-k', '--keep', action='store_true',
                        help='Keep 30-second preview tracks')
    parser.add_argument('-v', '--version', action='store_true', default=False,
                        help='Display the current version of SoundScrape')

    args = parser.parse_args()
    vargs = vars(args)

    if vargs['version']:
        import pkg_resources
        version = pkg_resources.require("soundscrape")[0].version
        print(version)
        return

    if not vargs['artist_url']:
        parser.error('Please supply an artist\'s username or URL!')

    if sys.version_info < (3,0,0):
        vargs['artist_url'] = urllib.quote(vargs['artist_url'][0], safe=':/')
    else:
        vargs['artist_url'] = urllib.parse.quote(vargs['artist_url'][0], safe=':/')

    artist_url = vargs['artist_url']

    if not exists(vargs['path']):
        if not access(dirname(vargs['path']), W_OK):
            vargs['path'] = ''
        else:
            mkdir(vargs['path'])

    if 'bandcamp.com' in artist_url or vargs['bandcamp']:
        process_bandcamp(vargs)
    elif 'mixcloud.com' in artist_url or vargs['mixcloud']:
        process_mixcloud(vargs)
    elif 'audiomack.com' in artist_url or vargs['audiomack']:
        process_audiomack(vargs)
    elif 'hive.co' in artist_url or vargs['hive']:
        process_hive(vargs)
    elif 'musicbed.com' in artist_url:
        process_musicbed(vargs)
    else:
        process_soundcloud(vargs)
207496
def guess_file_type(kind, filepath=None, youtube_id=None, web_url=None, encoding=None):
    
    if youtube_id:
        return FileTypes.YOUTUBE_VIDEO_FILE
    elif web_url:
        return FileTypes.WEB_VIDEO_FILE
    elif encoding:
        return FileTypes.BASE64_FILE
    else:
        ext = os.path.splitext(filepath)[1][1:].lower()
        if kind in FILE_TYPE_MAPPING and ext in FILE_TYPE_MAPPING[kind]:
            return FILE_TYPE_MAPPING[kind][ext]
    return None
11976
def user(netease, name, id):
    """"""
    if name:
        netease.download_user_playlists_by_search(name)

    if id:
        netease.download_user_playlists_by_id(id)
679133
def artist_infos(self, artist_id):
        
        action = uri + '/artist/' + str(artist_id)
        data = self.request('GET', action)
        return data
1013856
def songs(self, *, uploaded=True, purchased=True):
		

		if not uploaded and not purchased:
			raise ValueError("'uploaded' and 'purchased' cannot both be False.")

		if purchased and uploaded:
			song_list = []
			for chunk in self.songs_iter(export_type=1):
				song_list.extend(chunk)
		elif purchased:
			song_list = []
			for chunk in self.songs_iter(export_type=2):
				song_list.extend(chunk)
		elif uploaded:
			purchased_songs = []
			for chunk in self.songs_iter(export_type=2):
				purchased_songs.extend(chunk)

			song_list = [
				song
				for chunk in self.songs_iter(export_type=1)
				for song in chunk
				if song not in purchased_songs
			]

		return song_list
373855
def artist(netease, name, id):
    """"""
    if name:
        netease.download_artist_by_search(name)

    if id:
        netease.download_artist_by_id(id, 'artist'+str(id))