Tells iTunes to play a given song/artist/album - MACOSX ONLY
961562
def play(song, artist=None, album=None):
	""""""

	if not settings.platformCompatible():
		return False

	if song and not artist and not album:
		(output, error) = subprocess.Popen(["osascript", "-e", DEFAULT_ITUNES_PLAY % (song, song, song)], stdout=subprocess.PIPE).communicate()
		if output:
			speech.speak("Playing " + output)
		else:
			speech.speak("Unable to find " + song + " in your library.")

	elif song and artist and not album:
		(output, error) = subprocess.Popen(["osascript", "-e", ITUNES_SONG_AND_ARTIST % (song, artist, song, artist)], stdout=subprocess.PIPE).communicate()
		if output:
			speech.speak("Playing " + output)
		else:
			speech.speak("Unable to find " + song + " in your library.")

	elif album and artist and not song:
		(output, error) = subprocess.Popen(["osascript", "-e", ITUNES_ALBUM_AND_ARTIST % (artist, album)], stdout=subprocess.PIPE).communicate()
		if output:
			speech.speak("Playing " + output)
		else:
			speech.speak("Unable to find " + song + " in your library.")

	elif album and not artist and not song:
		(output, error) = subprocess.Popen(["osascript", "-e", ITUNES_ALBUM % (album)], stdout=subprocess.PIPE).communicate()
		if output:
			speech.speak("Playing " + output)
		else:
			speech.speak("Unable to find " + song + " in your library.")

	elif artist and not album and not song:
		(output, error) = subprocess.Popen(["osascript", "-e", ITUNES_ARTIST % (artist)], stdout=subprocess.PIPE).communicate()
		if output:
			speech.speak("Playing " + output)
		else:
			speech.speak("Unable to find " + song + " in your library.")
804406
def play_song(self, song):
        
        if song is not None and song == self.current_song:
            logger.warning('The song is already under playing.')
        else:
            self._playlist.current_song = song
169160
def createPlaylist(name,description,tracks,extras=nil)
      method = 'createPlaylist'
      type = Playlist
      args = {:name=>name,:description=>description,
        :tracks=>Rdio::keys(tracks)}
      args[:extras] = extras if extras
      return_object type,method,args,true
    end
971615
def song(netease, name, id):
    """"""
    if name:
        netease.download_song_by_search(name)

    if id:
        netease.download_song_by_id(id, 'song'+str(id))
256105
def play_Composition(self, composition, channels=None, bpm=120):
        """"""
        self.notify_listeners(self.MSG_PLAY_COMPOSITION, {'composition'
                              : composition, 'channels': channels, 'bpm': bpm})
        if channels == None:
            channels = map(lambda x: x + 1, range(len(composition.tracks)))
        return self.play_Tracks(composition.tracks, channels, bpm)
1093661
def get_now_playing(self):
        

        params = self._get_params()
        params["limit"] = "1"

        doc = self._request(self.ws_prefix + ".getRecentTracks", False, params)

        tracks = doc.getElementsByTagName("track")

        if len(tracks) == 0:
            return None

        e = tracks[0]

        if not e.hasAttribute("nowplaying"):
            return None

        artist = _extract(e, "artist")
        title = _extract(e, "name")

        return Track(artist, title, self.network, self.name)
988442
def set_itunes_explicit(self):
        """"""
        try:
            self.itunes_explicit = self.soup.find('itunes:explicit').string
            self.itunes_explicit = self.itunes_explicit.lower()
        except AttributeError:
            self.itunes_explicit = None
974623
def play_async(cls, file_path, on_done=None):
        
        thread = threading.Thread(
            target=AudioPlayer.play, args=(file_path, on_done,))
        thread.start()
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
1036203
function onAdvance(event, globalObject) {
    var maxPlayHistoryLength = globalObject.config.DubBotBase.numberOfPlayedSongsToStore;

    // Add the new song to the song history
    var play = {
        media: event.media,
        startDate: event.startDate,
        user: event.incomingDJ,
        votes: {
            grabs: [],
            mehs: [],
            woots: []
        }
    };

    globalObject.roomState.playHistory.unshift(play);

    if (globalObject.roomState.playHistory.length > maxPlayHistoryLength) {
        globalObject.roomState.playHistory.length = maxPlayHistoryLength;
    }
}
93400
async def play_url(self, url, position=0):
        """"""
        headers = {'User-Agent': 'MediaControl/1.0',
                   'Content-Type': 'application/x-apple-binary-plist'}
        body = {'Content-Location': url, 'Start-Position': position}

        address = self._url(self.port, 'play')
        _LOGGER.debug('AirPlay %s to %s', url, address)

        resp = None
        try:
            # pylint: disable=no-member
            resp = await self.session.post(
                address, headers=headers,
                data=plistlib.dumps(body, fmt=plistlib.FMT_BINARY),
                timeout=TIMEOUT)
            await self._wait_for_media_to_end()
        finally:
            if resp is not None:
                resp.close()
537136
def get_playlist(id)
      result = playlists.select { |p| p.id == id }
      result.nil? ? nil : result.first
    end
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)
82948
def main():
    '''
    
    '''

    system('clear') # Must be system('cls') for windows

    setup()

    parser = argparse.ArgumentParser(
        description='Download songs with album art and metadata!')
    parser.add_argument('-c', '--config', action='store_true',
                        help='Set your API keys')
    parser.add_argument('-m', '--multiple', action='store', dest='multiple_file',
                        help='Download multiple songs from a text file list')
    parser.add_argument('-a', '--auto', action='store_true',
                        help='Automatically chooses top result')
    parser.add_argument('--album', action='store_true',
                        help='Downloads all songs from an album')
    args = parser.parse_args()
    arg_multiple = args.multiple_file or None
    arg_auto = args.auto or None
    arg_album = args.album or None
    arg_config = args.config


    if arg_config:
        add_config()

    elif arg_multiple and arg_album:
        log.log_error("Can't do both!")

    elif arg_album:
        album_name = input('Enter album name : ')
        try:
            tracks = get_tracks_from_album(album_name)
            for songs in tracks:
                print(songs)
            confirm = input(
                '\nAre these the songs you want to download? (Y/n)\n> ')

        except IndexError:
            log.log_error("Couldn't find album")
            exit()

        if confirm == '' or confirm.lower() == ('y'):
            for track_name in tracks:
                track_name = track_name + ' song'
                song_url, file_name = get_url(track_name, arg_auto)
                download_song(song_url, file_name)
                system('clear')
                repair.fix_music(file_name + '.mp3')

        elif confirm.lower() == 'n':
            log.log_error("Sorry, if appropriate results weren't found")
            exit()
        else:
            log.log_error('Invalid Input')
            exit()

    elif arg_multiple:
        with open(arg_multiple, "r") as f:
            file_names = []
            for line in f:
                file_names.append(line.rstrip('\n'))

        for files in file_names:
            files = files + ' song'
            song_url, file_name = get_url(files, arg_auto)
            download_song(song_url, file_name)
            system('clear')
            repair.fix_music(file_name + '.mp3')

    else:
        query = input('Enter Song Name : ')
        song_url, file_name = get_url(query, arg_auto)  # Gets YT url
        download_song(song_url, file_name)  # Saves as .mp3 file
        system('clear')
        repair.fix_music(file_name + '.mp3')
702844
def set_album(self, album):
        
        self._set_attr(TALB(encoding=3, text=album.decode('utf-8')))
1069663
function objectIsMusicTrack(obj) {
    if ((obj.Name || obj.Artist)
        && !obj['Playlist ID']
        && (obj.Kind ==
            ('MPEG audio file'
                || 'AAC audio file'
                || 'Matched AAC audio file'
                || 'Protected AAC audio file'
                || 'Purchased AAC audio file')))
        return true;
    else
        return false;
}
449440
def set_subtitle(self):
        """"""
        try:
            self.subtitle = self.soup.find('itunes:subtitle').string
        except AttributeError:
            self.subtitle = None