2013-06-14, 09:33
NEVERMIND. I've got a different problem. The artist I'm testing with has something else going on in a couple of the translations. I tried a different artist and everything works fine. I'm marking this as solved.
I'm trying to add some new stuff to Artist Slideshow, including images and bios from theaudiodb.com. No matter what I try, I can't save the file generated by theaudiodb.com. For instance, here's the URL for Adele (using their test key - same result if I use mine):
http://www.theaudiodb.com/api/v1/json/[APIKEY]/artist-mb.php?i=cc2c9c3c-b7bc-4b8b-84d8-4fbd8779e493
Even if I copy the entire file by hand, put it in a local file, have my script read the file, then write it back out, I get a blank file. If I remove everything after the English bio, then it works fine. So there is some encoding trick I don't know to write out the file, but for the life of me I can't figure out what it is.
Here are three sets of code that don't work:
What I Started With:
First Alternate Try:
Test With Local File:
I also tried using urllib2 with the same level of success.
Again, the last one works if I delete everything in theaudiodb.com file after the English bio. I'm really beginning to hate extended character sets.
I'm trying to add some new stuff to Artist Slideshow, including images and bios from theaudiodb.com. No matter what I try, I can't save the file generated by theaudiodb.com. For instance, here's the URL for Adele (using their test key - same result if I use mine):
http://www.theaudiodb.com/api/v1/json/[APIKEY]/artist-mb.php?i=cc2c9c3c-b7bc-4b8b-84d8-4fbd8779e493
Even if I copy the entire file by hand, put it in a local file, have my script read the file, then write it back out, I get a blank file. If I remove everything after the English bio, then it works fine. So there is some encoding trick I don't know to write out the file, but for the life of me I can't figure out what it is.
Here are three sets of code that don't work:
What I Started With:
Code:
urllib.urlretrieve( self.url, filename )
First Alternate Try:
Code:
raw_file = open( filename, 'w')
raw_file.write( urllib.urlopen( self.url ).read() )
raw_file.close()
Test With Local File:
Code:
test_file = open( filename + '.txt' ).read()
raw_file = open( filename, 'w')
raw_file.write( test_file )
raw_file.close()
I also tried using urllib2 with the same level of success.
Again, the last one works if I delete everything in theaudiodb.com file after the English bio. I'm really beginning to hate extended character sets.