Skip to content

NicolasGraph/oui_bandcamp

Repository files navigation

oui_bandcamp

Introduction

oui_bandcamp is a oui_player v2+ extension to easily embed Bandcamp provided albums and tracks in Textpattern powered websites.

The above platform serves cookies with its player, according to the EU legislation, you should warn your users about these cookies before they are added. This can be done by using oui_cookie.

Plugin requirements

oui_bandcamp’s minimum requirements:

Plugin management

Installation

From the admin interface

  1. Download the compiled plugin file or the source to compile a customized file.
  2. Paste the content of the compiled plugin file under the “Admin > Plugins”:?event=plugin tab and click the Upload button.
  3. Confirm the plugin install by clicking the Install button on the plugin preview page.
  4. Enable the plugin and click the Options link (or visit the Preferences tab) to set the provider preferences.

Via Composer (not available yet)

After installing Composer

  1. Target your project directory:
    $ cd /path/to/your/textpattern/installation/dir
  2. If it’s not already done, lock your version of Txp:
    $ composer require textpattern/lock:4.6.2, where 4.6.2 is the Txp version in use.
  3. Install oui_bandcamp:
    $ composer require nicolasgraph/oui_bandcamp

Update

From the admin interface

  1. Follow the installation instruction above.

Via Composer (not available yet)

$ composer update nicolasgraph/oui_bandcamp

Uninstall

From the admin interface

  1. Check the box on the left of the plugin row under the “Admin > Plugins”:?event=plugin.
  2. open the select list at the bottom of the plugins table and choose Delete.
  3. confirm the plugin deletion.

Via Composer (not available yet)

$ composer remove nicolasgraph/oui_bandcamp

Tags and parameters

oui_bandcamp vs oui_player

While the <txp:oui_player /> tag is able to embed any media from any extension-related provider, the <txp:oui_bandcamp /> tag is a shortcut to embed Bandcamp albums and tracks only. It is strictly equivalent to <txp:oui_player provider="bandcamp" />.

Check the oui_player documentation for more informations.

Recognised values for the play attribute

  • album=ID;
  • track=ID;
  • album=ID/track=ID;
  • http(s)://bandcamp.com/(EmbeddedPlayer/)album=ID;
  • http(s)://bandcamp.com/(EmbeddedPlayer/)track=ID;
  • http(s)://bandcamp.com/(EmbeddedPlayer/)album=ID/(…/)track=ID.

When using the oui_player tag (vs oui_bandcamp), the right provider needs to be set if the play value or its field related one is an ID. It is optional, but can fasten the rendering, if the value is an URL.

Player customization

Preferences vs attributes

While some player customization elements, related to the media to play, should be used through attributes, these used as global settings should preferrably be set through the plugin preferences to avoid a massive use of tag attributes.

Of course, it is still possible to override a preference value via an attribute when needed.

Size
width

Integer; initially set to 350.
The width of the player.

height

Integer; initially set to 470.
The height of the player.

ratio

integer:integer; initially not set.
The ratio used to calculate the missing value for the width or the height.

responsive

true or false; initially set to false.
Adapts the final player size from the provided width and/or height and/or ratio values to fit the container width.
Wraps the player and adds some styles.

Parameters (a→z)

From Txp 4.7, paramaters accepting true and false as valid values can be enable through boolean/valueless attributes.

artwork

big or small; initially set to big.
Defines the artwork size.

bgcol

Hexadecimal color value; initially set to #ffffff.
Background color.

linkcol

Hexadecimal color value; initially set to #0687f5.
Links colors.

tracklist

true or false; initially set to true;
Displays the tracklist.

size

big or small; initially not set.
Defines the player size type; recommended width and height values are:

  • big: 350px × 470px (without the tracklist)
  • small: 100% × 120px (or 42px for a slim player)
Sets

The sets of values below allow to render different player types.

  • Big:
    • width="470";
  • medium:
    • artwork="small";
    • width="100%";
    • height="120";
  • small:
    • size="small";
    • width="100%";
    • height="42".

oui_if_bandcamp vs oui_if_player

While the <txp:oui_if_player>…</txp:oui_if_player> tag is able to check an URL against any URL from any extension-related provider, the <txp:oui_if_bandcamp>…</txp:oui_if_bandcamp> tag is a shortcut to check an URL against Bandcamp related URL schemes only. It is strictly equivalent to <txp:oui_if_player provider="bandcamp">…</txp:oui_if_player>.

Check the oui_player documentation for more informations.

Examples

Embed a player using the preference values

<txp:oui_player />

oui_player preference related field value: https://bandcamp.com/EmbeddedPlayer/album=3819613117.

Embed a player by defining its provider and a media ID through attributes

<txp:oui_player provider="bandcamp" play="album=3819613117" />

…or:

<txp:oui_bandcamp play="album=3819613117" />

Conditionally embed a player using attributes

<txp:oui_if_player provider="bandcamp" play="https://bandcamp.com/EmbeddedPlayer/album=3819613117/track=1169742928">
    <txp:oui_player />
</txp:oui_if_player>

…or:

<txp:oui_if_bandcamp play="https://bandcamp.com/EmbeddedPlayer/album=3819613117/track=1169742928">
    <txp:oui_bandcamp />
</txp:oui_if_bandcamp>

Credits

Author

Nicolas Morand
Thank you to the Textpattern community and the core team.

License

This plugin is distributed under GPL v2.0.

oui_bandcamp version 1.0.0-BETA3, Copyright © 2018 Nicolas Morand
This Textpattern plugin comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.

Changelog

  • oui_bandcamp v1.0.0-BETA3 (2018-08-15)
    • Changed: initial player size.
  • oui_player v1.3.0 (2017-05-24)