playlist: don't pass "fd" to showPlaylist(), playlistChangesPosId()
Pass the client struct instead of the raw file descriptor.
This commit is contained in:
parent
709ec6fa39
commit
93e6d4c3ad
@ -525,7 +525,7 @@ static int handleDeleteId(struct client *client, mpd_unused int *permission,
|
|||||||
static int handlePlaylist(struct client *client, mpd_unused int *permission,
|
static int handlePlaylist(struct client *client, mpd_unused int *permission,
|
||||||
mpd_unused int argc, mpd_unused char *argv[])
|
mpd_unused int argc, mpd_unused char *argv[])
|
||||||
{
|
{
|
||||||
showPlaylist(client_get_fd(client));
|
showPlaylist(client);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ static int handlePlaylistChangesPosId(struct client *client, mpd_unused int *per
|
|||||||
|
|
||||||
if (check_uint32(client, &version, argv[1], need_positive) < 0)
|
if (check_uint32(client, &version, argv[1], need_positive) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
return playlistChangesPosId(client_get_fd(client), version);
|
return playlistChangesPosId(client, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handlePlaylistInfo(struct client *client, mpd_unused int *permission,
|
static int handlePlaylistInfo(struct client *client, mpd_unused int *permission,
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "state_file.h"
|
#include "state_file.h"
|
||||||
#include "storedPlaylist.h"
|
#include "storedPlaylist.h"
|
||||||
#include "ack.h"
|
#include "ack.h"
|
||||||
#include "myfprintf.h"
|
|
||||||
#include "os_compat.h"
|
#include "os_compat.h"
|
||||||
|
|
||||||
#define PLAYLIST_STATE_STOP 0
|
#define PLAYLIST_STATE_STOP 0
|
||||||
@ -218,14 +217,14 @@ int clearStoredPlaylist(const char *utf8file)
|
|||||||
return removeAllFromStoredPlaylistByPath(utf8file);
|
return removeAllFromStoredPlaylistByPath(utf8file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showPlaylist(int fd)
|
void showPlaylist(struct client *client)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char path_max_tmp[MPD_PATH_MAX];
|
char path_max_tmp[MPD_PATH_MAX];
|
||||||
|
|
||||||
for (i = 0; i < playlist.length; i++) {
|
for (i = 0; i < playlist.length; i++) {
|
||||||
fdprintf(fd, "%i:%s\n", i,
|
client_printf(client, "%i:%s\n", i,
|
||||||
get_song_url(path_max_tmp, playlist.songs[i]));
|
get_song_url(path_max_tmp, playlist.songs[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,7 +399,7 @@ int playlistChanges(struct client *client, mpd_uint32 version)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int playlistChangesPosId(int fd, mpd_uint32 version)
|
int playlistChangesPosId(struct client *client, mpd_uint32 version)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -408,8 +407,8 @@ int playlistChangesPosId(int fd, mpd_uint32 version)
|
|||||||
if (version > playlist.version ||
|
if (version > playlist.version ||
|
||||||
playlist.songMod[i] >= version ||
|
playlist.songMod[i] >= version ||
|
||||||
playlist.songMod[i] == 0) {
|
playlist.songMod[i] == 0) {
|
||||||
fdprintf(fd, "cpos: %i\nId: %i\n",
|
client_printf(client, "cpos: %i\nId: %i\n",
|
||||||
i, playlist.positionToId[i]);
|
i, playlist.positionToId[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ int addToStoredPlaylist(const char *file, const char *utf8file);
|
|||||||
|
|
||||||
enum playlist_result addSongToPlaylist(Song * song, int *added_id);
|
enum playlist_result addSongToPlaylist(Song * song, int *added_id);
|
||||||
|
|
||||||
void showPlaylist(int fd);
|
void showPlaylist(struct client *client);
|
||||||
|
|
||||||
enum playlist_result deleteFromPlaylist(int song);
|
enum playlist_result deleteFromPlaylist(int song);
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ void playlistVersionChange(void);
|
|||||||
|
|
||||||
int playlistChanges(struct client *client, mpd_uint32 version);
|
int playlistChanges(struct client *client, mpd_uint32 version);
|
||||||
|
|
||||||
int playlistChangesPosId(int fd, mpd_uint32 version);
|
int playlistChangesPosId(struct client *client, mpd_uint32 version);
|
||||||
|
|
||||||
int PlaylistInfo(struct client *client, const char *utf8file, int detail);
|
int PlaylistInfo(struct client *client, const char *utf8file, int detail);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user