README

teve [te:ve:] is a CLI downloader for online video streams, aimed
primarily at Swedish television sites.
teve replaces SVTPlay.sh, which is outdated, unsupported and essentially
useless due to changes to svtplay.se.
1. REQUIREMENTS
Chicken Scheme 4.8 or later is required to run and compile teve. If your
package manager does not provide Chicken Scheme 4.8, or provides only an
outdated version, building Chicken from source is mind-numbingly simple
on most platforms.
The Chicken source code and pre-compiled binaries are available from the
Chicken home page:
http://code.call-cc.org/
After installing Chicken, you'll also need to install a few eggs:
# make install-eggs
Or if you prefer to see what you're installing:
# make print-eggs
intarweb srfi-37 json http-client vector-lib packrat ...
# chicken-install $(make print-eggs)
If chicken-install fails to build some egg, and there is no solution
listed in section 9. TROUBLESHOOTING below, please send a bug report.
teve currently invokes other programs to download streams.
FFmpeg For Apple HLS streams (SVT Play, Öppet arkiv, TV4 Play)
RTMPdump For rtmp/rtmpe streams (old streams at SVT & TV4 Play)
AdobeHDS.php For HDS streams (SVT & TV4 Play, Öppet arkiv)
This requires a working PHP installation. A suitable
version of this script is bundled with teve in the
gpl/ directory. To get the latest version of the
AdobeHDS.php script, please visit this page:
https://github.com/K-S-V/Scripts
cURL For ordinary HTTP downloads (SVT Play)
MPlayer For mms and rtsp downloads (old streams at SVT Play)
These tools must be present in your $PATH, or teve won't find them (or
see section 6. CONFIGURATION below).
You actually do not need both FFmpeg and AdobeHDS.php, as teve does not
try to use tools it cannot find. If you opt to use just one of the two,
you are recommended to use ffmpeg.
2. WINDOWS
teve is functional on Windows, though neither an automated build
process nor pre-compiled binaries are currently provided.
Please refer to the GitHub wiki to roll your own:
https://github.com/simio/teve/wiki/Windows-support
3. BUILDING
If you have not already, make sure the "scheme-prelude" git submodule is
initialised and current. (See 9. TROUBLESHOOTING below for details.)
With that done, just 'make' to get a binary, and then run it:
kaja$ teve -h
teve 0.3-devel
Usage: teve [options] <uri>
-c [type] Machine-readable output.
Different types are available:
s Scheme data [default]
j JSON
-d Download stream (default or specified with -i)
-e Enter REPL for each video.
-h Display this text
-i id Stream #id to use
-l List all streams (or specified with -i)
-o filename Set output filename
-v Be verbose
-V Print version information
Please report bugs to jesper at huggpunkt.org or https://github.com/simio/teve
You may optionally install it somewhere:
# make PREFIX=/usr/local install
The default PREFIX is /usr/opt, which puts the binary in /usr/opt/bin.
If you don't like binaries, you may run teve as a script:
$ csi -s teve.scm -h
4. TESTING
The tests are contained in tests/. They use the srfi-78 egg, so you
will need to install that before running the tests:
# chicken-install srfi-78
To run all tests in a batch, just 'make check'.
5. USAGE
The simplest use case is downloading a video:
1. In a web browser, go to the page where the video you want to
download is played.
2. Copy the uri (for example http://www.svtplay.se/aktuellt).
3. Run in a shell:
$ teve http://www.svtplay.se/aktuellt
If the video at that uri is properly identified, teve will
automatically pick a filename and start the appropriate downloader.
If there are several streams available for the same video, teve will
also try to pick the best stream to download. Please note that this
does NOT mean it will select the LARGEST stream. Instead, all streams
are compared to an ideal (defined by bitrate and video width in pixels),
and the closest match is selected. The ideal values can be changed in
configuration files or by setting environment variables. See
CONFIGURATION below for more information.
If you do not want teve to pick a stream automatically, you can
specify a specific stream id with the -i command line parameter.
To list all available streams, run teve with the -l parameter:
$ teve -l http://www.svtplay.se/aktuellt
And if you then decide to download stream #4:
$ teve -d -i 4 http://www.svtplay.se/aktuellt
To specify an output filename, use the -o parameter:
$ teve -d -o aktuellt -i 4 http://www.svtplay.se/aktuellt
An appropriate video file extension will be added automatically.
If the configuration value "default-action" is set to "download",
which is the default, the -d parameter above may be omitted.
6. CONFIGURATION
The built-in default configuration values may be overridden in
configuration files. The configuration with which teve is run is
loaded in a cascading manner:
1. The built-in defaults are loaded first.
2. If /etc/teve.conf is present, any values set in this file are
loaded. New values are added to the configuration, while already
present are replaced with the ones from this file.
3. If $HOME/.teverc is present, it is parsed and loaded as
/etc/teve.conf above. You may specify an alternate location to
look for this file by setting the TEVE_RC environment variable.
4. After the above files have been read, any environment variables set
are parsed, replacing or adding to the configuration.
5. The command line parameters are parsed last, overriding any
previously set configuration variables.
The configuration files are parsed as standard ini files. See
teve.conf.dist for a list of all configurable values, and their
corresponding environment variables.
7. SUPPORTED SITES
As of version 0.2, the following sites are supported:
svtplay.se
oppetarkiv.se
tv4play.se
8. CHANNELS
"Channels" refers to a bookmark-like functionality in teve, with which
you are able to define shorthands for URI:s, which are then
automatically expanded. For example, the following two invocations of
teve are functionally equivalent.
$ teve svt1
$ teve http://www.svtplay.se/kanaler/svt1
The "svt1" channel is predefined in the builtin configuration, meaning
you may override the associated uri in teve.conf by adding the
following line under the "[channels]" section:
[channels]
svt1="http://www.svtplay.se/my-favourite-slug"
You may also add any number of new channels in this way.
9. TROUBLESHOOTING
P: chicken-install fails to build the openssl egg.
S: Make sure you have the OpenSSL libs and header files installed.
If they have been stashed away into some obscure directory, you
may need to pass their locations to the compiler and linker:
# env CSC_OPTIONS='-I /foo/include/openssl -L /foo/lib' \
make install-eggs
P: There's some stuttering in an H.264 encoded video I downloaded.
S: This is a known problem with libavformat version 53 or older.
Amongst others, VLC, MPlayer and FFmpeg uses libavformat. Make
sure you have upgraded FFmpeg (for downloading HLS streams) and
are using the latest version of your media player of choice. If
this does not remedy the problem, please file a bug report.
P: When trying to compile, csc fails with a message of an unbound
identifier 'alist-update'.
S: Your version of Chicken Scheme is outdated. Version 4.8 or higher
is required.
P: make complains about targets not found in scheme-prelude/ and
refuses to do anything.
S: You need to 'git submodule update --init', or fetch the files
manually from https://github.com/simio/scheme-prelude
10. CONTACT
Direct any questions to either the (Swedish) BB at planka.huggpunkt.org
or directly to jesper at huggpunkt.org.