aboutsummaryrefslogtreecommitdiffstats
path: root/src/song_save.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* song_save: load one song at a timeMax Kellermann2009-11-011-62/+11
| | | | | Changed songvec_load() to song_load(). Added start and end markers for each song. Removed the "key" line, it's redundant.
* database: use strcmp() instead of g_str_has_prefix()Max Kellermann2009-11-011-2/+1
|
* text_file: allocate line buffers dynamicallyMax Kellermann2009-11-011-16/+15
| | | | | | | Use a single GString buffer object in all functions loading the database. Enlarge it automatically for long lines. This eliminates the maximum line length for tag values. There is still an upper limit of 512 kB to prevent denial of service, but that's reasonable I guess.
* song: renamed attribute "url" to "uri"Max Kellermann2009-10-131-7/+6
|
* song_save: use GError for error handlingMax Kellermann2009-07-051-5/+18
|
* song_save: no CamelCaseMax Kellermann2009-07-051-11/+11
| | | | Renamed functions.
* song_save: don't call tag_free(NULL)Max Kellermann2009-04-281-1/+2
| | | | | | When a song was in the database twice (which shouldn't happen), and the first song had no tag items, MPD calledd tag_free(NULL). Add a check to that source location, and an assertion to tag_free().
* log: removed DEBUG() and FATAL()Max Kellermann2009-03-151-3/+7
| | | | Use GLib the logging functions g_debug(), g_error() instead.
* all: Update copyright header.Avuton Olrich2009-03-131-6/+7
| | | | | | | | 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.
* tag: no CamelCaseMax Kellermann2009-02-271-2/+2
| | | | Renamed numOfItems to num_items.
* song_save: don't fail on empty tag valuesMax Kellermann2009-01-141-2/+2
| | | | | | If a tag value is an empty string, the space after the colon was removed by g_strchomp(). Fix this by removing the space check and using g_strchug() on the return value.
* song_save: return value pointer from matchesAnMpdTagItemKey()Max Kellermann2009-01-141-8/+8
| | | | | | | The matchesAnMpdTagItemKey() API becomes more powerful and flexible if the return value is the value pointer instead of a boolean. It also removes (invalid and dangerous) assumptions about the string from its caller.
* song_save: itemType is "enum tag_type", not "int"Max Kellermann2009-01-141-2/+2
|
* song_save: check for colon and space when loading a tagMax Kellermann2009-01-131-2/+4
| | | | | | matchesAnMpdTagItemKey() broke when two tag items had the same prefix, because it did not check if the tag name ended after the prefix. Add a check for the colon and the space after the tag name.
* don't include utils.h when it isn't usedMax Kellermann2009-01-031-1/+2
|
* utils: removed myFgets()Max Kellermann2008-12-281-2/+4
| | | | Replaced myFgets() with fgets() + g_strchomp().
* directory: eliminate CamelCaseMax Kellermann2008-10-081-1/+1
| | | | CamelCase is ugly, rename the functions.
* song: removed CamelCaseMax Kellermann2008-10-081-5/+5
| | | | CamelCase is ugly... rename all functions.
* song: replaced all song constructorsMax Kellermann2008-10-081-2/+2
| | | | | | 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.
* song: converted typedef Song to struct songMax Kellermann2008-10-081-5/+8
| | | | Again, a data type which can be forward-declared.
* directory: converted typedef Directory to struct directoryMax Kellermann2008-10-081-1/+1
| | | | | The struct can be forward-declared by other headers, which relaxes the header dependencies.
* song: use songvec_for_each() in songvec_print() / songvec_save()Max Kellermann2008-10-071-12/+11
| | | | | songvec_for_each() has locking, use it instead of manually iterating over the songvec items.
* song: stop storing song_typeEric Wong2008-10-061-1/+1
| | | | | | | 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).
* song: use flex arrays to store song->urlEric Wong2008-10-061-7/+3
| | | | | | Reduce the number of allocations we make, so there's less pressure on the allocator and less overhead to keep track of the allocations in.
* song: get rid of newNullSong()Eric Wong2008-10-061-1/+1
| | | | | It didn't save us any lines of code nor did it do anything useful since we would overwrite everything anyways.
* songvec: remove songvec_pruneEric Wong2008-09-231-3/+0
| | | | | | Any pruned files will be noticed during update and pruned from the live database, so this inefficient function can go away and never come back.
* Don't try to prune unless we're updatingEric Wong2008-09-231-1/+2
| | | | | | Pruning is very expensive and we won't need it in the future anyways. This brings startup back to previous speeds (before songvec changes).
* Replace SongList with struct songvecEric Wong2008-09-231-54/+31
| | | | | | | 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).
* tag: added buffered versions of the tag_print.c codeMax Kellermann2008-09-071-3/+20
| | | | | | | | | | | Currently, when the tag cache is being serialized to hard disk, the stdio buffer is flushed before every song, because tag_print.c performs unbuffered writes on the raw file descriptor. Unfortunately, the fdprintf() API allows buffered I/O only for a client connection by looking up the client pointer owning the file descriptor - for stdio, this is not possible. To re-enable proper stdio buffering, we have to duplicate the tag_print.c code without fprintf() instead of our custom fdprintf() hack. Add this duplicated code to tag_save.c.
* song: moved code to song_print.c, song_save.cMax Kellermann2008-09-071-0/+160
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.