\section{\label{ref:working_with_playlists}Working with Playlists}
\fixme{This section is currently in a half written state, with possible errors
  and a lot of stuff missing. Please help us fix this chapter by submitting
  additions/corrections to the tracker}

\subsection{Playlist terminology}
Some common terms that are used in Rockbox when referring to
playlists:

\begin{description}
\item[Directory.] A playlist! One of the keys to getting the most out of
  Rockbox is understanding that Rockbox \emph{always} considers the song that
  it is playing to be part of a playlist, and in some situations, Rockbox will
  create a playlist automatically. For example, if you are playing the
  contents of a directory, Rockbox will automatically create a playlist
  containing the songs in that directory. This means that just about anything
  that is described in this chapter with respect to playlists also applies to
  directories.

\item[Dynamic playlist.]  A dynamic playlist is a playlist that is created
  ``On the fly.'' Any time you insert or queue tracks using the
  \setting{Playlist submenu} (see \reference{ref:playlist_submenu}), you are
  creating (or adding to) a dynamic playlist.

\item[Insert.] In Rockbox, to \setting{Insert} an item into a playlist means
  putting an item into a playlist and leaving it there, even after it is
  played. As you will see later in this chapter, Rockbox can \setting{Insert}
  into a playlist in several places.

\item[Queue.] In Rockbox, to \setting{Queue} a song means to put the song
  into a playlist and then to remove the song from the playlist once it has
  been played. The only difference between \setting{Insert} and
  \setting{Queue} is that the \setting{Queue} option removes the song from the
  playlist once it has been played, and the \setting{Insert} option does not.
\end{description}

\subsection{Creating playlists}

Rockbox can create playlists in four different ways.

\subsubsection{By playing a song}
Whenever a song is selected from the \setting{File Browser} with
\ActionTreeEnter, Rockbox will automatically create a playlist containing
all of the songs in the directory in which that song is located.

\note{If you already have already created a dynamic playlist, playing a new
  song will \emph{erase} the current playlist and create a new one. If you
  want to add a song to the current playlist rather than erasing the current
  playlist, see the section below on ``Adding music to playlists.''}

\subsubsection{By using Insert and Queue functions}
If playback is stopped, the \setting{Insert} and \setting{Queue} functions
can be used as described in the next section to create a new playlist instead
of adding to an existing one.

\subsubsection{By using the Playlist catalog}
The \setting{Playlist catalog} makes it possible to modify and create playlists
that are not currently playing. To do this select \setting{Playlist catalog}
in the \setting{File Menu}. There you will have two choices,
\setting{Add to playlist} adds the selected track or directory to an existing
playlist and \setting{Add to a new playlist} creates a new playlist containing
the selected track or directory.

\note{All playlists in the \setting{Playlist catalog} are stored in the
  \fname{Playlists} directory in the root of your \daps{} harddisk and
  playlists stored in other locations are not included in the catalog. It is
  however possible to move existing playlists there (see
  \reference{ref:Filemenu}).}

\subsubsection{By using the Main Menu}
To create a playlist containing all music on your \dap{}, you can use the
\setting{Create Playlist} command in the \setting{Playlist Options} menu found
in the \setting{Main Menu}. The created playlist will be named
\fname{root.m3u} and saved in the root of your \daps{} harddisk.

\subsection{Adding music to playlists}
  
\subsubsection{\label{ref:playlist_submenu}Adding music to a dynamic playlist}
\screenshot{rockbox_interface/images/ss-playlist-menu}{The Playlist Submenu}{}
The \setting{Playlist Submenu} allows you to put tracks into a
``dynamic playlist''. If there is no music currently playing, Rockbox will
create a new dynamic playlist and put the selected track(s) into the
playlist. If there is music currently playing, Rockbox will put the
selected track(s) into the current playlist. The place in which the newly
selected tracks are added to the playlist is determined by the following
options:

\begin{description} 
\item [Insert.] Add track(s) immediately after any tracks added via the most
  recent \setting{Insert} operation. If no tracks have yet been added via an
  \setting{Insert}, new tracks will be added immediately after the current
  playing track.
  
\item [Insert next.] Add track(s) immediately after current playing
  track, no matter what else has been inserted.
  
\item [Insert last.] Add track(s) to end of playlist.
  
\item [Queue.] Queue is the same as Insert except queued tracks are
  deleted immediately from the playlist after they've been played. Also,
  queued tracks are not saved to the playlist file (see
  \reference{ref:playlistoptions}).
  
\item [Queue next.] Queue track(s) immediately after current playing track.
  
\item [Queue last.] Queue track(s) at end of playlist.
\end{description}

The \setting{Playlist Submenu}  can be used to add either single tracks or
entire directories to a playlist. If the \setting{Playlist Submenu} is
invoked on a single track, it will put only that track into the playlist.
On the other hand, if the \setting{Playlist Submenu} is invoked on a
directory, Rockbox adds all of the tracks in that directory to the
playlist.

Dynamic playlists are saved so resume will restore them exactly as they
were before shutdown.

\subsection{Saving playlists}
To save the current playlist either enter the \setting{Playlist} submenu
in the \setting{WPS Context Menu} (see \reference{sec:contextmenu}) and
select \setting{Save Current Playlist} or enter the
\setting{Playlist Options} menu in the \setting{Main Menu} and select
\setting{Save Current Playlist}.
Either method will bring you to the \setting{Virtual Keyboard} (see
\reference{sec:virtual_keyboard}), enter a filename for your playlist and
accept it and you're done.

\subsection{Loading saved playlists}

\subsection{Helpful Hints}

\subsubsection{Including sub-directories in playlists}
You can control whether or not Rockbox includes the contents of
sub-directories when adding an entire directory to a playlists.
Set the \setting{Main Menu $\rightarrow$ Playlist Options $\rightarrow$
  Recursively Insert Directories} setting to \setting{Yes} if you would like
Rockbox to include tracks in sub-directories as well as tracks in the
currently selected directory.
