r/Python • u/Ticklishcandy32 • Mar 24 '23
Beginner Showcase Spotr - a simple spotify CLI made in python
I made a spotify CLI in python.
I know its very basic, but this is my first python project and i think its pretty cool and useful :)It has all the commands you would need (i think), even a suprise command for song recommendations!
Made this beacuse i wanted a simple way of controlling my spotify in the terminal.I has a hint of neofetch in the way its displays info, so if you like that give it a try
It can be easily modified, and if you know basic python you can easily make your own commands
For more information and the source code check the github - https://github.com/Havard03/spotr
If you like it or find it useful, i would very much appreciate any stars :D


2
u/Ticklishcandy32 Mar 25 '23
Thank you all for the nice comments! And my project now has 11 stars! :D
I thought spotr was cool but not this cool :)
Please give feedback if there is anything you would like to change or improve :)
Also if u make any cool commands, be sure to share or make a PR, i would be happy to integrate your new commands in the project!
2
u/eeriemyxi Mar 26 '23 edited Mar 26 '23
Bare
except:is not recommended, as it catchesBaseException. You can useexcept Exception:. However, it is always recommended to be specific about which exception you're catching, you will have less abstruse bugs this way.Playing with environmental variables on runtime is not recommended, environmental variables are to be constant at all times. It'd be better to either use
jsonmodule for your app configurations, or to not do anything with environmental variables and rather have a manual explaining each option for the user to specify them in the.envfile.Whenever you're playing with file paths too much, you can use
pathlibwhich is object-oriented and will save you time.os.systemis very expensive as it initiates new processes. Usesubprocess.runfor your command line work.You're using
printas your logging module, however you will have much more easier control by using theloggingmodule for logging needs. By the way, one of your library dependency,rich, has a nice handlerrich.logging.RichHandler, which will prettify your logs.install.pyis very much oriented towards UNIX based systems. I recommend depending less on command-line tools, e.g.,touchis basically creating a new file, however you'll have more control withopenbuilt-in function, and it is compatible with all supported operating systems of Python too.You're also misusing the naming conventions in various files, for example, you're naming your function arguments with SCREAMING_CASE, however we, and PEP8, recommends you to use snake_case.
11
u/phxees Mar 24 '23
I’ll check it out. Happy to not see that you aren’t just promoting a simple wrapper using an already available Python library.
Too many similar posts here are just hey I made a thing by using an existing thing and now you no longer need to set two configurable parameters. Happy to see use of
requestsrather thanspotipy.3
u/LevelIntroduction764 Mar 25 '23
I’m excited to try this. Been wanting to make my own shuffle algorithm as Spotify’s sucks! Thanks
3
u/atreadw Mar 25 '23
This is really cool. Thanks for sharing. Keep up the good work :)