mirror of
https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
synced 2024-11-26 09:53:17 +01:00
Convert function now export to the correct bitrate
This commit is contained in:
parent
58832d2091
commit
baacbdf14b
3
.gitignore
vendored
3
.gitignore
vendored
@ -139,3 +139,6 @@ cython_debug/
|
|||||||
|
|
||||||
# Spotify Credentials
|
# Spotify Credentials
|
||||||
credentials.json
|
credentials.json
|
||||||
|
|
||||||
|
#Download Folder
|
||||||
|
ZSpotify\ Music/
|
||||||
|
@ -22,7 +22,7 @@ from librespot.metadata import TrackId
|
|||||||
from pydub import AudioSegment
|
from pydub import AudioSegment
|
||||||
|
|
||||||
quality: AudioQuality = AudioQuality.HIGH
|
quality: AudioQuality = AudioQuality.HIGH
|
||||||
#quality: AudioQuality = AudioQuality.VERY_HIGH #Uncomment this line if you have a premium account
|
quality: AudioQuality = AudioQuality.VERY_HIGH #Uncomment this line if you have a premium account
|
||||||
session: Session = None
|
session: Session = None
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
@ -241,7 +241,11 @@ def convertToMp3(filename):
|
|||||||
print("### CONVERTING TO MP3 ###")
|
print("### CONVERTING TO MP3 ###")
|
||||||
raw_audio = AudioSegment.from_file(filename, format="ogg",
|
raw_audio = AudioSegment.from_file(filename, format="ogg",
|
||||||
frame_rate=44100, channels=2, sample_width=2)
|
frame_rate=44100, channels=2, sample_width=2)
|
||||||
raw_audio.export(filename, format="mp3")
|
if quality == AudioQuality.VERY_HIGH:
|
||||||
|
bitrate = "320k"
|
||||||
|
else:
|
||||||
|
bitrate = "160k"
|
||||||
|
raw_audio.export(filename, format="mp3", bitrate=bitrate)
|
||||||
|
|
||||||
def setAudioTags(filename, artists, name, albumName, releaseYear, disc_number, track_number):
|
def setAudioTags(filename, artists, name, albumName, releaseYear, disc_number, track_number):
|
||||||
print("### SETTING MUSIC TAGS ###")
|
print("### SETTING MUSIC TAGS ###")
|
||||||
|
Loading…
Reference in New Issue
Block a user