main.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import sites as sites
  2. from helper.settings import Settings
  3. from helper import console as console
  4. import os.path
  5. import command
  6. def main():
  7. os.makedirs(Settings.tmpDir.get(), exist_ok=True)
  8. console.unlock()
  9. console.output('Music downloader by Deben Oldert')
  10. console.output()
  11. console.output('Download directory: {0}'.format(Settings.SaveDir.get()))
  12. console.output()
  13. help()
  14. console.output()
  15. console.output('Available sites: {0}'.format(', '.join(list(map(lambda x: x.url, sites.available)))))
  16. console.output('Selected site is: {0}'.format(sites.available[selected_site].url))
  17. console.output()
  18. while True:
  19. if not idle():
  20. break
  21. console.output('Quitting...')
  22. exit(0)
  23. def idle():
  24. _command = console.ask_input('Type command')
  25. for comm in command.commands:
  26. if comm[0] == _command.lower():
  27. return comm[1]()
  28. console.output('Command \'{0}\' not found. Type help to see a list of possible commands'.format(_command))
  29. return True
  30. def quit():
  31. return False
  32. selected_site = 0
  33. search_cache = None
  34. if __name__ == '__main__':
  35. main()