m_unescape_url: Remove completely
[libquvi.git] / src / misc / playlist.c
bloba3386034fb3e7c3e3a92504cca0f41ee4a26ef54
1 /* libquvi
2 * Copyright (C) 2012,2013 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of libquvi <http://quvi.sourceforge.net/>.
6 * This library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Affero General Public
8 * License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General
17 * Public License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
21 #include "config.h"
23 #include <glib.h>
25 #include "quvi.h"
26 /* -- */
27 #include "_quvi_s.h"
28 #include "_quvi_playlist_s.h"
29 /* -- */
30 #include "misc/playlist.h"
31 #include "misc/slst.h"
33 gpointer m_playlist_new(_quvi_t q, const gchar *url)
35 _quvi_playlist_t qp = g_new0(struct _quvi_playlist_s, 1);
36 /* URL */
37 qp->url.thumbnail = g_string_new(NULL);
38 qp->url.input = g_string_new(url);
39 /* ID */
40 qp->id.playlist = g_string_new(NULL);
41 /* Handle */
42 qp->handle.quvi = q;
43 /* Other */
44 qp->title = g_string_new(NULL);
45 return (qp);
48 void m_playlist_media_free(_quvi_playlist_media_t qpm)
50 if (qpm == NULL)
51 return;
53 g_string_free(qpm->title, TRUE);
54 qpm->title = NULL;
56 g_string_free(qpm->url, TRUE);
57 qpm->url = NULL;
59 g_free(qpm);
60 qpm = NULL;
63 static void _playlist_media_free(gpointer p, gpointer userdata)
65 m_playlist_media_free(p);
68 void m_playlist_free(_quvi_playlist_t qp)
70 if (qp == NULL)
71 return;
73 m_slist_free_full(qp->media, _playlist_media_free);
74 qp->media = NULL;
76 /* URL */
78 g_string_free(qp->url.thumbnail, TRUE);
79 qp->url.thumbnail = NULL;
81 g_string_free(qp->url.input, TRUE);
82 qp->url.input = NULL;
84 /* ID */
86 g_string_free(qp->id.playlist, TRUE);
87 qp->id.playlist = NULL;
89 /* Other */
91 g_string_free(qp->title, TRUE);
92 qp->title = NULL;
94 g_free(qp);
95 qp = NULL;
98 /* vim: set ts=2 sw=2 tw=72 expandtab: */