Skip to content

Commit

Permalink
fixed movie set management (add, delete, rename)
Browse files Browse the repository at this point in the history
no need for the associated functions in include/xbmc.js
it is all managed by xbmc now
  • Loading branch information
slash2009 committed Sep 22, 2013
1 parent d1b87c3 commit 98e4dea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 36 deletions.
29 changes: 0 additions & 29 deletions include/xbmc.js
Expand Up @@ -76,11 +76,6 @@ function downloadXBMCFile(url,myFile) {
});
};

function updateXBMCMovieSet(record) {
var inputUrl = '/xbmcCmds/xbmcHttp?command=execvideodatabase(UPDATE sets SET strSet = "'+record.data.strSet+'" WHERE idSet = "'+record.data.idSet+'")';
XBMCExecSql(inputUrl)
}

function AddXBMCNewMovieSet(record) {
var inputUrl = '/xbmcCmds/xbmcHttp?command=execvideodatabase(INSERT INTO sets (strSet) VALUES ("'+record.data.strSet+'"))';
Ext.Ajax.request({
Expand Down Expand Up @@ -139,30 +134,6 @@ function updateXBMCAlbum(record) {

}

function removeXBMCMovieSet(rec) {
// Delete Set
var inputUrl = '/xbmcCmds/xbmcHttp?command=execvideodatabase(DELETE FROM sets WHERE idSet='+rec.data.idSet+')';
Ext.Ajax.request({
url: inputUrl,
method: 'GET',
async: false,
success: function (t){},
failure: function(t){},
timeout: 2000
});

// Delete linked movies
var inputUrl = '/xbmcCmds/xbmcHttp?command=execvideodatabase(DELETE FROM setlinkmovie WHERE idSet='+rec.data.idSet+')';
Ext.Ajax.request({
url: inputUrl,
method: 'GET',
async: false,
success: function (t){},
failure: function(t){},
timeout: 2000
});
}

function removeXBMCGenre(record) {
var inputUrl = '/xbmcCmds/xbmcHttp?command=execvideodatabase(DELETE FROM genre WHERE idGenre='+record.data.genreid+')';
XBMCExecSql(inputUrl);
Expand Down
21 changes: 14 additions & 7 deletions movies/movieset.js
Expand Up @@ -59,7 +59,7 @@ var MovieInSetGrid = new Ext.grid.GridPanel({

function onAddMovieSet(btn, ev) {
var u = new MovieSetMgmtGrid.store.recordType({
set: 'New Set',
strSet: 'New Set',
idSet: '-1' // flag as new record
});
editor.stopEditing();
Expand All @@ -71,20 +71,27 @@ function onDeleteMovieSet() {
var rec = MovieSetMgmtGrid.getSelectionModel().getSelected();
if (!rec) {return false;}

removeXBMCMovieSet(rec);

MovieSetStore.remove(rec)
MoviesInSetStore.each( function (movieRecord)
{
xbmcJsonRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": '+ movieRecord.data.idMovie +', "set": ""}, "id": 1}');
}, this);
MovieSetStore.reload()
}

var MovieSetEditor = new Ext.ux.grid.RowEditor({
saveText: 'Update',
listeners: {
afteredit: function(roweditor, changes, record, rowIndex) {
if (record.data.idSet == -1) {
AddXBMCNewMovieSet(record);
MovieSetStore.reload()
//should add a bubble to tell user to add movies in the set
}
else {
updateXBMCMovieSet(record);
MoviesInSetStore.each( function (movieRecord)
{
xbmcJsonRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": '+ movieRecord.data.idMovie +', "set": "'+ changes.strSet +'"}, "id": 1}');
}, this);
MovieSetStore.reload()
}
}
Expand Down Expand Up @@ -116,12 +123,12 @@ var MovieSetMgmtGrid = new Ext.grid.GridPanel({
store: MovieSetStore,
tbar: [{
text: 'Add',
disabled: 'true', //disabled as no method of adding new sets via JSON currently
//disabled: 'true', //disabled as no method of adding new sets via JSON currently
iconCls: 'silk-add',
handler: onAddMovieSet
}, '-', {
text: 'Delete',
disabled: 'true', //disabled as no method of deleting sets via JSON currently
//disabled: 'true', //disabled as no method of deleting sets via JSON currently
iconCls: 'silk-delete',
handler: onDeleteMovieSet
}, '-'],
Expand Down

0 comments on commit 98e4dea

Please sign in to comment.