From 29239d66383ec0544cefca2e1c6de95d81b48376 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 1 Aug 2011 16:43:02 +0200 Subject: [PATCH 01/14] remember volume and playback time in the media player --- apps/media/ajax/api.php | 1 + apps/media/js/player.js | 31 +++++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php index e0183ff05de..bf1ebd8e4d1 100644 --- a/apps/media/ajax/api.php +++ b/apps/media/ajax/api.php @@ -132,6 +132,7 @@ if($arguments['action']){ header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); + header('Accept-Ranges: bytes'); header('Content-Length: '.OC_Filesystem::filesize($arguments['path'])); OC_Filesystem::readfile($arguments['path']); diff --git a/apps/media/js/player.js b/apps/media/js/player.js index 369d3e389c3..b6d3bc01ddb 100644 --- a/apps/media/js/player.js +++ b/apps/media/js/player.js @@ -3,6 +3,7 @@ var PlayList={ current:-1, items:[], player:null, + volume:0.8, next:function(){ var next=PlayList.current+1; if(next>=PlayList.items.length){ @@ -19,7 +20,7 @@ var PlayList={ PlayList.play(next); PlayList.render(); }, - play:function(index,ready){ + play:function(index,time,ready){ if(index==null){ index=PlayList.current; } @@ -28,11 +29,11 @@ var PlayList={ if(PlayList.player){ if(PlayList.player.data('jPlayer').options.supplied!=PlayList.items[index].type){//the the audio type changes we need to reinitialize jplayer PlayList.player.jPlayer("destroy"); - PlayList.init(PlayList.items[index].type,function(){PlayList.play(null,ready)}); + PlayList.init(PlayList.items[index].type,function(){PlayList.play(null,time,eady)}); }else{ PlayList.player.jPlayer("setMedia", PlayList.items[PlayList.current]); PlayList.items[index].playcount++; - PlayList.player.jPlayer("play"); + PlayList.player.jPlayer("play",time); localStorage.setItem(oc_current_user+'oc_playlist_current',index); if(index>0){ var previous=index-1; @@ -82,6 +83,14 @@ var PlayList={ play:function(){ localStorage.setItem(oc_current_user+'oc_playlist_playing','true'); }, + timeupdate:function(){ + var time=Math.round(PlayList.player.data('jPlayer').status.currentTime); + localStorage.setItem(oc_current_user+'oc_playlist_time',time); + }, + volumechange:function(){ + var volume=PlayList.player.data('jPlayer').options.volume*100; + localStorage.setItem(oc_current_user+'oc_playlist_volume',volume); + }, supplied:type, ready:function(){ PlayList.load(); @@ -89,6 +98,7 @@ var PlayList={ ready(); } }, + volume:PlayList.volume, cssSelectorAncestor:'#jp-interface', swfPath:OC.linkTo('media','js'), }); @@ -150,11 +160,20 @@ var PlayList={ if(typeof localStorage !== 'undefined'){ if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_items')){ PlayList.items=JSON.parse(localStorage.getItem(oc_current_user+'oc_playlist_items')); - PlayList.current=parseInt((localStorage.getItem(oc_current_user+'oc_playlist_current'))); + PlayList.current=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_current')); + var time=parseInt(localStorage.getItem(oc_current_user+'oc_playlist_time')); + if(localStorage.hasOwnProperty(oc_current_user+'oc_playlist_volume')){ + var volume=localStorage.getItem(oc_current_user+'oc_playlist_volume'); + PlayList.volume=volume/100; + $('.jp-volume-bar-value').css('width',volume+'%'); + if(PlayList.player.data('jPlayer')){ + PlayList.player.jPlayer("option",'volume',volume/100); + } + } if(JSON.parse(localStorage.getItem(oc_current_user+'oc_playlist_playing'))){ - PlayList.play(); + PlayList.play(null,time); }else{ - PlayList.play(null,function(){ + PlayList.play(null,time,function(){ PlayList.player.jPlayer("pause"); }); } From e79c827b22135810c3e66b3178c284d96b4232b7 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Mon, 1 Aug 2011 18:08:11 +0200 Subject: [PATCH 02/14] removed log feature because it is a privacy issue --- log/appinfo/app.php | 4 ++-- log/index.php | 3 ++- log/templates/index.php | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/log/appinfo/app.php b/log/appinfo/app.php index f3ef650704d..a3aa19d528d 100644 --- a/log/appinfo/app.php +++ b/log/appinfo/app.php @@ -1,6 +1,6 @@ - 1, "id" => "log", "name" => "Log" )); OC_App::addSettingsPage( array( "id" => "log", "order" => 999, "href" => OC_Helper::linkTo( "log", "index.php" ), "name" => "Log", "icon" => OC_Helper::imagePath( "log", "logs.png" ))); -?> +*/ ?> diff --git a/log/index.php b/log/index.php index e201411e483..a4fbc364703 100644 --- a/log/index.php +++ b/log/index.php @@ -22,6 +22,7 @@ */ //require_once('../../config/config.php'); +/* require_once('../lib/base.php'); if( !OC_User::isLoggedIn()){ @@ -103,4 +104,4 @@ $tmpl->assign( 'size', $pageSize ); $tmpl->assign( 'showActions', $showActions ); $tmpl->printPage(); -?> +*/ ?> diff --git a/log/templates/index.php b/log/templates/index.php index 2756332f519..9c2ce98f58f 100644 --- a/log/templates/index.php +++ b/log/templates/index.php @@ -1,4 +1,4 @@ -
+

t( 'Filter:' ); ?> @@ -50,5 +50,4 @@

- - +*/ ?>Z From a8ffe16f4f1652cfe9646f93dfc4e7a9a5766835 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Mon, 1 Aug 2011 18:37:47 +0200 Subject: [PATCH 03/14] Ctrl-Z the Z --- log/templates/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/log/templates/index.php b/log/templates/index.php index 9c2ce98f58f..863ac73fdbb 100644 --- a/log/templates/index.php +++ b/log/templates/index.php @@ -50,4 +50,4 @@

-*/ ?>Z +*/ ?> From ad45c78b44f887be547329501cba7c84c3a3c331 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Mon, 1 Aug 2011 21:31:16 +0200 Subject: [PATCH 04/14] pimped the search dropdown style a bit --- core/css/styles.css | 2 ++ core/templates/part.searchbox.php | 2 +- search/css/results.css | 18 +++++++++--------- search/css/search.css | 17 ----------------- 4 files changed, 12 insertions(+), 27 deletions(-) delete mode 100644 search/css/search.css diff --git a/core/css/styles.css b/core/css/styles.css index ff2aa98ddae..5d3864f4b37 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -82,6 +82,8 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', end form.searchbox { display:inline; position:fixed; top:.9em; right:9em; margin:0; padding:0; } input[type="search"] { font-size:1em; padding-left:2em; background:#eee url('../img/actions/search.png') .5em center no-repeat; } + + /* NAVIGATION ------------------------------------------------------------- */ #plugins { position:fixed; top:3.5em; float:left; width:15.7em; padding:0; z-index:50; height:100%; background:#eee; border-right: 1px #ccc solid; -moz-box-shadow: -3px 0 7px #000; -webkit-box-shadow: -3px 0 7px #000; box-shadow: -3px 0 7px #000; } } #plugins ul { list-style-type:none; border-top:1px solid #ccc; } diff --git a/core/templates/part.searchbox.php b/core/templates/part.searchbox.php index 49b44c718ec..f5a62de2c8b 100644 --- a/core/templates/part.searchbox.php +++ b/core/templates/part.searchbox.php @@ -1,3 +1,3 @@ diff --git a/search/css/results.css b/search/css/results.css index e61bf419b35..c3147451e4a 100644 --- a/search/css/results.css +++ b/search/css/results.css @@ -1,9 +1,9 @@ -#searchresults { position:fixed; top:3.3em; right:0; z-index:50; background-color:white; border:1px solid black; margin-bottom:3em; overflow:auto; max-height:80%; width:40em; } -#searchresults table{ width:100%; table-layout:fixed; top:1em;border-spacing:0} -#searchresults td{padding-right:0.3em;padding-left:0.3em;vertical-align:top} -#searchresults td.result div.text{padding-left:1em;} -#searchresults div.text,div.name{width:30em; white-space:normal} -#searchresults td.result{width:30em;} -#searchresults td.result *{cursor:pointer} -#searchresults td.type{width:7em;text-align:right; border-right:1px solid #aaa;border-bottom:none} -#searchresults tr.current{background-color:#ddd} +#searchresults { list-style:none; position:fixed; top:3.5em; right:0; z-index:100; background-color:#fff; overflow:hidden; text-overflow:ellipsis; max-height:80%; width:26.5em; padding-bottom:1em; -moz-box-shadow:0 0 10px #000; -webkit-box-shadow:0 0 10px #000; box-shadow:0 0 10px #000; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; } +#searchresults li.resultHeader { font-size:1.2em; font-weight:bold; border-bottom:solid 1px #CCC; padding:.2em; background-color:#eee; } +#searchresults li.result { margin-left:2em; } +#searchresults table { width:100%; table-layout:fixed; top:0; border-spacing:0; } +#searchresults td { padding:0 .3em; vertical-align:top; } +#searchresults td.result div.text { padding-left:1em; white-space:nowrap; } +#searchresults td.result * { cursor:pointer; } +#searchresults td.type { width:3.5em; text-align:right; border-right:1px solid #aaa; border-bottom:none; font-weight:bold; } +#searchresults tr.current { background-color:#ddd; } diff --git a/search/css/search.css b/search/css/search.css deleted file mode 100644 index df0712be03f..00000000000 --- a/search/css/search.css +++ /dev/null @@ -1,17 +0,0 @@ -#searchresults{ - margin: 2em; - list-style:none; - border: solid 1px #CCC; -} - -#searchresults li.resultHeader{ - font-size:1.2em; - font-weight:bold; - border-bottom: solid 1px #CCC; - padding:0.2em; - background-color:#eee; -} - -#searchresults li.result{ - margin-left:2em; -} \ No newline at end of file From 9f981de85437930ec89ecc85c2e79f096f65b5bb Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 1 Aug 2011 23:53:01 +0200 Subject: [PATCH 05/14] fance collection scanning wip --- apps/media/ajax/api.php | 46 ++++++++++++++---- apps/media/index.php | 1 + apps/media/js/collection.js | 42 +++++++++++++++++ apps/media/js/scanner.js | 72 +++++++++++++++++++++++++++++ apps/media/lib_scanner.php | 13 +++++- apps/media/templates/collection.php | 9 +++- 6 files changed, 170 insertions(+), 13 deletions(-) create mode 100644 apps/media/js/scanner.js diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php index bf1ebd8e4d1..60458167a96 100644 --- a/apps/media/ajax/api.php +++ b/apps/media/ajax/api.php @@ -53,6 +53,7 @@ if(!isset($arguments['search'])){ $arguments['search']=''; } OC_MEDIA_COLLECTION::$uid=OC_User::getUser(); +unset($_SESSION['collection']); if($arguments['action']){ switch($arguments['action']){ case 'delete': @@ -108,16 +109,18 @@ if($arguments['action']){ echo json_encode(OC_MEDIA_COLLECTION::getSongs($arguments['artist'],$arguments['album'],$arguments['search'])); break; case 'get_path_info': - $songId=OC_MEDIA_COLLECTION::getSongByPath($arguments['path']); - if($songId==0){ - unset($_SESSION['collection']); - $songId= OC_MEDIA_SCANNER::scanFile($arguments['path']); - } - if($songId>0){ - $song=OC_MEDIA_COLLECTION::getSong($songId); - $song['artist']=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']); - $song['album']=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']); - echo json_encode($song); + if(OC_Filesystem::file_exists($arguments['path'])){ + $songId=OC_MEDIA_COLLECTION::getSongByPath($arguments['path']); + if($songId==0){ + unset($_SESSION['collection']); + $songId= OC_MEDIA_SCANNER::scanFile($arguments['path']); + } + if($songId>0){ + $song=OC_MEDIA_COLLECTION::getSong($songId); + $song['artist']=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']); + $song['album']=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']); + echo json_encode($song); + } } break; case 'play': @@ -137,7 +140,30 @@ if($arguments['action']){ OC_Filesystem::readfile($arguments['path']); exit; + case 'find_music': + echo json_encode(findMusic()); + exit; } } +function findMusic($path='/'){ + $music=array(); + $dh=OC_Filesystem::opendir($path); + if($dh){ + while($filename=readdir($dh)){ + if($filename[0]!='.'){ + $file=$path.'/'.$filename; + if(OC_Filesystem::is_dir($file)){ + $music=array_merge($music,findMusic($file)); + }else{ + if(OC_MEDIA_SCANNER::isMusic($filename)){ + $music[]=$file; + } + } + } + } + } + return $music; +} + ?> \ No newline at end of file diff --git a/apps/media/index.php b/apps/media/index.php index 43423d27de6..a7128aaad42 100644 --- a/apps/media/index.php +++ b/apps/media/index.php @@ -37,6 +37,7 @@ OC_Util::addScript('media','player'); OC_Util::addScript('media','music'); OC_Util::addScript('media','playlist'); OC_Util::addScript('media','collection'); +OC_Util::addScript('media','scanner'); OC_Util::addScript('media','jquery.jplayer.min'); OC_Util::addStyle('media','player'); OC_Util::addStyle('media','music'); diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js index 95e5293ea48..42d249112b1 100644 --- a/apps/media/js/collection.js +++ b/apps/media/js/collection.js @@ -32,6 +32,10 @@ Collection={ for(var i=0;i +

0 Songs scanned

+
+ + +
  • loadingLoading Collection... @@ -7,4 +13,5 @@
  • -
\ No newline at end of file + + From 04b745d67a7d6c18b1bb06d1cf97cc65a640b1f4 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Tue, 2 Aug 2011 02:03:14 +0200 Subject: [PATCH 06/14] compacted sidebar --- core/css/styles.css | 23 ++++++++++------------- core/templates/layout.admin.php | 2 +- core/templates/layout.user.php | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index 5d3864f4b37..fa7421e0948 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -1,6 +1,6 @@ * { margin:0; padding:0; border:0; cursor:default; } body { background:#fefefe; font:normal 80%/1.6em "Lucida Grande", Arial, Verdana, sans-serif; color:#000; } -#header { position:fixed; top:0; z-index:100; width:100%; height:2.5em; padding:0.5em 1.5em; background:#1d2d44; -moz-box-shadow:0 0 10px #000, inset 0 -2px 10px #222; -webkit-box-shadow:0 0 10px #000, inset 0 -2px 10px #222; box-shadow:0 0 10px #000, inset 0 -2px 10px #222; } +#header { position:fixed; top:0; z-index:100; width:100%; height:2.5em; padding:.5em; background:#1d2d44; -moz-box-shadow:0 0 10px #000, inset 0 -2px 10px #222; -webkit-box-shadow:0 0 10px #000, inset 0 -2px 10px #222; box-shadow:0 0 10px #000, inset 0 -2px 10px #222; } #body-settings #header { background:#313131; } #owncloud { float:left; } h1 { margin:1em 3em 1em 0; border-bottom:1px solid #666; text-transform:uppercase; font-weight:normal; font-style:italic; color:#666; } @@ -72,7 +72,7 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', end .prettybutton:hover, .prettybutton:focus { background-color:#ccc; outline:0; } /* META NAVIGATION (Settings, Log out) ---------------------------------------------------------------- */ -#metanav { float:right; position:relative; top:0.5em; right:2.5em; list-style:none; margin:0; padding:0; } +#metanav { float:right; position:relative; top:.5em; right:1em; list-style:none; margin:0; padding:0; } #metanav li { display:inline; } #metanav li a { margin:.2em; padding:.7em; } #metanav li a:hover, #metanav li a:focus { background:rgba(0,0,0,.5); -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:#555 0 1px 0; -moz-box-shadow:#555 0 1px 0; -webkit-box-shadow:#555 0 1px 0; } @@ -82,20 +82,17 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', end form.searchbox { display:inline; position:fixed; top:.9em; right:9em; margin:0; padding:0; } input[type="search"] { font-size:1em; padding-left:2em; background:#eee url('../img/actions/search.png') .5em center no-repeat; } - - /* NAVIGATION ------------------------------------------------------------- */ -#plugins { position:fixed; top:3.5em; float:left; width:15.7em; padding:0; z-index:50; height:100%; background:#eee; border-right: 1px #ccc solid; -moz-box-shadow: -3px 0 7px #000; -webkit-box-shadow: -3px 0 7px #000; box-shadow: -3px 0 7px #000; } } -#plugins ul { list-style-type:none; border-top:1px solid #ccc; } -#plugins a { display:block; padding:0.5em 0.5em 0.5em 3em; background-position:1.5em center; background-repeat:no-repeat; border-bottom:1px solid #ddd; border-top:1px solid #fff; text-decoration:none; font-size:1.2em; color:#666; } -#plugins a.active, #plugins a:hover, #plugins a:focus, #plugins a.selected { background-color:#ccc; border-top:1px solid #ccc; border-bottom:1px solid #ccc; color:#000; outline:0; } -#plugins a:active { outline:0; } -#plugins .subentry { background-color:#ddd; border-top:1px solid #aaa; color:#000; outline:0; } -#plugins .subentry.active { background-color:#bbb; border-top:1px solid #aaa; color:#000; outline:0; } -#plugins li.subentry a { padding-left:3.7em; font-size:1em; } +#navigation { position:fixed; top:3.5em; float:left; width:12.5em; padding:0; z-index:50; height:100%; background:#eee; border-right: 1px #ccc solid; -moz-box-shadow: -3px 0 7px #000; -webkit-box-shadow: -3px 0 7px #000; box-shadow: -3px 0 7px #000; } } +#navigation ul { list-style-type:none; border-top:1px solid #ccc; } +#navigation a { display:block; padding:.5em .5em .5em 2.5em; background-position:1em center; background-repeat:no-repeat; border-bottom:1px solid #ddd; border-top:1px solid #fff; text-decoration:none; font-size:1.2em; color:#666; } +#navigation a.active, #navigation a:hover, #navigation a:focus, #navigation a.selected { background-color:#ccc; border-top:1px solid #c8c8c8; border-bottom:1px solid #ccc; color:#000; outline:0; } +#navigation .subentry { background-color:#ddd; border-top:1px solid #aaa; color:#555; outline:0; } +#navigation .subentry.active { background-color:#bbb; border-top:1px solid #888; border-bottom:1px solid #bbb; outline:0; } +#navigation li.subentry a { padding-left:3.1em; font-size:1em; } /* CONTENT ------------------------------------------------------------------ */ -#content { margin:3.5em 0 0 15.7em; } +#content { margin:3.5em 0 0 12.5em; } /* USER SETTINGS ------------------------------------------------------------ */ #quota_indicator { margin:0 4em 1em 0; padding:0; border:1px solid #ddd; border-radius:10px; -webkit-border-radius:10px; -moz-border-radius:10px; } diff --git a/core/templates/layout.admin.php b/core/templates/layout.admin.php index be4419af849..d70c54f7b15 100644 --- a/core/templates/layout.admin.php +++ b/core/templates/layout.admin.php @@ -37,7 +37,7 @@
-
+