quvi/const: Add subtitle types, formats
[libquvi-scripts.git] / share / common / quvi / const.lua
blob380bb1803c71d66e6e2c774b048101cfbd64b69f
1 -- libquvi-scripts
2 -- Copyright (C) 2010-2013 Toni Gundogdu <legatvs@gmail.com>
3 --
4 -- This file is part of libquvi-scripts <http://quvi.sourceforge.net/>.
5 --
6 -- This program 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 program 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 program. If not, see
18 -- <http://www.gnu.org/licenses/>.
21 local M = {}
24 -- subtitle
27 -- (s)ubtitle (t)ype
28 M.st_tts = 0x1 -- text-to-speech
29 M.st_cc = 0x2 -- closed caption
31 -- (s)ubtitle (i)nternal (f)ormat
32 M.sif_tt = 0x1 -- timed text
35 -- quvi.fetch
38 -- (q)uvi.(f)etch (o)ption
39 M.qfo_from_charset = 0x0 -- Convert (to UTF-8) from this charset
40 M.qfo_user_agent = 0x1 -- Set user-agent string value
41 M.qfo_cookie = 0x2 -- Set an arbitrary cookie
42 M.qfo_type = 0x3 -- Fetch type (see qft_*)
44 -- (q)uvi.(f)etch (t)ype
45 M.qft_playlist = 0x0
46 M.qft_config = 0x1
47 M.qft_url = 0x2 -- default
49 --[[
51 qfo_from_charset
52 ----------------
53 Instructs the library to convert from this charset to UTF-8. Using this
54 option may be required with the websites that use a specific (non-UTF8)
55 encoding.
57 The purpose of this option is to make sure that the data is encoded to
58 unicode (UTF-8) before any of it is parsed and returned to the
59 application using libquvi.
61 By default, libquvi converts the data which is in the encoding used for
62 the strings by the C runtime in the current locale into UTF-8. IF this
63 fails, and the 'from charset' option is set, the library will then try
64 to convert to UTF-8 using the 'from charset' value.
66 qfo_cookie
67 ----------
68 When set, the arbitrary cookie will be used with the quvi.fetch .
69 The cookies are handled by libcurl, look up the CURLOPT_COOKIE
70 description for details. If you must define >1 cookies, use the
71 following format: "foo=1; bar=2;" .
73 EXAMPLES
74 --------
75 local C = require 'quvi/const'
77 local p = quvi.fetch(URL, {[C.qfo_cookie] = 'foo=1'})
78 local p = quvi.fetch(URL, {[C.qfo_type] = C.qft_config})
80 local t = {
81 [C.qfo_cookie] = 'foo=1; bar=2;',
82 [C.qfo_type] = C.qft_config
84 local p = quvi.fetch(URL, t)
86 ]]--
88 return M
90 -- vim: set ts=2 sw=2 tw=72 expandtab: