Chapter 4. Under The Hood

Table of Contents

Media Groups
File Handlers
Media Type Binding
Includable Templates

MediaIndexer is designed to be modular and extendable so that it can provide support for new media types easily. Different Media files can contain specific attributes and they must be invoked by the browser in different ways. For example, images and video files are unique in many ways. Because of this invariance, MediaIndexer uses an idiom of groups and handlers to distinquish how each file should be categorized and displayed.

This chapter attempts to explain the definition of media groups, file handlers, and how they relate to the files served by MediaIndexer.

Media Groups

Media groups are classes which provides specific functionality when listing many media files within a particular group. Such examples include a Music Group, Movie Group, and a Pictures Group. A clear example of the functionality provided by a group class is the Music group. In this class, we add a checkbox next to each file listing, with the ability to add music files to a playlist.

Group classes are only used when specific features such as a Playlist is desired. In most cases, using the default group class is enough.

Creating a new media group is simply defining a new constant, associating it with a class name. For example movies assumes there will be a file named group.music.php which contains a PHP class named musicGroup.

Figure 4.1. Media Group Definitions

        define("_GROUP_MUSIC",       "music");
        define("_GROUP_MOVIES",      "movies");
        define("_GROUP_DOCUMENTS",   "documents");
      

Each group class must extend the default group class defaultGroup.