Use renamed quvi.http.fetch
[libquvi-scripts.git] / share / common / quvi / const.lua
blob6b334644e4567b68889ed5f39c50a352364564bc
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 --[[
69 qoo_fetch_from_charset
70 ----------------------
71 Instructs the library to convert from this charset to UTF-8. Using this
72 option may be required with the websites that use a specific (non-UTF8)
73 encoding.
75 The purpose of this option is to make sure that the data is encoded to
76 unicode (UTF-8) before any of it is parsed and returned to the
77 application using libquvi.
79 By default, libquvi converts the data which is in the encoding used for
80 the strings by the C runtime in the current locale into UTF-8. IF this
81 fails, and the 'from charset' option is set, the library will then try
82 to convert to UTF-8 using the 'from charset' value.
84 qoo_http_cookie
85 ---------------
86 When set, the arbitrary cookie will be used with the quvi.http.fetch
87 function. The cookies are handled by libcurl, look up the CURLOPT_COOKIE
88 description for details. If you must define >1 cookies, use the
89 following format: "foo=1; bar=2;" .
91 EXAMPLES
92 --------
93 local C = require 'quvi/const'
94 local r = quvi.http.fetch(URL, { [C.qoo_http_cookie] = 'foo=1' })
95 ]]--
97 return M
99 -- vim: set ts=2 sw=2 tw=72 expandtab: