fix bass download for linux

This commit is contained in:
cidoku 2025-10-08 01:12:42 -03:00
parent 9d07b7a431
commit f49b5b08ae

View File

@ -37,62 +37,68 @@ BASSOPUSZIP = "bassopus24.zip"
BASSOPUSDLL = "bassopus.dll" BASSOPUSDLL = "bassopus.dll"
BASSFLACZIP = "bassflac24.zip" BASSFLACZIP = "bassflac24.zip"
BASSFLACDLL = "bassflac.dll" BASSFLACDLL = "bassflac.dll"
if platform.system() == "Darwin":
BASSZIP = "bass24-osx.zip" arch = platform.uname()[4]
BASSDLL = "libbass.dylib"
BASSOPUSZIP = "bassopus24-osx.zip" if platform.system() == "Linux":
BASSOPUSDLL = "libbassopus.dylib" if arch not in ["x86", "x86_64"]:
BASSFLACZIP = "bassflac24-osx.zip" arch = "x86_64"
BASSFLACDLL = "libbassflac.dylib" print "Assuming that your system is x86_64..."
elif platform.system() == "Linux":
BASSZIP = "bass24-linux.zip" BASSZIP = "bass24-linux.zip"
BASSDLL = "libbass.so" BASSDLL = "libs/" + arch + "/libbass.so"
BASSOPUSZIP = "bassopus24-linux.zip" BASSOPUSZIP = "bassopus24-linux.zip"
BASSOPUSDLL = "libbassopus.so" BASSOPUSDLL = "libs/" + arch + "/libbassopus.so"
BASSFLACZIP = "bassflac24-linux.zip" BASSFLACZIP = "bassflac24-linux.zip"
BASSFLACDLL = "libbassflac.so" BASSFLACDLL = "libs/" + arch + "/libbassflac.so"
print "downloading", BASSZIP print "downloading", BASSZIP
filedata = urllib2.urlopen('http://us.un4seen.com/files/'+BASSZIP) filedata = urllib2.urlopen('http://us.un4seen.com/files/' + BASSZIP)
datatowrite = filedata.read() datatowrite = filedata.read()
with open(BASSZIP, 'wb') as f: with open(BASSZIP, 'wb') as f:
f.write(datatowrite) f.write(datatowrite)
f.close() f.close()
print "extracting "+BASSDLL+" from "+BASSZIP print "extracting " + BASSDLL + " from " + BASSZIP
zip_ref = zipfile.ZipFile(BASSZIP, 'r') zip_ref = zipfile.ZipFile(BASSZIP, 'r')
zip_ref.extract(BASSDLL) zip_ref.extract(BASSDLL)
zip_ref.close() zip_ref.close()
print "downloading", BASSOPUSZIP print "downloading", BASSOPUSZIP
filedata = urllib2.urlopen('http://us.un4seen.com/files/'+BASSOPUSZIP) filedata = urllib2.urlopen('http://us.un4seen.com/files/' + BASSOPUSZIP)
datatowrite = filedata.read() datatowrite = filedata.read()
with open(BASSOPUSZIP, 'wb') as f: with open(BASSOPUSZIP, 'wb') as f:
f.write(datatowrite) f.write(datatowrite)
f.close() f.close()
print "extracting "+BASSOPUSDLL+" from "+BASSOPUSZIP print "extracting " + BASSOPUSDLL + " from " + BASSOPUSZIP
zip_ref = zipfile.ZipFile(BASSOPUSZIP, 'r') zip_ref = zipfile.ZipFile(BASSOPUSZIP, 'r')
zip_ref.extract(BASSOPUSDLL) zip_ref.extract(BASSOPUSDLL)
zip_ref.close() zip_ref.close()
print "downloading", BASSFLACZIP print "downloading", BASSFLACZIP
filedata = urllib2.urlopen('http://us.un4seen.com/files/'+BASSFLACZIP) filedata = urllib2.urlopen('http://us.un4seen.com/files/' + BASSFLACZIP)
datatowrite = filedata.read() datatowrite = filedata.read()
with open(BASSFLACZIP, 'wb') as f: with open(BASSFLACZIP, 'wb') as f:
f.write(datatowrite) f.write(datatowrite)
f.close() f.close()
print "extracting "+BASSFLACDLL+" from "+BASSFLACZIP print "extracting " + BASSFLACDLL + " from " + BASSFLACZIP
zip_ref = zipfile.ZipFile(BASSFLACZIP, 'r') zip_ref = zipfile.ZipFile(BASSFLACZIP, 'r')
zip_ref.extract(BASSFLACDLL) zip_ref.extract(BASSFLACDLL)
zip_ref.close() zip_ref.close()
print "downloading", BASSMIDIZIP if platform.system() == "Linux":
filedata = urllib2.urlopen('http://us.un4seen.com/files/'+BASSMIDIZIP) os.rename(BASSDLL, "libbass.so")
datatowrite = filedata.read() os.rename(BASSOPUSDLL, "libbassopus.so")
os.rename(BASSFLACDLL, "libbassflac.so")
os.remove(BASSZIP)
os.remove(BASSOPUSZIP)
os.remove(BASSFLACZIP)
os.rmdir("libs/" + arch)
os.rmdir("libs")
pip_install("apng", "six", "appdirs", "packaging") pip_install("apng", "six", "appdirs", "packaging")