assumes playlist is valid
326305
function getGoToTrackState({
  prevState,
  index,
  track,
  shouldPlay = true,
  shouldForceLoad = false
}) {
  const isNewTrack = prevState.activeTrackIndex !== index;
  const shouldLoadAsNew = Boolean(isNewTrack || shouldForceLoad);
  const currentTime = track.startingTime || 0;
  return {
    duration: getInitialDuration(track),
    activeTrackIndex: index,
    trackLoading: shouldLoadAsNew,
    mediaCannotPlay: prevState.mediaCannotPlay && !shouldLoadAsNew,
    currentTime: convertToNumberWithinIntervalBounds(currentTime, 0),
    loop: shouldLoadAsNew ? false : prevState.loop,
    shouldRequestPlayOnNextUpdate: Boolean(shouldPlay),
    awaitingPlayAfterTrackLoad: Boolean(shouldPlay),
    awaitingForceLoad: Boolean(shouldForceLoad),
    maxKnownTime: shouldLoadAsNew ? 0 : prevState.maxKnownTime
  };
}
1013335
function m3u8(playlist) {
  return reader(playlist).reduce(function (streams, url, i, pl) {
    if (is_url(url)) {
      const stream = pl[i - 1]

      if ( typeof stream == 'object' && stream[TAG_STREAM] && typeof stream[TAG_STREAM] == 'object' ) {
        streams.push( Object.assign({url}, stream[TAG_STREAM]) )
      }
    }

    return streams
  }, [])
}
341062
function _mediaMatch(object, key, value) {
  if (!{}.hasOwnProperty.call(object, key)) {
    return false;
  }
  return Boolean(object[key].indexOf(value) >= 0);
}
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
189062
def valid(self,individuals=None,F=None):
        """"""
        if F:
            valid_locs = self.valid_loc(F)
        else:
            valid_locs = self.valid_loc(self.F)

        if individuals:
            return [ind for i,ind in enumerate(individuals) if i in valid_locs]
        else:
            return [ind for i,ind in enumerate(self.pop.individuals) if i in valid_locs]
580480
private void checkExistingTracks() {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                for (Map.Entry<DeckReference, TrackMetadata> entry : MetadataFinder.getInstance().getLoadedTracks().entrySet()) {
                    if (entry.getKey().hotCue == 0) {  // The track is currently loaded in a main player deck
                        checkIfSignatureReady(entry.getKey().player);
                    }
                }
            }
        });
    }
757455
def playlists(self):
        
        if self._playlists is None:
            playlists_data = self._api.user_playlists(self.identifier)
            playlists = []
            for playlist_data in playlists_data:
                playlist = _deserialize(playlist_data, PlaylistSchema)
                playlists.append(playlist)
            self._playlists = playlists
        return self._playlists
872670
def create_playlist(name, description = '', songs = [])
      @client.request('createPlaylist',
                      'playlistName' => name,
                      'playlistAbout' => description,
                      'songIDs' => songs.map do |s|
                        s.is_a?(Song) ? s.id : s.to_s
                      end)
    end
1215733
def addToPlaylist(playlist,tracks)
      method = 'addToPlaylist'
      type = true
      args = {:playlist=>playlist, :tracks=>Rdio::keys(tracks)}
      return_object type,method,args,true
    end
125566
def allowed(name, collection='all'):
    '''
    
    '''

    if not valid(name):
        return False

    blacklist = names()
    for forbidden in blacklist[collection]:
        if name.lower() == forbidden.lower():
            return False
        if forbidden.endswith('*'):
            # very primitive glob matching
            if name.lower().startswith(forbidden[:-1].lower()):
                return False
        if forbidden.startswith('/'):
            # reference to another collection
            if not allowed(name, collection=forbidden[1:]):
                return False

    # No match.
    return True
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
1012842
def play(self):
        """"""
        self._response['shouldEndSession'] = True
        self._response['action']['audio']['interface'] = 'play'
        self._response['action']['audio']['sources'] = []
        return self
142264
def playlist_songs_delete(self, playlist_songs):
		

		if not more_itertools.all_equal(
			playlist_song['playlistId']
			for playlist_song in playlist_songs
		):
			raise ValueError(
				"All 'playlist_songs' must be from the same playlist."
			)

		mutations = [mc_calls.PlaylistEntriesBatch.delete(playlist_song['id']) for playlist_song in playlist_songs]
		self._call(mc_calls.PlaylistEntriesBatch, mutations)

		return self.playlist(playlist_songs[0]['playlistId'], include_songs=True)
176920
function validateListFromOptions (opts, name) {
    if (opts.all) return Array.from(supported[name].values())

    let list = opts[name]
    if (!list) {
      if (name === 'arch') {
        list = hostArch()
      } else {
        list = process[name]
      }
    } else if (list === 'all') {
      return Array.from(supported[name].values())
    }

    if (!Array.isArray(list)) {
      if (typeof list === 'string') {
        list = list.split(/,\s*/)
      } else {
        return unsupportedListOption(name, list, supported[name])
      }
    }

    const officialElectronPackages = usingOfficialElectronPackages(opts)

    for (let value of list) {
      if (officialElectronPackages && !supported[name].has(value)) {
        return unsupportedListOption(name, value, supported[name])
      }
    }

    return list
  }
590258
def _is_playlist_in_config_dir(self):
        
        if path.dirname(self.stations_file) == self.stations_dir:
            self.foreign_file = False
            self.foreign_filename_only_no_extension = ''
        else:
            self.foreign_file = True
            self.foreign_filename_only_no_extension = self.stations_filename_only_no_extension
        self.foreign_copy_asked = False
701745
def createPlaylist(self, title, items=None, section=None, limit=None, smart=None, **kwargs):
        
        return Playlist.create(self, title, items=items, limit=limit, section=section, smart=smart, **kwargs)
258866
def loadlist(self, playlist, mode='replace'):
        """"""
        self.command('loadlist', playlist.encode(fs_enc), mode)