quvi/const: Remove quvi fetch options
[libquvi-scripts.git] / share / common / quvi / const.lua
blob9cf242092e0311d972e99cb8d1847f6f75c902d3
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 -- (q)uvi (err)or codes
26 -- static
27 M.qerr_ok = 0x00
28 M.qerr_callback_aborted = 0x01
29 M.qerr_no_subtitle_export_scripts = 0x02
30 M.qerr_no_subtitle_scripts = 0x03
31 M.qerr_no_playlist_scripts = 0x04
32 M.qerr_no_media_scripts = 0x05
33 M.qerr_no_scan_scripts = 0x06
34 M.qerr_no_util_scripts = 0x07
35 M.qerr_keyword_croak = 0x08
36 M.qerr_invalid_arg = 0x09
37 M.qerr_proxy_init = 0x0a
38 M.qerr_curl_init = 0x0b
39 M.qerr_lua_init = 0x0c
40 -- dynamically created
41 M.qerr_no_support = 0x40
42 M.qerr_callback = 0x41
43 -- an error occurred in a callback, e.g. a network error.
44 M.qerr_script = 0x42
47 -- (q)uvi (o)bject (o)ption
49 M.qoo_croak_if_error = 0x01 -- Terminate if an error occurs
50 -- fetch
51 M.qoo_fetch_from_charset = 0x20 -- Convert (to UTF-8) from this charset
52 -- http
53 M.qoo_http_user_agent = 0x40 -- Identify to HTTP servers as
54 M.qoo_http_cookie = 0x41 -- Set an arbitrary cookie
57 -- subtitle
60 -- (s)ubtitle (t)ype
61 M.st_tts = 0x1 -- text-to-speech
62 M.st_cc = 0x2 -- closed caption
64 -- (s)ubtitle (i)nternal (f)ormat
65 M.sif_tt = 0x1 -- timed text
67 -- (q)uvi.(f)etch (t)ype
68 M.qft_playlist = 0x0
69 M.qft_config = 0x1
70 M.qft_url = 0x2 -- default
72 --[[
74 qfo_from_charset
75 ----------------
76 Instructs the library to convert from this charset to UTF-8. Using this
77 option may be required with the websites that use a specific (non-UTF8)
78 encoding.
80 The purpose of this option is to make sure that the data is encoded to
81 unicode (UTF-8) before any of it is parsed and returned to the
82 application using libquvi.
84 By default, libquvi converts the data which is in the encoding used for
85 the strings by the C runtime in the current locale into UTF-8. IF this
86 fails, and the 'from charset' option is set, the library will then try
87 to convert to UTF-8 using the 'from charset' value.
89 qfo_cookie
90 ----------
91 When set, the arbitrary cookie will be used with the quvi.fetch .
92 The cookies are handled by libcurl, look up the CURLOPT_COOKIE
93 description for details. If you must define >1 cookies, use the
94 following format: "foo=1; bar=2;" .
96 EXAMPLES
97 --------
98 local C = require 'quvi/const'
100 local r = quvi.fetch(URL, {[C.qfo_cookie] = 'foo=1'})
101 local r = quvi.fetch(URL, {[C.qfo_type] = C.qft_config})
103 local t = {
104 [C.qfo_cookie] = 'foo=1; bar=2;',
105 [C.qfo_type] = C.qft_config
107 local r = quvi.fetch(URL, t)
109 ]]--
111 return M
113 -- vim: set ts=2 sw=2 tw=72 expandtab: