scdl
scdl copied to clipboard
Cleanup code base and add unit-tests
The code base is not big but its looking like a spaghetti code, with global variables and copy-pasted algorithms. The code is not testable, not reusable. For example the functionalities are tightly coupled to the terminal, idea is to split the core and the user interface. There are multiple possibilities to improve the quality of the code, here are some recommendations.
- Implement classes, some of the global variables can by replaced by attributes. Most of the functions can be replaced by methods, class methods, static methods or even kept as utility functions.
- Replace optparse by argparse (can generate the help string and can be turned (almost) into a full GUI application with https://github.com/chriskiehl/Gooey).
- The command line functions will instantiate the class and use it.
i didn't know optparse is now deprecated. For the class things i don't feel like we need it but it could be an improvement. Same thing for the GUI :)
ALSO : Move all the download logic to the client class.
also: separate the code for retrieving lists of files (likes, playlists) from the actual downloading.