Jump to content

Grooveshark


Zimmer

Recommended Posts

  • Replies 199
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

What do you mean referrers to JSON. Yes it does use JSON (JavaScript object notation). Also I can conceive the use of a live CD (for forensic and other times where you can't touch any part of the hard drive) but for Grooveshark, why would you want that? It seems that it is not only me that is confused by your wanting of a Live CD. This application is portable. Just set the save directory to some where on your usb thumb drive and it won't touch the hard drive. Of course you seems to be insulted that I don't understand your extreme need for a Live CD, but your unwillingness to either start a thread and work on it or to even explain the usefulness of a Live CD enviroment over say, using this app on a thumb drive.

So please explain why a live cd would be so much better and why it is better then other methods ok I have mentioned

Link to comment
Share on other sites

The LiveCD which i mentioned can write to Hard-Drives, i don't

know why you must insist that it's not meant to but, obviously,

we won't reach an agreement here. I've discussed the reason

why i favour the LiveCD approach years ago, i haven't visited

any on-line radio with any "time-shifting" tool for ages but i'm

still convinced there's nothing more portable than a LiveCD, as

proof i've given your approach a try and failed right at the start

because of the missing bells & whistles, of course, and i'll bet i

won't be the last.

Link to comment
Share on other sites

Portable is not what a Live CD is meant for. Live CD are meant for trying a OS out (like ubuntu) or for a place where you can't touch the hard drive (forensics) and sometimes for your own environment. You say it is the most portable. It isn't instead of burning a CD and make sure it all works etc etc you could compile a EXE version of this and then copy it to a USB thumb drive and be done.

Link to comment
Share on other sites

Portable is not what a Live CD is meant for. Live CD are meant for trying a OS out (like ubuntu) or for a place where you can't touch the hard drive (forensics) and sometimes for your own environment. You say it is the most portable. It isn't instead of burning a CD and make sure it all works etc etc you could compile a EXE version of this and then copy it to a USB thumb drive and be done.

Good to see someone agrees this is what livecds are for [not saving music].

Link to comment
Share on other sites

gnounc what does the console say (if you can't see it then open a console window and cd to the directory and run python Grooveshark_Gui.py)

also make sure you have httplib2 and python installed too (see the first post for details)

Link to comment
Share on other sites

A LiveCD implements the ultimate level of portability, if

you don't like that there's nothing to discuss any further.

Ultimate level of portability is a laptop, with 3g, and a hand crank generator :P

It's even harder to use a livecd outside of home/environs you control because most machines are locked down in some way or another. As zimmer said, you're more likely to be able to use an app on a flash drive than boot a livecd.

Hmm, a pandora client in javascript. Now that would be sweet. Not like it's hard... box some player (quicktime, win media?) in an iframe, and make requests to pandora. Put an object in the iframe with the url and provide a play/pause button and volume. And/or download the file (though, would not be tagged). Too bad xmlhttperequest is crippled so one would need to host it on a server. And the whole :js: bit. Hmm, this would also utterly break pandora's anti-euro check.

It wouldn't be hard to do it on a personal server either. Php script to do to cryto shit (could also call a c app) hell it could even do the xmlrpcs... just set headers so it looks like the request was forwarded through a proxy. parse the xml and return only the necessary data in json or what not... dammit now i've got to try it for shits and giggles

Link to comment
Share on other sites

zigzagjoe I have the blowfish stuff in js I'll post it..

js

/*
 JavaScript encryption module ver. 2.0 by Daniel Rench

 Based on existing code:
 Copyright © 2003 by Andre Mueller.
 Init of blowfish constants with a function (init/backup errors)
 Copyright © 2003 by Rainer Wollmann
 This Object is open source. You can redistribute it and/or modify
 it under the terms of the Universal General Public License (UGPL).
http://www.ugpl.de/
*/
function Blowfish(k){
	if (k.length==0) throw "0 length key";
	this.bf_P=this.Fbf_P();
	this.bf_S0=this.Fbf_S0();
	this.bf_S1=this.Fbf_S1();
	this.bf_S2=this.Fbf_S2();
	this.bf_S3=this.Fbf_S3();
	this.escape=function(t){
		var r='';
		for(var i=0;i<t.length;i++){
			var c=t.charCodeAt(i);
			var t1=Math.floor(c/16);
			var t2=c%16;
			if (t1<10) t1+=48;
			else t1+=55;
			if (t2<10) t2+=48;
			else t2+=55;
			r+=String.fromCharCode(t1)+String.fromCharCode(t2);
		}
		return r;
	};
	this.wordbyte0=function(w){return Math.floor(Math.floor(Math.floor(w/256)/256)/256)%256};
	this.wordbyte1=function(w){return Math.floor(Math.floor(w/256)/256)%256};
	this.wordbyte2=function(w){return Math.floor(w/256)%256};
	this.wordbyte3=function(w){return w%256};
	this.xor=function(w1,w2){var r=w1^w2;if (r<0) r=0xffffffff+1+r; return r};
	this.key=(k.length>56)?k.substr(0,56):k;
	var j=0;
	for(var i=0;i<18;++i){
		var d=((this.key.charCodeAt(j%this.key.length)*256+this.key.charCodeAt((j+1)%this.key.length))*256+this.key.charCodeAt((j+2)%this.key.length))*256+this.key.charCodeAt((j+3)%this.key.length);
		this.bf_P[i]=this.xor(this.bf_P[i],d);
		j=(j+4)%this.key.length;
	}
	this.key=this.escape(this.key);
	this.xl_par=0x00000000;
	this.xr_par=0x00000000;
	for(var i=0;i<18;i+=2){
		this.encipher();
		this.bf_P[i]=this.xl_par;
		this.bf_P[i+1]=this.xr_par;
	}
	for(j=0;j<256;j+=2){
		this.encipher();
		this.bf_S0[j]=this.xl_par;
		this.bf_S0[j+1]=this.xr_par;
	}
	for(j=0;j<256;j+=2){
		this.encipher();
		this.bf_S1[j]=this.xl_par;
		this.bf_S1[j+1]=this.xr_par;
	}
	for(j=0;j<256;j+=2){
		this.encipher();
		this.bf_S2[j]=this.xl_par;
		this.bf_S2[j+1]=this.xr_par;
	}
	for (j=0;j<256;j+=2){
		this.encipher();
		this.bf_S3[j]=this.xl_par;
		this.bf_S3[j+1]=this.xr_par;
	}
	this.unescape=function(t){
		var r='';
		for(i=0;i<t.length;i++){
			var t1=t.charCodeAt(i++);
			var t2=t.charCodeAt(i);
			if (t1<58) t1-=48;
			else {
				if (t1>96) t1-=87;
				else t1-=55;
			}
			if (t2<58) t2-=48;
			else {
				if (t2>96) t2-=87;
				else t2-=55;
			}
			r+=String.fromCharCode(t1*16+t2);
		}
		return r;
	};
}
Blowfish.prototype.Fbf_P=function(){return [
0xc10590ec,
0xba979ee1,
0x4eee520,
0x759c8c59,
0x22804ba7,
0x7c46eb7a,
0x21acf684,
0xb9a7b8e7,
0xbeed610a,
0xdb325139,
0xdf84ad90,
0x31fb85c8,
0xa5468088,
0x7241bc17,
0xd6e88a88,
0xa375f4a4,
0x223bf5ef,
0xeda2cdb5,
];};
Blowfish.prototype.Fbf_S0=function(){return [
0x9654c859,
0x909bc929,
0x6c13ea8e,
0xfb78c4f8,
0xa1dd8c99,
0x9c04168a,
0x2a43d4a9,
0x52be439b,
0x10040365,
0x422c267d,
0x5210312e,
0xad6d8ec,
0x14814e6f,
0xab8a7e9f,
0x981a1dba,
0x6c7ec03d,
0xa4dbeb04,
0x1bec8694,
0x30fdf157,
0x5c903dd3,
0xfec8d421,
0x32949bee,
0x89c0351,
0xf678350,
0xd71deb51,
0x3dc9f297,
0xd0ad6f45,
0x909cb0e,
0x37ee1700,
0xf1522308,
0x7a117a9a,
0x21606dde,
0xf69ed07,
0x1d2a8fe0,
0xef95f5ad,
0xa1f8c13c,
0x10480d0d,
0x2b1914be,
0x19071638,
0xc75af34f,
0x65cabbb2,
0x4ca28f5e,
0xa6264839,
0x7623bea7,
0x24dfbda6,
0x7cfc1117,
0xdf916c8f,
0x6abf9e8f,
0x2c9e8f85,
0x3b9ecf6,
0x39cffd8f,
0x302a0460,
0xe28543c0,
0x37ea897b,
0x36e025e3,
0xd4620943,
0x4f5ca829,
0x8f33310f,
0x730f4503,
0x8052db67,
0x2e0b8a1d,
0x91195ffb,
0x2a49b357,
0x3578d2ec,
0x8f2bc8ce,
0x197d2ed1,
0xbb5b1b11,
0x3b02f424,
0x8de5d13a,
0x2f4c7f70,
0xe66ab0cf,
0xdf93c57b,
0x48b52549,
0x735cb3fc,
0x6fa34c40,
0xeabd8238,
0xd5fb57d5,
0xb574befa,
0x7af7d0e9,
0x30d82d91,
0x3dc52795,
0x9a66f1c5,
0x1014d6d7,
0x1619b896,
0xa465e2d6,
0xdef33ed,
0x213bb77d,
0x65b1a904,
0x964751b0,
0x5335c857,
0xf72060e0,
0x579458db,
0xa33556fe,
0x8d41dd66,
0x7165d4f8,
0x261d183e,
0xd55ff261,
0xbfc3852b,
0xeb4050c3,
0xf500fc86,
0x19e25b41,
0x5a366b1a,
0xdebcb9ac,
0xf3e2d6d0,
0x4de3ee3a,
0x2579418d,
0xe94c1bc9,
0x39abd007,
0xeebf9405,
0x3e091753,
0x8757a7e7,
0x66456984,
0xe1ad1e6b,
0xc76a1b8,
0xdfbfa09e,
0x67431807,
0x9b8e1496,
0x38fde39,
0xa9656ff5,
0x48a6c2f9,
0x2a531f33,
0xe6213074,
0xe1e98733,
0x42bece69,
0xd1f77ad7,
0xc8ee6c6c,
0x221f337f,
0x37d93ce7,
0x94e6954f,
0x98557669,
0xb78adea9,
0xc97db869,
0x99bb9ff9,
0x7b245a04,
0xb56e2f44,
0x6de4945e,
0xd5c550e9,
0xe2406878,
0x9178bec4,
0xa1ceef70,
0x6a543d9b,
0x5df98e33,
0x1801a7b3,
0x1e9b8c86,
0x5501fbe1,
0xc7e53071,
0x94855ad1,
0x550e1997,
0x260c8e5a,
0xa40f1e26,
0x55cde2b4,
0x55c7850c,
0x5a6fc9d3,
0x8ed207bf,
0x3ba77dfe,
0x2505ded6,
0xcf49779,
0x57f557c6,
0x59474010,
0x638ba8a2,
0x4d82f6eb,
0x677d6829,
0x44c2cfc1,
0xd2c006a7,
0x21d5be8e,
0x5d8442d1,
0x6174f23f,
0xe2aa0ef3,
0x54328e77,
0x46a7983,
0x6523470b,
0x2cccdb19,
0x6683aba1,
0x191b22a4,
0x53131029,
0x1be73145,
0x27c1f557,
0xa819bda8,
0x3e47b139,
0xbe3c46ac,
0x42c59203,
0x92c6fd74,
0x491aa43a,
0x1ad367c3,
0x628a99c8,
0x3051e88e,
0x67c54a0d,
0xaa278070,
0x35776a31,
0x97557de3,
0x4b84e68f,
0x187a039f,
0xfd0db4bc,
0xf4c4286,
0xba4f54fc,
0xcbbc90c3,
0xf269800,
0xb78ec21b,
0x1c97fe3a,
0xa808792c,
0x7b658426,
0x81590c6c,
0xc7890561,
0x8a07080e,
0x9d99e5e4,
0xc3929bc4,
0x31e5d06a,
0x97a82a07,
0xc7a53a0e,
0x68596faf,
0x2f8d609,
0x14e256eb,
0xffe202e1,
0xfb13e18f,
0x21b1db15,
0x354080d6,
0x777fed00,
0xe6c89dc5,
0x711a18f6,
0x40c8e33b,
0x709e7e2d,
0x359c6507,
0x56cb9f2c,
0x92b8a949,
0x87e360f2,
0xc19ccb2e,
0x623b905c,
0x19f36d0,
0x7ae0ec6b,
0x2c903f89,
0xdb621170,
0x2ef6b8c6,
0x6656ba25,
0xf915180c,
0xcdee1bd7,
0x85e38edb,
0x7a9ac026,
0xca917632,
0xfcfddc64,
0x5c3a7d51,
0x71da7223,
0xa8d48e72,
0x2a3ba8e0,
0x710919d3,
0xab50a080,
0xd6228237,
0xb41b7a76,
0xd82b39f5,
0x1e922c3f,
0x6656d136,
0x4a8473a7,
0xa82aee63,
0xdf451c42,
0x62e2ae0e,
0xeca484f3,
0x1ebf64b5,
];};
Blowfish.prototype.Fbf_S1=function(){return [0xf5cf4fef,
0xa6eaedc5,
0x3e59980d,
0xc8f3911c,
0x9490f545,
0x53579eb,
0x5645e167,
0x2015a54b,
0xea2f52d0,
0xbb28b315,
0x1b907ef4,
0x9c841317,
0xd03f498f,
0x57045c47,
0x992d554d,
0x9d801a54,
0x1638d6b3,
0x88c1854,
0xa74d1549,
0xfd2b5787,
0xfbe12709,
0x432bb66,
0x880bcd01,
0xb9065d9e,
0x1c2fb7b5,
0xd27da333,
0x8a3d4436,
0x7310f49e,
0x128be54f,
0x772b8a37,
0x55579a3c,
0xbc75f552,
0x38eb2e19,
0x7c356617,
0x1de8d4c2,
0xd0e43cdf,
0xd46044dd,
0x252685ef,
0x24051ee5,
0x5b6bd82e,
0x495b6f47,
0x39e52934,
0x31b81cdd,
0x1487d6,
0xc2b8b92b,
0x8b8a0f1b,
0xdb763075,
0xe8fc685f,
0x9c3bd739,
0x60e6a1fc,
0xb628a9a6,
0xcd27caa,
0x950a56f4,
0x88691d4e,
0xfcb51d66,
0xdeb6d9b1,
0xb25625f6,
0x75c1d492,
0x36d4a98c,
0x9c5ac60d,
0xf2ad970b,
0x7e096239,
0x6c5d1c4e,
0x440bef8,
0x2855e769,
0x35442feb,
0x525d6f15,
0xa0d85345,
0x14ac130f,
0x640b6db5,
0x15ff503e,
0x7375b927,
0x48ce4829,
0xeedef8e8,
0x223ad535,
0xfa97618c,
0xda086cc5,
0xa9020e63,
0x89a828ff,
0x757f0bfd,
0xead8e38f,
0x864e3f9,
0xeff82819,
0xd7de2bad,
0x2183d925,
0x1c10ea2b,
0xd4405fb2,
0x24562242,
0xb56178f8,
0xd1682bbf,
0xcde0ff93,
0xb135f2c6,
0x6e95f144,
0x215484a8,
0xb335ada4,
0x10752b,
0xe7126eb1,
0x2f30aa95,
0x73c04d5b,
0xebf14789,
0x5be0ff05,
0xb2c3129f,
0x6d115378,
0x8a0c4623,
0xe716afeb,
0x6b3f36c0,
0x71d23f25,
0xdef919a5,
0x9b1cc604,
0x4e708139,
0x1d206bf9,
0x8c9c2be3,
0xac43a8f3,
0xcfb11067,
0xf741b5e,
0x1ea6c0f3,
0x86d5cc7e,
0x21189475,
0x88e9460,
0x6f91d8ab,
0x2d8c61c5,
0x45360e78,
0xe4a226d5,
0x5c769ab6,
0x2b67a136,
0x6f8adf6f,
0xade04340,
0x55fe66db,
0xc334ef8a,
0x61460c50,
0x8da1ff40,
0x75824980,
0x721fefc9,
0x948c22ba,
0x661e3c96,
0xfc1cdee7,
0x4c6c3abe,
0x67f1a2f5,
0xe5ea0ccb,
0xb58e9977,
0x13a78f94,
0x32921073,
0xa9bee311,
0x5b9d7ca1,
0x8681d048,
0x43e439b2,
0x4e80b689,
0x6a9b1125,
0x268e3fab,
0xf39e12f7,
0xeec77123,
0xd7b98ade,
0xb525de74,
0xd067f1d7,
0x5b341ade,
0xc16e27bc,
0xb61bc08e,
0xe8a0856,
0x8318dc09,
0x9c02b9db,
0xc6734b93,
0x8c1cdb58,
0xf729a76d,
0x71288bc1,
0x7d4685d0,
0xcca95f1,
0xfcdb8b5d,
0xde1eb92b,
0xe6cc8bc2,
0xc78d5b70,
0xd73387e8,
0x5676050a,
0x71d0c54,
0x4ed3ed2,
0x3ff4ecf5,
0x971ef95d,
0x367d0085,
0x633e3555,
0x78a90717,
0xd52d7bd6,
0x81f57041,
0x3ccef4af,
0x5a2ecfe9,
0x19b81054,
0x837c3482,
0x78db4bcb,
0xb7e7a2fc,
0xebc3ac19,
0x955eceec,
0x9af50f17,
0x4c62335,
0xd548a8c,
0x174d4064,
0x5801584f,
0x1c16e012,
0xcd1742c1,
0x97a4e3b1,
0x4df37c91,
0x4169a93a,
0x9b726c3b,
0x886d38cf,
0x1062ddf,
0x45b14b7,
0xf4a333b8,
0x64f0981b,
0x17a139c8,
0x660678f8,
0x3268cec7,
0xf60a6dac,
0x98c455df,
0x493bffa5,
0x927c471,
0x1523d52d,
0x32aca049,
0x9d59f95,
0x82b8d198,
0x66e92cb0,
0x268ef78,
0x9ccb850a,
0x6aaabed7,
0xc2d7f5f3,
0x1e4c4e8,
0x5fdb4266,
0xd83a3752,
0x9ca64941,
0x3f2f3efa,
0x2077cbbf,
0x4b046864,
0x33c040e9,
0xb17a057f,
0xc2cebf84,
0x92a3d3b3,
0x3b803fc2,
0x2fbaacf5,
0xcd08a0a7,
0xa61efac3,
0x369f85ae,
0x9614009b,
0x1481932d,
0x279e2645,
0xdd2f2f91,
0xb5ab540d,
0x3edd7f22,
0xcb52391b,
0x72bc36bc,
0xabb56089,
0x89d31de7,
0x1d50eb1d,
0x651efe74,
0x9a0df7bb,
0x1db885d4,
0xc09f5259,
0xdede19fd,
0xd025eb3,
0x6152d5c,
0x85385375,
];};
Blowfish.prototype.Fbf_S2=function(){return [
0xc91d3a82,
0xc79228c4,
0x516d9b16,
0xeaf41822,
0xa82b1ee5,
0x92bbb1ba,
0xc97072c4,
0xaf2d626,
0xec9cc306,
0xea07f8f4,
0x773ca5d5,
0x7986d9d4,
0xb5aa732d,
0xf87c05c9,
0x84134310,
0x6b5a33b9,
0x44e87bc3,
0xcbf5050d,
0xec3c68be,
0x9ffb0e43,
0xad9b3bdd,
0x35ded40a,
0x2ad14001,
0x4ef5cfd1,
0x7d263782,
0x25f3a325,
0x8b9ebec,
0x330f6d68,
0xf9a5d1db,
0x5b3bdb94,
0x1d20f47,
0xa6b89829,
0x6d657c3c,
0x9d32c68a,
0x8a389ddc,
0xaf1a252,
0xb5e9cba5,
0x74ca996b,
0x59e7c040,
0xe23c06b8,
0x3b69ecda,
0x53bd1e12,
0xcd81d8f6,
0x71b998f3,
0xd6ca4414,
0x53b7355,
0x76eab1b4,
0x7dca92a1,
0x8d8cb7df,
0x44f26572,
0x50723790,
0xf4810d93,
0x93b1efbd,
0xe9ea4046,
0xe6e9a0ee,
0x187facae,
0xea333ca2,
0xd5e99bd0,
0x916b8543,
0x20752b5a,
0x6554e503,
0xaaa61ead,
0x36eeef1c,
0x70121ea8,
0xe6dc468,
0xab6799c3,
0xa8265566,
0xf736e100,
0x3e20313,
0xd8181980,
0xe6e24b96,
0xb21e489a,
0x5b3c553c,
0x23a49dd3,
0xafc418b6,
0xa807b571,
0xc3be8c15,
0xccdb14a4,
0x9c77e8d3,
0x1fced935,
0x25e82d1f,
0x7838ed17,
0xa57ba392,
0x28e97b23,
0x60941d05,
0x663afdd9,
0xd913fe52,
0x10b0e9c8,
0x1c090b6,
0x921e2c4d,
0x6bd9488c,
0x68e1429d,
0x2aa87e7b,
0xc8ba1070,
0xd66da3e0,
0xf66884f,
0x1648af43,
0xa239a8dc,
0xe4964ad0,
0x8068a066,
0x91e4408c,
0x321b7e0,
0x3f33a264,
0xb72cc578,
0x6c1c912e,
0xed757723,
0xc9fa20fc,
0x13cc343c,
0xe7056942,
0x19ce5761,
0x35ad4db2,
0xbc76d4b9,
0x68c59615,
0x723c3060,
0xf57c23bc,
0xe7d6bcad,
0xf46073,
0xb9127d8f,
0x44cad49a,
0x9a5d6b11,
0xe394a7f5,
0xeb3f968e,
0xcd7520e0,
0x1d9d8244,
0x555c55e9,
0x25da7bb1,
0x3affa7f4,
0x575debf,
0x55c48d52,
0x5adc4dd8,
0x2eb346eb,
0x671d6ad8,
0x2b128fd9,
0x9df0d831,
0xb6c6c94,
0x9166356e,
0xa702a705,
0xa3dd56c0,
0x31c990e4,
0x7c4e326,
0x4f058c61,
0xb4f45d31,
0x1f555f53,
0x269fb055,
0xb6852aca,
0x7879c55b,
0xf18a8256,
0x82e1e5a6,
0x16fcdbd6,
0x3c53ee12,
0x1ddaae76,
0x3b6df49e,
0x5b4cae04,
0xb2353a19,
0x3080f4b9,
0xf3040cd0,
0xb8492621,
0xdac10038,
0x5fa35637,
0xf5d9cf83,
0x1077d5c6,
0x213793e7,
0xa5395a0a,
0x728003e1,
0xd90c5f36,
0xc945adce,
0x73421f88,
0x694c1d59,
0xde84f347,
0x4eaf0ab7,
0x4d50a504,
0x43dafec9,
0x821829b9,
0x7f532504,
0x765f31e4,
0x21c07c08,
0xa3c0d55b,
0x5e7b542a,
0x8e5c6600,
0xfd12640b,
0xb7953ad1,
0x864a78fe,
0xde548e94,
0x8792b188,
0x9e29e5bc,
0xc0186398,
0x8a39da22,
0x8883f7e0,
0x4ee058b7,
0x412fdb69,
0x9ae59311,
0x2466223d,
0xfee86abd,
0x56ce7230,
0xcfec05f2,
0x47dcee78,
0x837a5d28,
0x6e9d94ee,
0xe04a5ad2,
0xc701696c,
0x8e9ad861,
0x432b3647,
0x251c48c7,
0x2504d178,
0x69702645,
0x986348bd,
0xd5bfb37c,
0x741b7248,
0x23ebb3ae,
0x2d522818,
0xad77f3ed,
0x68c547d0,
0x7ccca781,
0x8fa511dc,
0x3789cbb4,
0x98344aec,
0xa5e96dd4,
0xede3622b,
0x4e000f33,
0xbe4fd4d1,
0x588c6f9e,
0xbde284b9,
0x44643084,
0x518da9cb,
0xba7fcf3d,
0x1556ecb9,
0x10864fa2,
0x2ea6b94,
0xed02e932,
0x2c507c14,
0x329e9866,
0x79e1c795,
0xf63beb62,
0x1de7eb1e,
0x45107ad3,
0x77e2abfb,
0x526a6cd2,
0x5ba1946f,
0x3257d238,
0xfab2fb30,
0xd1983860,
0x9943ca36,
0x496d6bd3,
0xf22cf09b,
0xccec9071,
0x579fbdd0,
0xcb814591,
0xe6dffdbb,
0xbe16f8df,
0xa87c9a49,
0xe6536354,
0x512ade24,
0xb657e640,
0xaf938431,
0xedf03a94,
0x350cf9d0,
];};
Blowfish.prototype.Fbf_S3=function(){return [
0x832696c3,
0xc83e3f7c,
0xf7abfcd7,
0xb4c19d26,
0x8875c200,
0xc6bb64ca,
0xe1637c82,
0x67e46aae,
0x2d57a570,
0x633f6cee,
0xbc6f56ea,
0xc358274d,
0x8c481858,
0x2f8c3351,
0x92b1e9d9,
0xf860ac88,
0x24320781,
0xa5ddee92,
0x1f5bf31c,
0x6ed0ae60,
0xb285558,
0x6ec438c,
0x70e85a6b,
0xed439238,
0x4bfc6de6,
0x8fb8144b,
0xbf039af,
0xdb9abc52,
0x96ff2429,
0x392586f8,
0x2d1115e2,
0x8d866f1e,
0xca24a8ba,
0x51ef2664,
0x455b4eee,
0x5bbe3978,
0xc09a03a1,
0x65bd9f62,
0xddc17919,
0x70a8fdf4,
0xd5c3973d,
0x7e5be10d,
0xb0b8c4f8,
0x62f9d805,
0xd68535cf,
0x4b144c86,
0x24a11180,
0xc3a954fa,
0xfac22023,
0xcd7e8e6f,
0xd337d770,
0x56911e62,
0x8f774493,
0x6f9daceb,
0x60413828,
0xd3b99186,
0xbe8e60e9,
0xc9d4324e,
0x3e590d8f,
0xa6701d7e,
0xc7266e0c,
0x22be9a94,
0xec59f354,
0x5a5c408a,
0xdb19d3ba,
0xa5977a8d,
0xc8ffcac5,
0x56ee41d9,
0xc2f3173e,
0x6bb40320,
0x404653b6,
0x224cff01,
0x43934af1,
0x70254314,
0x712d7040,
0x1ed7b45e,
0x2f4da29f,
0xd0bd94a9,
0x10729cdb,
0xbea38fe7,
0xb41eb6f6,
0x36dc612a,
0x5ffecaa6,
0xa1a4588,
0x34494826,
0x9cf0b3c2,
0xcf5540af,
0xae8fdaca,
0x4595d88c,
0x2a04b6c7,
0xd3ca223c,
0xf098ba,
0x87bff1eb,
0xf21728e,
0x3a4cc2fb,
0x7646fb6f,
0x9287de8e,
0x5a22dbbc,
0x9ca788d0,
0x3955c8ec,
0xef65ad58,
0xed39cc0c,
0xa9bca738,
0x441df384,
0x69c63b0,
0xfc2e1295,
0xcbba6e89,
0x62e0484e,
0xa964a170,
0x80c8b564,
0xf0145f20,
0x585d6976,
0x8a6fecb4,
0x2b5b9bfd,
0xb41bd3cd,
0x4d26c783,
0xf2518446,
0xf8e2f546,
0x28e1ec7b,
0x5891bd6e,
0x6f37030f,
0x76f3f25d,
0x6ada036e,
0xed521d56,
0x8cef9f66,
0x776d4ed8,
0x7b9075be,
0x1c19328c,
0xbc82a9d5,
0x90a12333,
0xa73f84ae,
0xce8c0ee6,
0x6532882a,
0x54de205d,
0x8ab9342f,
0xe9164823,
0xa7ef738a,
0x2b09f3f3,
0x25cd2bab,
0xdc1ada2d,
0xabfe0427,
0xa996d8c4,
0x4ea32afd,
0xf9559f4e,
0x62ecb2ae,
0x63b27945,
0x3dddb6fa,
0xd0c864bb,
0x2b3b0259,
0xbc52392d,
0x5d7d8c93,
0xa42a7c17,
0x781dd59f,
0x32281898,
0x40304092,
0x31ca351b,
0xdbdd120d,
0xe97f8a7c,
0x4b08951f,
0x76158668,
0xd40a28e9,
0xb3ae8ea9,
0xe9f00efc,
0x8e8464d,
0x449faa32,
0xb6378741,
0xc928f6fa,
0xf776248c,
0x78c1e863,
0xf89a3e1c,
0xd931aca6,
0xc7ec5faa,
0xd3f2712d,
0x6b82e088,
0x54d5937,
0x1de35a13,
0x8805365a,
0x5c5f501b,
0x4da49154,
0xf2c4de1b,
0x3fb9a18d,
0x7e0d9f63,
0x852ddd24,
0xf08b2b10,
0x8a3f44fd,
0xf5a7b732,
0x5c2ef81e,
0x8223a0ff,
0x8aad1618,
0xc920d93f,
0x82e09782,
0xc640d537,
0xa8085a33,
0x562ce081,
0x1fbb19a2,
0xaa655fe1,
0x1302e190,
0x41cc80b0,
0x2c8013c0,
0xcbed39f,
0xe9b9178a,
0xe109e701,
0xb77382b7,
0x67cf3a6,
0xcb5a8e8d,
0xedeb42f8,
0x8de95c0f,
0x1ae6c13,
0xf90e2f8d,
0xaffed100,
0xb83ef6ce,
0x2c16d9ec,
0x8c9c016e,
0xcc191879,
0xc4d838eb,
0xa149b638,
0x2f5dacfb,
0x55cf002d,
0x89c3e05a,
0x727573b3,
0x3f20e481,
0xa3cbf5cd,
0xbf346fae,
0xbeec614b,
0x1e0661f3,
0xd27be7da,
0xdd416072,
0xb14bb755,
0x62023b9a,
0xdc3b40b3,
0x20b6cdf8,
0x272af7a1,
0xba8e98cb,
0xd55deb6c,
0x92c024f5,
0x2eb140dd,
0x1c2fd4da,
0x285f0494,
0x34ee1057,
0x9cc4d0fd,
0x8ba6a4a8,
0x37683654,
0x16161de8,
0xd59b4d73,
0xba3035f4,
0x2c290032,
0x8f44cba9,
0x77cc1c17,
0x46ad0eb6,
0xeb3bbfcc,
0x5ba5713c,
0x454afbc3,
0x189f5b99,
0x486e7084,
0xe217d683,
0x16164931,
];};
Blowfish.prototype.encrypt=function(t){
	var t=this.escape(t);
	for(var i=0;i<t.length%16;i++) t+='0';
	var r='';
	for(var i=0;i<t.length;i+=16){
		this.xr_par=this.wordunescape(t.substr(i,8));
		this.xl_par=this.wordunescape(t.substr(i+8,8));
		this.encipher();
		r+=this.wordescape(this.xr_par)+this.wordescape(this.xl_par);
	}
	return r;
};
Blowfish.prototype.decrypt=function(t){
	for(var i=0;i<t.length%16;i++) t+='0';
	var r='';
	for (var i=0;i<t.length;i+=16){
		this.xr_par=this.wordunescape(t.substr(i,8));
		this.xl_par=this.wordunescape(t.substr(i+8,8));
		this.decipher();
		r+=this.wordescape(this.xr_par)+this.wordescape(this.xl_par);
	}
	return this.unescape®;
};
Blowfish.prototype.wordescape=function(w){
	var r='';
	// reverse byteorder for intel systems
	var m=new Array (this.wordbyte0(w),this.wordbyte1(w),this.wordbyte2(w),this.wordbyte3(w));
	for(var i=3;i>=0;i--){
		var t1=Math.floor(m[i]/16);
		var t2=m[i]%16;
		if (t1<10) t1+=48;
		else t1+=55;
		if (t2<10) t2+=48;
		else t2+=55;
		r+=String.fromCharCode(t1)+String.fromCharCode(t2);
	}
	return r;
};
Blowfish.prototype.wordunescape=function(t){
	var r=0;
	// reverse byteorder for intel systems
	for(var i=6;i>=0;i-=2){
		var t1=t.charCodeAt(i);
		var t2=t.charCodeAt(i+1);
		if (t1<58) t1-=48;
		else t1-=55;
		if (t2<58) t2-=48;
		else t2-=55;
		r=r*256+(t1*16+t2);
	}
	return r;
};
Blowfish.prototype.round=function(a,b,n){
	var t=this;
	return(t.xor(a,t.xor(((t.xor((t.bf_S0[t.wordbyte0(B)]+t.bf_S1[t.wordbyte1(B)]),t.bf_S2[t.wordbyte2(B)]))+t.bf_S3[t.wordbyte3(B)]),t.bf_P[n])));
};
Blowfish.prototype.encipher=function(){
	var t=this;
	var Xl=t.xl_par;
	var Xr=t.xr_par;
	Xl=t.xor(Xl,t.bf_P[0]);
	Xr=t.round(Xr,Xl,1);Xl=t.round(Xl,Xr,2);
	Xr=t.round(Xr,Xl,3);Xl=t.round(Xl,Xr,4);
	Xr=t.round(Xr,Xl,5);Xl=t.round(Xl,Xr,6);
	Xr=t.round(Xr,Xl,7);Xl=t.round(Xl,Xr,8);
	Xr=t.round(Xr,Xl,9);Xl=t.round(Xl,Xr,10);
	Xr=t.round(Xr,Xl,11);Xl=t.round(Xl,Xr,12);
	Xr=t.round(Xr,Xl,13);Xl=t.round(Xl,Xr,14);
	Xr=t.round(Xr,Xl,15);Xl=t.round(Xl,Xr,16);
	Xr=t.xor(Xr,t.bf_P[17]);
	t.xl_par=Xr;
	t.xr_par=Xl;
};
Blowfish.prototype.decipher=function(){
	var t=this;
	var Xl=t.xl_par;
	var Xr=t.xr_par;
	Xl=t.xor(Xl,t.bf_P[17]);
	Xr=t.round(Xr,Xl,16);Xl=t.round(Xl,Xr,15);
	Xr=t.round(Xr,Xl,14);Xl=t.round(Xl,Xr,13);
	Xr=t.round(Xr,Xl,12);Xl=t.round(Xl,Xr,11);
	Xr=t.round(Xr,Xl,10);Xl=t.round(Xl,Xr,9);
	Xr=t.round(Xr,Xl,8);Xl=t.round(Xl,Xr,7);
	Xr=t.round(Xr,Xl,6);Xl=t.round(Xl,Xr,5);
	Xr=t.round(Xr,Xl,4);Xl=t.round(Xl,Xr,3);
	Xr=t.round(Xr,Xl,2);Xl=t.round(Xl,Xr,1);
	Xr=t.xor(Xr,t.bf_P[0]);
	t.xl_par=Xr;
	t.xr_par=Xl;
};

Link to comment
Share on other sites

I get some errors when trying this in Ubuntu Karmic, I think I have all the packages installed that I need, but probably not. Here's the error:

rick@rick-desktop:~/Downloads/distrobution$ python 'Grooveshark GUI.py'

Song is Daughter

Album is Pearl Jam

Artist is Pearl Jam

Traceback (most recent call last):

File "Grooveshark GUI.py", line 331, in OnDownload

subprocess.Popen('python download.py %s %s %s %s' % (json.dumps(json.dumps(self.songKeys)), json.dumps(json.dumps(self.songServers)), json.dumps(json.dumps(self.songTitles)), json.dumps(json.dumps(settings.path))))

File "/usr/lib/python2.6/subprocess.py", line 621, in __init__

errread, errwrite)

File "/usr/lib/python2.6/subprocess.py", line 1126, in _execute_child

raise child_exception

OSError: [Errno 2] No such file or directory

Do I need to change a path somewhere?

Link to comment
Share on other sites

No if you don't play music then you don't have to

Also see if in a terminal you can start python by just typing python from any directory (if not add it to your path).

Also make sure all the .py files are in the SAME folder

hmm... still get the errors I posted above. I can run python from any directory (seems to be correctly on my path). Has anyone tried this on linux and got it to work?

Link to comment
Share on other sites

I couldnt get it to work in crunchbang linux either, but i think thats just me (and crunchbang).

I'm not sure i have httplib2 installed properly, but i have wxpython installed, and python is installed properly.

Line 451 in <module> g.sessionData() name error 'g' is not defined.

If you could, "I didnt read the licensing" would you add httplib2 to the same folder as the app and have its path hard coded? or have httplib2 installed through the app?

Anywho thanks for offering to check out my problem.

Link to comment
Share on other sites

Huh seems to be a LOT of problems. I will look at the code and also try to make it so you don't have to install everything... basically install httplib2 in you site-packages and also install wxPython in the site packages. If that doesn't work then go back to the text for now. I am working on rewriting it with twisted so should be better all around. As for the errors make sure you can run python then type import httplib2 and also import wx. See if those error and if they don't you have them correctly installed.

Or copy the install contents of httplib2 and wx into the programs folder.

Link to comment
Share on other sites

Same error unfortunately:

rick@rick-desktop:~/Downloads/distrobution$ python 'Grooveshark GUI.py'

/home/rick/Downloads/distrobution

Current Dir: /home/rick/Downloads/distrobution

Starting Log

Changed Path; OK

Song is Black

Album is Pearl Jam

Artist is Pearl Jam

Traceback (most recent call last):

File "Grooveshark GUI.py", line 346, in OnDownload

subprocess.Popen('python download.py %s %s %s %s' % (json.dumps(json.dumps(self.songKeys)), json.dumps(json.dumps(self.songServers)), json.dumps(json.dumps(self.songTitles)), json.dumps(json.dumps(settings.path))))

File "/usr/lib/python2.6/subprocess.py", line 621, in __init__

errread, errwrite)

File "/usr/lib/python2.6/subprocess.py", line 1126, in _execute_child

raise child_exception

OSError: [Errno 2] No such file or directory

Link to comment
Share on other sites

Ok try this replace all of Grooveshark GUI with this...

If there is still an error paste app.log here.

So Sorry about the errors :-(

#!/usr/bin/python

import os

import sys

grooveshark_error = False

try:

import json

except ImportError:

try:

import simplejson as json

except ImportError:

error = '''Neither json nor simplejson could be imported. Try installing python 2.6 (directions and binaries on python.prg/download) With python 2.6 json will be installed to.'''

grooveshark_error = True

try:

import ConfigParser

import subprocess

import time

except:

error = 'Error can not import python standard libary modules, please re-install python, preferably python 2.6, from python.org/download'

grooveshark_error = True

try:

import httplib2

except:

error = 'Could not import httplib2. Please install it from http://httplib2.googlecode.com/files/httplib2-0.5.0.zip'

grooveshark_error = True

try:

import wx

from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin

except ImportError:

error = '''Error: wxPython is not installed or was not found. Please download and install from wxPython.org/download.php

WIN32:

-Python 2.4: http://downloads.sourceforge.net/wxpython/...8.10.1-py24.exe

-Python 2.5: http://downloads.sourceforge.net/wxpython/...8.10.1-py25.exe

-Python 2.6: http://downloads.sourceforge.net/wxpython/...8.10.1-py26.exe

MacOSX:

-Python 2.4: http://downloads.sourceforge.net/wxpython/...ersal-py2.4.dmg

-Python 2.5: http://downloads.sourceforge.net/wxpython/...ersal-py2.5.dmg

-Python 2.6: http://downloads.sourceforge.net/wxpython/...ersal-py2.6.dmg

Linux:

See wxPython.org/download.php then goto Debian/Ubuntu (even if you run another distro it has directions)'''

print error

grooveshark_session_error = True

try:

from Grooveshark import Grooveshark

from Mplayer import MPlayer

from Player import Player

except ImportError:

error = 'Error: Either Grooveshark.py, Mplayer.py, or Player.py where not found... please make sure they are in the SAME directory as this file and have the correct names'

grooveshark_session_error = True

class Logger(object):

def __init__(self):

self.log_ = open('app.log', 'ab')

self.log_.write('\n\n\n STARTING LOG \n\n')

def write(self, string):

self.log_.write(string+'\n')

def close(self):

self.log_.write('---Closing Log---')

self.log_.close()

settings_default = '''/

[settings]

mplayer =

save_path =

'''

class Settings(object):

'''Stores settings'''

def __init__(self):

self.config = ConfigParser.RawConfigParser()

cf = self.config.read('settings.cfg')

if cf == []:

print 'No settings.cfg'

print 'Creating default'

f = open('settings.cfg')

f.write(settings_default)

f.close()

cf = self.config.read('settings.cfg')

try:

self.path = self.config.get('Settings', 'save_path')

self.path.replace('\\', '/')

if self.path[-1] == '/':

self.path = self.path[:-1] + '/'

except ConfigParser.NoOptionError:

self.path = ''

try:

self.eula = self.config.get('Settings', 'eula')

except ConfigParser.NoOptionError:

self.eula = False

try:

self.mplayer = self.config.get('Settings', 'mplayer')

self.mplayer.replace('\\', '/')

except ConfigParser.NoOptionError:

self.mplayer = ''

self.buffer_time = 10

#self.eula = self.config.get('Settings', 'mplayer_path')

self.stream_files = []

log.write('Save Path: %s ' % self.path)

log.write('MPlayer Path: %s ' % self.mplayer)

def setPath(self, path):

self.path = path.replace('\\', '/')

log.write('Path Changed To: %s' % self.path)

class GUI_Stream(object):

def OnPlay(self, event, audio_listings, grooveshark_results):

log.write('Called: OnPlay')

items = audio_listings.GetItemCount()

if not items < 1:

self.count = 0

self.songKeys = []

self.songServers = []

for i in range(items):

if audio_listings.IsChecked(i):

log.write('OnPlay, iterating though items')

try:

index_number = int(audio_listings.GetItemText(i).replace('.', ''))-1#Takes the number (1st col.) and gets the index number

songID = grooveshark_results[index_number]['SongID']

self.songKeys.append( g.songKeyfromID(songID))

self.songServers.append(g.reply['result']['streamServer'])

print 'Song is ' + grooveshark_results[index_number]['Name']

print 'Album is ' + grooveshark_results[index_number]['AlbumName']

print 'Artist is ' + grooveshark_results[index_number]['ArtistName']

except httplib2.ServerNotFoundError:

frame.Connection_Problem()

break#break the for loop

if not self.songKeys == []:

self.mp = MPlayer(settings.mplayer)#Crreates mplayer inst

self.stream()#start recurcion check

else:

pass

def stream(self):

log.write('Called: stream')

#Sends it to Groovehsarks stream method

g.stream(json.dumps([self.songKeys[0]]), json.dumps([self.songServers[0]]), settings.path+'streamsupport'+str(self.count)+'.mp3')#Creates a instance for all, _inc_ is a special key string that gets reaplce by a incremented number

self.count = self.count + 1

#Adds it to the files we have to delete

for n,i in enumerate(self.songKeys[0]):

settings.stream_files.append(settings.path+'streamsupport'+str(n)+'.mp3')#For cleanup

f = open(settings.path+'streamsupport'+str(n)+'.mp3', 'wb')#Create a empty container

f.close()

wx.CallLater((settings.buffer_time + 5) * 1000, self.check_stream)

wx.CallLater((settings.buffer_time * 1000), self.play_audio)#waits settings.buffer seconds then begins playing audio

self.player = Player((350,150), 'Player', self.mp, len(self.songKeys), settings, g)# +1 for the removed item (the one playing)

self.player.ShowModal()

def check_stream(self):

log.write('Called: check_stream')

p_id = g.stream_process.poll()

print 'Process: %s' % p_id

if p_id == None:

wx.CallLater(10000, self.check_stream)

else:

if p_id == 2:

self.player.SetInfoText('Error retrieving mp3. Going to next song')

print 'Starting next download'

try:

g.stream(json.dumps([self.songKeys[(self.count)]]), json.dumps([self.songServers[self.count]]), settings.path+'streamsupport'+str(self.count)+'.mp3')#Creates a instance for all, _inc_ is a special key string that gets reaplce by a incremented number

except IndexError:

print 'Done with downloads'

else:

self.count = self.count + 1

wx.CallLater((settings.buffer_time + 5) * 1000, self.check_stream)

def play_audio(self):

print 'play_audio called'

log.write('Called: Play Audio')

for n,i in enumerate(self.songKeys):

self.mp.files.append(settings.path + 'streamsupport'+str(n)+'.mp3')

print self.mp.files

self.mp.file('"'+settings.path + 'streamsupport'+str(n)+'.mp3'+'"'+' 1') #Runs loadfile path:/streamsupport,mp3, 1 (adds that file to current playlist)

class MainFrame(wx.Frame):

def __init__(self, title):

#Initailize Frame

wx.Frame.__init__(self, None, -1, title, size = (515, 315), style = wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN | wx.FULL_REPAINT_ON_RESIZE)

#Create Backround Frame

#p = AboutPanel(self, -1)

p = wx.Panel(self)

nb = wx.Notebook(p)

sp = SearchPanel(nb, -1)

ab = AboutPanel(nb, -1)

rp = PopularPanel(nb, -1)

op = OptionsPanel(nb, -1)

nb.AddPage(ab, 'About')

nb.AddPage(sp, 'Search')

nb.AddPage(rp, 'Popular')

nb.AddPage(op, 'Settings')

sizer = wx.BoxSizer()

sizer.Add(nb, 1, wx.EXPAND)

p.SetSizer(sizer)

def Connection_Problem(self):

log.write('Connection Problem')

con_dialog = wx.MessageDialog(None, 'There was a problem connecting to the internet, please check your connection (go to google.com or another website) and if you can\'t restart your computer. \n This is NOT a problem with this application, but your internet connection. \n Sorry for the inconvience.')

con_dialog.ShowModal()

def Error(self, error, quit = True):

log.write('Connection Problem')

error_dialog = wx.MessageDialog(None, 'Error: '+error+'\n\nIf you have seen this error multiple times please post the app.log (in this program\'s directory)to hak5.org for help.', 'Error', wx.OK | wx.ICON_ERROR)

error_dialog.ShowModal()

if quit == True:

self.Destroy()

sys.exit(1)

class OptionsPanel(wx.Panel):

def __init__(self, parent, id):

wx.Panel.__init__(self, parent, id)

self.path = settings.path

#Save Path

self.change_path_text = wx.StaticText(self, -1, 'Change Save Path:', pos = (20,3))

self.display_path = wx.TextCtrl(self, -1, self.path, pos = (110,21), size = (300, -1))

self.save_button = wx.Button(self, -1, 'Change', pos = (20,20))

#Mplayer

self.change_mplayer_text = wx.StaticText(self, -1, 'Change MPlayer Path:', pos = (20,45))

self.display_mplayer_path = wx.TextCtrl(self, -1, settings.mplayer, pos = (110,66), size = (300, -1))

self.mplayer_button = wx.Button(self, -1, 'Change', pos = (20,65))

#Buffer Time

# self.change_path_text = wx.StaticText(self, -1, 'Change Save Path:', pos = (20,3))

# self.display_buffer_time = wx.TextCtrl(self, -1, settings.buffer_time, pos = (110,21), size = (300, -1))

# self.change_buffer = wx.Button(self, -1, 'Change', pos = (20,20))

#Binds

self.Bind(wx.EVT_BUTTON, self.change_save_path, self.save_button)

self.Bind(wx.EVT_BUTTON, self.change_mplayer_path, self.mplayer_button)

# self.Bind(wx.EVT_BUTTON, self.change_buffer, self.change_buffer)

def change_save_path(self, event):

self.save_dlg = wx.DirDialog(self, 'Select save folder.', 'C:/', name = 'save_dialog')

result = self.save_dlg.ShowModal()

if result == wx.ID_OK:

print 'Changed Path; OK'

settings.setPath(self.save_dlg.GetPath()+'/')

self.display_path.SetValue(settings.path)

settings.config.set('Settings', 'save_path', settings.path)

if result == wx.ID_CANCEL:

pass #User did not select a path, or they select the path and then hit cancel

def change_mplayer_path(self, event):

self.mplayer_dlg = wx.FileDialog(self, 'Select MPlayer executable.', 'C:/')

result = self.mplayer_dlg.ShowModal()

if result == wx.ID_OK:

print 'Changed MPlayer; OK'

input_path = self.mplayer_dlg.GetDirectory().replace('\\', '/') + '/' + self.mplayer_dlg.GetFilename()

print os.path.exists(input_path)

if os.path.exists(input_path):

print 'Path exists'

settings.mplayer = input_path

self.display_mplayer_path.SetValue(settings.mplayer)

settings.config.set('Settings', 'mplayer', settings.mplayer)

else:

print 'Path does not exist'

if result == wx.ID_CANCEL:

pass #User did not select a path, or they select the path and then hit cancel

class PopularPanel(wx.Panel):

def __init__(self, parent, id):

wx.Panel.__init__(self, parent, id)

self.results = PopularResultsPanel(self, -1, pos = (0, 0))

play = wx.Button(self, -1, 'Play Checked', pos = (240, 233))

download = wx.Button(self, -1, 'Download Checked', pos = (330, 233))

self.Bind(wx.EVT_BUTTON, self.OnStream, play)

self.Bind(wx.EVT_BUTTON, self.OnDownload, download)

def OnDownload(self, event):

log.write('Download Called - Popular')

items = self.results.result_listings.GetItemCount()

if items > 0:

self.songKeys = []

self.songServers = []

self.songTitles = []

#We have to spawn a process or thread of some sort! - Spawning seperate process (safer )

for i in range(items):

if self.results.result_listings.IsChecked(i):

index_number = int(self.results.result_listings.GetItemText(i).replace('.', ''))-1#Takes the number (1st col.) and gets the index number

songID = self.results.popular_results[index_number]['SongID']

self.songKeys.append( g.songKeyfromID(songID))

self.songServers.append(g.reply['result']['streamServer'])

self.songTitles.append(self.results.popular_results[index_number]['Name'])

print 'Song is ' + self.results.popular_results[index_number]['Name']

print 'Album is ' + self.results.popular_results[index_number]['AlbumName']

print 'Artist is ' + self.results.popular_results[index_number]['ArtistName']

#Start Downloading...

subprocess.Popen('python download.py %s %s %s %s' % (json.dumps(json.dumps(self.songKeys)), json.dumps(json.dumps(self.songServers)), json.dumps(json.dumps(self.songTitles)), json.dumps(json.dumps(settings.path))))

else:

pass

def OnStream(self, event):

stream = GUI_Stream()

stream.OnPlay(event, self.results.result_listings, self.results.popular_results)

class PopularResultsPanel(wx.Panel):

def __init__(self, parent, id, pos):

wx.Panel.__init__(self, parent, id, pos)

self.vbox = wx.BoxSizer(wx.VERTICAL)

self.hbox = wx.BoxSizer(wx.HORIZONTAL)

self.result_listings = CheckListCtrl(self, (500,230), (0,0))

self.result_listings.InsertColumn(0, ' ', width = 40)

self.result_listings.InsertColumn(1, 'Song')

self.result_listings.InsertColumn(2, 'Artist')

self.result_listings.InsertColumn(3, 'Album')

self.hbox.Add(self.result_listings, 1, wx.ALL | wx.CENTER)

self.vbox.Add(self.hbox, 1, wx.ALL | wx.CENTER)

self.SetSizer(self.vbox)

self.vbox.Fit(self)

#Get and Display Most Popular Songs

#self.displaySearch()

def displaySearch(self):

self.popular_results = g.popular()

for n,i in enumerate(self.popular_results):

index = self.result_listings.InsertStringItem(n+1, str(n+1)+'.')

try:

self.result_listings.SetStringItem(index, 1, i['Name'])

except UnicodeEncodeError:

self.result_listings.SetStringItem(index, 1, repr(i['Name'])[2:-1])

self.result_listings.SetStringItem(index, 2, i['ArtistName'])

try:

self.result_listings.SetStringItem(index, 3, i['AlbumName'])

except TypeError:

self.result_listings.SetStringItem(index, 1, ' ')

class SearchPanel(wx.Panel):

def __init__(self, parent, id):

wx.Panel.__init__(self, parent, id)

#Encapsulation and data transfer between the Input and Results Search Frames

self.searchResults = SearchResultsPanel(self, -1, pos = (0, 0))

self.searchInput = SearchInputPanel(self, -1, pos = (30, 0))

sizer = wx.BoxSizer(wx.VERTICAL)

sizer.Add(self.searchInput, 0, wx.EXPAND, 1)

sizer.Add(self.searchResults, 0, wx.EXPAND, 3)

self.SetSizer(sizer)

sizer.Fit(self)

self.Bind(wx.EVT_BUTTON, self.OnPlay, self.searchResults.play)

self.Bind(wx.EVT_BUTTON, self.OnDownload, self.searchResults.download)

def OnDownload(self, event):

log.write('Download Called - Search')

items = self.searchResults.result_listings.GetItemCount()

if items > 0:

self.songKeys = []

self.songServers = []

self.songTitles = []

#We have to spawn a process or thread of some sort!

for i in range(items):

if self.searchResults.result_listings.IsChecked(i):

index_number = int(self.searchResults.result_listings.GetItemText(i).replace('.', ''))-1#Takes the number (1st col.) and gets the index number

songID = self.searchResults.search_results[index_number]['SongID']

self.songKeys.append( g.songKeyfromID(songID))

self.songServers.append(g.reply['result']['streamServer'])

self.songTitles.append(self.searchResults.search_results[index_number]['Name'])

print 'Song is ' + self.searchResults.search_results[index_number]['Name']

print 'Album is ' + self.searchResults.search_results[index_number]['AlbumName']

print 'Artist is ' + self.searchResults.search_results[index_number]['ArtistName']

#Start Downloading...

download_log = open("download.log","a")

try:

subprocess.Popen('python download.py %s %s %s %s' % (json.dumps(json.dumps(self.songKeys)), json.dumps(json.dumps(self.songServers)), json.dumps(json.dumps(self.songTitles)), json.dumps(json.dumps(settings.path))), stdout = download_log, stderr = download_log)

except:

print 'Error downloading'

download_log.write('error.\n')

traceback.print_exc(file=download_log)

download_log.close()

download_log.close()

else:

pass

def OnPlay(self, event):

gui_stream = GUI_Stream()

gui_stream.OnPlay(event, self.searchResults.result_listings, self.searchResults.search_results)

class SearchInputPanel(wx.Panel):

def __init__(self, parent, id, pos):

wx.Panel.__init__(self, parent, id, pos)

#Controls to occupy frame

self.searchBttn = wx.Button(self, -1, "Search")

self.searchText = wx.StaticText(self, -1, 'Search:')

self.searchTextBox = wx.TextCtrl(self, -1, 'Search for music')

searchInputSizer = wx.BoxSizer(wx.HORIZONTAL)

searchAreaSizer = wx.BoxSizer(wx.VERTICAL)

searchInputSizer.AddSpacer((10,10))

searchInputSizer.AddSpacer((10,10))

searchInputSizer.Add(self.searchText, 0, wx.ALL, 10)

searchInputSizer.AddSpacer((10,0))

searchInputSizer.Add(self.searchTextBox, 1, wx.EXPAND|wx.ALL, 10)

searchInputSizer.AddSpacer((10,0))

searchInputSizer.Add(self.searchBttn, 0, wx.ALL, 10)

searchAreaSizer.Add(searchInputSizer, 0, wx.EXPAND)

self.SetSizer(searchAreaSizer)

searchAreaSizer.Fit(self)

self.parent = self.GetParent()

self.Bind(wx.EVT_BUTTON, self.OnSearch, id=self.searchBttn.GetId())

def OnSearch(self, event):

search_string = self.searchTextBox.GetValue()

self.parent.searchResults.displaySearch(event, search_string)

class SearchResultsPanel(wx.Panel):

def __init__(self, parent, id, pos):

self.search_results = None

wx.Panel.__init__(self, parent, id, pos)

self.vbox = wx.BoxSizer(wx.VERTICAL)

self.result_listings = CheckListCtrl(self, (455,155), (0,10))

self.result_listings.InsertColumn(0, ' ', width = 40)

self.result_listings.InsertColumn(1, 'Song')

self.result_listings.InsertColumn(2, 'Artist')

self.result_listings.InsertColumn(3, 'Album')

self.vbox.Add(self.result_listings, 1, wx.ALL | wx.CENTER, 5)

self.play = wx.Button(self, -1, 'Play Checked', pos = (240, 170))

self.download = wx.Button(self, -1, 'Download Checked', pos = (330, 170))

def displaySearch(self, event, search_string):

search_string = search_string.replace('"', '')

try:

self.search_results = g.search(search_string)

except httplib2.ServerNotFoundError:

frame.Connection_Problem()

event.Skip()

for n,i in enumerate(self.search_results):

index = self.result_listings.InsertStringItem(n+1, str(n+1)+'.')

try:

self.result_listings.SetStringItem(index, 1, i['Name'])

except UnicodeEncodeError:

self.result_listings.SetStringItem(index, 1, repr(i['Name'])[2:-1])

self.result_listings.SetStringItem(index, 2, i['ArtistName'])

self.result_listings.SetStringItem(index, 3, i['AlbumName'])

def loading(self):

vbox = wx.BoxSizer(wx.VERTICAL)

hbox = wx.BoxSizer(wx.HORIZONTAL)

hbox.Add(wx.StaticText(self, -1, 'LOADING', (20,20)), 1, wx.CENTER|wx.ALL)

vbox.Add(hbox, 1, wx.CENTER|wx.ALL)

self.SetSizer(vbox)

#Next two Class are both for the about panel... (for the sizers to work with an image I has to encapsulate the Image in a panel)

class Image(wx.Panel):

""" class Panel1 creates a panel with an image on it, inherits wx.Panel """

def __init__(self, parent, id):

# create the panel

wx.Panel.__init__(self, parent, id)

try:

# pick a .jpg file you have in the working folder

imageFile = 'g8831.png'

if not os.path.exists(imageFile):

raise IOError('Image does not exists!')

jpg1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY)

height = jpg1.GetHeight()

width = jpg1.GetWidth()

scaled_version = jpg1.Scale(height/10, width/10)

author_text = wx.StaticText(self, -1, 'By: Zimmer', (0,scaled_version.GetWidth()+10))

author_text = wx.StaticText(self, -1, 'Grooveshark Explorer', (0,scaled_version.GetWidth()+25))

author_text.Show()

# bitmap upper left corner is in the position tuple (x, y) = (5, 5)

bitmap = wx.StaticBitmap(self, -1, scaled_version.ConvertToBitmap())

except IOError:

print "Image file %s not found" % imageFile

raise SystemExit

class AboutPanel(wx.Panel):

def __init__(self, parent, id):

# create the panel

wx.Panel.__init__(self, parent, id)

ImagePane = Image(self, -1)

sizer = wx.BoxSizer(wx.HORIZONTAL)

sizer2 = wx.BoxSizer(wx.VERTICAL)

sizer.Add(ImagePane, 1, wx.CENTER|wx.ALL)

sizer2.Add(sizer, 1, wx.CENTER|wx.ALL)

self.SetSizer(sizer2)

sizer2.Fit(self)

class CheckListCtrl(wx.ListCtrl, CheckListCtrlMixin, ListCtrlAutoWidthMixin):

def __init__(self, parent, size, pos):

wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT, size = size, pos = pos)

CheckListCtrlMixin.__init__(self)

ListCtrlAutoWidthMixin.__init__(self)

vbox = wx.BoxSizer(wx.VERTICAL)

self.SetSizer(vbox)

vbox.Add(self, 1, wx.ALL)

vbox.Fit(self)

if __name__ == '__main__':

try:

#Set Folder

if len('/'.join(os.path.abspath(__file__).replace('\\', '/').split('/')[:-1])) == 1:

folder = os.path.abspath(__file__).replace('\\', '/').split('/')[:-1][0] + '/'

else:

folder = '/'.join(os.path.abspath(__file__).replace('\\', '/').split('/')[:-1])

print folder

os.chdir(folder)

print 'Current Dir: %s' % os.getcwd()

#Start logger

print 'Starting Log'

log = Logger()

#Set the folder to the Grooveshark GUI.py folder

log.write('Current Folder After: %s' % os.getcwd())

log.write('------Directory-----------')

log.write('Folder: %s' % folder)

for n, i in enumerate(os.listdir(folder)):

log.write('%i. %s' % (n+1, i))

try:

g = Grooveshark()

except:

grooveshark_error = True

print 'Could not start vital component'

try:

g.sessionData()

except httplib2.ServerNotFoundError:

grooveshark_error = True

error = 'Error could not contact grooveshark.com. Please check your internet connection'

log.write('Setting current directory as %s' % folder)

settings = Settings()

app = wx.App(redirect = False)

frame = MainFrame("Grooveshark")

frame.Show(True)

#Set this windows on top of any others.

app.SetTopWindow(frame)

if grooveshark_error:

print 'Grooveshark Error'

frame.Error(error)

else:

log.write('All import are good.')

app.MainLoop()

#After the GUI is exited

#Kill the stream process

log.write('GUI has been exited')

#if g.stream_process.poll() == None:#PRocess has not shut down we need to kill it

# g.stream_process.terminate()

log.write('Removing stream files')

for i in settings.stream_files:

log.write(' - File: %s' % i)

os.remove(i)#Remove all stream files

print 'closing log'

finally:

download_content = open('download.log', 'rb').read()

log.write('\n---------------------------download errors---------------------------\n')

log.write(download_content)

log.close()

f = open('settings.cfg', 'wb')

settings.config.write(f)

f.close()

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...