Updates to Radio theme / extension in order to have MP3, OGG playlists and Audio sources as configurable.

This commit is contained in:
Benjamin Southall 2017-04-25 00:04:36 +09:00
parent 03f814cfcb
commit 501f2694ff
2 changed files with 32 additions and 14 deletions

View File

@ -22,7 +22,27 @@ $theme = array(
array('title' => 'Radio Status URL', array('title' => 'Radio Status URL',
'name' => 'radiostatus', 'name' => 'radiostatus',
'type' => 'text', 'type' => 'text',
'default' => '/radio_assets/status.xsl')), 'default' => '/radio_assets/status.xsl'),
array('title' => 'Radio MP3 Playlist',
'name' => 'radiomp3playlist',
'type' => 'text',
'default' => ''),
array('title' => 'Radio OGG Playlist',
'name' => 'radiooggplaylist',
'type' => 'text',
'default' => ''),
array('title' => 'Radio MP3 Source',
'name' => 'radiomp3source',
'type' => 'text',
'default' => ''),
array('title' => 'Radio OGG Source',
'name' => 'radiooggsource',
'type' => 'text',
'default' => ''),
),
'build_function' => 'radio_build'); 'build_function' => 'radio_build');
?> ?>

View File

@ -9,7 +9,7 @@
<link rel="stylesheet" media="screen" href="/stylesheets/style.css"/> <link rel="stylesheet" media="screen" href="/stylesheets/style.css"/>
<link rel="stylesheet" media="screen" href="/stylesheets/cyberpunk.css"/> <link rel="stylesheet" media="screen" href="/stylesheets/cyberpunk.css"/>
<link rel="stylesheet" href="/stylesheets/font-awesome/css/font-awesome.min.css"> <link rel="stylesheet" href="/stylesheets/font-awesome/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script> <script src="https://lainchan.org/js/jquery.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
check_status(); check_status();
@ -19,13 +19,11 @@ $(document).ready(function(){
function check_status(){ function check_status(){
$.get("{{ settings.radiostatus }}", function(data){ $.get("{{ settings.radiostatus }}", function(data){
var el = $( '<div></div>' ); var el = $( '<div></div>' );
el.html(data); el.html(data.getElementsByTagName('html')[0].innerHTML);
var sd = el.find(".streamdata"); var sd = el.find(".streamstats");
$(".nowplaying").text("Now playing: " + sd[5].textContent);
$(".nowplaying").text("Now playing: " + sd[16].textContent); $(".currentlisteners").text("Current listeners: " + (parseInt(sd[2].textContent) + parseInt(sd[8].textContent)));
});}
$(".currentlisteners").text("Current listeners: " + sd[13].textContent); });
}
</script> </script>
</head> </head>
<body style=" background: url(/bg.php) no-repeat center center fixed; <body style=" background: url(/bg.php) no-repeat center center fixed;
@ -51,7 +49,7 @@ $(".currentlisteners").text("Current listeners: " + sd[13].textContent); });
<p>Welcome to lainchan's radio stream. <p>Welcome to lainchan's radio stream.
</p> </p>
<noscript><p>Radio statistics will be not be updated without JavaScript, please visit https://lainchan.org/radio_assets/status.xsl to see them directly.</p></noscript> <noscript><p>Radio statistics will be not be updated without JavaScript, please visit {{ settings.radiostatus }} to see them directly.</p></noscript>
<p class="nowplaying"> Now playing: <p class="nowplaying"> Now playing:
</p> </p>
@ -60,15 +58,15 @@ $(".currentlisteners").text("Current listeners: " + sd[13].textContent); });
<ul> <ul>
<li><a href="https://lainchan.org/static/lain.ogg.m3u">Vorbis M3U Playlist</a></li> <li><a href="{{ settings.radiooggplaylist }}">Vorbis M3U Playlist</a></li>
<li><a href="https://lainchan.org/static/lain.mp3.m3u">MP3 M3U Playlist</a></li> <li><a href="{{ settings.radiomp3playlist }}">MP3 M3U Playlist</a></li>
XSPF considered harmful. XSPF considered harmful.
</ul> </ul>
<audio controls preload="none" style="margin: 0 5% 20px 5%; width: 90%; box-shadow: 0px 0px 5px black;"> <audio controls preload="none" style="margin: 0 5% 20px 5%; width: 90%; box-shadow: 0px 0px 5px black;">
<source src="https://lainchan.org/radio_assets/lain.ogg" type="audio/ogg"> <source src="{{ settings.radiooggsource }}" type="audio/ogg">
<source src="https://lainchan.org/radio_assets/lain" type="audio/mpeg"> <source src="{{ settings.radiomp3source }}" type="audio/mpeg">
<em>Your browser lacks support for OGG Vorbis files. Please open the M3U file or XSPF file in a multimedia player.</em> <em>Your browser lacks support for OGG Vorbis files. Please open the M3U file or XSPF file in a multimedia player.</em>
</audio> </audio>
</div> </div>