MyDigitalLife

Media Application Design

This component has sub components, so it uses a component launcher; class MediaMenuWindow.

Data model

The model for the music database is shown below.

MediaDb

The media database, it consists of:

  • artists (set of type Artist)
    All bands, musicians, singers, composers, etc. used in the database.
  • songs (set of type Song)
    All songs referred to by the tracks.
  • tracks (set of type Track)
    All tracks referred to by the albums.
  • albums (set of type Album)
    All music albums known in the database.

Artist

An artist can be anything like a band, a player, a songwriter, etc..

  • name (type String)
    The name of the artist.
  • roles (set of type ArtistRole)
    The set of roles the artist plays.
  • containerArtist (reference to an Artist)
    This is used for grouping. For example, if you have an album of ‘Pete Yorn’ and one of ‘Pete Yorn & Scarlett Johansson’, it make sense to store them under ‘Pete Yorn’. In this case artist ‘Pete Yorn & Scarlett Johansson’ has ‘Pete Yorn’ as container artist.

ArtistRoleEnum (enumeration)

An enumeration of roles an Artist can have:

  • BAND
    The artist is a band.
  • MUSICIAN
    The artist plays one or more instruments.
  • SINGER
    The artist sings.
  • SONGWRITER
    The artist composes songs.

Player

Someone who plays (or sings) on an album. A player is an artist, combined with the set of instruments he plays on an album.

  • artist (type Artist)
  • instruments (type String)
    A comma separated list of instruments (including vocals).

Song

A song is a piece of music, written by one or more composers/authors.
There are often different versions of a song, occurring on different albums and also often by different artists.

  • title (type String)
    The title (name) of the song.
  • authors (set of type Artist)
    The people who wrote the song.

Album

A music album.

  • title (type String)
    The album title (name).
  • artist (type Artist)
    The album artist.
  • releaseDate (type FlexDate)
    The date the album was released (issued).
  • id (type String)
    The album identification.
  • imagesFront (list of type String)
    A list of filenames of front images of the album.
  • imagesFrontInside (list of type String)
    A list of filenames of front inside images of the album. For a CD these are typically part of the inlay.
  • imagesBack (list of type String)
    A list of filenames of back images of the album.
  • imagesLabel (list of type String)
    A list of filenames of label images of the album.
  • players (set of type Player)
    The players on the album.
  • descriptionTitle (type String)
    The title of the description.
  • description (type String)
    A description of the album. This typically contains facts about the album.
  • comments (type String)
    Comments on the album. This typically contains opinions about the album.
  • issuedOnMediums (set of type MediumType)
    The media on which the album has been issued.
  • compilation (type Boolean)
    If set, the album is a compilation album. I.e. an album with tracks of earlier released albums.
  • soundtrack (type Boolean)
    If set, the album is a movie soundtrack.
  • discs (list of type Disc)
    The discs of the album.
  • myInfo (type MyInfo)
    My information about the album.

MyCompilation (extends Album)

This type extends type Album, but doesn’t add anything. It is only there to indicate that the album is my own compilation (without polluting the Album type).

Disc

A disc of an album. An album has one of more discs.

  • title (type String)
    The disc title (name). The disc of a single disc album has no title.
  • tracks (list of type TrackReference)
    The tracks on the disc.

TrackReference

A reference to a Track.

  • track (reference to a Track)
    A reference to a Track.
  • myTrackReferenceInfo (type MyTrackReferenceInfo)
    My information about this track reference.

MyTrackReferenceInfo

My information about a TrackReference.

  • compilationTrackReference (type TrackReference)
    Reference to the track on the My Compilation album.
  • originalAlbumTrackReference (type TrackReference)
    Reference to the track on the original album.

Track

Describes a track (a recording of a song).

  • title (type String)
    The track title (name).
  • duration (type Integer)
    The length of the track in seconds.
  • song (reference to a Song)
    A reference to a song.
  • authors (set of type Artist)
    The artists who wrote the song.
  • artist (type Artist)
    The artist of the track. This is mainly used for compilation albums with tracks from different artists.
  • players (set of type Artist)
    The artists playing on the track.
  • parts (list of type TrackPart)
    A track can consist of several parts.
  • originalAlbum (type Album)
    A reference to the Album on which the track originally appeared.
  • referredBy (list of TrackReference)
    A list of the track references which refer to this track. This is the opposite of TrackReference.trackReference.
  • myTrackInfo (type MyTrackInfo)
    My information about this track.

TrackPart

Describes a part of a Track.

  • title (type String)
    The title (name) of the track part.

MyTrackInfo

My information about a Track.

  • iHaveOn (set of MediumInfo)
    Indicates on which media I have the tracks.
  • iWant (type IWant)
    Indicates whether I want the track or not.
  • collection (type Collection)
    The collection in which I have this track.

Collection (enumeration)

An enumeration of song collections:

  • EASY_LISTENING
    Easy listening songs.
  • FILM_BACKING_TRACKS
    Tracks that can be used as backing track for a film.
  • FRANSTALIG
    French songs
  • KLASSIEK
    Classical music
  • NEDERLANDSTALIG
    Songs in the dutch language.
  • POP
    Pop songs.
  • ROCK
    Rock music, the rougher pop songs.

MyInfo

My personal information on an album.

  • iWant (type IWant)
    Indicates whether I want an album or not, or that I don’t know yet.
    If I have an album, or I have the tracks of an album that I want to have, this value is no longer set (if you have it, you can assume you want to have it).
    This attribute is only used if there is no track information available.
  • myComments (type String)
    My remarks about the album.
  • inlayDocument (type String)
    The name of a file, which holds an inlay document for the album.
  • iveHadOnLP (type Boolean)
    If true, I’ve had the album on LP.
  • albumReferences (a list of references to type Album)
    TODO

IWant (enumeration)

An enumeration of values that indicate whether I want something or not:

  • YES
    I want it.
  • NO
    I don’t want it.
  • DONT_KNOW
    I Don’t know whether I want it or not.

MediumInfo

Provides information about storage media.

  • mediumType (type MediumType)
    The kind of medium.
  • TODO

DiscAndTrackNrs

Specifies tracks on a disc.

  • discNr (type integer)
    The disc index within the list of discs of an album.
    For single disc albums this value is set to -1.
  • trackNrs (list of integer)
    The track numbers on the disc.
    An empty list indicates all tracks of the disc.

Design overview

The media database contains general music related information and user specific information about this information. Among others it provides information on which albums or tracks you have. It does however not specify where albums or tracks are stored on disc. This coupling is based on the convention of how the music files are stored.

The starting point for the media based applications is the MediaMenuWindow. This class first reads the media database and passes it on to any component that needs it.


Next the Music Folder (‘D:/Music’) is parsed to get information on what is available on disc. Finally the information in the MediaDb is coupled to what is available on disc.
Based on the MediaDb it is already possible to determine which audio files should be available and where, but with our approach we can check for files that are not related to information in the database (i.e. errors).

Packages

package goedegep.media.app.guifx

class MediaMenuWindow

This class is the component launcher for the media based applications. This class first reads the media database and passes it on to any component that needs it.
The components that can be launched are:

  • Music database – class MediaDbWindow, using the media database
  • Music Folder
  • Photoshow builder
  • Photoshow viewer
  • Photo Map View
  • Photo Editor
  • Video database
  • Dune

Saving the media database is also done in this window.

package goedegep.media.mediadb.app.guifx

class MediaDbWindow

This is the main class of the media database component. At startup it gets the media database as a parameter. It does the following at startup:

  • TODO: Currently it starts by reading the artist information via the ArtistInfoHandler, which adds this information to the database. When this works well it will be removed.

package goedegep.media.musicfolder

This package provides all functionality related to the music stored on disc, known as the Music Folder.

class MusicFolder

This class contains the top level information about the music folder.
It gets all kinds of names from the MusicFolderDescription.

class MusicFolderDescription

This class provides a description of the top level of the Music Folder.
The different items are described by ItemDescriptions.

class ItemDescription

Description of an item, being a name and description.

class ArtistFolder

This class contains all information about an album folder.

class AlbumFolder

This class provides functionality for Album Folders within the Music Folder structure.

class TrackFile

This class provides the functionality related to audio tracks (audio files). Mainly the naming conventions for these files.

class MusicFolderContent

This class gathers the content of the MusicFolder and provides it in a way applications can use it.
Album information is provided as a list of AlbumOnDiscInfo, track information is provided as a list of TrackOnDiscInfo.

class  AlbumOnDiscInfo

This class stores information on the folder name and track filenames of an album.

class TrackOnDiscInfo

This class provides information on where a music track is stored on disc (file system).

class MusicFolderUtil

This is a utility class for handling a Music Folder.

class MusicFolderStructureErrorInfo

This class provides error information for errors encountered in the structure of the Music Folder.

enum MusicFolderStructureError

This enum provides error codes for errors encountered in the structure of the Music Folder.

package goedegep.media.mediadb.albuminfo

This package contains the classes to read the Album Info files and store the information in a MediaDb structure.

class AlbumInfoFilesReader

This class iterates over the Album Info files and for each file calls the AlbumInfoHandler.

class AlbumInfoHandler

This is a handler working together with a SAXParser, to parse an Album Info file.
All information is translated to the classes of the MediaDb data model and stored in the mediaDb.
All errors encountered during parsing are stored in a list of AlbumInfoErrorInfo.

class AlbumInfoErrorInfo

Details about a parsing error.

enum AlbumInfoError

Error codes which are used in the AlbumInfoErrorInfo.

package goedegep.media.mediadb.trackinfo

This package contains the classes to read a Track Info file.

class TrackInfoHandler

This is a handler working together with a SAXParser, to parse a Track Info file.
All information is translated to the classes of the MediaDb data model and stored in the mediaDb.
All errors encountered during parsing are stored in a list of TrackInfoErrorInfo.

class TrackInfoErrorInfo

Details about a parsing error.