|  |  | @ -21,6 +21,8 @@ define([ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		constructor:	function(attributes, options) { |  |  |  | 		constructor:	function(attributes, options) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			_.bindAll(this |  |  |  | 			_.bindAll(this | 
			
		
	
		
		
			
				
					
					|  |  |  | 				, "setAuth" |  |  |  | 				, "setAuth" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				, "setState" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				, "getState" | 
			
		
	
		
		
			
				
					
					|  |  |  | 				, "init" |  |  |  | 				, "init" | 
			
		
	
		
		
			
				
					
					|  |  |  | 				, "deinit" |  |  |  | 				, "deinit" | 
			
		
	
		
		
			
				
					
					|  |  |  | 				, "logout" |  |  |  | 				, "logout" | 
			
		
	
	
		
		
			
				
					|  |  | @ -69,10 +71,30 @@ define([ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		, setState:		function (state) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			if (_.isNumber(state)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				this.trigger("state", this, state); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				return this.state	= state; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} else if (_.isString(state) && !_.isUndefined(this._states[state])) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				this.trigger("state", this, this._states[state]); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				return this.state	= this._states[state]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			return undefined; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		, getState:		function () { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			return this.state; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		, init:			function () { |  |  |  | 		, init:			function () { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			var that	= this |  |  |  | 			var that	= this | 
			
		
	
		
		
			
				
					
					|  |  |  | 			; |  |  |  | 			; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			this.setState("connecting"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			console.debug("Fetching content types"); |  |  |  | 			console.debug("Fetching content types"); | 
			
		
	
		
		
			
				
					
					|  |  |  | 			that.fetchContentTypes(function __fnClientCbFetchContentTypes(contentTypes) { |  |  |  | 			that.fetchContentTypes(function __fnClientCbFetchContentTypes(contentTypes) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				console.debug("Fetching server info"); |  |  |  | 				console.debug("Fetching server info"); | 
			
		
	
	
		
		
			
				
					|  |  | @ -94,6 +116,7 @@ define([ | 
			
		
	
		
		
			
				
					
					|  |  |  | 											//that.fetchArtists(function () {
 |  |  |  | 											//that.fetchArtists(function () {
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 												//console.debug("Fetching albums of db 1");
 |  |  |  | 												//console.debug("Fetching albums of db 1");
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 												//that.fetchAlbums(function () {
 |  |  |  | 												//that.fetchAlbums(function () {
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 													that.setState("connected"); | 
			
		
	
		
		
			
				
					
					|  |  |  | 													that.trigger("inited", serverInfo); |  |  |  | 													that.trigger("inited", serverInfo); | 
			
		
	
		
		
			
				
					
					|  |  |  | 												//});
 |  |  |  | 												//});
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 											//});
 |  |  |  | 											//});
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -195,11 +218,15 @@ define([ | 
			
		
	
		
		
			
				
					
					|  |  |  | 			try { |  |  |  | 			try { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				xhr.onerror		= function () {console.log("Error", arguments, this);}; |  |  |  | 				xhr.onerror		= function () {console.log("Error", arguments, this);}; | 
			
		
	
		
		
			
				
					
					|  |  |  | 				xhr.onabort		= function () {console.log("Abort", arguments, this);}; |  |  |  | 				xhr.onabort		= function () {console.log("Abort", arguments, this);}; | 
			
		
	
		
		
			
				
					
					|  |  |  | 				xhr.ontimeout	= function () {console.log("Timeout", arguments, this);}; |  |  |  | 				xhr.ontimeout	= function () { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					that.setState("timedout"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				}; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 				xhr.onload		= function (e) { |  |  |  | 				xhr.onload		= function (e) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 					if (this.status === 200) { |  |  |  | 					if (this.status === 200) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 						callback(null, this.response); |  |  |  | 						callback(null, this.response); | 
			
		
	
		
		
			
				
					
					|  |  |  | 					} else if (this.status === 401) { |  |  |  | 					} else if (this.status === 401) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 						that.setState("unauthorized"); | 
			
		
	
		
		
			
				
					
					|  |  |  | 						that.trigger("unauthorized", [this, e]); |  |  |  | 						that.trigger("unauthorized", [this, e]); | 
			
		
	
		
		
			
				
					
					|  |  |  | 					} else { |  |  |  | 					} else { | 
			
		
	
		
		
			
				
					
					|  |  |  | 						callback(e.status); |  |  |  | 						callback(e.status); | 
			
		
	
	
		
		
			
				
					|  |  | @ -428,15 +455,16 @@ define([ | 
			
		
	
		
		
			
				
					
					|  |  |  | 				, password:		"" |  |  |  | 				, password:		"" | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			, status:			0 |  |  |  | 			, state:			0 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			, statusCodes:	{ |  |  |  | 			, _states:	{ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				disconnected:	0 |  |  |  | 				disconnected:	0 | 
			
		
	
		
		
			
				
					
					|  |  |  | 				, connecting:	1 |  |  |  | 				, timedout:		1 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				, timedout:		2 |  |  |  | 				, connecting:	2 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				, unauthorized:	3 |  |  |  | 				, unauthorized:	3 | 
			
		
	
		
		
			
				
					
					|  |  |  | 				, connected:	4 |  |  |  | 				, connected:	4 | 
			
		
	
		
		
			
				
					
					|  |  |  | 				, loaded:		5 |  |  |  | 				, loading:		5 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				, loaded:		6 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			, collections:	{ |  |  |  | 			, collections:	{ | 
			
		
	
	
		
		
			
				
					|  |  | 
 |