| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
| |
playlist_print_song() and playlist_print_uri() handle charset
conversion and (optional) music directory prefixing.
|
|
|
|
|
|
| |
The only caller of deletePlaylist() appends PLAYLIST_FILE_SUFFIX, so
we can be sure it's already there. We don't need to stat the file,
since unlink() does all the checking.
|
|
|
|
|
|
| |
QUEUE adds a new song to the player's queue. CANCEL clears the queue.
These two commands replace the old and complex queueState and
queueLockState code.
|
|
|
|
|
|
| |
Simplify and merge several if clauses before the clearPlayerQueue()
invocation. Call clearPlayerQueue() only if a song is actually
queued; add an assertion for that in clearPlayerQueue().
|
|
|
|
| |
Search'n'replace typo..
|
|
|
|
| |
Yet another CamelCase removal patch.
|
|
|
|
|
|
| |
Taming the directory.c monster, part II: move the database management
stuff to database. directory.c should only contain code which works
on directory objects.
|
|
|
|
| |
CamelCase is ugly... rename all functions.
|
|
|
|
|
|
| |
Provide separate constructors for creating a remote song, a local
song, and one for loading data from a song file. This way, we can add
more assertions.
|
|
|
|
|
| |
Check the old status before assigning. This saves a temporary
variable.
|
|
|
|
| |
"bool" should be used in C99 programs for boolean values.
|
|
|
|
| |
Again, a data type which can be forward-declared.
|
|
|
|
|
|
| |
This make argument order more consistent for iterators.
Additionally, these now return ssize_t results for error
checking.
|
|
|
|
|
|
|
| |
We already know if a song is a URL or not based on whether it
has parentDir defined or not. Hopefully one day in the future
we can drop HTTP support from MPD entirely when an HTTP
filesystem comes along and we can access streams via open(2).
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
LOC reduction and less noise makes things easier for
tired old folks to follow.
|
|
|
|
|
|
|
| |
Since all callers of song_id_exists() will map it to a song position
after the check, introduce a new function called song_id_to_position()
which performs both the check and the map lookup, including nice
assertions.
|
|
|
|
| |
Pass the client struct instead of the raw file descriptor.
|
|
|
|
|
|
| |
The shared code in showPlaylist() isn't worth it, because we aim to
remove fdprintf(). Duplicate this small function, and enable stdio
buffering for saved playlists.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Continuing the effort of removing protocol specific calls from the
core libraries: let the command.c code call commandError() based on
PlaylistInfo's return value.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
Move everything which dumps song information (via tag_print.c) to a
separate source file. song_print.c gets code which writes song data
to the client; song_save.c is responsible for serializing songs from
the tag cache.
|
|
|
|
| |
The usual bunch of const pointer conversions.
|
| |
|
|
|
|
|
| |
Give player.c a better name, meaning that the code is used to control
the player thread.
|
|
|
|
|
|
| |
We should avoid having protocol specific code in player.c. Just
return success or failure, and let the caller send the error code to
the MPD client.
|
| |
|
|
|
|
|
| |
There is only one caller which passes "true", so we can move the
queueNextSongInPlaylist() invocation there.
|
|
|
|
|
|
| |
There is no unlocked caller of clearPlayerQueue(), and the functions
lockPlaylistInteraction() and unlockPlaylistInteraction() are trivial
- merge them.
|
| |
|
|
|
|
|
|
|
| |
Since playerPlay() already calls playerStop(), we can remove its
invocation of playerStop() from playPlaylistOrderNumber().
We can also make playerStop a static function.
|
|
|
|
|
|
|
| |
All (indirect) callers of queueSong() ensure that the queue state is
BLANK, so there is no need to check it in queueSong() again. As a
side effect, queueSong() cannot fail anymore, and can return void.
Also, playlist_queueError and all its error handling can go away.
|
| |
|
|
|
|
|
| |
Again, remove file descriptor parameters, which are not actually
used. These functions can also be converted to return void.
|
|
|
|
|
| |
Most player*() functions do not actually use the file descriptor, and
always return 0 (success). Eliminate them to get a leaner interface.
|
|
|
|
|
|
| |
Also enable -Wunused-parameter - this forces us to add the gcc
"unused" attribute to a lot of parameters (mostly library callback
functions), but it's worth it during code refactorizations.
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
since clearPlayerQueue() is always called within
lockPlaylistInteraction() / unlockPlaylistInteraction(), it simplifies
the code to add another function which calls these three functions.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7253 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
| |
strtok() may return NULL if the input is an empty string. The
playlist parser did not check for that.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7200 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
| |
Local variables which are never read before the first assignment don't
need initialization. Saves a few bytes of text. Also don't reset
variables which are never read until function return.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7199 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
| |
There is unreachable code at several positions, e.g. after an
#if/#end, or after an endless loop. Remove that.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7197 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
| |
The while() loop only checks for interrupted system calls (which woudl
never happen if the signal mask were set up properly), but nobody
checks if the fopen() actually succeeds.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7195 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
|