Commit Graph

90 Commits

Author SHA1 Message Date
Max Kellermann
715844fd08 dbUtils: don't use directoryAddSongToPlaylist() twice
In findAddInDirectory(), call playlist_append_song() directly, to have
some more type checking.
2011-01-10 19:46:14 +01:00
Max Kellermann
8e34c59c82 song_print: song_print() returns void
The only "return" statement always returns 0.
2010-02-08 10:21:15 +01:00
Max Kellermann
a0a26d3341 Merge release 0.15.8 from branch 'v0.15.x
Conflicts:
	Makefile.am
	NEWS
	configure.ac
	src/decoder/ffmpeg_decoder_plugin.c
	src/decoder_thread.c
2010-01-18 07:52:58 +01:00
Max Kellermann
959f94b06c dbUtils: return empty tag value only if no value was found
This fixes a regression in the patch "return multiple tag values per
song": even when the song has values for the specified tag type, the
empty string gets added to the set, because the "return" was removed.
This patch adds a flag which remembers whether at least one value was
found.
2010-01-02 19:24:31 +01:00
Avuton Olrich
9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann
333e11d0eb Merged release 0.15.7 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/decoder_api.c
2009-12-27 20:10:45 +01:00
Max Kellermann
d66c055fec dbUtils: return multiple tag values per song
When collecting tag values for the result set, add all of a song's tag
values of the searched type.  This affects the "list" command.
Previously, "list" only considered the first tag value of a song.
2009-12-27 16:49:04 +01:00
Max Kellermann
6622d69fda song: added function song_get_duration() 2009-12-26 13:56:35 +01:00
Max Kellermann
5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +01:00
Max Kellermann
f7ce4f6239 song: renamed attribute "url" to "uri" 2009-10-13 18:01:06 +02:00
Anton Khirnov
df0c26a394 command: add "findadd" command. 2009-08-25 13:43:22 +02:00
Max Kellermann
d897170455 playlist: no CamelCase 2009-07-14 21:28:36 +02:00
Max Kellermann
9e30dfb9c1 dbUtils: removed printSavedMemoryFromFilenames()
The function is unused.
2009-03-15 18:21:53 +01:00
Avuton Olrich
0aee49bdf8 all: Update copyright header.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Max Kellermann
75c2029b1c tag: no CamelCase
Renamed numOfItems to num_items.
2009-02-27 09:01:55 +01:00
Max Kellermann
8d3205871c playlist: renamed global "playlist" variable to "g_playlist"
Export the "g_playlist" variable, and pass it to all playlist
functions.  This way, we can split playlist.c easier into separate
parts.  The code which initializes the singleton variable is moved to
playlist_global.c.
2009-02-04 18:56:41 +01:00
Max Kellermann
a45922cd66 use g_free() instead of free()
On some platforms, g_free() must be used for memory allocated by
GLib.  This patch intends to correct a lot of occurrences, but is
probably not complete.
2009-01-25 18:47:21 +01:00
Max Kellermann
e6cb939a82 locate: added locate_item_list_casefold()
Merged casefolding code from two locations into this one library
function.
2009-01-24 15:56:34 +01:00
Max Kellermann
6a2118d04c queue_print, dbUtils: use struct locate_item_list
Changed the function prototypes to get locate_item_list objects
instead of num_items/items.
2009-01-24 15:56:34 +01:00
Max Kellermann
ba7c996266 locate: added struct locate_item_list
Instead of passing two parameters around (number of items, array of
items), combine both in a variable size struct.
2009-01-24 15:56:30 +01:00
Max Kellermann
3582977e01 locate: no CamelCase
Renamed functions and variables.
2009-01-24 15:26:59 +01:00
Max Kellermann
53e712aca4 locate: renamed LocateTagItem to "struct locate_item"
No CamelCase and no typedefs.
2009-01-24 14:52:05 +01:00
Max Kellermann
1e6a26b6ca locate: use const pointers
Pass const pointers where no writes are performed.
2009-01-22 16:12:34 +01:00
Max Kellermann
14ca99b224 stats: use one db_walk() to obtain stats
Don't use dbUtils.h functions.  This reduces 4 full database walks to
just one.
2009-01-18 15:40:50 +01:00
Max Kellermann
ea8ae68e6f directory: added directory_is_root()
directory_is_root() is cheaper than
isRootDirectory(directory_get_path()).
2009-01-04 19:08:52 +01:00
Max Kellermann
906ca3e204 dbUtils: use GLib instead of utils.h 2009-01-03 13:37:36 +01:00
Thomas Jansen
34b1a9061e dbUtils.c: replaced mpd_unused by G_GNUC_UNUSED 2008-11-24 14:42:47 +01:00
Max Kellermann
ac853b6165 stored_playlist: no CamelCase
Renamed all public functions, prefix is "spl_".
2008-10-22 17:21:59 +02:00
Max Kellermann
a4def81313 renamed storedPlaylist.c to stored_playlist.c
No CamelCase in file names.
2008-10-22 17:21:57 +02:00
Max Kellermann
047043d2a8 locate: use g_utf8_casefold() instead of string_toupper()
string_toupper() and strDupToUpper() were not able to deal with
character sets other than US-ASCII.  Use GLib's g_utf8_casefold()
for strings.
2008-10-15 19:36:37 +02:00
Max Kellermann
22645abc10 directory: fix update in root directory
Commit 0bfe7802 broke update for new files in the root directory,
because music_root->path was an empty string and not NULL.  There were
some NULL tests missing.  Change them to !isRootDirectory(path)
instead of path!=NULL.
2008-10-08 11:55:52 +02:00
Max Kellermann
68977af6e0 directory: eliminate CamelCase
CamelCase is ugly, rename the functions.
2008-10-08 11:07:58 +02:00
Max Kellermann
bb8a9533b1 database: renamed functions, "db_" prefix and no CamelCase
Yet another CamelCase removal patch.
2008-10-08 11:07:55 +02:00
Max Kellermann
8a50e8a266 directory: moved code to database.c
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.
2008-10-08 11:07:35 +02:00
Max Kellermann
d562ba5fbb song: converted typedef Song to struct song
Again, a data type which can be forward-declared.
2008-10-08 10:49:11 +02:00
Max Kellermann
25f67da58c directory: converted typedef Directory to struct directory
The struct can be forward-declared by other headers, which relaxes the
header dependencies.
2008-10-08 10:49:05 +02:00
Eric Wong
8be6026336 dbUtils/directory: traverseAllIn forEachSong returns -1 on error
Being consistent with most UNIX functions...
2008-10-07 22:07:44 +02:00
Eric Wong
e19f6905d9 song: replace printSong* with song_print_*
This make argument order more consistent for iterators.
Additionally, these now return ssize_t results for error
checking.
2008-10-07 22:06:59 +02:00
Eric Wong
0352766dca Switch to C99 types (retaining compat with old compilers)
Seeing the "mpd_" prefix _everywhere_ is mind-numbing as the
mind needs to retrain itself to skip over the first 4 tokens of
a type to get to its meaning.  So avoid having extra characters
on my terminal to make it easier to follow code at 2:30 am in
the morning.

Please report any new issues you may come across on Free
toolchains.  I realize how difficult it can be to build/maintain
cross-compiling toolchains and I have no intention of forcing
people to upgrade their toolchains to build mpd.

Tested with gcc 2.95.4 and and gcc 4.3.1 on x86-32.
2008-09-29 13:29:33 +02:00
Eric Wong
a4019f7d21 allow searching for albums with an empty tag
tfing wrote:
> I have quite some files with an empty album tag as they do not come
> from a particular album.
>
> If I want to look for those files and browse them, this happens:
> :: nc localhost 6600
> OK MPD 0.12.0
> find album ""
> ACK [2@0] {find} too few arguments for "find"
>
> I'd like to be able to browse those files in a client like gmpc.
> So these 2 items would have to be developed:
> - list album should report that some files have an empty tag
> - it should be possible to search for an empty tag with the find command

Patch-by: Marc Pavot
ref: http://musicpd.org/mantis/view.php?id=464
2008-09-29 13:18:49 +02:00
Eric Wong
0bec1d3807 Replace SongList with struct songvec
Our linked-list implementation is wasteful and the
SongList isn't modified enough to benefit from being a linked
list.  So use a more compact array of song pointers which
saves ~200K on a library with ~9K songs (on x86-32).
2008-09-23 20:48:39 +02:00
Max Kellermann
f0e64ceb48 use strset.h instead of tagTracker.h
With a large music database, the linear string collection in
tagTracker.c becomes very slow.  We implemented that in a
quick'n'dirty fashion when we removed tree.c, and now we rewrite it
using the fast hashed string set.
2008-09-08 11:47:57 +02:00
Max Kellermann
4665f2bf32 tag: don't pass "fd" to printVisitedInTagTracker()
Pass the client struct instead of the raw file descriptor.
2008-09-07 13:57:58 +02:00
Max Kellermann
dc8b64fdef pass "struct client" to dbUtils.c, song.c, tag_print.c
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.
2008-09-07 13:53:55 +02:00
Max Kellermann
f320c9fa1d directory: don't pass fd to traverseAllIn()
This patch continues the work of the previous patch: don't pass a file
descriptor at all to traverseAllIn().  Since this fd was only used to
report "directory not found" errors, we can easily move that check to
the caller.  This is a great relief, since it removes the dependency
on a client connection from a lot of enumeration functions.
2008-09-07 13:48:37 +02:00
Max Kellermann
528be8a0a9 directory: don't pass fd to traverseAllIn() callbacks
Database traversal should be generic, and not bound to a client
connection.  This is the first step: no file descriptor for the
callback functions forEachSong() and forEachDir().  If a callback
needs the file descriptor, it has to be passed in the void*data
pointer somehow; some callbacks might need a new struct for passing
more than one parameter.  This might look a bit cumbersome right now,
but our goal is to have a clean API.
2008-09-07 13:48:24 +02:00
Max Kellermann
a8b225f947 playlist: don't pass "fd" to storedPlaylist.c functions
Return an "enum playlist_result" value instead of calling
commandError() in storedPlaylist.c.
2008-09-07 13:44:12 +02:00
Max Kellermann
8d2830b3f9 playlist: don't pass "fd" to playlist.c functions
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.
2008-09-07 13:39:31 +02:00
Max Kellermann
75aa8dad4c song: moved code to song_print.c, song_save.c
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.
2008-09-07 13:35:01 +02:00
Max Kellermann
35c0b84f08 dbUtils, playlist, directory: pass constant pointers
The usual bunch of const pointer conversions.
2008-09-06 15:28:31 +02:00