first commit
This commit is contained in:
commit
6f9f8e42c1
6
README.md
Normal file
6
README.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
* https://doc.owncloud.org/server/9.0/developer_manual/app/tutorial.html
|
||||||
|
* https://github.com/owncloud/app-tutorial#tutorial
|
||||||
|
* http://127.0.0.1/index.php/settings/apps
|
||||||
|
|
||||||
|
* https://mvigil-cs263-technology-project.readthedocs.io/en/latest/apptutorial.html
|
||||||
|
* docker run -v /home/onny/projects/owncloud-app-radio:/var/www/html/apps/radio -d -p 80:80 owncloud:latestdocker run -v /home/onny/projects/owncloud-app-radio:/var/www/html/apps/radio -d -p 80:80 owncloud:latest
|
14
ajax/seturl.php
Executable file
14
ajax/seturl.php
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2011, Frank Karlitschek <karlitschek@kde.org>
|
||||||
|
* Copyright (c) 2012, Florian Hülsmann <fh@cbix.de>
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or later.
|
||||||
|
* See the COPYING-README file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
OCP\User::checkAdminUser();
|
||||||
|
OCP\JSON::callCheck();
|
||||||
|
|
||||||
|
OCP\Config::setSystemValue( 'somesetting', $_GET['somesetting'] );
|
||||||
|
|
||||||
|
echo 'true';
|
34
appinfo/app.php
Executable file
34
appinfo/app.php
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ownCloud - App Template plugin
|
||||||
|
*
|
||||||
|
* @author Frank Karlitschek
|
||||||
|
* @author Florian Hülsmann
|
||||||
|
* @copyright 2011 Frank Karlitschek karlitschek@kde.org
|
||||||
|
* @copyright 2012 Florian Hülsmann fh@cbix.de
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
OCP\App::registerAdmin( 'radio', 'settings' );
|
||||||
|
|
||||||
|
OCP\App::addNavigationEntry( array(
|
||||||
|
'id' => 'radio',
|
||||||
|
'order' => 74,
|
||||||
|
'href' => OCP\Util::linkTo( 'radio', 'index.php' ),
|
||||||
|
'icon' => OCP\Util::imagePath( 'radio', 'radio.png' ),
|
||||||
|
'name' => 'Radio'
|
||||||
|
));
|
38
appinfo/database.xml
Executable file
38
appinfo/database.xml
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<database>
|
||||||
|
<name>*dbname*</name>
|
||||||
|
<create>true</create>
|
||||||
|
<overwrite>false</overwrite>
|
||||||
|
<charset>utf8</charset>
|
||||||
|
<table>
|
||||||
|
<name>*dbprefix*radio_streams</name>
|
||||||
|
<declaration>
|
||||||
|
<field>
|
||||||
|
<name>id</name>
|
||||||
|
<type>integer</type>
|
||||||
|
<default>0</default>
|
||||||
|
<notnull>true</notnull>
|
||||||
|
<autoincrement>1</autoincrement>
|
||||||
|
<length>4</length>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>name</name>
|
||||||
|
<type>text</type>
|
||||||
|
<notnull>true</notnull>
|
||||||
|
<length>64</length>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>url</name>
|
||||||
|
<type>text</type>
|
||||||
|
<notnull>true</notnull>
|
||||||
|
<length>100</length>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>image</name>
|
||||||
|
<type>text</type>
|
||||||
|
<notnull>true</notnull>
|
||||||
|
<length>100</length>
|
||||||
|
</field>
|
||||||
|
</declaration>
|
||||||
|
</table>
|
||||||
|
</database>
|
10
appinfo/info.xml
Executable file
10
appinfo/info.xml
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<info>
|
||||||
|
<id>radio</id>
|
||||||
|
<name>Radio</name>
|
||||||
|
<description>Listening to your favorite radio stations in NextCloud</description>
|
||||||
|
<version>0.1</version>
|
||||||
|
<licence>MIT</licence>
|
||||||
|
<author>Jonas Heinrich</author>
|
||||||
|
<requiremin>9</requiremin>
|
||||||
|
</info>
|
12
appinfo/routes.php
Normal file
12
appinfo/routes.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2014, Lukas Reschke <lukas@owncloud.com>
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or later.
|
||||||
|
* See the COPYING-README file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @var $this \OCP\Route\IRouter */
|
||||||
|
$this->create('radio_index', '/')
|
||||||
|
->actionInclude('radio/index.php');
|
||||||
|
$this->create('radio_ajax_seturl', 'ajax/seturl.php')
|
||||||
|
->actionInclude('radio/ajax/seturl.php');
|
1
appinfo/version
Executable file
1
appinfo/version
Executable file
@ -0,0 +1 @@
|
|||||||
|
0.1
|
26
css/main.css
Normal file
26
css/main.css
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
body {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
td{
|
||||||
|
border-right: none;
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr{
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:hover {
|
||||||
|
background-color: edeff2;
|
||||||
|
transition: all 0.1s ease;
|
||||||
|
}
|
21
db/stream.php
Normal file
21
db/stream.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace OCA\Radio\Db;
|
||||||
|
|
||||||
|
use JsonSerializable;
|
||||||
|
|
||||||
|
use OCP\AppFramework\Db\Entity;
|
||||||
|
|
||||||
|
class Stream extends Entity implements JsonSerializable {
|
||||||
|
|
||||||
|
protected $title;
|
||||||
|
protected $content;
|
||||||
|
protected $userId;
|
||||||
|
|
||||||
|
public function jsonSerialize() {
|
||||||
|
return [
|
||||||
|
'name' => $this->name,
|
||||||
|
'url' => $this->url,
|
||||||
|
'image' => $this->image
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
BIN
img/radio.png
Normal file
BIN
img/radio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
87
img/radio.svg
Normal file
87
img/radio.svg
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
height="16"
|
||||||
|
width="16"
|
||||||
|
version="1.0"
|
||||||
|
id="svg3581"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="radio.svg"
|
||||||
|
inkscape:export-filename="/home/onny/projects/owncloud-app-radio/img/radio.png"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90">
|
||||||
|
<metadata
|
||||||
|
id="metadata3600">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1596"
|
||||||
|
inkscape:window-height="860"
|
||||||
|
id="namedview3598"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="29.610096"
|
||||||
|
inkscape:cx="1.9547647"
|
||||||
|
inkscape:cy="8"
|
||||||
|
inkscape:window-x="2"
|
||||||
|
inkscape:window-y="19"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="svg3581">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid3613" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs3583">
|
||||||
|
<linearGradient
|
||||||
|
id="a"
|
||||||
|
y2="47.208"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
y1="-5.2547"
|
||||||
|
gradientTransform="matrix(.21865 0 0 .26685 56.619 1.4022)"
|
||||||
|
x2="-39.422"
|
||||||
|
x1="-39.422">
|
||||||
|
<stop
|
||||||
|
offset="0"
|
||||||
|
id="stop3586" />
|
||||||
|
<stop
|
||||||
|
stop-color="#363636"
|
||||||
|
offset="1"
|
||||||
|
id="stop3588" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<rect
|
||||||
|
style="color:#000000"
|
||||||
|
fill-opacity="0"
|
||||||
|
height="97.986"
|
||||||
|
width="163.31"
|
||||||
|
y="-32.993"
|
||||||
|
x="-62.897"
|
||||||
|
id="rect3590" />
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff"
|
||||||
|
d="M 0.94676967,14.933853 C 0.62195724,14.762477 0.39360747,14.515081 0.23230597,14.159794 0.01672734,13.684968 -0.00500319,13.303945 -0.00731475,9.958037 -0.01019259,5.8467141 0.01907789,5.6823746 0.85234564,5.1256899 1.0866637,4.9691484 1.3747818,4.6257446 1.4926074,4.3625707 1.7295609,3.8333153 1.9180173,3.7214637 2.5727941,3.7214637 c 0.3756302,0 10.6202619,-2.76574642 10.9116159,-2.94581148 0.05559,-0.0343578 0.101076,-0.13464798 0.101076,-0.22286979 0,-0.2748734 0.438712,-0.57326255 0.84285,-0.57326255 0.58071,0 0.869727,0.36871073 0.782177,0.99785181 C 15.131726,1.5435343 14.39623,1.7805576 13.867456,1.4101888 13.61352,1.2323267 13.2508,1.3232128 8.5334565,2.7467104 3.9223597,4.1381482 3.4751505,4.29666 3.508258,4.5278772 c 0.035788,0.2499093 0.1228174,0.2547611 5.6714322,0.3161697 5.4519318,0.060339 5.6465328,0.070762 5.9871098,0.3206955 0.757474,0.555873 0.788444,0.744841 0.785642,4.7932946 -0.0025,3.347401 -0.02398,3.726775 -0.239891,4.202369 -0.16807,0.370191 -0.384269,0.597745 -0.740679,0.779572 -0.489557,0.249752 -0.681845,0.25663 -7.0255195,0.251268 -6.2966316,-0.0053 -6.5387001,-0.01423 -6.99958283,-0.257393 z M 12.088701,13.191491 C 15.550536,11.627702 14.502194,6.5437461 10.716658,6.5377345 9.3331149,6.5355251 8.1327745,7.3088597 7.5546875,8.574841 c -0.377632,0.8269897 -0.3670632,2.128232 0.023368,2.879974 0.4955836,0.954157 1.23574,1.604123 2.139922,1.879162 0.6236474,0.189705 1.7905854,0.119568 2.3707034,-0.142486 z M 9.7811695,12.394805 c -0.3461132,-0.158483 -0.275915,-0.171769 0.9354885,-0.177051 1.196072,-0.0052 1.282627,0.0098 0.997851,0.172547 -0.395044,0.225826 -1.444648,0.228273 -1.9333395,0.0045 z M 8.4964386,11.305137 c -0.082323,-0.08233 -0.1496784,-0.194581 -0.1496784,-0.249463 0,-0.05488 1.0664518,-0.09979 2.3698978,-0.09979 1.303442,0 2.369898,0.02348 2.369898,0.05216 0,0.0287 -0.03407,0.140949 -0.07572,0.249463 -0.06497,0.169325 -0.379768,0.197299 -2.220218,0.197299 -1.5016426,0 -2.1893799,-0.04487 -2.294185,-0.149678 z m -0.3159883,-1.05606 c -0.045735,-0.04573 -0.083153,-0.186058 -0.083153,-0.3118287 0,-0.2144848 0.1625269,-0.228674 2.6193616,-0.228674 l 2.619359,0 0,0.3118287 0,0.311828 -2.536207,0 c -1.3949127,0 -2.5736254,-0.03742 -2.6193607,-0.08315 z M 8.3467602,9.0143515 c 0,-0.038811 0.058102,-0.1791343 0.1291211,-0.3118291 0.1200435,-0.2243041 0.2813038,-0.2412627 2.2941847,-0.2412627 2.229632,0 2.31649,0.01909 2.31649,0.5091269 0,0.065534 -1.013848,0.1145299 -2.369898,0.1145299 -1.303446,0 -2.3698978,-0.031756 -2.3698978,-0.070566 z M 9.6299267,7.6390813 C 10.20995,7.3245564 11.083439,7.2964182 11.652143,7.573939 l 0.498925,0.2434702 -1.43441,0.00511 C 9.3680241,7.8273146 9.3030387,7.8163418 9.6299267,7.6390849 Z M 3.4255382,11.273387 C 3.9762494,10.722672 3.6992473,9.8304058 2.9165791,9.6339682 2.5298532,9.536907 2.0192395,9.8529324 1.8519778,10.292864 1.4912464,11.241659 2.7024994,11.996422 3.4255382,11.273387 Z M 3.4430235,8.1900545 C 3.8021815,7.8526401 3.8140576,7.3522803 3.473173,6.9189375 3.1586187,6.5190432 2.5291504,6.4754074 2.0990546,6.8236801 1.7366201,7.1171607 1.7070791,7.8352836 2.0422032,8.2055926 2.3578525,8.554382 3.0635285,8.5465541 3.4430071,8.1900559 Z"
|
||||||
|
id="path3615"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 5.4 KiB |
33
index.php
Executable file
33
index.php
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ownCloud - App Template Example
|
||||||
|
*
|
||||||
|
* @author Frank Karlitschek
|
||||||
|
* @author Florian Hülsmann
|
||||||
|
* @copyright 2011 Frank Karlitschek karlitschek@kde.org
|
||||||
|
* @copyright 2012 Florian Hülsmann fh@cbix.de
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Check if we are a user
|
||||||
|
OCP\User::checkLoggedIn();
|
||||||
|
|
||||||
|
$somesetting = OCP\Config::getSystemValue( "somesetting", '' );
|
||||||
|
OCP\App::setActiveNavigationEntry( 'radio' );
|
||||||
|
$tmpl = new OCP\Template( 'radio', 'main', 'user' );
|
||||||
|
$tmpl->assign( 'somesetting', $somesetting );
|
||||||
|
$tmpl->printPage();
|
15
js/admin.js
Executable file
15
js/admin.js
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$('#somesetting').blur(function(event){
|
||||||
|
event.preventDefault();
|
||||||
|
var post = $( "#somesetting" ).serialize();
|
||||||
|
$.post( OC.filePath('radio', 'ajax', 'seturl.php') , post, function(data){
|
||||||
|
$('#radio .msg').text('Finished saving: ' + data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
33
js/main.js
Normal file
33
js/main.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
$(window).on('load', function(){
|
||||||
|
|
||||||
|
$('body').on('click', 'tr', function() {
|
||||||
|
var sourceUrl = $(this).attr('src');
|
||||||
|
$("#player").attr("src", sourceUrl);
|
||||||
|
$('#player').trigger('play');
|
||||||
|
});
|
||||||
|
|
||||||
|
function show_result(data){
|
||||||
|
$("tbody > tr").remove();
|
||||||
|
$.each(data, function(i, station) {
|
||||||
|
$('tbody').append('<tr src='+station['url']+'><td width=60px align=center><img width=20px height=20px src=img/fav.png></td><td width=60px align=center><img width=40px height=40px src='+station['favicon']+'></td><td>'+station['name']+'</td><td width=60px align=center><a href="'+station['homepage']+'" target="_blank"><img width=20px height=20px src=img/homepage.png></a></td></tr>');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function search(query){
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: 'http://www.radio-browser.info/webservice/json/stations/search',
|
||||||
|
data: {
|
||||||
|
name: query
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
success: show_result
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$('form').submit(function() {
|
||||||
|
var query = $('input').val();
|
||||||
|
search(query);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
11
settings.php
Executable file
11
settings.php
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
OCP\User::checkAdminUser();
|
||||||
|
|
||||||
|
OCP\Util::addScript( "radio", "admin" );
|
||||||
|
|
||||||
|
$tmpl = new OCP\Template( 'radio', 'settings');
|
||||||
|
|
||||||
|
$tmpl->assign('url', OCP\Config::getSystemValue( "somesetting", '' ));
|
||||||
|
|
||||||
|
return $tmpl->fetchPage();
|
22
templates/main.php
Executable file
22
templates/main.php
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
style('radio', 'main');
|
||||||
|
script('radio', 'main');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<audio id="player" src="" controls></audio>
|
||||||
|
<form>
|
||||||
|
<input placeholder="Search for name" autofocus required></input>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Test</td>
|
||||||
|
<td>Test</td>
|
||||||
|
<td>Test</td>
|
||||||
|
<td>Test</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- <?php p($l->t('Some Setting'));?>: "<?php p($_['somesetting']); ?>" -->
|
8
templates/settings.php
Executable file
8
templates/settings.php
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
<form id="radio">
|
||||||
|
<div class="section">
|
||||||
|
<h2><?php p($l->t('App Template'));?></h2>
|
||||||
|
<input type="text" name="somesetting" id="somesetting" value="<?php p($_['url']); ?>" placeholder="<?php p($l->t('Some Setting'));?>" />
|
||||||
|
<br />
|
||||||
|
<span class="msg"></span>
|
||||||
|
</div>
|
||||||
|
</form>
|
Loading…
Reference in New Issue
Block a user