Welcome

This program generates a static standalone W3C HTML5/CSS3 website from a regular file system structure, focusing on media files (images, audio files, video files and text files). In each directory, a HTML file is created, embedding an audio-video player and a playlist made of all the compatible media files found at this level. An explorer view is also proposed in order to open and download files, as well as to navigate to the other directories. This program makes use of ExifTool and ImageMagick. Supported html5 and flash players are jPlayer, CodeBaseHero, DewPlayer and XspfPlayer.

Here is an example of the program output, as displayed by a regular web browser. In each directory, the program generates a single HTML file that embeds all the information about media files. It is therefore easy to design the resulting website using a home-made CSS3 file.

media2html 20130529


Live demo


Media2html is a cross-platform bash script that should run on most of the Unix environments. So far it has been tested on Mac OSX, Linux Ubuntu and Raspberry Pi Debian.

USAGE ./media2html [options]
OPTIONS
  --prefix           <PATH>  Set the processed directory to PATH. Default is current directory.
  --site-url         <URL>   Set the targeted site URL. This is used to prefix track locations in XSPF playlists.
                             If you apply this script to the /home/me/Music prefix and you upload the Music/ fodler to
                             http://www.mywebsite.com/, use http://www.mywebsite.com/Music as a site URL.
  --player           <NAME>  Set the embedded player. See in the media2htmldata/players/ directory. Default is jplayer.
  --style            <NAME>  Set the CSS style. See in the media2htmldata/styles/ directory. Default is yellow.
  --output           <NAME>  Set the NAME of the generated HTML files. Default is index.html.
  --google-analytics <ID>    Add a Google Analytics tracking code to each web page.
                             Your personal Analytics ID looks like UA-xxxxxxx-x
                             http://www.google.com/analytics/
  --google-search    <ID>    Add a Custom Google Search box to each web page.
                             Your personal Search ID looks like 011737558837375720776:mbfrjmyam1g
                             http://www.google.fr/cse/
  --facebook         <URL>   Add a Facebook Like Box widget showing your page stream located at URL.
  --soundcloud       <ID>    Add a Soundcloud widget showing the music stream.
                             To get your ID, use the share button on the profile page,
                             and get it from the URL given by the WordPress Code, that looks:
                             http://api.soundcloud.com/users/ID
  --link             <URL>   Add a link to a given URL. You can repeat this option in the same command line.
                             This can be used to add social networks.
                             Add URLs within quotes to prevent special characters misinterpretation.
  --exiftool         <PATH>  Set the PATH to the exiftool command-line application.
                             ExifTool is used to read metadata and tags from media files.
                             Just download this tool and extract wherever you want. No need to install.
                             http://www.sno.phy.queensu.ca/~phil/exiftool/
                             If this option is not set, media2html will search for exiftool in your $PATH environment.
                             No metadata will be processed otherwise (except for mp3 ID3TAG v1).
  --convert          <PATH>  Set the PATH to the convert command-line application.
                             Convert is used to create thumbnails from image files. Size is up to 256x512px.
                             Install the ImageMagick package or follow instructions on this site.
                             http://www.imagemagick.org
                             If this option is not set, media2html will search for convert in your $PATH environment.
                             No thumbnails will be created otherwise.
  --zip                      Enable ZIP compression to download files. Generates one ZIP file per folder.
  --xspf                     Generate one XSPF playlist per folder.
  --xspf-global              Generate a global XSPF playlist.
  --no-player                Disable the playlist player.
  --no-html                  Disable the HTML output.
  --print                    Print the list of generated files to the standard output,
                             delimited by the newline character.
  --print0                   Print the list of generated files to the standard output,
                             delimited by the null character.
  --regexp           <EXP>   Apply the EXP regular expression to the style.css file.
                             Please use the sed -e \'EXP\' syntax.
  --maxdepth         <DEPTH> Descend at most DEPTH directory levels below the target directory to process,
                             '--maxdepth 1' only processes files in the target directory.
                             This option may be used within a Makefile to update selected directories
                             or to apply different styles to different directories.
                             Default is unset, recursively processing the whole sub-tree.
  --version                  Display the script version.
  --help                     Display this information.
EXAMPLES
  ./media2html
                             This will process the current directory.
  ./media2html --prefix /Users/Me/Music --style green
                             This will process the Music directory using the green style.
  ./media2html --link "https://sites.google.com/site/media2html" --link "http://www.jplayer.org/"
                             This will add both site links on each generated html page.
  ./media2html --exiftool ~/dev/src/Image-ExifTool-9.23/
                             This will use the given path to find the exiftool application.
  ./media2html --maxdepth 1
                             This will only process the files in the current directory.
DIAGNOSTICS
  The ./media2html utility exits 0 on success, and 1 otherwise.



GitHub



This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.