2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 /** @file script_get.c */
29 #include "_quvi_script_s.h"
32 typedef _quvi_script_t _qs_t
;
35 static QuviError
_get(_quvi_t q
, QuviScriptType stype
,
36 QuviScriptProperty n
, ...)
49 case QUVI_SCRIPT_TYPE_PLAYLIST
:
50 qs
= (_qs_t
) q
->scripts
.curr
.playlist
->data
;
52 case QUVI_SCRIPT_TYPE_MEDIA
:
54 qs
= (_qs_t
) q
->scripts
.curr
.media
->data
;
56 case QUVI_SCRIPT_TYPE_SCAN
:
57 qs
= (_qs_t
) q
->scripts
.curr
.scan
->data
;
62 type
= QUVI_SCRIPT_PROPERTY_MASK
& (gint
) n
;
73 case QUVI_SCRIPT_PROPERTY_TYPE_DOUBLE
:
74 dp
= va_arg(arg
, gdouble
*);
76 rc
= QUVI_ERROR_INVALID_ARG
;
78 case QUVI_SCRIPT_PROPERTY_TYPE_STRING
:
79 sp
= va_arg(arg
, gchar
**);
81 rc
= QUVI_ERROR_INVALID_ARG
;
83 case QUVI_SCRIPT_PROPERTY_TYPE_LONG
:
84 lp
= va_arg(arg
, glong
*);
86 rc
= QUVI_ERROR_INVALID_ARG
;
88 case QUVI_SCRIPT_PROPERTY_TYPE_VOID
:
89 vp
= va_arg(arg
, gpointer
*);
91 rc
= QUVI_ERROR_INVALID_ARG
;
94 rc
= QUVI_ERROR_INVALID_ARG
;
104 /* Media, playlist. */
105 case QUVI_SCRIPT_PROPERTY_DOMAINS
:
106 *sp
= qs
->domains
->str
;
109 case QUVI_SCRIPT_PROPERTY_FILEPATH
:
110 *sp
= qs
->fpath
->str
;
112 case QUVI_SCRIPT_PROPERTY_FILENAME
:
113 *sp
= qs
->fname
->str
;
115 case QUVI_SCRIPT_PROPERTY_SHA1
:
119 rc
= QUVI_ERROR_INVALID_ARG
;
125 /** @brief Return a media script property
128 void quvi_script_get(quvi_t handle
, QuviScriptType type
,
129 QuviScriptProperty id
, ...)
135 /* If G_DISABLE_CHECKS is defined then the check is not performed. */
136 g_return_if_fail(handle
!= NULL
);
139 p
= va_arg(arg
, gpointer
);
142 q
= (_quvi_t
) handle
;
144 q
->status
.rc
= _get(handle
, type
, id
, p
);
147 /* vim: set ts=2 sw=2 tw=72 expandtab: */