2 * Copyright (C) 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/>.
23 #include <glib/gi18n-lib.h>
29 #include "_quvi_subtitle_export_s.h"
30 #include "_quvi_subtitle_s.h"
31 #include "_quvi_script_s.h"
33 #include "misc/match_subtitle_export_script.h"
34 #include "misc/subtitle_export.h"
37 extern const gchar
*show_script
; /* m_scan_scripts */
40 _match_format_to_subtitle_export_script(_quvi_subtitle_export_t qse
,
43 *curr
= qse
->handle
.quvi
->scripts
.subtitle_export
;
46 const QuviError rc
= l_exec_subtitle_export_script_ident(qse
, *curr
);
51 *curr
= g_slist_next(*curr
);
53 return (QUVI_ERROR_NO_SUPPORT
);
57 m_match_subtitle_export_script(_quvi_t q
, _quvi_subtitle_export_t
*dst
,
58 _quvi_subtitle_lang_t qsl
,
59 const gchar
*to_format
)
64 *dst
= m_subtitle_export_new(q
, qsl
->url
->str
);
65 g_string_assign((*dst
)->format
.to
, to_format
);
66 (*dst
)->format
.from
= qsl
->format
;
68 rc
= _match_format_to_subtitle_export_script(*dst
, &s
);
69 if (rc
== QUVI_ERROR_NO_SUPPORT
)
71 g_string_printf(q
->status
.errmsg
,
72 _("No support: Could not find a subtitle export "
73 "script for format `%s'"), to_format
);
76 else if (rc
!= QUVI_OK
)
79 if (show_script
!= NULL
&& strlen(show_script
) >0)
81 const _quvi_script_t qs
= (const _quvi_script_t
) s
->data
;
83 g_message("[%s] libquvi: %s: input URL accepted",
84 __func__
, qs
->fpath
->str
);
86 return (l_exec_subtitle_export_script_export(*dst
, s
));
89 /* vim: set ts=2 sw=2 tw=72 expandtab: */