示例#1
0
文件: dbUtils.c 项目: GunioRobot/mpd
int listAllUniqueTags(struct client *client, int type,
		      const struct locate_item_list *criteria)
{
	int ret;
	ListCommandItem *item = newListCommandItem(type, criteria);
	struct list_tags_data data = {
		.client = client,
		.item = item,
	};

	if (type >= 0 && type <= TAG_NUM_OF_ITEM_TYPES) {
		data.set = strset_new();
	}

	ret = db_walk(NULL, listUniqueTagsInDirectory, NULL, &data);

	if (type >= 0 && type <= TAG_NUM_OF_ITEM_TYPES) {
		const char *value;

		strset_rewind(data.set);

		while ((value = strset_next(data.set)) != NULL)
			client_printf(client, "%s: %s\n",
				      tag_item_names[type],
				      value);

		strset_free(data.set);
	}

	freeListCommandItem(item);

	return ret;
}
示例#2
0
文件: dbUtils.c 项目: GunioRobot/mpd
int addAllInToStoredPlaylist(const char *name, const char *utf8file)
{
	struct add_data data = {
		.path = utf8file,
	};

	return db_walk(name, directoryAddSongToStoredPlaylist, NULL, &data);
}
示例#3
0
文件: dbUtils.c 项目: GunioRobot/mpd
int findAddIn(struct client *client, const char *name,
	      const struct locate_item_list *criteria)
{
	struct search_data data;

	data.client   = client;
	data.criteria = criteria;

	return db_walk(name, findAddInDirectory, NULL, &data);
}
示例#4
0
文件: db_print.c 项目: mvasilkov/mpd
bool
findSongsIn(struct client *client, const char *name,
	    const struct locate_item_list *criteria,
	    GError **error_r)
{
	struct search_data data;

	data.client = client;
	data.criteria = criteria;

	return db_walk(name, &find_visitor, &data, error_r);
}
示例#5
0
文件: db_print.c 项目: mvasilkov/mpd
bool
searchStatsForSongsIn(struct client *client, const char *name,
		      const struct locate_item_list *criteria,
		      GError **error_r)
{
	SearchStats stats;

	stats.criteria = criteria;
	stats.numberOfSongs = 0;
	stats.playTime = 0;

	if (!db_walk(name, &stats_visitor, &stats, error_r))
		return false;

	printSearchStats(client, &stats);
	return true;
}
示例#6
0
文件: dbUtils.c 项目: GunioRobot/mpd
int
searchStatsForSongsIn(struct client *client, const char *name,
		      const struct locate_item_list *criteria)
{
	SearchStats stats;
	int ret;

	stats.criteria = criteria;
	stats.numberOfSongs = 0;
	stats.playTime = 0;

	ret = db_walk(name, searchStatsInDirectory, NULL, &stats);
	if (ret == 0)
		printSearchStats(client, &stats);

	return ret;
}
示例#7
0
文件: db_print.c 项目: mvasilkov/mpd
bool
searchForSongsIn(struct client *client, const char *name,
		 const struct locate_item_list *criteria,
		 GError **error_r)
{
	struct locate_item_list *new_list
		= locate_item_list_casefold(criteria);
	struct search_data data;

	data.client = client;
	data.criteria = new_list;

	bool success = db_walk(name, &search_visitor, &data, error_r);

	locate_item_list_free(new_list);

	return success;
}
示例#8
0
文件: dbUtils.c 项目: GunioRobot/mpd
int
searchForSongsIn(struct client *client, const char *name,
		 const struct locate_item_list *criteria)
{
	int ret;
	struct locate_item_list *new_list
		= locate_item_list_casefold(criteria);
	struct search_data data;

	data.client = client;
	data.criteria = new_list;

	ret = db_walk(name, searchInDirectory, NULL, &data);

	locate_item_list_free(new_list);

	return ret;
}
示例#9
0
文件: stats.c 项目: raumzeitlabor/mpd
void stats_update(void)
{
    struct visit_data data;

    stats.song_count = 0;
    stats.song_duration = 0;
    stats.artist_count = 0;

    data.artists = strset_new();
    data.albums = strset_new();

    db_walk(NULL, stats_collect_song, NULL, &data);

    stats.artist_count = strset_size(data.artists);
    stats.album_count = strset_size(data.albums);

    strset_free(data.artists);
    strset_free(data.albums);
}
示例#10
0
文件: db_print.c 项目: mvasilkov/mpd
bool
listAllUniqueTags(struct client *client, int type,
		  const struct locate_item_list *criteria,
		  GError **error_r)
{
	ListCommandItem *item = newListCommandItem(type, criteria);
	struct list_tags_data data = {
		.client = client,
		.item = item,
	};

	if (type >= 0 && type <= TAG_NUM_OF_ITEM_TYPES) {
		data.set = strset_new();
	}

	if (!db_walk("", &unique_tags_visitor, &data, error_r)) {
		freeListCommandItem(item);
		return false;
	}

	if (type >= 0 && type <= TAG_NUM_OF_ITEM_TYPES) {
		const char *value;

		strset_rewind(data.set);

		while ((value = strset_next(data.set)) != NULL)
			client_printf(client, "%s: %s\n",
				      tag_item_names[type],
				      value);

		strset_free(data.set);
	}

	freeListCommandItem(item);

	return true;
}
示例#11
0
文件: dbUtils.c 项目: GunioRobot/mpd
int printInfoForAllIn(struct client *client, const char *name)
{
	return db_walk(name, directoryPrintSongInfo,
			     printDirectoryInDirectory, client);
}
示例#12
0
文件: dbUtils.c 项目: GunioRobot/mpd
int
addAllIn(struct player_control *pc, const char *name)
{
	return db_walk(name, directoryAddSongToPlaylist, NULL, pc);
}