Jump to content
MediaWiki

Extension:WikiMusicGuide MusicStream

From mediawiki.org
Revision as of 15:25, 30 March 2016 by Kghbln (talk | contribs) (chg)
MediaWiki extensions manual
WikiMusicGuide MusicStream
Release status: unknown
Implementation Tag
Description WikiMusicGuide Free Music Streaming Service
Author(s) wikiwebguide
Latest version 1.0.0 (10-24-2006)
MediaWiki
Licence No licence specified
Download see below

The MusicStream extension allows you to link an .mp3 or .ogg file on a wiki page.


About
The MusicStream is a media extension that allows anyone who has an .mp3 or .ogg file to stream/play it using the WikiMusicGuide Free Streaming Service. You can play music without waiting for the download to complete or installing complicated web media players. Linking your .mp3 or .ogg file on your page will let your browser download the song to either save it on your disk or open it in your preferred media player.
This simple but useful application that WikiMusicGuide offers will surely give an enjoyable interactive experience to its visitors, contributors, and all independent artists and bands in the music industry.

File:Musicstream.jpg
WikiMusicGuide Listening Room
Installation
If you have an .mp3 or ogg file and you want to share it with WikiMusicGuide and others, please refer to the wiki text below.

syntax

 <musicstream>
 url=http://yourdomain.com/song.mp3
 label=Song
 </musicstream>

URL is the address of the .mp3 or ogg file.
Label is the title of the .mp3 or ogg file.


Code
<?php
 # Using this extension will allow you to stream your music. 
 # It takes a mp3 or ogg file as input and outputs a m3u streaming file.
 #
 # To activate the extension, include the following at the end of your LocalSettings.php
 # require_once("extensions/musicstream.php");
 #
 # Syntax:
 # <musicstream>
 # url=http://yourdomain.com/song.mp3
 # label=Song
 # </musicstream>
 $wgExtensionFunctions[] = "wfMusicStream";
 
 function wfMusicStream() {
 global $wgParser;
 $wgParser->setHook( "musicstream", "renderMusicStream" );
 }
 function renderMusicStream($input) {
 getOption($url,$input,'url');
 getOption($text,$input,'label');
 $output = "<a href='http://www.wikimusicguide.com/stream.php?url=$url'>$text</a> 
 <img src='http://www.wikimusicguide.com/images/musicstream.gif' border='1' />";
 return $output;
 }
 function getOption(&$value,&$input,$name,$isNumber=false) {
 if(preg_match("/^\s*$name\s*=\s*(.*)/mi",$input,$matches)) {
 if($isNumber) {
 $value=intval($matches[1]);
 } else {
 $value=htmlspecialchars($matches[1]);
 }
 }
 }

MP3 Download example

AltStyle によって変換されたページ (->オリジナル) /