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 /** @file script_next.c */
33 #define _W "libquvi: %s: %d"
37 /** @brief Traverse to the next script
38 @return QUVI_TRUE if succeeded, otherwise QUVI_FALSE
41 QuviBoolean
quvi_script_next(quvi_t handle
, QuviScriptType type
)
49 /* If G_DISABLE_CHECKS is defined then the check is not performed. */
50 g_return_val_if_fail(handle
!= NULL
, QUVI_FALSE
);
54 case QUVI_SCRIPT_TYPE_SUBTITLE_EXPORT
:
55 l
= q
->scripts
.subtitle_export
;
58 case QUVI_SCRIPT_TYPE_SUBTITLE
:
59 l
= q
->scripts
.subtitle
;
62 case QUVI_SCRIPT_TYPE_PLAYLIST
:
63 l
= q
->scripts
.playlist
;
68 g_warning(_W
, __func__
, (gint
) type
);
70 case QUVI_SCRIPT_TYPE_MEDIA
:
74 case QUVI_SCRIPT_TYPE_SCAN
:
83 case QUVI_SCRIPT_TYPE_SUBTITLE_EXPORT
:
84 q
->scripts
.curr
.subtitle_export
=
85 (q
->scripts
.curr
.subtitle_export
!= NULL
)
86 ? g_slist_next(q
->scripts
.curr
.subtitle_export
)
88 r
= (q
->scripts
.curr
.subtitle_export
!= NULL
)
93 case QUVI_SCRIPT_TYPE_SUBTITLE
:
94 q
->scripts
.curr
.subtitle
= (q
->scripts
.curr
.subtitle
!= NULL
)
95 ? g_slist_next(q
->scripts
.curr
.subtitle
)
97 r
= (q
->scripts
.curr
.subtitle
!= NULL
)
102 case QUVI_SCRIPT_TYPE_PLAYLIST
:
103 q
->scripts
.curr
.playlist
= (q
->scripts
.curr
.playlist
!= NULL
)
104 ? g_slist_next(q
->scripts
.curr
.playlist
)
106 r
= (q
->scripts
.curr
.playlist
!= NULL
)
111 case QUVI_SCRIPT_TYPE_MEDIA
:
113 q
->scripts
.curr
.media
= (q
->scripts
.curr
.media
!= NULL
)
114 ? g_slist_next(q
->scripts
.curr
.media
)
116 r
= (q
->scripts
.curr
.media
!= NULL
)
121 case QUVI_SCRIPT_TYPE_SCAN
:
122 q
->scripts
.curr
.scan
= (q
->scripts
.curr
.scan
!= NULL
)
123 ? g_slist_next(q
->scripts
.curr
.scan
)
125 r
= (q
->scripts
.curr
.scan
!= NULL
)
136 /* vim: set ts=2 sw=2 tw=72 expandtab: */