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