aboutsummaryrefslogtreecommitdiffstats
path: root/src/song_save.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2010-07-25queue_save: save tags and range of non-database songsMax Kellermann1-6/+12
Use the functions song_save() and song_load() to use the same format as in the database file for those songs which need the tags.
2010-07-25song_save: save start_ms and end_msMax Kellermann1-0/+11
While this is not useful for the database, it may become useful for reusing this code for the state file.
2010-07-25song_save: song_load() returns NULL instead of falseMax Kellermann1-2/+2
2010-07-21song_save: pass const songvec to songvec_save()Max Kellermann1-1/+1
2009-12-31Update copyright notices.Avuton Olrich1-1/+1
2009-11-12include config.h in all sourcesMax Kellermann1-0/+1
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-04tag: added function tag_name_parse()Max Kellermann1-14/+1
Convert a string into a tag_type enum.
2009-11-04song_save: explicitly parse the colonMax Kellermann1-18/+27
Clear the colon. This simplifies all attribute parsers, because they can now use strcmp() instead of strncmp().
2009-11-01song_save: free song object on errorMax Kellermann1-0/+4
Fix a minor memory leak.
2009-11-01song_save: load one song at a timeMax Kellermann1-62/+11
Changed songvec_load() to song_load(). Added start and end markers for each song. Removed the "key" line, it's redundant.
2009-11-01database: use strcmp() instead of g_str_has_prefix()Max Kellermann1-2/+1
2009-11-01text_file: allocate line buffers dynamicallyMax Kellermann1-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.
2009-11-01song_save: increased maximum line length to 32 kBMax Kellermann1-3/+7
The line buffer had a fixed size of 5 kB, and was allocated on the stack. This was too small for some users. As a hotfix, we're increasing the buffer size to 32 kB now, allocated on the heap. In MPD 0.16, we'll switch to dynamic allocation.
2009-10-13song: renamed attribute "url" to "uri"Max Kellermann1-7/+6
2009-07-05song_save: use GError for error handlingMax Kellermann1-5/+18
2009-07-05song_save: no CamelCaseMax Kellermann1-11/+11
Renamed functions.
2009-04-28song_save: don't call tag_free(NULL)Max Kellermann1-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().
2009-03-15log: removed DEBUG() and FATAL()Max Kellermann1-3/+7
Use GLib the logging functions g_debug(), g_error() instead.
2009-03-13all: Update copyright header.Avuton Olrich1-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.
2009-02-27tag: no CamelCaseMax Kellermann1-2/+2
Renamed numOfItems to num_items.
2009-01-14song_save: don't fail on empty tag valuesMax Kellermann1-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.
2009-01-14song_save: return value pointer from matchesAnMpdTagItemKey()Max Kellermann1-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.
2009-01-14song_save: itemType is "enum tag_type", not "int"Max Kellermann1-2/+2
2009-01-13song_save: check for colon and space when loading a tagMax Kellermann1-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.
2009-01-03don't include utils.h when it isn't usedMax Kellermann1-1/+2
2008-12-28utils: removed myFgets()Max Kellermann1-2/+4
Replaced myFgets() with fgets() + g_strchomp().
2008-10-08directory: eliminate CamelCaseMax Kellermann1-1/+1
CamelCase is ugly, rename the functions.
2008-10-08song: removed CamelCaseMax Kellermann1-5/+5
CamelCase is ugly... rename all functions.
2008-10-08song: replaced all song constructorsMax Kellermann1-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.
2008-10-08song: converted typedef Song to struct songMax Kellermann1-5/+8
Again, a data type which can be forward-declared.
2008-10-08directory: converted typedef Directory to struct directoryMax Kellermann1-1/+1
The struct can be forward-declared by other headers, which relaxes the header dependencies.
2008-10-07song: use songvec_for_each() in songvec_print() / songvec_save()Max Kellermann1-12/+11
songvec_for_each() has locking, use it instead of manually iterating over the songvec items.
2008-10-06song: stop storing song_typeEric Wong1-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).
2008-10-06song: use flex arrays to store song->urlEric Wong1-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.
2008-10-06song: get rid of newNullSong()Eric Wong1-1/+1
It didn't save us any lines of code nor did it do anything useful since we would overwrite everything anyways.
2008-09-23songvec: remove songvec_pruneEric Wong1-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.
2008-09-23Don't try to prune unless we're updatingEric Wong1-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).
2008-09-23Replace SongList with struct songvecEric Wong1-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).
2008-09-07tag: added buffered versions of the tag_print.c codeMax Kellermann1-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.
2008-09-07song: moved code to song_print.c, song_save.cMax Kellermann1-186/+3
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-07tag: moved code to tag_print.cMax Kellermann1-0/+1
Move everything which dumps a tag to a file descriptor to tag_print.c. This relaxes dependencies and splits the code into smaller parts.
2008-09-06tag: fix segfault on updateEric Wong1-0/+1
clearMpdTag could be called on a tag that was still in a tag_begin_add transaction before tag_end_add is called. This was causing free() to attempt to operate on bulk.items; which is un-free()-able. Now instead we unmark the bulk.busy to avoid committing the tags to the heap only to be immediately freed. Additionally, we need to remember to call tag_end_add() when a song is updated before we NULL song->tag to avoid tripping an assertion the next time tag_begin_add() is called.
2008-08-29tag: try not to reallocate tag.items in every add() callMax Kellermann1-4/+16
If many tag_items are added at once while the tag cache is being loaded, manage these items in a static fixed list, instead of reallocating the list with every newly created item. This reduces heap fragmentation. Massif results again: mk before: total 12,837,632; useful 10,626,383; extra 2,211,249 mk now: total 12,736,720; useful 10,626,383; extra 2,110,337 The "useful" value is the same since this patch only changes the way we allocate the same amount of memory, but heap fragmentation was reduced by 5%.
2008-08-29song: don't export newNullSong()Max Kellermann1-1/+1
The function newNullSong() is only used internally in song.c.
2008-08-29tag: renamed functions, no CamelCaseMax Kellermann1-10/+10
2008-08-26assert song->url != NULLMax Kellermann1-0/+3
2008-08-26no camel case in struct decoder_pluginMax Kellermann1-2/+2
2008-08-26renamed inputPlugin.* to decoder_list.*Max Kellermann1-1/+1
Since inputPlugin.c manages the list of registered decoders, we should rename the source file.
2008-08-26renamed InputPlugin to struct decoder_pluginMax Kellermann1-2/+3
"decoder plugin" is a better name than "input plugin", since the plugin does not actually do the input - InputStream does. Also don't use typedef, so we can forward-declare it if required.
2008-03-26fix segmentation fault in song info parserMax Kellermann1-4/+5
The database parser does not check whether the song object has been initialized yet, which may lead to a NULL pointer dereference. Add this check. git-svn-id: https://svn.musicpd.org/mpd/trunk@7201 09075e82-0dd4-0310-85a5-a0d7c8717e4f