Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
cf9595df
Commit
cf9595df
authored
Jan 24, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: removed locate functions to queue_print.c
Now playlist.c does not contain any protocol specific code anymore.
parent
53e712ac
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
46 deletions
+45
-46
command.c
src/command.c
+2
-2
playlist.c
src/playlist.c
+0
-33
playlist.h
src/playlist.h
+0
-11
queue_print.c
src/queue_print.c
+34
-0
queue_print.h
src/queue_print.h
+9
-0
No files found.
src/command.c
View file @
cf9595df
...
@@ -914,7 +914,7 @@ handle_playlistfind(struct client *client, int argc, char *argv[])
...
@@ -914,7 +914,7 @@ handle_playlistfind(struct client *client, int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
}
}
findSongsInPlaylist
(
client
,
numItems
,
items
);
queue_find
(
client
,
playlist_get_queue
()
,
numItems
,
items
);
freeLocateTagItemArray
(
numItems
,
items
);
freeLocateTagItemArray
(
numItems
,
items
);
...
@@ -934,7 +934,7 @@ handle_playlistsearch(struct client *client, int argc, char *argv[])
...
@@ -934,7 +934,7 @@ handle_playlistsearch(struct client *client, int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
}
}
searchForSongsInPlaylist
(
client
,
numItems
,
items
);
queue_search
(
client
,
playlist_get_queue
()
,
numItems
,
items
);
freeLocateTagItemArray
(
numItems
,
items
);
freeLocateTagItemArray
(
numItems
,
items
);
...
...
src/playlist.c
View file @
cf9595df
...
@@ -1177,39 +1177,6 @@ enum playlist_result loadPlaylist(const char *utf8file)
...
@@ -1177,39 +1177,6 @@ enum playlist_result loadPlaylist(const char *utf8file)
return
PLAYLIST_RESULT_SUCCESS
;
return
PLAYLIST_RESULT_SUCCESS
;
}
}
void
searchForSongsInPlaylist
(
struct
client
*
client
,
unsigned
numItems
,
const
struct
locate_item
*
items
)
{
unsigned
i
;
struct
locate_item
*
new_items
=
g_memdup
(
items
,
sizeof
(
items
[
0
])
*
numItems
);
for
(
i
=
0
;
i
<
numItems
;
i
++
)
new_items
[
i
].
needle
=
g_utf8_casefold
(
new_items
[
i
].
needle
,
-
1
);
for
(
i
=
0
;
i
<
queue_length
(
&
playlist
.
queue
);
i
++
)
{
const
struct
song
*
song
=
queue_get
(
&
playlist
.
queue
,
i
);
if
(
strstrSearchTags
(
song
,
numItems
,
items
))
queue_print_song_info
(
client
,
&
playlist
.
queue
,
i
);
}
freeLocateTagItemArray
(
numItems
,
new_items
);
}
void
findSongsInPlaylist
(
struct
client
*
client
,
unsigned
numItems
,
const
struct
locate_item
*
items
)
{
for
(
unsigned
i
=
0
;
i
<
queue_length
(
&
playlist
.
queue
);
i
++
)
{
const
struct
song
*
song
=
queue_get
(
&
playlist
.
queue
,
i
);
if
(
tagItemsFoundAndMatches
(
song
,
numItems
,
items
))
queue_print_song_info
(
client
,
&
playlist
.
queue
,
i
);
}
}
/*
/*
* Not supporting '/' was done out of laziness, and we should really
* Not supporting '/' was done out of laziness, and we should really
* strive to support it in the future.
* strive to support it in the future.
...
...
src/playlist.h
View file @
cf9595df
...
@@ -26,9 +26,6 @@
...
@@ -26,9 +26,6 @@
#define PLAYLIST_COMMENT '#'
#define PLAYLIST_COMMENT '#'
struct
client
;
struct
locate_item
;
enum
playlist_result
{
enum
playlist_result
{
PLAYLIST_RESULT_SUCCESS
,
PLAYLIST_RESULT_SUCCESS
,
PLAYLIST_RESULT_ERRNO
,
PLAYLIST_RESULT_ERRNO
,
...
@@ -175,14 +172,6 @@ enum playlist_result seekSongInPlaylistById(unsigned id, float seek_time);
...
@@ -175,14 +172,6 @@ enum playlist_result seekSongInPlaylistById(unsigned id, float seek_time);
void
playlistVersionChange
(
void
);
void
playlistVersionChange
(
void
);
void
searchForSongsInPlaylist
(
struct
client
*
client
,
unsigned
numItems
,
const
struct
locate_item
*
items
);
void
findSongsInPlaylist
(
struct
client
*
client
,
unsigned
numItems
,
const
struct
locate_item
*
items
);
int
is_valid_playlist_name
(
const
char
*
utf8path
);
int
is_valid_playlist_name
(
const
char
*
utf8path
);
#endif
#endif
src/queue_print.c
View file @
cf9595df
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "queue.h"
#include "queue.h"
#include "song.h"
#include "song.h"
#include "song_print.h"
#include "song_print.h"
#include "locate.h"
#include "client.h"
#include "client.h"
void
void
...
@@ -77,3 +78,36 @@ queue_print_changes_position(struct client *client, const struct queue *queue,
...
@@ -77,3 +78,36 @@ queue_print_changes_position(struct client *client, const struct queue *queue,
client_printf
(
client
,
"cpos: %i
\n
Id: %i
\n
"
,
client_printf
(
client
,
"cpos: %i
\n
Id: %i
\n
"
,
i
,
queue_position_to_id
(
queue
,
i
));
i
,
queue_position_to_id
(
queue
,
i
));
}
}
void
queue_search
(
struct
client
*
client
,
const
struct
queue
*
queue
,
unsigned
num_items
,
const
struct
locate_item
*
items
)
{
unsigned
i
;
struct
locate_item
*
new_items
=
g_memdup
(
items
,
sizeof
(
items
[
0
])
*
num_items
);
for
(
i
=
0
;
i
<
num_items
;
i
++
)
new_items
[
i
].
needle
=
g_utf8_casefold
(
new_items
[
i
].
needle
,
-
1
);
for
(
i
=
0
;
i
<
queue_length
(
queue
);
i
++
)
{
const
struct
song
*
song
=
queue_get
(
queue
,
i
);
if
(
strstrSearchTags
(
song
,
num_items
,
items
))
queue_print_song_info
(
client
,
queue
,
i
);
}
freeLocateTagItemArray
(
num_items
,
new_items
);
}
void
queue_find
(
struct
client
*
client
,
const
struct
queue
*
queue
,
unsigned
num_items
,
const
struct
locate_item
*
items
)
{
for
(
unsigned
i
=
0
;
i
<
queue_length
(
queue
);
i
++
)
{
const
struct
song
*
song
=
queue_get
(
queue
,
i
);
if
(
tagItemsFoundAndMatches
(
song
,
num_items
,
items
))
queue_print_song_info
(
client
,
queue
,
i
);
}
}
src/queue_print.h
View file @
cf9595df
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
struct
client
;
struct
client
;
struct
queue
;
struct
queue
;
struct
locate_item
;
void
void
queue_print_song_info
(
struct
client
*
client
,
const
struct
queue
*
queue
,
queue_print_song_info
(
struct
client
*
client
,
const
struct
queue
*
queue
,
...
@@ -57,4 +58,12 @@ void
...
@@ -57,4 +58,12 @@ void
queue_print_changes_position
(
struct
client
*
client
,
const
struct
queue
*
queue
,
queue_print_changes_position
(
struct
client
*
client
,
const
struct
queue
*
queue
,
uint32_t
version
);
uint32_t
version
);
void
queue_search
(
struct
client
*
client
,
const
struct
queue
*
queue
,
unsigned
num_items
,
const
struct
locate_item
*
items
);
void
queue_find
(
struct
client
*
client
,
const
struct
queue
*
queue
,
unsigned
num_items
,
const
struct
locate_item
*
items
);
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment