This section describes the various parts of the framework, their purposes, and the modules that implement them.

Discography Entities and Fields

Within Drupal, discography information is saved inside an entity type. Usually, that entity is a node type, but it could be a custom entity type, or a system of related node types (like Pushtape Discography), and it can have different kinds of fields.

The Discography Framework provides one field, and two node types:

  • Track Field: This is a field that holds information about a single track. You can add this field to any content type (such as an audio node). In addition to the multiple built-in formatters and widgets, the field is fully themeable using a template.

    Both the Release Node and Track Node modules are dependent upon the Track Field module.

  • Track Node: This is provided for sites that focus on tracks, rather than albums or releases. It is essentially a node wrapper for a single instance of a Track Field. Of course, site administrators can also add whatever fields they want through the Fields UI, just like any other node type.
  • Release Node: This node type handles information for a single discography release. It is probably the most important part of the framework, from the user's perspective.

    The Release Node is a rewrite of the Discography content type from Discogs 6.x. In this version, all of the images are handled by Drupal 7's Image module (thank goodness). The tracks are handled by multiple Track Fields.

Discography Entity Adapter

If you want to programmatically create the entity types above, there needs to be some way to take properly-formatted release data, put it into a form that the entity understands, and save that entity. This is the job of the Entity Adapter.

By putting this into a separate module, you can write a specific Entity Adapter for a specific content type. This way, any entity, node, bundle, field, or whatever can be supported by the Discography Framework. Other developers can support their specific content type simply by implementing a couple of hooks.

The Discography Framework provides the Release Adapter module for this purpose. It is the adapter for the Release Node type.

Discography Provider Adapter

Outside of Drupal, there are third parties that provide discography information through their own API's. Those API's could use JSON, REST, SOAP, or any other protocol that supports remote procedural calls. More services are popping up daily, which is a good thing.

In order to get this information into the Discography Framework, there needs to be some way to query the third party API, and return properly-formatted release data. This is the job of the Provider Adapter.

By putting this into a separate module, you can write a specific Provider Adapter for a specific API. This way, the Discography Framework can support any API that returns discography data, such as Discogs.com or Last.fm. Other developers can support a specific API by implementing a couple of hooks.

The Discography Framework provides the Discogs.com Adapter module for this purpose. It is the adapter for the Discogs.com website.

Discography Mediator

The mediator is the glue that holds everything together. It routes requests between the users, the Provider Adapter, and the Entity Adapter. It is the Mediator that invokes the hooks that the Adapters implement.

Specifically, the mediator has these tasks:

  • Handle form wizards and user interaction
  • Route search requests from the user to the Provider Adapter
  • Display search results returned by the Provider Adapter
  • Route import requests from the user to the Entity Adapter
  • Use the Batch API to import multiple releases at a time

Because all of this is done in the provided Discography Mediator, other module developers do not have to worry about it. They can create their own Provider Adapter or Entity Adapter simply by implementing a couple of hooks.