remove unnecessary song change code

pull/124/head
Aevann 2023-02-17 18:42:55 +02:00
parent b5b7c8ef5e
commit c3842b8bf8
1 changed files with 2 additions and 5 deletions

View File

@ -737,7 +737,7 @@ def _change_song_youtube(vid, id):
ydl_opts = {
'cookiefile': '.cookies',
'outtmpl': '/temp_songs/%(title)s.%(ext)s',
'outtmpl': '/temp_songs/%(id)s.%(ext)s',
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
@ -754,10 +754,7 @@ def _change_song_youtube(vid, id):
db.close()
return
files = os.listdir("/temp_songs/")
paths = [path.join("/temp_songs/", basename) for basename in files]
songfile = max(paths, key=path.getctime)
os.rename(songfile, f"/songs/{id}.mp3")
os.rename(f"/temp_songs/{id}.mp3", f"/songs/{id}.mp3")
v.song = id
db.add(v)