') === null) {
- str = ''+str+' ';
- }
- str = str.replace(/\n/g,'');
-
- if (window.DOMParser)
- {
- parser=new DOMParser();
- xmlDoc=parser.parseFromString(str,'text/xml');
- }
- else // Internet Explorer
- {
- xmlDoc=new ActiveXObject('Microsoft.XMLDOM');
- xmlDoc.async='false';
- xmlDoc.loadXML(str);
- }
-
- var MasterUrl = getTagAttribute(xmlDoc.documentElement, 'url');
- if (MasterUrl === null){ MasterUrl = '';}
- for (var i=0 ; i < xmlDoc.documentElement.childNodes.length; i++) {
- var downloadUrl = MasterUrl + xmlDoc.getElementsByTagName('thumb')[i].childNodes[0].nodeValue;
- var previewUrl = xmlDoc.getElementsByTagName('thumb')[i].getAttribute('preview');
- if (previewUrl === '' || previewUrl === null) { previewUrl = downloadUrl;}
- else { previewUrl = MasterUrl + previewUrl;}
- // need to change preview url for impawards links
- if (previewUrl.match('impaward') !== null) {previewUrl = previewUrl.replace(/posters\//g,'thumbs/imp_');}
-
- result.push([previewUrl, downloadUrl, 'Remote', '']);
- }
- return result;
-}
-
-function getTagAttribute(xmlString, tag) {
- var temp ="";
- for (var i=0 ; i < xmlString.attributes.length; i++) {
- if (xmlString.attributes[i].nodeName == tag) {
- temp = xmlString.attributes[i].nodeValue
- }
+function GetAlbumDetails(record) {
+ var request = {
+ jsonrpc: '2.0',
+ method: 'AudioLibrary.GetAlbumDetails',
+ params: {
+ albumid: record.data.albumid,
+ properties: [
+ 'description', 'theme', 'mood', 'style',
+ 'type', 'albumlabel', 'rating', 'thumbnail'
+ ]
+ },
+ id: 'XWMM'
+ };
+ var response = xbmcJsonRPC(request);
+ XWMM.util.merge2Objects(record.data, response.albumdetails);
+
+ record.data.theme = XWMM.util.convertArrayToList(response.albumdetails.theme, ' | ');
+ record.data.mood = XWMM.util.convertArrayToList(response.albumdetails.mood, ' | ');
+ record.data.style = XWMM.util.convertArrayToList(response.albumdetails.style, ' | ');
+ record.data.rating = XWMM.util.convertRating(record.data.rating);
+ if (record.data.rating < 0) {
+ record.data.rating = 0;
}
- return temp;
-}
-
-function GetAlbumDetails(r) {
-
- var jsonResponse = xbmcJsonRPC('{"jsonrpc": "2.0", "method": "AudioLibrary.GetAlbumDetails", "params": {"albumid": '+r.data.albumid+', "properties": ["title", "genre", "year", "rating", "theme", "mood", "style", "type", "description", "albumlabel"]}, "id": 1}');
-
- XWMM.util.merge2Objects(r.data, jsonResponse.albumdetails);
-
- r.data.currentThumbnail = '/image/' + encodeURI(r.data.currentThumbnail);
- r.data.details = true;
+ record.data.thumbnail = '/image/' + encodeURI(record.data.thumbnail);
+ record.data.details = true;
}
diff --git a/resources/js/app/music/music.js b/resources/js/app/music/music.js
index 3b284e4..823d5ce 100644
--- a/resources/js/app/music/music.js
+++ b/resources/js/app/music/music.js
@@ -20,90 +20,344 @@
* along with WIMM. If not, see .
*/
-// -----------------------------------------
-// music.js
-// last modified : 31-12-2009
-//
-//------------------------------------------
-
-Ext.ns('Audio');
-
-
-//Main Panel
-Audio.Mainpanel = Ext.extend(Ext.Panel, {
- initComponent: function() {
- Ext.applyIf(this, {
- frame: true,
- title: 'Audio List',
- width: 1250,
- height: 700,
- loadMask: true,
- layout: 'border',
- renderTo: Ext.getBody(),
- items: [
- menuBar,
- AlbumGrid,
+var AlbumRecord = Ext.data.Record.create([
+ { name: 'albumid' },
+ { name: 'title' },
+ { name: 'artist', convert: XWMM.util.convertArrayToList },
+ { name: 'displayartist' },
+ { name: 'genre', convert: XWMM.util.convertArrayToList },
+ { name: 'year' }
+]);
+
+var sortArticles = docCookies.getItem('sortArticles') === '1';
+var AlbumStore = new Ext.data.GroupingStore({
+ autoLoad: true,
+ sortInfo: { field: 'title', direction: 'ASC' },
+ proxy: new Ext.data.XBMCProxy({
+ jsonData: {
+ jsonrpc: '2.0',
+ method: 'AudioLibrary.GetAlbums',
+ params: {
+ properties: [
+ 'title', 'genre', 'artist', 'year', 'displayartist'
+ ],
+ sort: {
+ order: 'ascending',
+ ignorearticle: sortArticles,
+ method: 'title'
+ }
+ },
+ id: 'XWMM'
+ }
+ }),
+ reader: new Ext.data.JsonReader({ root: 'result.albums' }, AlbumRecord)
+});
+
+var AlbumcolModel = new Ext.grid.ColumnModel([
+ { header: '#', dataIndex: 'albumid', hidden: true },
+ { header: 'Album', dataIndex: 'title', width: 150 },
+ { header: 'Year', dataIndex: 'year', hidden: true },
+ { header: 'Artist', dataIndex: 'displayartist', hidden: true },
+ { header: 'Genre', dataIndex: 'genre', hidden: true }
+]);
+
+var AlbumGrid = new Ext.grid.GridPanel({
+ cm: AlbumcolModel,
+ id: 'albumGrid',
+ enableDragDrop: false,
+ stripeRows: true,
+ viewconfig: { forceFit: true },
+ view: new Ext.grid.GroupingView({
+ forceFit:true,
+ width: 260,
+ startCollapsed: true,
+ showGroupName : false,
+ enableGroupingMenu : true,
+ groupTextTpl: '{text}'
+ }),
+ selModel: new Ext.grid.RowSelectionModel({singleSelect: true}),
+ region: 'west',
+ width: 260,
+ split: true,
+ store: AlbumStore
+});
+
+// ------------ Album information -------------
+
+var AlbumCover = new Ext.ux.XbmcImages ({
+ autoEl: { tag: 'img', src: Ext.BLANK_IMAGE_URL },
+ border: 0,
+ width: 160,
+ height: 160
+});
+
+var AlbumStars = new Ext.ux.XbmcStars ({
+ border: 0,
+ width: 58,
+ height: 16
+});
+
+var standardInfo = new Ext.FormPanel({
+ layout: 'form',
+ title: 'Album Info (from tags)',
+ frame: true,
+ width: 270,
+ height: 190,
+ trackResetOnLoad: true,
+ bodyStyle: 'padding:5px',
+ labelWidth: 60,
+ defaults: {
+ xtype:'textfield',
+ width: 170,
+ listeners: {
+ change: function() {
+ Ext.getCmp('savebutton').enable();
+ }
+ }
+ },
+ items: [
{
- xtype: 'panel',
- region: 'center',
- defaults:{xtype:'container'},
- items: [
- albumDetailPanel,
- SongGrid
- ]
- },{
- xtype: 'panel',
- region:'east',
- margins:'5 5 5 5',
- split:true,
- width: 200,
- items: [{
- layout:'accordion',
- height: 500,
- items:[Genregrid, ArtistGrid]
- }]
- }]
- });
-
- Audio.Mainpanel.superclass.initComponent.call(this);
+ fieldLabel: 'Title',
+ name: 'title',
+ allowBlank: false
+ },
+ {
+ fieldLabel: 'Genre',
+ name: 'genre'
+ },
+ {
+ fieldLabel: 'Artist',
+ name: 'artist'
+ },
+ {
+ fieldLabel: 'Year',
+ name: 'year'
+ }
+ ]
+});
+
+var extraInfo = new Ext.FormPanel({
+ title: 'Additional Info (from scraper)',
+ layout: 'form',
+ trackResetOnLoad: true,
+ frame: true,
+ height: 368,
+ width: 280,
+ id: 'albumscraperdetails',
+ labelWidth: 60,
+ defaults: {
+ xtype: 'textfield',
+ width: 170,
+ enableKeyEvents: true,
+ listeners: {
+ change: function() { Ext.getCmp('savebutton').enable(); }
+ }
},
+ rowspan: 2,
+ items: [
+ {
+ fieldLabel: 'Display Artist',
+ name: 'displayartist'
+ },
+ {
+ fieldLabel: 'Rating',
+ name: 'rating'
+ },
+ {
+ fieldLabel: 'Type',
+ name: 'type'
+ },
+ {
+ fieldLabel: 'Label',
+ name: 'albumlabel'
+ },
+ {
+ xtype: 'textarea',
+ height: 47,
+ fieldLabel: 'Styles',
+ name: 'style'
+ },
+ {
+ xtype:'textarea',
+ height: 47,
+ fieldLabel: 'Moods',
+ name: 'mood'
+ },
+ {
+ xtype:'textarea',
+ height: 47,
+ fieldLabel: 'Themes',
+ name: 'theme'
+ }
+ ]
+});
- initEvents: function() {
- Audio.Mainpanel.superclass.initEvents.call(this);
- var currentAlbum = this.getComponent('albumGrid').getSelectionModel();
+var albumDescription = new Ext.FormPanel({
+ title:'Description',
+ layout: 'form',
+ trackResetOnLoad: true,
+ labelWidth: 6,
+ buttons: [
+ {
+ disabled: true,
+ text: 'Save',
+ id: 'savebutton',
+ handler: function() {
+ updateMusicAlbum();
+ this.disable();
+ }
+ },
+ {
+ text: 'Cancel',
+ handler: function() {
+ updateGenreGrid(currentRecord.data.genres);
+ }
+ }
+ ],
+ width: 460,
+ colspan: 2,
+ items: [
+ {
+ xtype: 'textarea',
+ name: 'description',
+ listeners: {
+ change: function() {
+ Ext.getCmp('savebutton').enable();
+ }
+ },
+ height: 105,
+ width: 430
+ }
+ ]
+});
- currentAlbum.on('rowselect', this.onRowSelect, this);
+var albumDetailPanel = new Ext.Panel({
+ region: 'north',
+ width: 740,
+ id: 'albumDetailPanel',
+ trackResetOnLoad: true,
+ title: 'Select Album
',
+ defaults:{frame:true},
+ layout:'table',
+ layoutConfig: {columns:3},
+ items:[{
+ width:190,
+ items: [AlbumStars, AlbumCover]
+ },
+ standardInfo,
+ extraInfo,
+ albumDescription
+ ]
+});
- //add double-click event to cover object
- var element = AlbumCover.getEl();
- element.on('dblclick', function(){ChangeImages(currentRecord);});
- },
+// ------------ Track information -------------
+
+function convertTime(val) {
+ var minutes = Math.floor(val / 60);
+ var seconds = val - minutes * 60;
+ if (seconds < 10) seconds = '0' + seconds;
+ if (minutes < 10) minutes = '0' +minutes;
+ return minutes + ':' + seconds;
+}
+
+function starRating(val) {
+ val = parseInt(val);
+ return ' ';
+}
- onRowSelect: function(sm, rowIdx, r) {
+var SongcolModel = new Ext.grid.ColumnModel([
+ { header: '#', dataIndex: 'songid', hidden: true },
+ { header: '#', dataIndex: 'track', width: 30 },
+ { header: 'Track', dataIndex: 'title', width: 300 },
+ { header: 'Duration', dataIndex: 'duration', width: 70, renderer: convertTime },
+ { header: 'Rating', dataIndex: 'rating', width: 100, renderer: starRating }
+]);
- currentRecord = r;
+var SongRecord = Ext.data.Record.create([
+ { name: 'songid' },
+ { name: 'title' },
+ { name: 'track' },
+ { name: 'duration' },
+ { name: 'rating', convert: XWMM.util.convertRating },
+]);
- if (r.data.details === undefined){
- GetAlbumDetails(r);
+var SongStore = new Ext.data.Store({
+ proxy: new Ext.data.XBMCProxy({
+ jsonData: {
+ jsonrpc: '2.0',
+ method: 'AudioLibrary.GetSongs',
+ params: {
+ properties: [
+ 'track', 'title', 'artist', 'duration', 'rating'
+ ],
+ sort: {
+ order: 'ascending',
+ ignorearticle: sortArticles,
+ method: 'track'
+ }
+ },
+ id: 'XWMM'
}
+ }),
+ reader: new Ext.data.JsonReader({ root: 'result.songs' }, SongRecord)
+});
+
+var SongGrid = new Ext.grid.GridPanel({
+ cm: SongcolModel,
+ title: 'Album Tracks
',
+ region: 'center',
+ loadMask: true,
+ frame: 'true',
+ enableDragDrop: false,
+ stripeRows: true,
+ viewconfig: { forceFit: true },
+ selModel: new Ext.grid.RowSelectionModel({ singleSelect: true }),
+ width: 740,
+ height: 230,
+ split: true,
+ store: SongStore
+});
+
+var mainPanel = new Ext.Panel({
+ region: 'center',
+ layout: 'border',
- //albumDetailPanel.getForm().loadRecord(r);
- standardInfo.getForm().loadRecord(r);
- extraInfo.getForm().loadRecord(r);
- albumDescription.getForm().loadRecord(r);
- albumDetailPanel.setTitle(''+r.data.strAlbum+' / '+r.data.strArtist+'
');
+ frame: true,
+ loadMask: true,
+
+ items: [
+ menuBar,
+ AlbumGrid,
+ {
+ xtype: 'panel',
+ region: 'center',
+ defaults: { xtype:'container' },
+ items: [
+ albumDetailPanel,
+ SongGrid
+ ]
+ }
+ ],
- AlbumCover.updateSrc(r.data.currentThumbnail);
+ initEvents: function() {
+ Ext.getCmp('albumGrid').getSelectionModel().on('rowselect', this.albumSelect, this);
+ },
- if (r.data.rating < 10) { AlbumStars.updateSrc(r);}
+ albumSelect: function(sm, rowIdx, record) {
+ if (record.data.details === undefined){
+ GetAlbumDetails(record);
+ }
- r.data.details = true;
+ //albumDetailPanel.getForm().loadRecord(record);
+ standardInfo.getForm().loadRecord(record);
+ extraInfo.getForm().loadRecord(record);
+ albumDescription.getForm().loadRecord(record);
+ albumDetailPanel.setTitle('' + record.data.title + ' / ' + record.data.artist + '
');
- SongStore.proxy.conn.jsonData = {'jsonrpc': '2.0', 'method': 'AudioLibrary.GetSongs', 'params': {'properties': [ 'track', 'artist', 'duration'], 'filter': {'albumid': r.data.albumid}},'id': 1};
+ AlbumCover.updateSrc(record.data.thumbnail);
+ AlbumStars.updateSrc(record);
- //SongStore.proxy.conn.url = '/xbmcCmds/xbmcHttp?command=querymusicdatabase(select idSong, strTitle, iTrack, iDuration, iYear, strFileName, rating, idAlbum, strAlbum, strPath, idArtist, strArtist, idGenre, strGenre FROM songview WHERE idAlbum = '+r.data.albumid+')';
- SongStore.load();
+ SongStore.load({ params: { filter: { albumid: record.data.albumid } } });
Ext.getCmp('savebutton').disable();
}
});
-Ext.reg('Mainpanel', Audio.Mainpanel);
diff --git a/resources/js/app/music/musiclist.js b/resources/js/app/music/musiclist.js
deleted file mode 100644
index 688c84a..0000000
--- a/resources/js/app/music/musiclist.js
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * Copyright 2011 slash2009.
- * Copyright 2013 Zernable.
- * Copyright 2013 uNiversal.
- * Copyright 2013, 2014 Andrew Fyfe.
- *
- * This file is part of Web interface Media Manager (WIMM) for kodi.
- *
- * WIMM is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * WIMM is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with WIMM. If not, see .
- */
-
-// -----------------------------------------
-// movie.js
-// last modified : 21-02-2010
-//
-//------------------------------------------
-
-// ------------ Artist information -------------
-
-var CheckArtist = new Ext.grid.CheckboxSelectionModel({
- dataIndex:'artistid',
- alwaysSelectOnCheck: 'true',
- header: false,
- listeners: {
- selectionchange: function(sm) {
- movieGenreChange(sm);
- var bt = Ext.getCmp('savebutton');
- bt.enable();
- }
- }
-});
-
-var ArtistcolModel = new Ext.grid.ColumnModel([
- CheckArtist,
- {header: '#', dataIndex: 'artistid', hidden: true},
- {header: 'Artist', dataIndex: 'artist'}
- ]);
-
-var ArtistRecord = Ext.data.Record.create([
- {name: 'artistid'},
- {name: 'artist'},
-]);
-
-var ArtistStore = new Ext.data.Store({
- autoLoad: true,
- proxy: new Ext.data.XBMCProxy({
- jsonData : {'jsonrpc': '2.0', 'method': 'AudioLibrary.GetArtists','id': 1}
- }),
- reader: new Ext.data.JsonReader({
- root: 'result.artists',
- }, ArtistRecord)
-});
-
-ArtistGrid = new Ext.grid.GridPanel({
- cm: ArtistcolModel,
- id: 'artistGrid',
- title: 'Extra Artists',
- enableDragDrop: false,
- stripeRows: true,
- viewconfig: {forceFit: true},
- selModel: new Ext.grid.RowSelectionModel({singleSelect: true}),
- region: 'center',
- width: 260,
- split: true,
- store: ArtistStore
-});
-
-
-// ------------ Album information -------------
-
-var AlbumCover = new Ext.ux.XbmcImages ({
- id: 'albumCover',
- autoEl: {tag: 'img', src: Ext.BLANK_IMAGE_URL},
- border: 0,
- width: 160,
- height:160
-});
-
-var AlbumStars = new Ext.ux.XbmcStars ({
- id: 'albumrating',
- border: 0,
- width: 58,
- height:16
-});
-
-var standardInfo = new Ext.FormPanel({
- layout: 'form',
- title: 'Album Info (from tags)',
- frame:true, width:270, height: 190,
- trackResetOnLoad: true,
- bodyStyle:'padding:5px',
- labelWidth: 60,
- defaults: { xtype:'textfield',
- width: 170,
- listeners:{'change' : function(){DetailsFlag = true; Ext.getCmp('savebutton').enable();}}
- },
- items: [{
- fieldLabel: 'Title',
- name: 'strAlbum',
- id: 'albumtitlefield',
- allowBlank: false,
- XBMCName: 'strAlbum'
- },{
- xtype: 'combo',
- fieldLabel: 'Genre',
- store: GenreStore,
- displayField: 'strGenre',
- id: 'albumgenrefield',
- valueField : 'strGenre',
- //mode: 'local',
- //typeAhead: true,
- name: 'genre',
- XBMCName: 'idGenre'
- },{
- xtype: 'combo',
- fieldLabel: 'artist',
- store: ArtistStore,
- id: 'albumartistfield',
- displayField: 'artist',
- valueField : 'artistid',
- //mode: 'local',
- //typeAhead: true,
- name: 'strArtist',
- XBMCName: 'idArtist'
- },{
- fieldLabel: 'Year',
- id: 'albumyearfield',
- name: 'year',
- XBMCName: 'iYear'
-
- }]
-});
-
-var extraInfo = new Ext.FormPanel({
- title:'Additional Info (from scraper)',
- layout: 'form',
- trackResetOnLoad : true,
- frame:true,
- height: 368,
- width: 280,
- id: 'albumscraperdetails',
- labelWidth: 60,
- defaults: { xtype:'textfield',
- width: 170,
- enableKeyEvents: true,
- //listeners:{'change' : function(){DetailsFlag = true; Ext.getCmp('savebutton').enable()}}
- listeners : {
- 'keyup': function (txt, newValue, oldValue) {
- Ext.getCmp('savebutton').enable();
- },
- buffer: 100
- }
- },
- rowspan: 2,
- items:[{
- fieldLabel: 'Genre',
- name: 'strGenreScraper',
- readOnly : true
- },{
- fieldLabel: 'Year',
- name: 'iYearScraper',
- //id: 'scraperyear',
- readOnly : true
- },{
- fieldLabel: 'Rating',
- id: 'albumratingfield',
- name: 'rating',
- XBMCName: 'iRating'
- },{
- fieldLabel: 'Type',
- id : 'scrapertype',
- name: 'type',
- XBMCName: 'strType'
- },{
- fieldLabel: 'Label',
- id : 'scraperlabel',
- name: 'albumlabel',
- XBMCName: 'strLabel'
- },{
- xtype:'textarea',
- height: 47,
- fieldLabel: 'Extra Genre',
- id : 'scraperextgenre',
- name: 'strExtraGenres',
- XBMCName: 'strExtraGenres'
- },{
- xtype:'textarea',
- height: 47,
- fieldLabel: 'Styles',
- id : 'scraperstyles',
- name: 'style',
- XBMCName: 'strStyles'
- },{
- xtype:'textarea',
- height: 47,
- fieldLabel: 'Moods',
- id : 'scrapermoods',
- name: 'mood',
- XBMCName: 'strMoods'
- },{
- xtype:'textarea',
- height: 47,
- fieldLabel: 'Themes',
- id : 'scraperthemes',
- name: 'theme',
- XBMCName: 'strThemes'
- }]
-});
-
-var albumDescription = new Ext.FormPanel({
- title:'Description',
- layout: 'form',
- trackResetOnLoad : true,
- labelWidth: 6,
- buttons: [{
- disabled: true,
- text:'Save',
- id: 'savebutton',
- handler: function(){
- updateMusicAlbum();
- //storeMovie.reload();
- this.disable();
- }
- },{
- text:'Cancel',
- handler: function(){
- updateGenreGrid(currentRecord.data.genres);
- }
- }],
- width: 460,
- colspan:2,
- items: [{
- xtype:'textarea',
- name:'description',
- id: 'albumreviewfield',
- XBMCName: 'strReview',
- listeners:{'change' : function(){DetailsFlag = true; Ext.getCmp('savebutton').enable();}},
- height: 105,
- width: 430
- }]
-});
-
-var albumDetailPanel = new Ext.Panel({
- region: 'north',
- width: 740,
- id: 'albumDetailPanel',
- trackResetOnLoad: true,
- title: 'Select Album
',
- defaults:{frame:true},
- layout:'table',
- layoutConfig: {columns:3},
- items:[{
- width:190,
- items: [AlbumStars, AlbumCover]
- },
- standardInfo,
- extraInfo,
- albumDescription
- ]
-});
-
-// ------------ Track information -------------
-
-function convertTime(val) {
-
- var minutes = Math.floor(val / 60);
- var seconds = val - minutes*60;
- if (seconds < 10) seconds = '0'+seconds;
- if (minutes < 10) minutes = '0'+minutes;
- return minutes+':'+seconds;
-}
-
-function starRating(val) {
- return ' ';
-}
-
-var SongcolModel = new Ext.grid.ColumnModel([
- {header: '#', dataIndex: 'songid', hidden: true},
- {header: '#', dataIndex: 'track', width: 30},
- {header: 'Track', dataIndex: 'strTitle', width: 300},
- {header: 'Duration', dataIndex: 'duration', width: 70, renderer: convertTime},
- //{header: 'Rating', dataIndex: 'rating', width: 100, renderer: starRating} bug with JSON-RPC
- ]);
-
-var SongRecord = Ext.data.Record.create([
- {name: 'songid'},
- {name: 'strTitle', mapping: 'label'},
- {name: 'track', type: 'int'},
- {name: 'duration'}
- //{name: 'iYear', mapping: 'field:nth(5)'},
- //{name: 'strFileName', mapping: 'field:nth(6)'},
- //{name: 'rating', mapping: 'field:nth(7)'},
- // {name: 'idAlbum', mapping: 'field:nth(8)'},
- // {name: 'strAlbum', mapping: 'field:nth(9)'},
- // {name: 'strPath', mapping: 'field:nth(10)'},
- // {name: 'idArtist', mapping: 'field:nth(11)'},
- // {name: 'strArtist', mapping: 'field:nth(12)'},
- // {name: 'idGenre', mapping: 'field:nth(13)'},
- // {name: 'strGenre', mapping: 'field:nth(14)'},
-]);
-
-var SongStore = new Ext.data.Store({
- sortInfo: {field: 'track', direction: 'ASC'},
- proxy: new Ext.data.XBMCProxy({
- url: '/jsonrpc',
- }),
- reader: new Ext.data.JsonReader({
- root: 'result.songs',
- }, SongRecord)
-});
-
-
-SongGrid = new Ext.grid.GridPanel({
- cm: SongcolModel,
- title: 'Album Tracks
',
- region: 'center',
- id: 'Moviegrid',
- loadMask: true,
- frame: 'true',
- enableDragDrop: false,
- stripeRows: true,
- viewconfig: {forceFit: true},
- selModel: new Ext.grid.RowSelectionModel({singleSelect: true}),
- width: 740,
- height: 230,
- split: true,
- store: SongStore
-
-});
-
-
-Ext.onReady(function() {
-
- menuBar.add({
- xtype: 'tbbutton',
- text: 'Tools',
- menu: [
- {
- text: 'Scan Library',
- iconCls: 'silk-plugin',
- handler: function() {
- XWMM.audio.scanLibrary();
- Ext.MessageBox.alert(
- 'Scan Library',
- 'A library scan has begun.'
- );
- }
- },
- {
- text: 'Clean Library',
- iconCls: 'silk-plugin',
- handler: function() {
- XWMM.audio.cleanLibrary();
- Ext.MessageBox.alert(
- 'Clean Library',
- 'The library is being cleaned.'
- );
- }
- },
- {
- text: 'Manage Genres',
- disabled: 'true',
- iconCls: 'silk-plugin',
- handler: function(){winGenre.show();}
- }]
- },{
- text: 'Quicksearch:',
- tooltip: 'Quickly search through the grid.'
- },{
- xtype: 'text',
- tag: 'input',
- id: 'quicksearch',
- size: 30,
- value: '',
- style: 'background: #F0F0F9;'
- });
-
- menuBar.add({
- text: 'X',
- tooltip: 'Clear quicksearch',
- handler: function() {
- if (searchBox.getValue().length!==0) {
- searchBox.setValue('');
- ArtistStore.clearFilter();
- }
- }
- });
-
- menuBar.add({
- xtype: 'tbfill'
- },{
- text: myVersion
- });
-
- //Start Application with Main Panel
- var App = new Audio.Mainpanel({
- renderTo: Ext.getBody()
- });
-
- ArtistStore.load();
-
- // We can retrieve a reference to the data store
- // via the StoreMgr by its storeId
- Ext.QuickTips.init();
-
- // begin search config
- var searchStore = new Ext.data.SimpleStore({
- fields: ['query'],
- data: []
- });
- var searchBox = new Ext.form.ComboBox({
- store: searchStore,
- displayField: 'query',
- typeAhead: false,
- mode: 'local',
- triggerAction: 'all',
- applyTo: 'quicksearch',
- hideTrigger: true
- });
-
- var searchRec = Ext.data.Record.create([
- {name: 'query', type: 'string'}
- ]);
-
-
- var onFilteringBeforeQuery = function(e) {
- //grid.getSelectionModel().clearSelections();
- if (this.getValue().length===0) {
- ArtistStore.clearFilter();
- } else {
- var strSearch = this.getValue().replace(/^\s+|\s+$/g, '');
- if (strSearch==='')
- return;
- AlbumStore.filterBy(function(r, id) {
- var regex = RegExp(strSearch, 'i');
- return regex.test(String(r.get('strAlbum'))) || regex.test(String(r.get('strArtist')));
- });
- }
- };
- var onQuickSearchBeforeQuery = function(e) {
- if (this.getValue().length===0) {
- } else {
- var value = this.getValue().replace(/^\s+|\s+$/g, '');
- if (value==='')
- return;
- searchStore.clearFilter();
- var vr_insert = true;
- searchStore.each(function(r) {
- if (r.data.query.indexOf(value)===0) {
- // backspace
- vr_insert = false;
- return false;
- } else if (value.indexOf(r.data.query)===0) {
- // forward typing
- searchStore.remove(r);
- }
- });
- if (vr_insert===true) {
- searchStore.each(function(r) {
- if (r.data.query===value) {
- vr_insert = false;
- }
- });
- }
- if (vr_insert===true) {
- var vr = new searchRec({query: value});
- searchStore.insert(0, vr);
- }
- var ss_max = 4; // max 5 query history, starts counting from 0; 0==1,1==2,2==3,etc
- if (searchStore.getCount()>ss_max) {
- var ssc = searchStore.getCount();
- var overflow = searchStore.getRange(ssc-(ssc-ss_max), ssc);
- for (var i=0; i .
*/
-var AlbumRecord = Ext.data.Record.create([
- {name: 'albumid'},
- {name: 'strAlbum', mapping:'label'},
- {name: 'strArtist', mapping:'artist'},
- {name: 'strGenre', mapping:'genre'},
- {name: 'year'}, {name: 'currentThumbnail', mapping:'thumbnail'}
-]);
-
-var AlbumStore = new Ext.data.GroupingStore({
- sortInfo: {field: 'strAlbum', direction: 'ASC'},
- autoLoad: true,
- groupField: 'year',
- proxy: new Ext.data.XBMCProxy({
- jsonData : {'jsonrpc': '2.0', 'method': 'AudioLibrary.GetAlbums', 'params': {'properties': ['genre', 'artist', 'year', 'thumbnail']},'id': 1}
- }),
- reader: new Ext.data.JsonReader({
- root:'result.albums'
- }, AlbumRecord)
-});
-
-var AlbumcolModel = new Ext.grid.ColumnModel([
- {header: '#', dataIndex: 'albumid', hidden: true},
- {header: 'Album', dataIndex: 'strAlbum', width: 150},
- {header: 'Artist', dataIndex: 'strArtist', hidden: true},
- {header: 'Genre', dataIndex: 'strGenre', hidden: true},
- {header: 'Year', dataIndex: 'year', hidden: true}
- ]);
-
-AlbumGrid = new Ext.grid.GridPanel({
- cm: AlbumcolModel,
- id: 'albumGrid',
- enableDragDrop: false,
- stripeRows: true,
- viewconfig: {forceFit: true},
- view: new Ext.grid.GroupingView({
- forceFit:true,
- width: 260,
- startCollapsed: true,
- showGroupName : false,
- // enableGrouping: false,
- enableGroupingMenu : true,
- //enableNoGroups: false,
- groupTextTpl: '{text} '}),
- selModel: new Ext.grid.RowSelectionModel({singleSelect: true}),
- region: 'west',
- width: 260,
- split: true,
- store: AlbumStore
-
-});
+Ext.getCmp('albumGrid').getStore().groupBy('year');
diff --git a/view/music-by-artist.html b/view/music-by-artist.html
index be10b56..8982172 100644
--- a/view/music-by-artist.html
+++ b/view/music-by-artist.html
@@ -1,12 +1,19 @@
- WIMM Music Management
-
-
-
-
-
-
+ WIMM Music
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -16,15 +23,17 @@
+
+
-
-
-
+
+
+
diff --git a/view/music-by-genre.html b/view/music-by-genre.html
index a082bc3..c03bef1 100644
--- a/view/music-by-genre.html
+++ b/view/music-by-genre.html
@@ -1,12 +1,19 @@
- WIMM Music Management
-
-
-
-
-
-
+ WIMM Music
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -16,15 +23,17 @@
+
+
-
-
-
+
+
+
diff --git a/view/music-by-year.html b/view/music-by-year.html
index 2715271..329f4cc 100644
--- a/view/music-by-year.html
+++ b/view/music-by-year.html
@@ -1,12 +1,19 @@
- WIMM Music Management
-
-
-
-
-
-
+ WIMM Music
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -16,15 +23,17 @@
+
+
-
-
-
+
+
+