From 110383cfa7e25b09bc64a67a4f4e4e3787196251 Mon Sep 17 00:00:00 2001 From: Andrew Fyfe Date: Mon, 8 Dec 2014 11:56:04 +0000 Subject: [PATCH] Add download movie/episode button (Issue #106) closes #106 --- changelog.txt | 1 + resources/js/app/movies/movie.js | 31 +++++++++++++++++++++++------- resources/js/app/tvshows/tvshow.js | 12 ++++++++++++ 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/changelog.txt b/changelog.txt index d580077..a5e45ff 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ 4.1.13 - Allow semi-colon (;) to be used as a list delimiter + - Add download movie/episode button 4.1.12 - Massive clean up of the music section diff --git a/resources/js/app/movies/movie.js b/resources/js/app/movies/movie.js index d0ca087..279da8d 100644 --- a/resources/js/app/movies/movie.js +++ b/resources/js/app/movies/movie.js @@ -289,14 +289,31 @@ var movieDetailsPanel = new Ext.FormPanel({ name: 'trailer' }, { - xtype: 'button', - text: 'View Trailer', - handler: function() { - if (Ext.getCmp('trailer').getValue() !== '') { - window.open(Ext.getCmp('trailer').getValue(), ''); + xtype: 'panel', + layout: 'hbox', + items: [ + { + xtype: 'button', + text: 'Download Movie', + handler: function() { + var selectedMovie = Ext.getCmp('Moviegrid').getSelectionModel().getSelected(), + path = selectedMovie.data.file; + + if (path !== '') { + window.open(XWMM.util.convertVFSURL(path), ''); + } + } + }, + { + xtype: 'button', + text: 'View Trailer', + handler: function() { + if (Ext.getCmp('trailer').getValue() !== '') { + window.open(Ext.getCmp('trailer').getValue(), ''); + } + } } - }, - width: 60 + ] } ] }, diff --git a/resources/js/app/tvshows/tvshow.js b/resources/js/app/tvshows/tvshow.js index 31b414e..6f982fa 100644 --- a/resources/js/app/tvshows/tvshow.js +++ b/resources/js/app/tvshows/tvshow.js @@ -329,6 +329,18 @@ var episodeDetailsPanel = new Ext.FormPanel({ fieldLabel: 'Description', name: 'plot', height: 125, + }, + { + xtype: 'button', + text: 'Download Episode', + handler: function() { + var selectedEpisode = Ext.getCmp('episodeGird').getSelectionModel().getSelected(), + path = selectedEpisode.data.directory + selectedEpisode.data.file; + + if (path !== '') { + window.open(XWMM.util.convertVFSURL(path), ''); + } + } } ] },