diff --git a/src/main/resources/static/app/js/all.js b/src/main/resources/static/app/js/all.js index 74be8ff18..1ae261bea 100644 --- a/src/main/resources/static/app/js/all.js +++ b/src/main/resources/static/app/js/all.js @@ -273,11 +273,14 @@ this.items.push(item); break; case 'Finish': - this.$notification('T\xE9l\xE9chargement termin\xE9', { - body: item.title, - icon: item.cover.url, - delay: 5000 - }); + try { + this.$notification('T\xE9l\xE9chargement termin\xE9', { + body: item.title, + icon: item.cover.url, + delay: 5000 + }); + } catch (e) { + } this.onStoppedFromWS(elemToUpdate); break; case 'Stopped': @@ -529,117 +532,6 @@ } }); }]).controller('ItemPlayerController', ItemPlayerController); - var PlayerController = function () { - function PlayerController(playlistService, $timeout, deviceDetectorService) { - _classCallCheck(this, PlayerController); - this.playlistService = playlistService; - this.$timeout = $timeout; - this.playlist = []; - this.state = null; - this.API = null; - this.currentVideo = {}; - this.config = { - autoPlay: true, - sources: [], - plugins: { - controls: { - autoHide: !deviceDetectorService.isTouchedDevice(), - autoHideTime: 2000 - }, - poster: '' - } - }; - this.reloadPlaylist(); - } - PlayerController.$inject = ["playlistService", "$timeout", "deviceDetectorService"]; - _createClass(PlayerController, [ - { - key: 'onPlayerReady', - value: function onPlayerReady(API) { - this.API = API; - if (this.API.currentState == 'play' || this.isCompleted) - this.API.play(); - this.isCompleted = false; - this.setVideo(0); - } - }, - { - key: 'onCompleteVideo', - value: function onCompleteVideo() { - var indexOfVideo = this.getIndexOfVideoInPlaylist(this.currentVideo); - this.isCompleted = true; - if (indexOfVideo + 1 === this.playlist.length) { - this.currentVideo = this.playlist[0]; - return; - } - this.setVideo(indexOfVideo + 1); - } - }, - { - key: 'reloadPlaylist', - value: function reloadPlaylist() { - _.updateinplace(this.playlist, this.playlistService.playlist(), function (inArray, elem) { - return _.findIndex(inArray, { id: elem.id }); - }); - } - }, - { - key: 'setVideo', - value: function setVideo(index) { - this.currentVideo = this.playlist[index]; - if (this.currentVideo !== null && this.currentVideo !== undefined) { - this.API.stop(); - this.config.sources = [{ - src: this.currentVideo.proxyURL, - type: this.currentVideo.mimeType - }]; - this.config.plugins.poster = this.currentVideo.cover.url; - } - } - }, - { - key: 'remove', - value: function remove(item) { - this.playlistService.remove(item); - this.reloadPlaylist(); - if (this.config.sources.length > 0 && this.config.sources[0].src === item.proxyURL) { - this.setVideo(0); - } - } - }, - { - key: 'removeAll', - value: function removeAll() { - this.playlistService.removeAll(); - this.reloadPlaylist(); - } - }, - { - key: 'getIndexOfVideoInPlaylist', - value: function getIndexOfVideoInPlaylist(item) { - return this.playlist.indexOf(item); - } - } - ]); - return PlayerController; - }(); - angular.module('ps.player', [ - 'ngSanitize', - 'ngRoute', - 'device-detection', - 'com.2fdevs.videogular', - 'com.2fdevs.videogular.plugins.poster', - 'com.2fdevs.videogular.plugins.controls', - 'com.2fdevs.videogular.plugins.overlayplay', - 'com.2fdevs.videogular.plugins.buffering', - 'ps.player.playlist' - ]).config(["$routeProvider", function ($routeProvider) { - $routeProvider.when('/player', { - templateUrl: 'html/player.html', - controller: 'PlayerController', - controllerAs: 'pc' - }); - }]).controller('PlayerController', PlayerController); (function (module) { try { module = angular.module('ps.partial'); @@ -835,6 +727,117 @@ } ]); }()); + var PlayerController = function () { + function PlayerController(playlistService, $timeout, deviceDetectorService) { + _classCallCheck(this, PlayerController); + this.playlistService = playlistService; + this.$timeout = $timeout; + this.playlist = []; + this.state = null; + this.API = null; + this.currentVideo = {}; + this.config = { + autoPlay: true, + sources: [], + plugins: { + controls: { + autoHide: !deviceDetectorService.isTouchedDevice(), + autoHideTime: 2000 + }, + poster: '' + } + }; + this.reloadPlaylist(); + } + PlayerController.$inject = ["playlistService", "$timeout", "deviceDetectorService"]; + _createClass(PlayerController, [ + { + key: 'onPlayerReady', + value: function onPlayerReady(API) { + this.API = API; + if (this.API.currentState == 'play' || this.isCompleted) + this.API.play(); + this.isCompleted = false; + this.setVideo(0); + } + }, + { + key: 'onCompleteVideo', + value: function onCompleteVideo() { + var indexOfVideo = this.getIndexOfVideoInPlaylist(this.currentVideo); + this.isCompleted = true; + if (indexOfVideo + 1 === this.playlist.length) { + this.currentVideo = this.playlist[0]; + return; + } + this.setVideo(indexOfVideo + 1); + } + }, + { + key: 'reloadPlaylist', + value: function reloadPlaylist() { + _.updateinplace(this.playlist, this.playlistService.playlist(), function (inArray, elem) { + return _.findIndex(inArray, { id: elem.id }); + }); + } + }, + { + key: 'setVideo', + value: function setVideo(index) { + this.currentVideo = this.playlist[index]; + if (this.currentVideo !== null && this.currentVideo !== undefined) { + this.API.stop(); + this.config.sources = [{ + src: this.currentVideo.proxyURL, + type: this.currentVideo.mimeType + }]; + this.config.plugins.poster = this.currentVideo.cover.url; + } + } + }, + { + key: 'remove', + value: function remove(item) { + this.playlistService.remove(item); + this.reloadPlaylist(); + if (this.config.sources.length > 0 && this.config.sources[0].src === item.proxyURL) { + this.setVideo(0); + } + } + }, + { + key: 'removeAll', + value: function removeAll() { + this.playlistService.removeAll(); + this.reloadPlaylist(); + } + }, + { + key: 'getIndexOfVideoInPlaylist', + value: function getIndexOfVideoInPlaylist(item) { + return this.playlist.indexOf(item); + } + } + ]); + return PlayerController; + }(); + angular.module('ps.player', [ + 'ngSanitize', + 'ngRoute', + 'device-detection', + 'com.2fdevs.videogular', + 'com.2fdevs.videogular.plugins.poster', + 'com.2fdevs.videogular.plugins.controls', + 'com.2fdevs.videogular.plugins.overlayplay', + 'com.2fdevs.videogular.plugins.buffering', + 'ps.player.playlist' + ]).config(["$routeProvider", function ($routeProvider) { + $routeProvider.when('/player', { + templateUrl: 'html/player.html', + controller: 'PlayerController', + controllerAs: 'pc' + }); + }]).controller('PlayerController', PlayerController); var PlaylistService = function () { function PlaylistService($localStorage) { _classCallCheck(this, PlaylistService); diff --git a/src/main/resources/static/app/js/all.min.js b/src/main/resources/static/app/js/all.min.js index 369376f76..99f1a112b 100644 --- a/src/main/resources/static/app/js/all.min.js +++ b/src/main/resources/static/app/js/all.min.js @@ -1,5 +1,5 @@ -!function(){"use strict";var t=function(){function t(t,e){for(var n=0;n]+>/gm,"")}}),_.mixin({updateinplace:function(t,e){var n=void 0===arguments[2]?function(t,e){return t.indexOf(e)}:arguments[2],a=void 0===arguments[3]?!1:arguments[3];return _.forEachRight(t.slice(),function(a,i){return-1===n(e,a)&&t.splice(i,1)}),_.forEach(e,function(e){return-1===n(t,e)&&t.push(e)}),a&&_.forEach(e,function(e,a){var i=t.splice(n(t,e),1)[0];t.splice(a,0,i)}),t}});var o=function M(){e(this,M),this.navCollapsed=!0},s=function(){function n(){e(this,n),this.transclude=!0,this.replace=!0,this.restrict="E",this.scope=!0,this.templateUrl="html/navbar.html",this.controller="navbarController",this.controllerAs="navbar"}return t(n,[{key:"link",value:function(t,e){e.removeClass("hidden")}}]),n}();angular.module("navbar",[]).directive("navbar",function(){return new s}).controller("navbarController",o),angular.module("ps.config",["ps.config.route","ps.config.loading","ps.config.restangular","ps.config.ngstomp","ps.config.module"]),angular.module("ps.config.loading",["angular-loading-bar"]).config(["cfpLoadingBarProvider",function(t){t.includeSpinner=!1}]),angular.module("ps.config.module",["ngTouch","ngAnimate","ui.bootstrap","truncate"]),angular.module("ps.config.ngstomp",["AngularStompDK"]).config(["ngstompProvider",function(t){return t.url("/ws").credential("login","password")["class"](SockJS)}]),angular.module("ps.config.restangular",["restangular"]).config(["RestangularProvider",function(t){t.setBaseUrl("/api/"),t.addElementTransformer("items",!1,function(t){return t.addRestangularMethod("reset","get","reset"),t.addRestangularMethod("download","get","addtoqueue"),t})}]),angular.module("ps.config.route",["ngRoute","cfp.hotkeys"]).constant("commonKey",[["h","Goto Home",function(t){t.preventDefault(),window.location.href="#/items"}],["s","Goto Search",function(t){t.preventDefault(),window.location.href="#/item/search"}],["p","Goto Podcast List",function(t){t.preventDefault(),window.location.href="#/podcasts"}],["d","Goto Download List",function(t){t.preventDefault(),window.location.href="#/download"}]]).config(["$routeProvider",function(t){return t.otherwise({redirectTo:"/items"})}]).config(["$locationProvider",function(t){return t.html5Mode(!0)}]);var l=function(){function n(t,a,i){var o=this;e(this,n),this.DonwloadManager=a,this.$notification=i,this.items=[],this.waitingitems=[],this.numberOfSimDl=0,this.DonwloadManager.getNumberOfSimDl().then(function(t){o.numberOfSimDl=parseInt(t)}),this.DonwloadManager.ws.subscribe("/app/download",function(t){return o.onSubscribeDownload(t)},t).subscribe("/app/waiting",function(t){return o.onSubscribeWaiting(t)},t).subscribe("/topic/download",function(t){return o.onDownloadUpdate(t)},t).subscribe("/topic/waiting",function(t){return o.onWaitingUpdate(t)},t)}return n.$inject=["$scope","DonwloadManager","$notification"],t(n,[{key:"onSubscribeDownload",value:function(t){this.items=JSON.parse(t.body)}},{key:"onSubscribeWaiting",value:function(t){this.waitingitems=JSON.parse(t.body)}},{key:"onDownloadUpdate",value:function(t){var e=JSON.parse(t.body),n=_.find(this.items,{id:e.id});switch(e.status){case"Started":case"Paused":n?_.assign(n,e):this.items.push(e);break;case"Finish":this.$notification("Téléchargement terminé",{body:e.title,icon:e.cover.url,delay:5e3}),this.onStoppedFromWS(n);break;case"Stopped":this.onStoppedFromWS(n)}}},{key:"onStoppedFromWS",value:function(t){t&&_.remove(this.items,function(e){return e.id===t.id})}},{key:"onWaitingUpdate",value:function(t){var e=JSON.parse(t.body);_.updateinplace(this.waitingitems,e,function(t,e){return _.findIndex(t,{id:e.id})},!0)}},{key:"getTypeFromStatus",value:function(t){return"Paused"===t.status?"warning":"info"}},{key:"updateNumberOfSimDl",value:function(t){this.DonwloadManager.updateNumberOfSimDl(t)}},{key:"download",value:function(t){this.DonwloadManager.download(t)}},{key:"stopDownload",value:function(t){this.DonwloadManager.ws.stop(t)}},{key:"toggleDownload",value:function(t){this.DonwloadManager.ws.toggle(t)}},{key:"stopAllDownload",value:function(){this.DonwloadManager.stopAllDownload()}},{key:"pauseAllDownload",value:function(){this.DonwloadManager.pauseAllDownload()}},{key:"restartAllCurrentDownload",value:function(){this.DonwloadManager.restartAllCurrentDownload()}},{key:"removeFromQueue",value:function(t){this.DonwloadManager.removeFromQueue(t)}},{key:"dontDonwload",value:function(t){this.DonwloadManager.dontDonwload(t)}},{key:"moveInWaitingList",value:function(t,e){this.DonwloadManager.moveInWaitingList(t,e)}}]),n}();angular.module("ps.download",["ps.config.route","ps.dataService.donwloadManager","notification"]).config(["$routeProvider","commonKey",function(t,e){return t.when("/download",{templateUrl:"html/download.html",controller:"DownloadCtrl",controllerAs:"dc",hotkeys:e})}]).controller("DownloadCtrl",l);var r=function(){function n(t,a,i,o,s,l){var r=this;e(this,n),this.item=l,this.$location=i,this.item.podcast=s,this.playlistService=o,this.DonwloadManager=a;var c="/topic/podcast/".concat(this.item.podcast.id);this.DonwloadManager.ws.subscribe(c,function(t){var e=JSON.parse(t.body);e.id==r.item.id&&_.assign(r.item,e)},t)}return n.$inject=["$scope","DonwloadManager","$location","playlistService","podcast","item"],t(n,[{key:"stopDownload",value:function(t){this.DonwloadManager.ws.stop(t)}},{key:"toggleDownload",value:function(t){this.DonwloadManager.ws.toggle(t)}},{key:"remove",value:function(t){var e=this;return t.remove().then(function(){e.playlistService.remove(t),e.$location.path("/podcasts/".concat(e.item.podcast.id))})}},{key:"reset",value:function(t){var e=this;return t.reset().then(function(n){_.assign(e.item,n),e.playlistService.remove(t)})}},{key:"toggleInPlaylist",value:function(){this.playlistService.addOrRemove(this.item)}},{key:"isInPlaylist",value:function(){return this.playlistService.contains(this.item)}}]),n}();angular.module("ps.item.details",["ps.dataService.donwloadManager","ps.player"]).config(["$routeProvider","commonKey",function(t,e){t.when("/podcasts/:podcastId/item/:itemId",{templateUrl:"html/item-detail.html",controller:"ItemDetailCtrl",controllerAs:"idc",hotkeys:e,resolve:{item:["itemService","$route",function(t,e){return t.findById(e.current.params.podcastId,e.current.params.itemId)}],podcast:["podcastService","$route",function(t,e){return t.findById(e.current.params.podcastId)}]}})}]).controller("ItemDetailCtrl",r),angular.module("ps.item",["ps.item.details","ps.item.player"]);var c=function O(t,n,a,i){e(this,O),this.item=n,this.item.podcast=t,this.$timeout=a,this.config={autoPlay:!0,sources:[{src:this.item.proxyURL,type:this.item.mimeType}],plugins:{controls:{autoHide:!i.isTouchedDevice(),autoHideTime:2e3},poster:this.item.cover.url}}};c.$inject=["podcast","item","$timeout","deviceDetectorService"],angular.module("ps.item.player",["ngSanitize","ngRoute","device-detection","com.2fdevs.videogular","com.2fdevs.videogular.plugins.poster","com.2fdevs.videogular.plugins.controls","com.2fdevs.videogular.plugins.overlayplay","com.2fdevs.videogular.plugins.buffering"]).config(["$routeProvider",function(t){t.when("/podcasts/:podcastId/item/:itemId/play",{templateUrl:"html/item-player.html",controller:"ItemPlayerController",controllerAs:"ipc",resolve:{item:["itemService","$route",function(t,e){return t.findById(e.current.params.podcastId,e.current.params.itemId)}],podcast:["podcastService","$route",function(t,e){return t.findById(e.current.params.podcastId)}]}})}]).controller("ItemPlayerController",c);var d=function(){function n(t,a,i){e(this,n),this.playlistService=t,this.$timeout=a,this.playlist=[],this.state=null,this.API=null,this.currentVideo={},this.config={autoPlay:!0,sources:[],plugins:{controls:{autoHide:!i.isTouchedDevice(),autoHideTime:2e3},poster:""}},this.reloadPlaylist()}return n.$inject=["playlistService","$timeout","deviceDetectorService"],t(n,[{key:"onPlayerReady",value:function(t){this.API=t,("play"==this.API.currentState||this.isCompleted)&&this.API.play(),this.isCompleted=!1,this.setVideo(0)}},{key:"onCompleteVideo",value:function(){var t=this.getIndexOfVideoInPlaylist(this.currentVideo);return this.isCompleted=!0,t+1===this.playlist.length?void(this.currentVideo=this.playlist[0]):void this.setVideo(t+1)}},{key:"reloadPlaylist",value:function(){_.updateinplace(this.playlist,this.playlistService.playlist(),function(t,e){return _.findIndex(t,{id:e.id})})}},{key:"setVideo",value:function(t){this.currentVideo=this.playlist[t],null!==this.currentVideo&&void 0!==this.currentVideo&&(this.API.stop(),this.config.sources=[{src:this.currentVideo.proxyURL,type:this.currentVideo.mimeType}],this.config.plugins.poster=this.currentVideo.cover.url)}},{key:"remove",value:function(t){this.playlistService.remove(t),this.reloadPlaylist(),this.config.sources.length>0&&this.config.sources[0].src===t.proxyURL&&this.setVideo(0)}},{key:"removeAll",value:function(){this.playlistService.removeAll(),this.reloadPlaylist()}},{key:"getIndexOfVideoInPlaylist",value:function(t){return this.playlist.indexOf(t)}}]),n}();angular.module("ps.player",["ngSanitize","ngRoute","device-detection","com.2fdevs.videogular","com.2fdevs.videogular.plugins.poster","com.2fdevs.videogular.plugins.controls","com.2fdevs.videogular.plugins.overlayplay","com.2fdevs.videogular.plugins.buffering","ps.player.playlist"]).config(["$routeProvider",function(t){t.when("/player",{templateUrl:"html/player.html",controller:"PlayerController",controllerAs:"pc"})}]).controller("PlayerController",d),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/authorize-notification.html",'\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/download.html",'
\n\n
\n
\n \n
\n \n
\n
\n
\n \n \n \n
\n
\n
\n\n
\n
\n \n \n
\n\n \n \n \n\n
\n
{{item.title | characters:100}}
\n
\n {{item.progression}}%\n
\n
\n\n\n
\n\n \n \n \n Liste d\'attente {{ dc.waitingitems.length }}\n \n
\n\n
\n
\n \n \n \n
\n\n \n \n \n\n
\n
{{item.title | characters:100}}
\n
\n
\n\n
\n
\n\n\n
')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/item-detail.html",'\n
\n\n
\n \n\n
\n
\n
\n \n \n \n\n
\n\n
\n \n \n \n \n \n\n \n \n\n \n\n \n \n \n \n \n\n \n \n
\n
\n
\n
\n\n
\n
\n
\n

{{ idc.item.title }}

\n
\n
\n {{ idc.item.description | htmlToPlaintext }}\n
\n \n
\n
\n\n
\n
\n\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/item-player.html",'
\n
\n \n\n
\n \n \n\n \n \n {{ currentTime | date:\'mm:ss\' }}\n \n \n \n {{ timeLeft | date:\'mm:ss\' }}\n \n \n \n \n \n
\n
\n\n \n \n \n
\n
\n
')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/items-search.html",'\n
\n \n\n \n\n
\n \n \n
\n
\n
\n
\n \n \n
\n \n \n \n \n\n \n \n\n \n \n
\n
\n
\n
\n \n
\n \n
\n
\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/navbar.html",'')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/player.html",'
\n
\n
\n \n \n\n \n \n {{ currentTime | date:\'mm:ss\' }}\n \n \n \n {{ timeLeft | date:\'mm:ss\' }}\n \n \n \n \n \n
\n
\n\n \n\n \n
\n
\n
\n
\n
Rafraichir
\n
Vider
\n
\n
\n\n \n\n \n \n \n\n
\n

{{ item.title }}

\n
\n
\n \n
\n\n
'); +!function(){"use strict";var t=function(){function t(t,e){for(var n=0;n]+>/gm,"")}}),_.mixin({updateinplace:function(t,e){var n=void 0===arguments[2]?function(t,e){return t.indexOf(e)}:arguments[2],a=void 0===arguments[3]?!1:arguments[3];return _.forEachRight(t.slice(),function(a,i){return-1===n(e,a)&&t.splice(i,1)}),_.forEach(e,function(e){return-1===n(t,e)&&t.push(e)}),a&&_.forEach(e,function(e,a){var i=t.splice(n(t,e),1)[0];t.splice(a,0,i)}),t}});var o=function M(){e(this,M),this.navCollapsed=!0},s=function(){function n(){e(this,n),this.transclude=!0,this.replace=!0,this.restrict="E",this.scope=!0,this.templateUrl="html/navbar.html",this.controller="navbarController",this.controllerAs="navbar"}return t(n,[{key:"link",value:function(t,e){e.removeClass("hidden")}}]),n}();angular.module("navbar",[]).directive("navbar",function(){return new s}).controller("navbarController",o),angular.module("ps.config",["ps.config.route","ps.config.loading","ps.config.restangular","ps.config.ngstomp","ps.config.module"]),angular.module("ps.config.loading",["angular-loading-bar"]).config(["cfpLoadingBarProvider",function(t){t.includeSpinner=!1}]),angular.module("ps.config.module",["ngTouch","ngAnimate","ui.bootstrap","truncate"]),angular.module("ps.config.ngstomp",["AngularStompDK"]).config(["ngstompProvider",function(t){return t.url("/ws").credential("login","password")["class"](SockJS)}]),angular.module("ps.config.restangular",["restangular"]).config(["RestangularProvider",function(t){t.setBaseUrl("/api/"),t.addElementTransformer("items",!1,function(t){return t.addRestangularMethod("reset","get","reset"),t.addRestangularMethod("download","get","addtoqueue"),t})}]),angular.module("ps.config.route",["ngRoute","cfp.hotkeys"]).constant("commonKey",[["h","Goto Home",function(t){t.preventDefault(),window.location.href="#/items"}],["s","Goto Search",function(t){t.preventDefault(),window.location.href="#/item/search"}],["p","Goto Podcast List",function(t){t.preventDefault(),window.location.href="#/podcasts"}],["d","Goto Download List",function(t){t.preventDefault(),window.location.href="#/download"}]]).config(["$routeProvider",function(t){return t.otherwise({redirectTo:"/items"})}]).config(["$locationProvider",function(t){return t.html5Mode(!0)}]);var l=function(){function n(t,a,i){var o=this;e(this,n),this.DonwloadManager=a,this.$notification=i,this.items=[],this.waitingitems=[],this.numberOfSimDl=0,this.DonwloadManager.getNumberOfSimDl().then(function(t){o.numberOfSimDl=parseInt(t)}),this.DonwloadManager.ws.subscribe("/app/download",function(t){return o.onSubscribeDownload(t)},t).subscribe("/app/waiting",function(t){return o.onSubscribeWaiting(t)},t).subscribe("/topic/download",function(t){return o.onDownloadUpdate(t)},t).subscribe("/topic/waiting",function(t){return o.onWaitingUpdate(t)},t)}return n.$inject=["$scope","DonwloadManager","$notification"],t(n,[{key:"onSubscribeDownload",value:function(t){this.items=JSON.parse(t.body)}},{key:"onSubscribeWaiting",value:function(t){this.waitingitems=JSON.parse(t.body)}},{key:"onDownloadUpdate",value:function(t){var e=JSON.parse(t.body),n=_.find(this.items,{id:e.id});switch(e.status){case"Started":case"Paused":n?_.assign(n,e):this.items.push(e);break;case"Finish":try{this.$notification("Téléchargement terminé",{body:e.title,icon:e.cover.url,delay:5e3})}catch(a){}this.onStoppedFromWS(n);break;case"Stopped":this.onStoppedFromWS(n)}}},{key:"onStoppedFromWS",value:function(t){t&&_.remove(this.items,function(e){return e.id===t.id})}},{key:"onWaitingUpdate",value:function(t){var e=JSON.parse(t.body);_.updateinplace(this.waitingitems,e,function(t,e){return _.findIndex(t,{id:e.id})},!0)}},{key:"getTypeFromStatus",value:function(t){return"Paused"===t.status?"warning":"info"}},{key:"updateNumberOfSimDl",value:function(t){this.DonwloadManager.updateNumberOfSimDl(t)}},{key:"download",value:function(t){this.DonwloadManager.download(t)}},{key:"stopDownload",value:function(t){this.DonwloadManager.ws.stop(t)}},{key:"toggleDownload",value:function(t){this.DonwloadManager.ws.toggle(t)}},{key:"stopAllDownload",value:function(){this.DonwloadManager.stopAllDownload()}},{key:"pauseAllDownload",value:function(){this.DonwloadManager.pauseAllDownload()}},{key:"restartAllCurrentDownload",value:function(){this.DonwloadManager.restartAllCurrentDownload()}},{key:"removeFromQueue",value:function(t){this.DonwloadManager.removeFromQueue(t)}},{key:"dontDonwload",value:function(t){this.DonwloadManager.dontDonwload(t)}},{key:"moveInWaitingList",value:function(t,e){this.DonwloadManager.moveInWaitingList(t,e)}}]),n}();angular.module("ps.download",["ps.config.route","ps.dataService.donwloadManager","notification"]).config(["$routeProvider","commonKey",function(t,e){return t.when("/download",{templateUrl:"html/download.html",controller:"DownloadCtrl",controllerAs:"dc",hotkeys:e})}]).controller("DownloadCtrl",l);var r=function(){function n(t,a,i,o,s,l){var r=this;e(this,n),this.item=l,this.$location=i,this.item.podcast=s,this.playlistService=o,this.DonwloadManager=a;var c="/topic/podcast/".concat(this.item.podcast.id);this.DonwloadManager.ws.subscribe(c,function(t){var e=JSON.parse(t.body);e.id==r.item.id&&_.assign(r.item,e)},t)}return n.$inject=["$scope","DonwloadManager","$location","playlistService","podcast","item"],t(n,[{key:"stopDownload",value:function(t){this.DonwloadManager.ws.stop(t)}},{key:"toggleDownload",value:function(t){this.DonwloadManager.ws.toggle(t)}},{key:"remove",value:function(t){var e=this;return t.remove().then(function(){e.playlistService.remove(t),e.$location.path("/podcasts/".concat(e.item.podcast.id))})}},{key:"reset",value:function(t){var e=this;return t.reset().then(function(n){_.assign(e.item,n),e.playlistService.remove(t)})}},{key:"toggleInPlaylist",value:function(){this.playlistService.addOrRemove(this.item)}},{key:"isInPlaylist",value:function(){return this.playlistService.contains(this.item)}}]),n}();angular.module("ps.item.details",["ps.dataService.donwloadManager","ps.player"]).config(["$routeProvider","commonKey",function(t,e){t.when("/podcasts/:podcastId/item/:itemId",{templateUrl:"html/item-detail.html",controller:"ItemDetailCtrl",controllerAs:"idc",hotkeys:e,resolve:{item:["itemService","$route",function(t,e){return t.findById(e.current.params.podcastId,e.current.params.itemId)}],podcast:["podcastService","$route",function(t,e){return t.findById(e.current.params.podcastId)}]}})}]).controller("ItemDetailCtrl",r),angular.module("ps.item",["ps.item.details","ps.item.player"]);var c=function O(t,n,a,i){e(this,O),this.item=n,this.item.podcast=t,this.$timeout=a,this.config={autoPlay:!0,sources:[{src:this.item.proxyURL,type:this.item.mimeType}],plugins:{controls:{autoHide:!i.isTouchedDevice(),autoHideTime:2e3},poster:this.item.cover.url}}};c.$inject=["podcast","item","$timeout","deviceDetectorService"],angular.module("ps.item.player",["ngSanitize","ngRoute","device-detection","com.2fdevs.videogular","com.2fdevs.videogular.plugins.poster","com.2fdevs.videogular.plugins.controls","com.2fdevs.videogular.plugins.overlayplay","com.2fdevs.videogular.plugins.buffering"]).config(["$routeProvider",function(t){t.when("/podcasts/:podcastId/item/:itemId/play",{templateUrl:"html/item-player.html",controller:"ItemPlayerController",controllerAs:"ipc",resolve:{item:["itemService","$route",function(t,e){return t.findById(e.current.params.podcastId,e.current.params.itemId)}],podcast:["podcastService","$route",function(t,e){return t.findById(e.current.params.podcastId)}]}})}]).controller("ItemPlayerController",c),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/authorize-notification.html",'\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/download.html",'
\n\n
\n
\n \n
\n \n
\n
\n
\n \n \n \n
\n
\n
\n\n
\n
\n \n \n
\n\n \n \n \n\n
\n
{{item.title | characters:100}}
\n
\n {{item.progression}}%\n
\n
\n\n\n
\n\n \n \n \n Liste d\'attente {{ dc.waitingitems.length }}\n \n
\n\n
\n
\n \n \n \n
\n\n \n \n \n\n
\n
{{item.title | characters:100}}
\n
\n
\n\n
\n
\n\n\n
')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/item-detail.html",'\n
\n\n
\n \n\n
\n
\n
\n \n \n \n\n
\n\n
\n \n \n \n \n \n\n \n \n\n \n\n \n \n \n \n \n\n \n \n
\n
\n
\n
\n\n
\n
\n
\n

{{ idc.item.title }}

\n
\n
\n {{ idc.item.description | htmlToPlaintext }}\n
\n \n
\n
\n\n
\n
\n\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/item-player.html",'
\n
\n \n\n
\n \n \n\n \n \n {{ currentTime | date:\'mm:ss\' }}\n \n \n \n {{ timeLeft | date:\'mm:ss\' }}\n \n \n \n \n \n
\n
\n\n \n \n \n
\n
\n
')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/items-search.html",'\n
\n \n\n \n\n
\n \n \n
\n
\n
\n
\n \n \n
\n \n \n \n \n\n \n \n\n \n \n
\n
\n
\n
\n \n
\n \n
\n
\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/navbar.html",'')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/player.html",'
\n
\n
\n \n \n\n \n \n {{ currentTime | date:\'mm:ss\' }}\n \n \n \n {{ timeLeft | date:\'mm:ss\' }}\n \n \n \n \n \n
\n
\n\n \n\n \n
\n
\n
\n
\n
Rafraichir
\n
Vider
\n
\n
\n\n \n\n \n \n \n\n
\n

{{ item.title }}

\n
\n
\n \n
\n\n
'); -}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-creation.html",'
\n
\n

Ajouter un Podcast

\n
\n
\n\n
\n
\n
\n \n\n
\n \n
\n
\n
\n \n\n
\n \n
\n
\n
\n \n
\n \n \n \n
\n
\n
\n \n\n
\n \n
\n
\n\n
\n \n
\n\n
\n\n
\n \n
\n
\n
\n \n\n
\n \n
\n
\n
\n \n\n
\n \n
\n
\n
\n \n\n
\n \n
\n
\n
\n\n\n
\n
\n \n
\n
\n
\n
\n\n\n\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-detail.html",'\n\n
\n
\n \n\n
\n
\n
\n
\n

{{ pdc.podcast.title }}

\n

{{ pdc.podcast.totalItems }} Episodes

\n
\n
\n \n \n
\n
\n
\n
\n
\n\n
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n
\n
\n\n\n\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-details-edition.html",'
\n\n \n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n
\n \n
\n
\n
\n \n
\n \n \n \n
\n
\n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n
\n
\n
\n \n \n \n
\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-details-episodes.html",'
\n
\n
\n
\n \n \n \n \n \n\n \n \n\n \n \n \n \n \n\n \n \n
\n\n \n \n \n \n
\n

{{ item.title }}

\n \n

{{item.pubdate | date : \'dd/MM/yyyy à HH:mm\' }}

\n
\n
\n\n
\n \n
\n
\n\n ')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-details-stats.html",'
\n
\n
\n - \n \n + \n
\n
\n
\n \n
\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-details-upload.html",'
\n
\n
\n
\n Déposer un ou des fichiers ici\n
\n
\n
\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcasts-list.html",'
\n
\n
\n \n \n \n
\n
\n
\n\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/stats.html",'
\n
\n
\n
\n - \n \n + \n
\n
\n
\n \n
\n
')}])}();var u=function(){function n(t){e(this,n),this.$localStorage=t,this.$localStorage.playlist=this.$localStorage.playlist||[]}return n.$inject=["$localStorage"],t(n,[{key:"playlist",value:function(){return this.$localStorage.playlist}},{key:"add",value:function(t){this.$localStorage.playlist.push(t)}},{key:"remove",value:function(t){this.$localStorage.playlist=_.remove(this.$localStorage.playlist,function(e){return e.id!==t.id})}},{key:"contains",value:function(t){return angular.isObject(_.find(this.$localStorage.playlist,{id:t.id}))}},{key:"addOrRemove",value:function(t){this.contains(t)?this.remove(t):this.add(t)}},{key:"removeAll",value:function(){this.$localStorage.playlist=[]}}]),n}();angular.module("ps.player.playlist",["ngStorage"]).service("playlistService",u);var p=function(){function n(t,a,i,o){e(this,n),this.podcastService=o,this.$location=t,this.tagService=i,this.podcast=angular.extend(this.podcastService.getNewPodcast(),a)}return n.$inject=["$location","defaultPodcast","tagService","podcastService"],t(n,[{key:"findInfo",value:function(){var t=this;return this.podcastService.findInfo(this.podcast.url).then(function(e){t.podcast.title=e.title,t.podcast.description=e.description,t.podcast.type=e.type,t.podcast.cover.url=e.cover.url})}},{key:"loadTags",value:function(t){return this.tagService.search(t)}},{key:"changeType",value:function(){this.podcast.type=/beinsports\.fr/i.test(this.podcast.url)?"BeInSports":/canalplus\.fr/i.test(this.podcast.url)?"CanalPlus":/jeuxvideo\.fr/i.test(this.podcast.url)?"JeuxVideoFR":/jeuxvideo\.com/i.test(this.podcast.url)?"JeuxVideoCom":/parleys\.com/i.test(this.podcast.url)?"Parleys":/pluzz\.francetv\.fr/i.test(this.podcast.url)?"Pluzz":/youtube\.com/i.test(this.podcast.url)?"Youtube":this.podcast.url.length>0?"RSS":"Send"}},{key:"save",value:function(){var t=this;this.podcastService.save(this.podcast).then(function(e){return t.$location.path("/podcasts/"+e.id)})}}]),n}();angular.module("ps.podcast.creation",["ps.config.route","ps.dataservice","ngTagsInput"]).config(["$routeProvider","commonKey",function(t,e){t.when("/podcast-creation",{templateUrl:"html/podcast-creation.html",controller:"PodcastAddCtrl",controllerAs:"pac",hotkeys:e})}]).constant("defaultPodcast",{hasToBeDeleted:!0,cover:{height:200,width:200}}).controller("PodcastAddCtrl",p);var g=function L(t){e(this,L),this.podcasts=t};g.$inject=["podcasts"],angular.module("ps.podcast.list",["ps.config.route","ps.dataService.podcast"]).config(["$routeProvider","commonKey",function(t,e){t.when("/podcasts",{templateUrl:"html/podcasts-list.html",controller:"PodcastsListCtrl",controllerAs:"plc",hotkeys:e,resolve:{podcasts:["podcastService",function(t){return t.findAll()}]}})}]).controller("PodcastsListCtrl",g),angular.module("ps.podcast",["ps.podcast.details","ps.podcast.creation","ps.podcast.list"]);var h=function(){function n(t,a){e(this,n),this.$sessionStorage=a,this.$sessionStorage.searchParameters=t}return n.$inject=["DefaultItemSearchParameters","$sessionStorage"],t(n,[{key:"getParameters",value:function(){return this.$sessionStorage.searchParameters}},{key:"page",value:function(t){return angular.isNumber(t)&&(this.$sessionStorage.searchParameters.page=t),this.$sessionStorage.searchParameters.page}},{key:"size",value:function(t){return angular.isNumber(t)&&(this.$sessionStorage.searchParameters.size=t),this.$sessionStorage.searchParameters.size}},{key:"updateSearchParam",value:function(t){this.$sessionStorage.searchParameters.term=t.term,this.$sessionStorage.searchParameters.tags=t.tags,this.$sessionStorage.searchParameters.direction=t.direction,this.$sessionStorage.searchParameters.properties=t.properties}}]),n}(),m=function(){function n(t,a,i,o,s,l,r,c){var d=this;e(this,n),this.$location=i,this.itemService=o,this.tagService=s,this.DownloadManager=l,this.playlistService=r,this.SearchItemCache=a,this.totalItems=Number.MAX_VALUE,this.maxSize=10,this.currentPage=this.SearchItemCache.page()+1,this.searchParameters=this.SearchItemCache.getParameters(),this.DownloadManager.ws.subscribe("/topic/download",function(t){return d.updateItemFromWS(t)},t),t.$on("$routeUpdate",function(){d.currentPage!==d.$location.search().page&&(d.currentPage=d.$location.search().page||1,d.changePage())}),this.attachResponse(c)}return n.$inject=["$scope","SearchItemCache","$location","itemService","tagService","DonwloadManager","playlistService","items"],t(n,[{key:"updateItemFromWS",value:function(t){var e=JSON.parse(t.body),n=_.find(this.items,{id:e.id});n&&_.assign(n,e)}},{key:"changePage",value:function(){var t=this;return this.SearchItemCache.page(this.calculatePage()),this.itemService.search(this.SearchItemCache.getParameters()).then(function(e){return t.attachResponse(e)})}},{key:"attachResponse",value:function(t){this.items=t.content,this.totalPages=t.totalPages,this.totalItems=t.totalElements,this.currentPage=this.SearchItemCache.page(t.number)+1,this.$location.search("page",this.currentPage)}},{key:"swipePage",value:function(t){return this.currentPage=this.SearchItemCache.page()+t+1,this.changePage()}},{key:"remove",value:function(t){var e=this;return t.remove().then(function(){return e.playlistService.remove(t)}).then(function(){return e.changePage()})}},{key:"reset",value:function(t){var e=this;return t.reset().then(function(t){var n=_.find(e.items,{id:t.id});return _.assign(n,t),n}).then(function(t){return e.playlistService.remove(t)})}},{key:"stopDownload",value:function(t){this.DownloadManager.ws.stop(t)}},{key:"toggleDownload",value:function(t){return this.DownloadManager.ws.toggle(t)}},{key:"loadTags",value:function(t){return this.tagService.search(t)}},{key:"addOrRemove",value:function(t){return this.playlistService.addOrRemove(t)}},{key:"isInPlaylist",value:function(t){return this.playlistService.contains(t)}},{key:"calculatePage",value:function(){return this.currentPage<=1?0:this.currentPage>Math.ceil(this.totalItems/this.SearchItemCache.size())?Math.ceil(this.totalItems/this.SearchItemCache.size())-1:this.currentPage-1}},{key:"resetSearch",value:function(){return this.currentPage=1,this.SearchItemCache.updateSearchParam(this.searchParameters),this.changePage()}}]),n}();angular.module("ps.search.item",["ps.dataService.donwloadManager","ps.dataService.item","ps.dataService.tag","ps.player","ps.config.route","ngTagsInput","ngStorage"]).config(["$routeProvider","commonKey",function(t,e){t.when("/items",{templateUrl:"html/items-search.html",controller:"ItemsSearchCtrl",controllerAs:"isc",reloadOnSearch:!1,hotkeys:[["right","Next page","isc.swipePage(1)"],["left","Previous page","isc.swipePage(-1)"]].concat(e),resolve:{items:["itemService","SearchItemCache",function(t,e){return t.search(e.getParameters())}]}})}]).constant("DefaultItemSearchParameters",{page:0,size:12,term:void 0,tags:void 0,direction:"DESC",properties:"pubdate"}).controller("ItemsSearchCtrl",m).service("SearchItemCache",h),angular.module("ps.search",["ps.search.item"]);var v=function(){function n(t,a){e(this,n),this.statService=t,this.month=1,this.chartSeries=[],this.transform(a),this.chartConfig={options:{chart:{type:"spline"},plotOptions:{spline:{marker:{enabled:!0}}},xAxis:{type:"datetime",dateTimeLabelFormats:{month:"%e. %b",year:"%b"},title:{text:"Date"}}},series:this.chartSeries,title:{text:""},credits:{enabled:!1},loading:!1}}return n.$inject=["statService","stats"],t(n,[{key:"transform",value:function(t){var e=this;_.updateinplace(this.chartSeries,[]),angular.forEach(t,function(t){var a={name:t.type};a.data=_(t.values).map(n.dateMapper()).sortBy("date").map(n.highChartsMapper()).value(),e.chartSeries.push(a)})}},{key:"navigate",value:function(t){this.month+=t,this.generateChartData()}},{key:"generateChartData",value:function(){var t=this;return this.statService.statsByType(this.month).then(function(e){return t.transform(e)})}}],[{key:"dateMapper",value:function(){return function(t){return{date:Date.UTC(t.date[0],t.date[1]-1,t.date[2]),numberOfItems:t.numberOfItems}}}},{key:"highChartsMapper",value:function(){return function(t){return[t.date,t.numberOfItems]}}}]),n}();angular.module("ps.stats",["ps.dataService.stat"]).config(["$routeProvider","commonKey",function(t,e){t.when("/stats",{templateUrl:"html/stats.html",controller:"StatsController",controllerAs:"sc",hotkeys:e,resolve:{stats:["statService",function(t){return t.statsByType()}]}})}]).controller("StatsController",v),angular.module("ps.dataservice",["ps.dataService.donwloadManager","ps.dataService.item","ps.dataService.podcast","ps.dataService.tag","ps.dataService.updateService"]);var f=function(){function n(t,a){e(this,n),this.WS_DOWNLOAD_BASE=t,this.ngstomp=a}return t(n,[{key:"connect",value:function(){return this.ngstomp.connect()}},{key:"subscribe",value:function(t,e,n){return this.ngstomp.subscribe(t,e,n)}},{key:"unsubscribe",value:function(t){return this.ngstomp.unsubscribe(t)}},{key:"toggle",value:function(t){return this.ngstomp.send(this.WS_DOWNLOAD_BASE+"/toogle",t)}},{key:"start",value:function(t){return this.ngstomp.send(this.WS_DOWNLOAD_BASE+"/start",t)}},{key:"pause",value:function(t){return this.ngstomp.send(this.WS_DOWNLOAD_BASE+"/pause",t)}},{key:"stop",value:function(t){return this.ngstomp.send(this.WS_DOWNLOAD_BASE+"/stop",t)}}]),n}(),y=function(){function n(t,a){e(this,n),this.Restangular=t,this.baseTask=this.Restangular.one("task"),this.baseDownloadManager=this.baseTask.one("downloadManager"),this.WS_DOWNLOAD_BASE="/app/download",this.ws=new f(this.WS_DOWNLOAD_BASE,a)}return n.$inject=["Restangular","ngstomp"],t(n,[{key:"download",value:function(t){return this.Restangular.one("item").customGET(t.id+"/addtoqueue")}},{key:"stopDownload",value:function(t){return this.baseDownloadManager.customPOST(t.id,"stopDownload")}},{key:"toggleDownload",value:function(t){return this.baseDownloadManager.customPOST(t.id,"toogleDownload")}},{key:"stopAllDownload",value:function(){return this.baseDownloadManager.customGET("stopAllDownload")}},{key:"pauseAllDownload",value:function(){return this.baseDownloadManager.customGET("pauseAllDownload")}},{key:"restartAllCurrentDownload",value:function(){return this.baseDownloadManager.customGET("restartAllCurrentDownload")}},{key:"removeFromQueue",value:function(t){return this.baseDownloadManager.customDELETE("queue/"+t.id)}},{key:"updateNumberOfSimDl",value:function(t){return this.baseDownloadManager.customPOST(t,"limit")}},{key:"dontDonwload",value:function(t){return this.baseDownloadManager.customDELETE("queue/"+t.id+"/andstop")}},{key:"getDownloading",value:function(){return this.baseTask.all("downloadManager/downloading").getList()}},{key:"getNumberOfSimDl",value:function(){return this.baseDownloadManager.one("limit").get()}},{key:"moveInWaitingList",value:function(t,e){this.baseDownloadManager.customPOST({id:t.id,position:e},"move")}}]),n}();angular.module("ps.dataService.donwloadManager",["restangular","AngularStompDK"]).service("DonwloadManager",y);var b=function(){function n(t){e(this,n),this.Restangular=t}return n.$inject=["Restangular"],t(n,[{key:"search",value:function(){var t=this,e=void 0===arguments[0]?{page:0,size:12}:arguments[0];return this.Restangular.one("item/search").post(null,e).then(function(e){return e.content=t.restangularizedItems(e.content),e})}},{key:"findById",value:function(t,e){return this.Restangular.one("podcast",t).one("items",e).get()}},{key:"getItemForPodcastWithPagination",value:function(t,e){return t.one("items").post(null,e)}},{key:"restangularizePodcastItem",value:function(t,e){return this.Restangular.restangularizeCollection(t,e,"items")}},{key:"restangularizedItems",value:function(t){var e=this,n=[];return angular.forEach(t,function(t){n.push(e.Restangular.restangularizeElement(e.Restangular.one("podcast",t.podcastId),t,"items"))}),n}}]),n}();angular.module("ps.dataService.item",["restangular"]).service("itemService",b);var w=function(){function n(t){e(this,n),this.Restangular=t,this.route="podcast"}return n.$inject=["Restangular"],t(n,[{key:"findById",value:function(t){return this.Restangular.one(this.route,t).get()}},{key:"findAll",value:function(){return this.Restangular.all(this.route).getList()}},{key:"save",value:function(t){return t.save()}},{key:"getNewPodcast",value:function(){return this.Restangular.one(this.route)}},{key:"patch",value:function(t){return t.patch()}},{key:"deletePodcast",value:function(t){return t.remove()}},{key:"findInfo",value:function(t){return this.Restangular.one(this.route).findInfo(t)}},{key:"statsByPubdate",value:function(t){var e=void 0===arguments[1]?6:arguments[1];return this.Restangular.one(this.route,t).one("stats").all("byPubdate").post(e)}},{key:"statsByByDownloaddate",value:function(t){var e=void 0===arguments[1]?6:arguments[1];return this.Restangular.one(this.route,t).one("stats").all("byDownloaddate").post(e)}}]),n}();angular.module("ps.dataService.podcast",["restangular"]).config(["RestangularProvider",function(t){t.addElementTransformer("podcast",!1,function(t){return t.addRestangularMethod("findInfo","post","fetch",void 0,{"Content-Type":"text/plain"}),t})}]).service("podcastService",w);var S=function(){function n(t){e(this,n),this.Restangular=t,this.base=this.Restangular.one("stats")}return n.$inject=["Restangular"],t(n,[{key:"statsByType",value:function(){var t=void 0===arguments[0]?1:arguments[0];return this.base.all("byType").post(t)}}]),n}();angular.module("ps.dataService.stat",["restangular"]).service("statService",S);var P=function(){function n(t){e(this,n),this.baseAll=t.all("tag")}return n.$inject=["Restangular"],t(n,[{key:"getAll",value:function(){return this.baseAll.get()}},{key:"search",value:function(t){return this.baseAll.post(null,{name:t})}}]),n}();angular.module("ps.dataService.tag",["restangular"]).service("tagService",P);var k=function(){function n(t){e(this,n),this.Restangular=t}return n.$inject=["Restangular"],t(n,[{key:"forceUpdatePodcast",value:function(t){return this.Restangular.one("task").customPOST(t,"updateManager/updatePodcast/force")}}]),n}();angular.module("ps.dataService.updateService",["restangular"]).service("UpdateService",k);var D=function U(){e(this,U),this.restrict="E",this.templateUrl="html/podcast-details-edition.html", -this.scope={podcast:"="},this.controller="podcastEditionCtrl",this.controllerAs="pec",this.bindToController=!0},$=function(){function n(t,a,i,o){e(this,n),this.$scope=t,this.$location=a,this.tagService=i,this.podcastService=o}return n.$inject=["$scope","$location","tagService","podcastService"],t(n,[{key:"loadTags",value:function(t){return this.tagService.search(t)}},{key:"save",value:function(){var t=this,e=_.cloneDeep(this.podcast);return e.items=null,this.podcastService.patch(e).then(function(e){return _.assign(t.podcast,e)}).then(function(){return t.$scope.$emit("podcastEdition:save")})}},{key:"deletePodcast",value:function(){var t=this;return this.podcastService.deletePodcast(this.podcast).then(function(){return t.$location.path("/podcasts")})}}]),n}();angular.module("ps.podcast.details.edition",["ps.dataService.podcast","ps.dataService.tag","ngTagsInput"]).directive("podcastEdition",function(){return new D}).controller("podcastEditionCtrl",$);var x=function E(){e(this,E),this.restrict="E",this.templateUrl="html/podcast-details-episodes.html",this.scope={podcast:"="},this.controller="podcastItemsListCtrl",this.controllerAs="pic",this.bindToController=!0},I=function(){function n(t,a,i,o,s){var l=this;e(this,n),this.$scope=t,this.DownloadManager=a,this.itemService=o,this.playlistService=s,this.currentPage=1,this.itemPerPage=i,this.loadPage(),this.$scope.$on("podcastItems:refresh",function(){l.currentPage=1,l.loadPage()}),this.DownloadManager.ws.subscribe("/topic/podcast/".concat(this.podcast.id),function(t){return l.onMessageFromWS(t)},t)}return n.$inject=["$scope","DonwloadManager","PodcastItemPerPage","itemService","playlistService"],t(n,[{key:"onMessageFromWS",value:function(t){var e=JSON.parse(t.body),n=_.find(this.podcast.items,{id:e.id});_.assign(n,e)}},{key:"loadPage",value:function(){var t=this;return this.currentPage=this.currentPage<1?1:this.currentPage>Math.ceil(this.totalItems/this.itemPerPage)?Math.ceil(this.totalItems/this.itemPerPage):this.currentPage,this.itemService.getItemForPodcastWithPagination(this.podcast,{size:this.itemPerPage,page:this.currentPage-1,direction:"DESC",properties:"pubdate"}).then(function(e){t.podcast.items=t.itemService.restangularizePodcastItem(t.podcast,e.content),t.podcast.totalItems=e.totalElements})}},{key:"remove",value:function(t){var e=this;t.remove().then(function(){return e.podcast.items=_.reject(e.podcast.items,function(e){return e.id===t.id})}).then(function(){return e.playlistService.remove(t)}).then(function(){return e.loadPage()})}},{key:"reset",value:function(t){var e=this;return t.reset().then(function(t){var n=_.find(e.podcast.items,{id:t.id});return _.assign(n,t),n}).then(function(t){return e.playlistService.remove(t)})}},{key:"addOrRemoveInPlaylist",value:function(t){this.playlistService.addOrRemove(t)}},{key:"isInPlaylist",value:function(t){return this.playlistService.contains(t)}},{key:"swipePage",value:function(t){this.currentPage+=t,this.loadPage()}},{key:"stopDownload",value:function(t){this.DownloadManager.ws.stop(t)}},{key:"toggleDownload",value:function(t){this.DownloadManager.ws.toggle(t)}}]),n}();angular.module("ps.podcast.details.episodes",["ps.player"]).directive("podcastItemsList",function(){return new x}).constant("PodcastItemPerPage",10).controller("podcastItemsListCtrl",I);var C=function(){function n(t,a,i){var o=this;e(this,n),this.$scope=t,this.UpdateService=i,this.podcast=a,this.podcastTabs=[{heading:"Episodes",active:!0},{heading:"Edition",active:!1},{heading:"Upload",disabled:"send"!==this.podcast.type},{heading:"Stats",active:!1}],this.$scope.$on("podcastEdition:save",function(){return o.refreshItems()})}return n.$inject=["$scope","podcast","UpdateService"],t(n,[{key:"refreshItems",value:function(){this.$scope.$broadcast("podcastItems:refresh")}},{key:"refresh",value:function(){var t=this;this.UpdateService.forceUpdatePodcast(this.podcast.id).then(function(){return t.refreshItems()})}},{key:"tabsActive",value:function(t){this.podcastTabs[t].active=!0}}]),n}();angular.module("ps.podcast.details",["ps.config.route","ps.podcast.details","ps.podcast.details.episodes","ps.podcast.details.edition","ps.podcast.details.upload","ps.podcast.details.stats","ps.dataService.updateService"]).config(["$routeProvider","commonKey",function(t,e){return t.when("/podcasts/:podcastId",{templateUrl:"html/podcast-detail.html",controller:"PodcastDetailCtrl",controllerAs:"pdc",hotkeys:e,resolve:{podcast:["podcastService","$route",function(t,e){return t.findById(e.current.params.podcastId)}]}})}]).controller("PodcastDetailCtrl",C);var T=function z(){e(this,z),this.restrict="E",this.scope={podcast:"="},this.templateUrl="html/podcast-details-stats.html",this.controller="PodcastDetailsStatsCtrl",this.controllerAs="pdsc",this.bindToController=!0},A=function(){function n(t,a,i){var o=this;e(this,n),this.$q=a,this.podcastService=i,this.month=6,this.chartSeries=[],this.generateChartData(),this.chartConfig={options:{chart:{type:"spline"},plotOptions:{spline:{marker:{enabled:!0}}},xAxis:{type:"datetime",dateTimeLabelFormats:{month:"%e. %b",year:"%b"},title:{text:"Date"}}},series:this.chartSeries,title:{text:""},credits:{enabled:!1},loading:!1},t.$on("podcastItems:refresh",function(){return o.generateChartData()})}return n.$inject=["$scope","$q","podcastService"],t(n,[{key:"navigate",value:function(t){return this.month+=t,this.generateChartData()}},{key:"generateChartData",value:function(){var t=this;return n.resetChart(this.chartSeries),this.$q.all([this.podcastService.statsByByDownloaddate(this.podcast.id,this.month),this.podcastService.statsByPubdate(this.podcast.id,this.month)]).then(function(e){var a=_(e[0]).map(n.dateMapper()).sortBy("date").map(n.highChartsMapper()).value(),i=_(e[1]).map(n.dateMapper()).sortBy("date").map(n.highChartsMapper()).value();return t.chartSeries.push({name:"Download Date",data:a}),t.chartSeries.push({name:"Publication Date",data:i}),t.chartSeries})}}],[{key:"resetChart",value:function(t){_.updateinplace(t,[])}},{key:"dateMapper",value:function(){return function(t){return{date:Date.UTC(t.date[0],t.date[1]-1,t.date[2]),numberOfItems:t.numberOfItems}}}},{key:"highChartsMapper",value:function(){return function(t){return[t.date,t.numberOfItems]}}}]),n}();angular.module("ps.podcast.details.stats",["highcharts-ng"]).directive("podcastStats",function(){return new T}).controller("PodcastDetailsStatsCtrl",A),angular.module("ps.podcast.details.upload",["angularFileUpload"]).directive("podcastUpload",function(){return{restrcit:"E",templateUrl:"html/podcast-details-upload.html",scope:{podcast:"="},controller:"podcastUploadCtrl"}}).controller("podcastUploadCtrl",["$scope","$log",function(t,e){t.onFileSelect=function(n){var a;angular.forEach(n,function(n){a=new FormData,a.append("file",n),t.podcast.all("items").withHttpConfig({transformRequest:angular.identity}).customPOST(a,"upload",void 0,{"Content-Type":void 0}).then(function(t){e.info("Upload de l'item suivant"),e.info(t)})})}}])}(); +}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-creation.html",'
\n
\n

Ajouter un Podcast

\n
\n
\n\n
\n
\n
\n \n\n
\n \n
\n
\n
\n \n\n
\n \n
\n
\n
\n \n
\n \n \n \n
\n
\n
\n \n\n
\n \n
\n
\n\n
\n \n
\n\n
\n\n
\n \n
\n
\n
\n \n\n
\n \n
\n
\n
\n \n\n
\n \n
\n
\n
\n \n\n
\n \n
\n
\n
\n\n\n
\n
\n \n
\n
\n
\n
\n\n\n\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-detail.html",'\n\n
\n
\n \n\n
\n
\n
\n
\n

{{ pdc.podcast.title }}

\n

{{ pdc.podcast.totalItems }} Episodes

\n
\n
\n \n \n
\n
\n
\n
\n
\n\n
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n
\n
\n\n\n\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-details-edition.html",'
\n\n \n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n
\n \n
\n
\n
\n \n
\n \n \n \n
\n
\n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n
\n
\n
\n \n \n \n
\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-details-episodes.html",'
\n
\n
\n
\n \n \n \n \n \n\n \n \n\n \n \n \n \n \n\n \n \n
\n\n \n \n \n \n
\n

{{ item.title }}

\n \n

{{item.pubdate | date : \'dd/MM/yyyy à HH:mm\' }}

\n
\n
\n\n
\n \n
\n
\n\n ')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-details-stats.html",'
\n
\n
\n - \n \n + \n
\n
\n
\n \n
\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcast-details-upload.html",'
\n
\n
\n
\n Déposer un ou des fichiers ici\n
\n
\n
\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/podcasts-list.html",'
\n
\n
\n \n \n \n
\n
\n
\n\n')}])}(),function(t){try{t=angular.module("ps.partial")}catch(e){t=angular.module("ps.partial",[])}t.run(["$templateCache",function(t){t.put("html/stats.html",'
\n
\n
\n
\n - \n \n + \n
\n
\n
\n \n
\n
')}])}();var d=function(){function n(t,a,i){e(this,n),this.playlistService=t,this.$timeout=a,this.playlist=[],this.state=null,this.API=null,this.currentVideo={},this.config={autoPlay:!0,sources:[],plugins:{controls:{autoHide:!i.isTouchedDevice(),autoHideTime:2e3},poster:""}},this.reloadPlaylist()}return n.$inject=["playlistService","$timeout","deviceDetectorService"],t(n,[{key:"onPlayerReady",value:function(t){this.API=t,("play"==this.API.currentState||this.isCompleted)&&this.API.play(),this.isCompleted=!1,this.setVideo(0)}},{key:"onCompleteVideo",value:function(){var t=this.getIndexOfVideoInPlaylist(this.currentVideo);return this.isCompleted=!0,t+1===this.playlist.length?void(this.currentVideo=this.playlist[0]):void this.setVideo(t+1)}},{key:"reloadPlaylist",value:function(){_.updateinplace(this.playlist,this.playlistService.playlist(),function(t,e){return _.findIndex(t,{id:e.id})})}},{key:"setVideo",value:function(t){this.currentVideo=this.playlist[t],null!==this.currentVideo&&void 0!==this.currentVideo&&(this.API.stop(),this.config.sources=[{src:this.currentVideo.proxyURL,type:this.currentVideo.mimeType}],this.config.plugins.poster=this.currentVideo.cover.url)}},{key:"remove",value:function(t){this.playlistService.remove(t),this.reloadPlaylist(),this.config.sources.length>0&&this.config.sources[0].src===t.proxyURL&&this.setVideo(0)}},{key:"removeAll",value:function(){this.playlistService.removeAll(),this.reloadPlaylist()}},{key:"getIndexOfVideoInPlaylist",value:function(t){return this.playlist.indexOf(t)}}]),n}();angular.module("ps.player",["ngSanitize","ngRoute","device-detection","com.2fdevs.videogular","com.2fdevs.videogular.plugins.poster","com.2fdevs.videogular.plugins.controls","com.2fdevs.videogular.plugins.overlayplay","com.2fdevs.videogular.plugins.buffering","ps.player.playlist"]).config(["$routeProvider",function(t){t.when("/player",{templateUrl:"html/player.html",controller:"PlayerController",controllerAs:"pc"})}]).controller("PlayerController",d);var u=function(){function n(t){e(this,n),this.$localStorage=t,this.$localStorage.playlist=this.$localStorage.playlist||[]}return n.$inject=["$localStorage"],t(n,[{key:"playlist",value:function(){return this.$localStorage.playlist}},{key:"add",value:function(t){this.$localStorage.playlist.push(t)}},{key:"remove",value:function(t){this.$localStorage.playlist=_.remove(this.$localStorage.playlist,function(e){return e.id!==t.id})}},{key:"contains",value:function(t){return angular.isObject(_.find(this.$localStorage.playlist,{id:t.id}))}},{key:"addOrRemove",value:function(t){this.contains(t)?this.remove(t):this.add(t)}},{key:"removeAll",value:function(){this.$localStorage.playlist=[]}}]),n}();angular.module("ps.player.playlist",["ngStorage"]).service("playlistService",u);var p=function(){function n(t,a,i,o){e(this,n),this.podcastService=o,this.$location=t,this.tagService=i,this.podcast=angular.extend(this.podcastService.getNewPodcast(),a)}return n.$inject=["$location","defaultPodcast","tagService","podcastService"],t(n,[{key:"findInfo",value:function(){var t=this;return this.podcastService.findInfo(this.podcast.url).then(function(e){t.podcast.title=e.title,t.podcast.description=e.description,t.podcast.type=e.type,t.podcast.cover.url=e.cover.url})}},{key:"loadTags",value:function(t){return this.tagService.search(t)}},{key:"changeType",value:function(){this.podcast.type=/beinsports\.fr/i.test(this.podcast.url)?"BeInSports":/canalplus\.fr/i.test(this.podcast.url)?"CanalPlus":/jeuxvideo\.fr/i.test(this.podcast.url)?"JeuxVideoFR":/jeuxvideo\.com/i.test(this.podcast.url)?"JeuxVideoCom":/parleys\.com/i.test(this.podcast.url)?"Parleys":/pluzz\.francetv\.fr/i.test(this.podcast.url)?"Pluzz":/youtube\.com/i.test(this.podcast.url)?"Youtube":this.podcast.url.length>0?"RSS":"Send"}},{key:"save",value:function(){var t=this;this.podcastService.save(this.podcast).then(function(e){return t.$location.path("/podcasts/"+e.id)})}}]),n}();angular.module("ps.podcast.creation",["ps.config.route","ps.dataservice","ngTagsInput"]).config(["$routeProvider","commonKey",function(t,e){t.when("/podcast-creation",{templateUrl:"html/podcast-creation.html",controller:"PodcastAddCtrl",controllerAs:"pac",hotkeys:e})}]).constant("defaultPodcast",{hasToBeDeleted:!0,cover:{height:200,width:200}}).controller("PodcastAddCtrl",p);var g=function L(t){e(this,L),this.podcasts=t};g.$inject=["podcasts"],angular.module("ps.podcast.list",["ps.config.route","ps.dataService.podcast"]).config(["$routeProvider","commonKey",function(t,e){t.when("/podcasts",{templateUrl:"html/podcasts-list.html",controller:"PodcastsListCtrl",controllerAs:"plc",hotkeys:e,resolve:{podcasts:["podcastService",function(t){return t.findAll()}]}})}]).controller("PodcastsListCtrl",g),angular.module("ps.podcast",["ps.podcast.details","ps.podcast.creation","ps.podcast.list"]);var h=function(){function n(t,a){e(this,n),this.$sessionStorage=a,this.$sessionStorage.searchParameters=t}return n.$inject=["DefaultItemSearchParameters","$sessionStorage"],t(n,[{key:"getParameters",value:function(){return this.$sessionStorage.searchParameters}},{key:"page",value:function(t){return angular.isNumber(t)&&(this.$sessionStorage.searchParameters.page=t),this.$sessionStorage.searchParameters.page}},{key:"size",value:function(t){return angular.isNumber(t)&&(this.$sessionStorage.searchParameters.size=t),this.$sessionStorage.searchParameters.size}},{key:"updateSearchParam",value:function(t){this.$sessionStorage.searchParameters.term=t.term,this.$sessionStorage.searchParameters.tags=t.tags,this.$sessionStorage.searchParameters.direction=t.direction,this.$sessionStorage.searchParameters.properties=t.properties}}]),n}(),m=function(){function n(t,a,i,o,s,l,r,c){var d=this;e(this,n),this.$location=i,this.itemService=o,this.tagService=s,this.DownloadManager=l,this.playlistService=r,this.SearchItemCache=a,this.totalItems=Number.MAX_VALUE,this.maxSize=10,this.currentPage=this.SearchItemCache.page()+1,this.searchParameters=this.SearchItemCache.getParameters(),this.DownloadManager.ws.subscribe("/topic/download",function(t){return d.updateItemFromWS(t)},t),t.$on("$routeUpdate",function(){d.currentPage!==d.$location.search().page&&(d.currentPage=d.$location.search().page||1,d.changePage())}),this.attachResponse(c)}return n.$inject=["$scope","SearchItemCache","$location","itemService","tagService","DonwloadManager","playlistService","items"],t(n,[{key:"updateItemFromWS",value:function(t){var e=JSON.parse(t.body),n=_.find(this.items,{id:e.id});n&&_.assign(n,e)}},{key:"changePage",value:function(){var t=this;return this.SearchItemCache.page(this.calculatePage()),this.itemService.search(this.SearchItemCache.getParameters()).then(function(e){return t.attachResponse(e)})}},{key:"attachResponse",value:function(t){this.items=t.content,this.totalPages=t.totalPages,this.totalItems=t.totalElements,this.currentPage=this.SearchItemCache.page(t.number)+1,this.$location.search("page",this.currentPage)}},{key:"swipePage",value:function(t){return this.currentPage=this.SearchItemCache.page()+t+1,this.changePage()}},{key:"remove",value:function(t){var e=this;return t.remove().then(function(){return e.playlistService.remove(t)}).then(function(){return e.changePage()})}},{key:"reset",value:function(t){var e=this;return t.reset().then(function(t){var n=_.find(e.items,{id:t.id});return _.assign(n,t),n}).then(function(t){return e.playlistService.remove(t)})}},{key:"stopDownload",value:function(t){this.DownloadManager.ws.stop(t)}},{key:"toggleDownload",value:function(t){return this.DownloadManager.ws.toggle(t)}},{key:"loadTags",value:function(t){return this.tagService.search(t)}},{key:"addOrRemove",value:function(t){return this.playlistService.addOrRemove(t)}},{key:"isInPlaylist",value:function(t){return this.playlistService.contains(t)}},{key:"calculatePage",value:function(){return this.currentPage<=1?0:this.currentPage>Math.ceil(this.totalItems/this.SearchItemCache.size())?Math.ceil(this.totalItems/this.SearchItemCache.size())-1:this.currentPage-1}},{key:"resetSearch",value:function(){return this.currentPage=1,this.SearchItemCache.updateSearchParam(this.searchParameters),this.changePage()}}]),n}();angular.module("ps.search.item",["ps.dataService.donwloadManager","ps.dataService.item","ps.dataService.tag","ps.player","ps.config.route","ngTagsInput","ngStorage"]).config(["$routeProvider","commonKey",function(t,e){t.when("/items",{templateUrl:"html/items-search.html",controller:"ItemsSearchCtrl",controllerAs:"isc",reloadOnSearch:!1,hotkeys:[["right","Next page","isc.swipePage(1)"],["left","Previous page","isc.swipePage(-1)"]].concat(e),resolve:{items:["itemService","SearchItemCache",function(t,e){return t.search(e.getParameters())}]}})}]).constant("DefaultItemSearchParameters",{page:0,size:12,term:void 0,tags:void 0,direction:"DESC",properties:"pubdate"}).controller("ItemsSearchCtrl",m).service("SearchItemCache",h),angular.module("ps.search",["ps.search.item"]);var v=function(){function n(t,a){e(this,n),this.statService=t,this.month=1,this.chartSeries=[],this.transform(a),this.chartConfig={options:{chart:{type:"spline"},plotOptions:{spline:{marker:{enabled:!0}}},xAxis:{type:"datetime",dateTimeLabelFormats:{month:"%e. %b",year:"%b"},title:{text:"Date"}}},series:this.chartSeries,title:{text:""},credits:{enabled:!1},loading:!1}}return n.$inject=["statService","stats"],t(n,[{key:"transform",value:function(t){var e=this;_.updateinplace(this.chartSeries,[]),angular.forEach(t,function(t){var a={name:t.type};a.data=_(t.values).map(n.dateMapper()).sortBy("date").map(n.highChartsMapper()).value(),e.chartSeries.push(a)})}},{key:"navigate",value:function(t){this.month+=t,this.generateChartData()}},{key:"generateChartData",value:function(){var t=this;return this.statService.statsByType(this.month).then(function(e){return t.transform(e)})}}],[{key:"dateMapper",value:function(){return function(t){return{date:Date.UTC(t.date[0],t.date[1]-1,t.date[2]),numberOfItems:t.numberOfItems}}}},{key:"highChartsMapper",value:function(){return function(t){return[t.date,t.numberOfItems]}}}]),n}();angular.module("ps.stats",["ps.dataService.stat"]).config(["$routeProvider","commonKey",function(t,e){t.when("/stats",{templateUrl:"html/stats.html",controller:"StatsController",controllerAs:"sc",hotkeys:e,resolve:{stats:["statService",function(t){return t.statsByType()}]}})}]).controller("StatsController",v),angular.module("ps.dataservice",["ps.dataService.donwloadManager","ps.dataService.item","ps.dataService.podcast","ps.dataService.tag","ps.dataService.updateService"]);var f=function(){function n(t,a){e(this,n),this.WS_DOWNLOAD_BASE=t,this.ngstomp=a}return t(n,[{key:"connect",value:function(){return this.ngstomp.connect()}},{key:"subscribe",value:function(t,e,n){return this.ngstomp.subscribe(t,e,n)}},{key:"unsubscribe",value:function(t){return this.ngstomp.unsubscribe(t)}},{key:"toggle",value:function(t){return this.ngstomp.send(this.WS_DOWNLOAD_BASE+"/toogle",t)}},{key:"start",value:function(t){return this.ngstomp.send(this.WS_DOWNLOAD_BASE+"/start",t)}},{key:"pause",value:function(t){return this.ngstomp.send(this.WS_DOWNLOAD_BASE+"/pause",t)}},{key:"stop",value:function(t){return this.ngstomp.send(this.WS_DOWNLOAD_BASE+"/stop",t)}}]),n}(),y=function(){function n(t,a){e(this,n),this.Restangular=t,this.baseTask=this.Restangular.one("task"),this.baseDownloadManager=this.baseTask.one("downloadManager"),this.WS_DOWNLOAD_BASE="/app/download",this.ws=new f(this.WS_DOWNLOAD_BASE,a)}return n.$inject=["Restangular","ngstomp"],t(n,[{key:"download",value:function(t){return this.Restangular.one("item").customGET(t.id+"/addtoqueue")}},{key:"stopDownload",value:function(t){return this.baseDownloadManager.customPOST(t.id,"stopDownload")}},{key:"toggleDownload",value:function(t){return this.baseDownloadManager.customPOST(t.id,"toogleDownload")}},{key:"stopAllDownload",value:function(){return this.baseDownloadManager.customGET("stopAllDownload")}},{key:"pauseAllDownload",value:function(){return this.baseDownloadManager.customGET("pauseAllDownload")}},{key:"restartAllCurrentDownload",value:function(){return this.baseDownloadManager.customGET("restartAllCurrentDownload")}},{key:"removeFromQueue",value:function(t){return this.baseDownloadManager.customDELETE("queue/"+t.id)}},{key:"updateNumberOfSimDl",value:function(t){return this.baseDownloadManager.customPOST(t,"limit")}},{key:"dontDonwload",value:function(t){return this.baseDownloadManager.customDELETE("queue/"+t.id+"/andstop")}},{key:"getDownloading",value:function(){return this.baseTask.all("downloadManager/downloading").getList()}},{key:"getNumberOfSimDl",value:function(){return this.baseDownloadManager.one("limit").get()}},{key:"moveInWaitingList",value:function(t,e){this.baseDownloadManager.customPOST({id:t.id,position:e},"move")}}]),n}();angular.module("ps.dataService.donwloadManager",["restangular","AngularStompDK"]).service("DonwloadManager",y);var b=function(){function n(t){e(this,n),this.Restangular=t}return n.$inject=["Restangular"],t(n,[{key:"search",value:function(){var t=this,e=void 0===arguments[0]?{page:0,size:12}:arguments[0];return this.Restangular.one("item/search").post(null,e).then(function(e){return e.content=t.restangularizedItems(e.content),e})}},{key:"findById",value:function(t,e){return this.Restangular.one("podcast",t).one("items",e).get()}},{key:"getItemForPodcastWithPagination",value:function(t,e){return t.one("items").post(null,e)}},{key:"restangularizePodcastItem",value:function(t,e){return this.Restangular.restangularizeCollection(t,e,"items")}},{key:"restangularizedItems",value:function(t){var e=this,n=[];return angular.forEach(t,function(t){n.push(e.Restangular.restangularizeElement(e.Restangular.one("podcast",t.podcastId),t,"items"))}),n}}]),n}();angular.module("ps.dataService.item",["restangular"]).service("itemService",b);var w=function(){function n(t){e(this,n),this.Restangular=t,this.route="podcast"}return n.$inject=["Restangular"],t(n,[{key:"findById",value:function(t){return this.Restangular.one(this.route,t).get()}},{key:"findAll",value:function(){return this.Restangular.all(this.route).getList()}},{key:"save", +value:function(t){return t.save()}},{key:"getNewPodcast",value:function(){return this.Restangular.one(this.route)}},{key:"patch",value:function(t){return t.patch()}},{key:"deletePodcast",value:function(t){return t.remove()}},{key:"findInfo",value:function(t){return this.Restangular.one(this.route).findInfo(t)}},{key:"statsByPubdate",value:function(t){var e=void 0===arguments[1]?6:arguments[1];return this.Restangular.one(this.route,t).one("stats").all("byPubdate").post(e)}},{key:"statsByByDownloaddate",value:function(t){var e=void 0===arguments[1]?6:arguments[1];return this.Restangular.one(this.route,t).one("stats").all("byDownloaddate").post(e)}}]),n}();angular.module("ps.dataService.podcast",["restangular"]).config(["RestangularProvider",function(t){t.addElementTransformer("podcast",!1,function(t){return t.addRestangularMethod("findInfo","post","fetch",void 0,{"Content-Type":"text/plain"}),t})}]).service("podcastService",w);var S=function(){function n(t){e(this,n),this.Restangular=t,this.base=this.Restangular.one("stats")}return n.$inject=["Restangular"],t(n,[{key:"statsByType",value:function(){var t=void 0===arguments[0]?1:arguments[0];return this.base.all("byType").post(t)}}]),n}();angular.module("ps.dataService.stat",["restangular"]).service("statService",S);var P=function(){function n(t){e(this,n),this.baseAll=t.all("tag")}return n.$inject=["Restangular"],t(n,[{key:"getAll",value:function(){return this.baseAll.get()}},{key:"search",value:function(t){return this.baseAll.post(null,{name:t})}}]),n}();angular.module("ps.dataService.tag",["restangular"]).service("tagService",P);var k=function(){function n(t){e(this,n),this.Restangular=t}return n.$inject=["Restangular"],t(n,[{key:"forceUpdatePodcast",value:function(t){return this.Restangular.one("task").customPOST(t,"updateManager/updatePodcast/force")}}]),n}();angular.module("ps.dataService.updateService",["restangular"]).service("UpdateService",k);var D=function U(){e(this,U),this.restrict="E",this.templateUrl="html/podcast-details-edition.html",this.scope={podcast:"="},this.controller="podcastEditionCtrl",this.controllerAs="pec",this.bindToController=!0},$=function(){function n(t,a,i,o){e(this,n),this.$scope=t,this.$location=a,this.tagService=i,this.podcastService=o}return n.$inject=["$scope","$location","tagService","podcastService"],t(n,[{key:"loadTags",value:function(t){return this.tagService.search(t)}},{key:"save",value:function(){var t=this,e=_.cloneDeep(this.podcast);return e.items=null,this.podcastService.patch(e).then(function(e){return _.assign(t.podcast,e)}).then(function(){return t.$scope.$emit("podcastEdition:save")})}},{key:"deletePodcast",value:function(){var t=this;return this.podcastService.deletePodcast(this.podcast).then(function(){return t.$location.path("/podcasts")})}}]),n}();angular.module("ps.podcast.details.edition",["ps.dataService.podcast","ps.dataService.tag","ngTagsInput"]).directive("podcastEdition",function(){return new D}).controller("podcastEditionCtrl",$);var x=function E(){e(this,E),this.restrict="E",this.templateUrl="html/podcast-details-episodes.html",this.scope={podcast:"="},this.controller="podcastItemsListCtrl",this.controllerAs="pic",this.bindToController=!0},I=function(){function n(t,a,i,o,s){var l=this;e(this,n),this.$scope=t,this.DownloadManager=a,this.itemService=o,this.playlistService=s,this.currentPage=1,this.itemPerPage=i,this.loadPage(),this.$scope.$on("podcastItems:refresh",function(){l.currentPage=1,l.loadPage()}),this.DownloadManager.ws.subscribe("/topic/podcast/".concat(this.podcast.id),function(t){return l.onMessageFromWS(t)},t)}return n.$inject=["$scope","DonwloadManager","PodcastItemPerPage","itemService","playlistService"],t(n,[{key:"onMessageFromWS",value:function(t){var e=JSON.parse(t.body),n=_.find(this.podcast.items,{id:e.id});_.assign(n,e)}},{key:"loadPage",value:function(){var t=this;return this.currentPage=this.currentPage<1?1:this.currentPage>Math.ceil(this.totalItems/this.itemPerPage)?Math.ceil(this.totalItems/this.itemPerPage):this.currentPage,this.itemService.getItemForPodcastWithPagination(this.podcast,{size:this.itemPerPage,page:this.currentPage-1,direction:"DESC",properties:"pubdate"}).then(function(e){t.podcast.items=t.itemService.restangularizePodcastItem(t.podcast,e.content),t.podcast.totalItems=e.totalElements})}},{key:"remove",value:function(t){var e=this;t.remove().then(function(){return e.podcast.items=_.reject(e.podcast.items,function(e){return e.id===t.id})}).then(function(){return e.playlistService.remove(t)}).then(function(){return e.loadPage()})}},{key:"reset",value:function(t){var e=this;return t.reset().then(function(t){var n=_.find(e.podcast.items,{id:t.id});return _.assign(n,t),n}).then(function(t){return e.playlistService.remove(t)})}},{key:"addOrRemoveInPlaylist",value:function(t){this.playlistService.addOrRemove(t)}},{key:"isInPlaylist",value:function(t){return this.playlistService.contains(t)}},{key:"swipePage",value:function(t){this.currentPage+=t,this.loadPage()}},{key:"stopDownload",value:function(t){this.DownloadManager.ws.stop(t)}},{key:"toggleDownload",value:function(t){this.DownloadManager.ws.toggle(t)}}]),n}();angular.module("ps.podcast.details.episodes",["ps.player"]).directive("podcastItemsList",function(){return new x}).constant("PodcastItemPerPage",10).controller("podcastItemsListCtrl",I);var C=function(){function n(t,a,i){var o=this;e(this,n),this.$scope=t,this.UpdateService=i,this.podcast=a,this.podcastTabs=[{heading:"Episodes",active:!0},{heading:"Edition",active:!1},{heading:"Upload",disabled:"send"!==this.podcast.type},{heading:"Stats",active:!1}],this.$scope.$on("podcastEdition:save",function(){return o.refreshItems()})}return n.$inject=["$scope","podcast","UpdateService"],t(n,[{key:"refreshItems",value:function(){this.$scope.$broadcast("podcastItems:refresh")}},{key:"refresh",value:function(){var t=this;this.UpdateService.forceUpdatePodcast(this.podcast.id).then(function(){return t.refreshItems()})}},{key:"tabsActive",value:function(t){this.podcastTabs[t].active=!0}}]),n}();angular.module("ps.podcast.details",["ps.config.route","ps.podcast.details","ps.podcast.details.episodes","ps.podcast.details.edition","ps.podcast.details.upload","ps.podcast.details.stats","ps.dataService.updateService"]).config(["$routeProvider","commonKey",function(t,e){return t.when("/podcasts/:podcastId",{templateUrl:"html/podcast-detail.html",controller:"PodcastDetailCtrl",controllerAs:"pdc",hotkeys:e,resolve:{podcast:["podcastService","$route",function(t,e){return t.findById(e.current.params.podcastId)}]}})}]).controller("PodcastDetailCtrl",C);var T=function z(){e(this,z),this.restrict="E",this.scope={podcast:"="},this.templateUrl="html/podcast-details-stats.html",this.controller="PodcastDetailsStatsCtrl",this.controllerAs="pdsc",this.bindToController=!0},A=function(){function n(t,a,i){var o=this;e(this,n),this.$q=a,this.podcastService=i,this.month=6,this.chartSeries=[],this.generateChartData(),this.chartConfig={options:{chart:{type:"spline"},plotOptions:{spline:{marker:{enabled:!0}}},xAxis:{type:"datetime",dateTimeLabelFormats:{month:"%e. %b",year:"%b"},title:{text:"Date"}}},series:this.chartSeries,title:{text:""},credits:{enabled:!1},loading:!1},t.$on("podcastItems:refresh",function(){return o.generateChartData()})}return n.$inject=["$scope","$q","podcastService"],t(n,[{key:"navigate",value:function(t){return this.month+=t,this.generateChartData()}},{key:"generateChartData",value:function(){var t=this;return n.resetChart(this.chartSeries),this.$q.all([this.podcastService.statsByByDownloaddate(this.podcast.id,this.month),this.podcastService.statsByPubdate(this.podcast.id,this.month)]).then(function(e){var a=_(e[0]).map(n.dateMapper()).sortBy("date").map(n.highChartsMapper()).value(),i=_(e[1]).map(n.dateMapper()).sortBy("date").map(n.highChartsMapper()).value();return t.chartSeries.push({name:"Download Date",data:a}),t.chartSeries.push({name:"Publication Date",data:i}),t.chartSeries})}}],[{key:"resetChart",value:function(t){_.updateinplace(t,[])}},{key:"dateMapper",value:function(){return function(t){return{date:Date.UTC(t.date[0],t.date[1]-1,t.date[2]),numberOfItems:t.numberOfItems}}}},{key:"highChartsMapper",value:function(){return function(t){return[t.date,t.numberOfItems]}}}]),n}();angular.module("ps.podcast.details.stats",["highcharts-ng"]).directive("podcastStats",function(){return new T}).controller("PodcastDetailsStatsCtrl",A),angular.module("ps.podcast.details.upload",["angularFileUpload"]).directive("podcastUpload",function(){return{restrcit:"E",templateUrl:"html/podcast-details-upload.html",scope:{podcast:"="},controller:"podcastUploadCtrl"}}).controller("podcastUploadCtrl",["$scope","$log",function(t,e){t.onFileSelect=function(n){var a;angular.forEach(n,function(n){a=new FormData,a.append("file",n),t.podcast.all("items").withHttpConfig({transformRequest:angular.identity}).customPOST(a,"upload",void 0,{"Content-Type":void 0}).then(function(t){e.info("Upload de l'item suivant"),e.info(t)})})}}])}(); //# sourceMappingURL=all.min.js.map \ No newline at end of file diff --git a/src/main/resources/static/app/js/modules/download/download.es6.js b/src/main/resources/static/app/js/modules/download/download.es6.js index 626bd0944..7ecd4535f 100644 --- a/src/main/resources/static/app/js/modules/download/download.es6.js +++ b/src/main/resources/static/app/js/modules/download/download.es6.js @@ -38,11 +38,15 @@ class DownloadCtrl { this.items.push(item); break; case 'Finish' : - this.$notification('Téléchargement terminé', { - body: item.title, - icon: item.cover.url, - delay: 5000 - }); + try { + this.$notification('Téléchargement terminé', { + body: item.title, + icon: item.cover.url, + delay: 5000 + }); + } catch (e) { + + } this.onStoppedFromWS(elemToUpdate); break; case 'Stopped' :