I am trying to create a Django project on SpotDL. Here's my files:
--urls.py
urlpatterns = [
path('admins/', admin.site.urls),
path('spdl/', views.spdl),
]
--views.py
def spdl(request):
import spotdl
spotify_url = "https://open.spotify.com/track/2Cd9iWfcOpGDHLz6tVA3G4";
subprocess.run(['spotdl', spotify_url] , check=True)
return HttpResponse("downloaded")
It successfully downloads the track on my PC. But, I want to customize it a little bit. I want to set the --bitrate
on views.py file during the spotdl call. I tried this line but failed: (got via ChatGPT)
subprocess.run(['spotdl', '--bitrate', '128', spotify_url], check=True)
How can I pass other commands to SpotDL like --bitrate
or --cookie-file cookies.txt
?