[t̪eːveː]

File List
Login

Files of check-in [c9a3f4ef57] in the top-level directory


teve [te:ve:] is a CLI downloader for online video streams, aimed
primarily at Swedish television sites.


TABLE OF CONTENTS

  1. REQUIREMENTS
  2. RUNNING ON WINDOWS
  3. OBTAINING THE SOURCE CODE
  4. BUILDING
  5. TESTING
  6. USAGE
  7. CONFIGURATION
  8. SUPPORTED SITES
  9. CHANNELS
  10. TROUBLESHOOTING
  11. CONTACT



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 will also need to install a few eggs:

    # cd teve-src/
    # 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 10. 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 7. 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. RUNNING ON WINDOWS

teve is functional on Windows, though neither an automated build
process nor pre-compiled binaries are currently provided.

Please refer to the teve wiki to roll your own:

    https://chiselapp.com/user/jesper/repository/teve/wiki?name=Windows+support



3. OBTAINING THE SOURCE CODE

The source code for both parts of teve are ISC licensed. The easiest
way to explain the ISC license is arguably the licence text itself:

    Permission to use, copy, modify, and distribute this software for any
    purpose with or without fee is hereby granted, provided that the above
    copyright notice and this permission notice appear in all copies.

Another way is to simply list exhaustively the things you MAY NOT do:

    1. You may not remove nor change the license text.
       If you're "that guy" and simply must use some other license for
       your parts of a derivative work, you will have to dual license.
    
    2. You may not remove nor change the copyright statement.
       Simply add your own copyright statement wherever you see fit.

That said, the latest code can easily be obtained from the project page:

    https://chiselapp.com/user/jesper/repository/teve/

You may either use Fossil to clone the repository or download a tarball
directly from the site. To download a tarball of the latest release,
click "Branches" in the menu. From this page, you may proceed to the
latest state of the main development trunk or to the latest release.

Before teve will actually compile or run, you will also need to add the
"scheme-base" library, which can be obtained in a similar manner from
this page:

    https://chiselapp.com/user/jesper/repository/scheme-base/

Put the base library files in a subdirectory called "base" inside the
teve source code directory.

This extra step will be either redundant or performed automatically
when a scheme based build system is implemented.



4. BUILDING

Just 'make' to get a binary, and then run it:

  kaja$ teve -h
  teve 0.2.6
  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
  at https://chiselapp.com/user/jesper/repository/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



5. 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'.

As is all too common with tests, they are currently not up-to-date.



6. 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
7. 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.



7. 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.



8. SUPPORTED SITES

As of version 0.2, the following sites are supported:

  svtplay.se
  oppetarkiv.se
  tv4play.se



9. 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.



10. 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.
 


11. CONTACT

Direct any questions to either the project page at
https://chiselapp.com/user/jesper/repository/teve/, the (Swedish) BB at
planka.huggpunkt.org, or directly to jesper at huggpunkt.org.