| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Don't declare and export variables specific to stored playlists in
playlist.c/playlist.h.
|
|
|
|
| |
Now playlist.c does not contain any protocol specific code anymore.
|
|
|
|
| |
No CamelCase and no typedefs.
|
|
|
|
|
| |
Replaced several wrapper functions from playlist.c, and make command.c
use the queue print functions directly.
|
|
|
|
|
| |
To allow code outside playlist.c to access the "queue" object,
provide a function which returns a const pointer.
|
|
|
|
| |
No typedefs.
|
|
|
|
| |
Moved the 2 remaining global variables into the playlist struct.
|
|
|
|
|
|
| |
PlaylistInfo() (notice the capital 'P') sends a stored playlist to the
client. Move it to a separate library, where all the code which glues
the playlist and the MPD protocol together will live.
|
|
|
|
| |
The LocateTagItem objects are not modified.
|
|
|
|
|
|
| |
The playlist.c source is currently quite hard to understand. I have
managed to wrap my head around it, and this patch attempts to explain
it to the next guy.
|
|
|
|
| |
All callers pass false. Don't bother to collect that parameter.
|
|
|
|
|
|
| |
There were only two possible states: STOP and PLAY. The code looks a
lot easier if we use a bool instead. Move the variable into the
playlist struct.
|
|
|
|
| |
Added several comments.
|
|
|
|
|
| |
Attempt to untie the playlist.c knot: moved the playlist storage code
to queue.c, struct queue.
|
|
|
|
|
|
| |
Don't attempt to restart the player if it was stopped, but there were
still songs left on the playlist. This looks like it has been a
workaround for a bug which has been fixed long time ago.
|
|
|
|
|
|
| |
The "TAG" event is emitted by the player thread when the current
song's tag has changed. Split this event from "PLAYLIST" and make it
a separate callback, which is more efficient.
|
| |
|
|
|
|
|
| |
A song index cannot be negative. Also require the second parameter to
be valid.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Loosely based on a patch provided by lesion in bug #1766. The playlistinfo
command can now retrieve ranges of the playlist. The new argument indicates
which entry is the last one that will be displayed. The number of displayed
entries may be smaller than expected if the end of the playlist is reached.
Previous usage:
playlistinfo [start]
New usage:
playlistinfo [start[:end]]
|
|
|
|
|
|
| |
Don't call command_error() if loading a song from the playlist fails.
This may result in assertion failures, since command_error() may be
called more than once.
|
|
|
|
|
|
| |
There are no unix sockets on WIN32, and therefore no authentication.
WIN32 might have similar capabilities, but until we implement them,
disable that MPD feature.
|
|
|
|
|
| |
When the tag of the current song changes (e.g. a new tag was sent in
the stream), update the playlist, so clients pick up the new tag.
|
|
|
|
|
| |
Added the function map_spl_utf8_to_fs() which replaces
utf8_to_fs_playlist_path().
|
|
|
|
|
|
|
| |
"LOG_H" is a macro which is also used by ffmpeg/log.h. This is
ffmpeg's fault, because short macros should be reserved for
applications, but since it's always a good idea to choose prefixed
macro names, even for applications, we are going to do that in MPD.
|
|
|
|
| |
The function deletePlaylist() shouldn't be in playlist.c.
|
|
|
|
|
|
| |
There are some integers which have a "magic" -1 value which means
"undefined" or "nothing". All others can be converted to unsigned,
since they must not contain a negative number.
|
|
|
|
|
|
| |
The two functions clearStoredPlaylist() and addToStoredPlaylist()
don't belong into playlist.c. clearStoredPlaylist() was a wrapper for
spl_clear(), and is converted into a CPP macro for now.
|
|
|
|
|
| |
Clients which have authenticated via unix socket may add local files
to the MPD playlist, provided that they own the file.
|
|
|
|
| |
"bool" should be used in C99 programs for boolean values.
|
|
|
|
| |
Again, a data type which can be forward-declared.
|
|
|
|
|
| |
Do full C99 integer type conversion in all modules which were not
touched by Eric's merged patch.
|
|
|
|
| |
We don't change the song pointer there, either.
|
|
|
|
| |
Pass the client struct instead of the raw file descriptor.
|
|
|
|
|
|
|
| |
The function loadPlaylist() wants to report incremental errors to the
client, for this reason we cannot remove its protocol dependency right
now. Instead, make it use the client struct instead of the raw file
descriptor.
|
|
|
|
|
|
| |
Don't pass the raw file descriptor around. This migration patch is
rather large, because all of the sources have inter dependencies - we
have to change all of them at the same time.
|
|
|
|
|
| |
Return an "enum playlist_result" value instead of calling
commandError() in storedPlaylist.c.
|
|
|
|
|
|
| |
The playlist library shouldn't talk to the client if possible.
Introduce the "enum playlist_result" type which the caller
(i.e. command.c) may use to generate an error message.
|
|
|
|
| |
Make them both return void.
|
|
|
|
|
|
|
|
| |
Client's input values should be validated by the command
implementation, and the core libraries shouldn't talk to the client
directly if possible. Thus, setPlaylistRepeatStatus() and
setPlaylistRandomStatus() don't get the file descriptor, and cannot
fail (return void).
|
|
|
|
|
|
|
|
| |
The function valid_playlist_name() checks the name, but it insists on
reporting an eventual error to the client. The new function
is_valid_playlist_name() is more generic: it just returns a boolean,
and does not care what the caller will use it for. The old function
valid_playlist_name() will be removed later.
|
|
|
|
| |
The usual bunch of const pointer conversions.
|
|
|
|
| |
Only include headers which are really needed.
|
|
|
|
|
| |
Again, remove file descriptor parameters, which are not actually
used. These functions can also be converted to return void.
|
|
|
|
|
|
|
|
|
| |
Try to only include headers which are really needed. We should
particularly check all "headers including other headers". The
long-term goal is to have a manageable, small API for plugins
(decoders, output) without so many mpd internals cluttering the
namespace.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
| |
git-svn-id: https://svn.musicpd.org/mpd/trunk@7300 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's too ugly and broken (both technically and usability-wise)
to be worth supporting in any stable release.
In one sentence: The queue is a very crippled version of the
playlist that takes precedence over the normal playlist.
How is it crippled?
* The "queueid" command only allows the queuing of songs
ALREADY IN THE PLAYLIST! This promotes having the entire mpd
database of songs in the playlist, which is a stupid practice
to begin with.
* It doesn't allow for meaningful rearranging and movement
of songs within the queue. To move a song, you'd need to
dequeue and requeue it (and other songs on the list).
Why? The playlist already allows _all_ these features
and shows everything a client needs to know about the ordering
of songs in a _single_ command!
* Random was a stupid idea to begin with and unfortunately
we're stuck supporting it since we've always had it. Users
should learn to use "shuffle" instead and not look at their
playlists. Implementing queue because we have the problem of
random is just a bandage fix and digging ourselves a new hole.
This protocol addition was never in a stable release of mpd, so
reverting it will only break things for people following trunk;
which I'm not too worried about. I am however worried about
long-term support of this misfeature, so I'm removing it.
Additionally, there are other points:
* It's trivially DoS-able:
(while true; do echo queueid $song_id; done) | nc $MPD_HOST $MPD_PORT
The above commands would cause the queue to become infinitely
expanding, taking up all available memory in the system. The
mpd playlist was implemented as an array with a fixed (but
configurable) size limit for this reason.
* It's not backwards-compatible. All clients would require
upgrades (and additional complexity) to even know what the
next song in the playlist is. mpd is a shared architecture,
and we should not violate the principle of least astonishment
here.
This removes the following commands:
queueid, dequeue, queueinfo
Additionally, the status field of "playlistqueue: " is removed
from the status command.
While this DoS is trivial to fix, the design is simply too
broken to ever support in a real release.
The overloading of the "addid" command and the allowing of
negative numbers to be used as offsets is far more flexible.
This improved "addid" is completely backwards-compatible with
all clients, and does not require clients to have UI changes or
run additional commands to display the queue.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7155 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While mpd has always protected against the infinite expansion of
the main playlist by limiting its size in memory, however the
new storedPlaylist code has never checked for this limit.
Malicious (or clumsy) users could repeatedly append songs to
stored playlists, causing files to grow increasingly large
on disk. Attempting to load extremely large files into memory
will require mpd to slurp that all into memory, and ultimately
the file would be unusable by mpd because of the configurable
playlist size limit.
Now we limit stored playlists to the max_playlist_length
configuration variable set by the user (default is 16384). We
will refuse to append to playlist files if they hit that limit;
and also refuse to load more than the specified amount of songs
into memory.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7154 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of printing out the Id from playlist.c, instead set
the integer that added_id poitns to if added_id is non-NULL.
This makes the API cleaner and will allow us to use additional
commands to manipulate the newly-added song_id. Callers
(handleAddId) that relied on printId to print it to the given
fd have now been modified to print the ID at a higher-level;
making playlist.c less-dependent on protocol details.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7149 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This will make refactoring features easier, especially now that
pthreads support and larger refactorings are on the horizon.
Hopefully, this will make porting to other platforms (even
non-UNIX-like ones for masochists) easier, too.
os_compat.h will house all the #includes for system headers
considered to be the "core" of MPD. Headers for optional
features will be left to individual source files.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
| |
It was a nice way to double the memory needed to write the
playlist to a file.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7116 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|