Beispiel #1
0
static gboolean
xmms_html_browse (xmms_xform_t *xform, const gchar *url,
                  xmms_error_t *error)
{
	gchar buffer[XMMS_XFORM_MAX_LINE_SIZE];
	const gchar *plsurl;
	gchar *tagbeg, *aurl, *full;

	xmms_error_reset (error);
	plsurl = xmms_xform_get_url (xform);

	while (xmms_xform_read_line (xform, buffer, error)) {
		tagbeg = buffer;
		while ((tagbeg = strchr (tagbeg, '<'))) {
			if ((aurl = parse_tag (++tagbeg, plsurl))) {
				full = xmms_build_playlist_url (plsurl,
				                                aurl);
				xmms_xform_browse_add_symlink (xform,
				                               NULL, full);
				g_free (full);
				g_free (aurl);
			}
		}
	}

	return TRUE;
}
Beispiel #2
0
static void
add_track (xmms_xform_t *xform, cue_track *tr)
{
	GList *n;
	gchar *file;

	tr->tracks = g_list_reverse (tr->tracks);
	n = tr->tracks;

	file = xmms_build_playlist_url (xmms_xform_get_url (xform), tr->file);

	while (n) {
		gchar arg0[32], arg1[32];
		gchar *arg[2] = { arg0, arg1 };
		gint numargs = 1;
		cue_track *t = n->data;
		if (!t) {
			continue;
		}

		g_snprintf (arg0, sizeof (arg0), "startms=%d",
		            t->index2 ? t->index2 : t->index);

		if (n->next && n->next->data) {
			cue_track *t2 = n->next->data;
			g_snprintf (arg1, sizeof (arg1), "stopms=%d", t2->index);
			numargs = 2;
		}

		xmms_xform_browse_add_symlink_args (xform, NULL, file, numargs, arg);
		xmms_xform_browse_add_entry_property_int (xform, "intsort", t->index);
		if (*t->title) {
			xmms_xform_browse_add_entry_property_str (xform, "title", t->title);
		}
		if (*t->artist || *tr->artist) {
			xmms_xform_browse_add_entry_property_str (xform, "artist",
			                                          (*t->artist)? t->artist : tr->artist);
		}
		if (*tr->album) {
			xmms_xform_browse_add_entry_property_str (xform, "album", tr->album);
		}

		g_free (t);
		n = g_list_delete_link (n, n);
	}

	g_free (file);

	tr->file[0] = '\0';
	tr->tracks = NULL;
}
Beispiel #3
0
static gboolean
xmms_m3u_browse (xmms_xform_t *xform,
                 const gchar *url,
                 xmms_error_t *error)
{
	gchar line[XMMS_XFORM_MAX_LINE_SIZE];
	gchar *tmp;
	gchar *title = NULL;
	const gchar *d;

	g_return_val_if_fail (xform, FALSE);

	xmms_error_reset (error);

	if (!xmms_xform_read_line (xform, line, error)) {
		XMMS_DBG ("Error reading m3u-file");
		return FALSE;
	}

	d = xmms_xform_get_url (xform);

	do {
		if (line[0] == '#') {
			if (!title) {
				title = get_extinf (line);
			}
		} else {
			tmp = xmms_build_playlist_url (d, line);
			xmms_xform_browse_add_symlink (xform, NULL, tmp);

			if (title) {
				xmms_xform_browse_add_entry_property_str (xform,
				                                          "title",
				                                          title);
				g_free (title);
				title = NULL;
			}

			g_free (tmp);
		}

	} while (xmms_xform_read_line (xform, line, error));

	g_free (title);

	return TRUE;
}
Beispiel #4
0
static void
xmms_pls_add_entry (xmms_xform_t *xform,
                    const gchar *plspath,
                    xmms_pls_entry_t *e)
{
	if (e->file) {
		gchar *path;

		path = xmms_build_playlist_url (plspath, e->file);

		xmms_xform_browse_add_symlink (xform, NULL, path);
		if (e->title)
			xmms_xform_browse_add_entry_property_str (xform, "title", e->title);

		g_free (path);
		g_free (e->file);
		e->file = NULL;
	}

	if (e->title) {
		g_free (e->title);
		e->title = NULL;
	}
}