commit 6f9f8e42c13870d016590d540b4e3565075d3795 Author: Jonas Heinrich Date: Thu Nov 17 23:07:22 2016 +0100 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..dbdf9af --- /dev/null +++ b/README.md @@ -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 diff --git a/ajax/seturl.php b/ajax/seturl.php new file mode 100755 index 0000000..c2bcabe --- /dev/null +++ b/ajax/seturl.php @@ -0,0 +1,14 @@ + + * Copyright (c) 2012, Florian Hülsmann + * 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'; diff --git a/appinfo/app.php b/appinfo/app.php new file mode 100755 index 0000000..c8963fe --- /dev/null +++ b/appinfo/app.php @@ -0,0 +1,34 @@ +. +* +*/ + +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' +)); diff --git a/appinfo/database.xml b/appinfo/database.xml new file mode 100755 index 0000000..f8f8243 --- /dev/null +++ b/appinfo/database.xml @@ -0,0 +1,38 @@ + + + *dbname* + true + false + utf8 + + *dbprefix*radio_streams + + + id + integer + 0 + true + 1 + 4 + + + name + text + true + 64 + + + url + text + true + 100 + + + image + text + true + 100 + + +
+
diff --git a/appinfo/info.xml b/appinfo/info.xml new file mode 100755 index 0000000..90b07f2 --- /dev/null +++ b/appinfo/info.xml @@ -0,0 +1,10 @@ + + + radio + Radio + Listening to your favorite radio stations in NextCloud + 0.1 + MIT + Jonas Heinrich + 9 + diff --git a/appinfo/routes.php b/appinfo/routes.php new file mode 100644 index 0000000..eefb4fc --- /dev/null +++ b/appinfo/routes.php @@ -0,0 +1,12 @@ + + * 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'); diff --git a/appinfo/version b/appinfo/version new file mode 100755 index 0000000..49d5957 --- /dev/null +++ b/appinfo/version @@ -0,0 +1 @@ +0.1 diff --git a/css/main.css b/css/main.css new file mode 100644 index 0000000..5cdad3b --- /dev/null +++ b/css/main.css @@ -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; +} diff --git a/db/stream.php b/db/stream.php new file mode 100644 index 0000000..d4cd495 --- /dev/null +++ b/db/stream.php @@ -0,0 +1,21 @@ + $this->name, + 'url' => $this->url, + 'image' => $this->image + ]; + } +} diff --git a/img/radio.png b/img/radio.png new file mode 100644 index 0000000..aa1d24e Binary files /dev/null and b/img/radio.png differ diff --git a/img/radio.svg b/img/radio.svg new file mode 100644 index 0000000..1ee1f01 --- /dev/null +++ b/img/radio.svg @@ -0,0 +1,87 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/index.php b/index.php new file mode 100755 index 0000000..ca97156 --- /dev/null +++ b/index.php @@ -0,0 +1,33 @@ +. +* +*/ + +// 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(); diff --git a/js/admin.js b/js/admin.js new file mode 100755 index 0000000..cfe81a5 --- /dev/null +++ b/js/admin.js @@ -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); + }); + }); + + + +}); diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000..f9a23b4 --- /dev/null +++ b/js/main.js @@ -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(''+station['name']+''); + }); + } + + 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; + }); +}); diff --git a/settings.php b/settings.php new file mode 100755 index 0000000..24c07ee --- /dev/null +++ b/settings.php @@ -0,0 +1,11 @@ +assign('url', OCP\Config::getSystemValue( "somesetting", '' )); + +return $tmpl->fetchPage(); diff --git a/templates/main.php b/templates/main.php new file mode 100755 index 0000000..04d2d8f --- /dev/null +++ b/templates/main.php @@ -0,0 +1,22 @@ + + + +
+ +
+ + + + + + + + + + +
TestTestTestTest
+ + diff --git a/templates/settings.php b/templates/settings.php new file mode 100755 index 0000000..ffe05fb --- /dev/null +++ b/templates/settings.php @@ -0,0 +1,8 @@ +
+
+

t('App Template'));?>

+ +
+ +
+