~ubuntu-branches/ubuntu/trusty/mpd/trusty

« back to all changes in this revision

Viewing changes to src/dbUtils.c

  • Committer: Bazaar Package Importer
  • Author(s): Angel Abad
  • Date: 2011-02-02 12:26:30 UTC
  • mfrom: (1.5.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20110202122630-bdyx8w4k94doz4fs
Tags: 0.16.1-1ubuntu1
* Merge from debian unstable. Remaining changes:
  - debian/control:
    + Don't build-depend on libmikmod2-dev (Debian bug #510675).
    + Move avahi-daemon from Suggests field to Recommends field.
  - debian/mpd.init.d:
    + Read mpd user from mpd.conf.
  - debian/control, debian/rules:
    + Add libmp3lame-dev to the build dependencies and enable lame.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2003-2009 The Music Player Daemon Project
 
2
 * Copyright (C) 2003-2010 The Music Player Daemon Project
3
3
 * http://www.musicpd.org
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or modify
17
17
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
18
 */
19
19
 
 
20
#include "config.h"
20
21
#include "dbUtils.h"
21
22
#include "locate.h"
22
23
#include "directory.h"
59
60
printSongInDirectory(struct song *song, G_GNUC_UNUSED void *data)
60
61
{
61
62
        struct client *client = data;
62
 
        song_print_url(client, song);
 
63
        song_print_uri(client, song);
63
64
        return 0;
64
65
}
65
66
 
74
75
        struct search_data *data = _data;
75
76
 
76
77
        if (locate_song_search(song, data->criteria))
77
 
                return song_print_info(data->client, song);
 
78
                song_print_info(data->client, song);
78
79
 
79
80
        return 0;
80
81
}
104
105
        struct search_data *data = _data;
105
106
 
106
107
        if (locate_song_match(song, data->criteria))
107
 
                return song_print_info(data->client, song);
 
108
                song_print_info(data->client, song);
108
109
 
109
110
        return 0;
110
111
}
134
135
 
135
136
        if (locate_song_match(song, stats->criteria)) {
136
137
                stats->numberOfSongs++;
137
 
                if (song->tag->time > 0)
138
 
                        stats->playTime += song->tag->time;
 
138
                stats->playTime += song_get_duration(song);
139
139
        }
140
140
 
141
141
        return 0;
168
168
static int
169
169
directoryAddSongToPlaylist(struct song *song, G_GNUC_UNUSED void *data)
170
170
{
171
 
        return addSongToPlaylist(&g_playlist, song, NULL);
 
171
        return playlist_append_song(&g_playlist, song, NULL);
172
172
}
173
173
 
174
174
struct add_data {
200
200
}
201
201
 
202
202
static int
 
203
findAddInDirectory(struct song *song, void *_data)
 
204
{
 
205
        struct search_data *data = _data;
 
206
 
 
207
        if (locate_song_match(song, data->criteria))
 
208
                return directoryAddSongToPlaylist(song, data);
 
209
 
 
210
        return 0;
 
211
}
 
212
 
 
213
int findAddIn(struct client *client, const char *name,
 
214
              const struct locate_item_list *criteria)
 
215
{
 
216
        struct search_data data;
 
217
 
 
218
        data.client   = client;
 
219
        data.criteria = criteria;
 
220
 
 
221
        return db_walk(name, findAddInDirectory, NULL, &data);
 
222
}
 
223
 
 
224
static int
203
225
directoryPrintSongInfo(struct song *song, void *data)
204
226
{
205
227
        struct client *client = data;
237
259
        bool found = false;
238
260
 
239
261
        if (tagType == LOCATE_TAG_FILE_TYPE) {
240
 
                song_print_url(client, song);
 
262
                song_print_uri(client, song);
241
263
                return;
242
264
        }
243
265