scdl icon indicating copy to clipboard operation
scdl copied to clipboard

Cleanup code base and add unit-tests

Open davidfischer-ch opened this issue 10 years ago • 3 comments

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.

  1. 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.
  2. 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).
  3. The command line functions will instantiate the class and use it.

davidfischer-ch avatar Aug 26 '15 08:08 davidfischer-ch

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 :)

flyingrub avatar Aug 26 '15 14:08 flyingrub

ALSO : Move all the download logic to the client class.

flyingrub avatar Apr 17 '16 13:04 flyingrub

also: separate the code for retrieving lists of files (likes, playlists) from the actual downloading.

r00t- avatar Jan 17 '18 20:01 r00t-