__main__.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #! /usr/bin/env python3
  2. """
  3. ClSpotify
  4. It's like youtube-dl, but for Spotify.
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, version 3 of the License.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. """
  15. import argparse
  16. from app import client
  17. from config import CONFIG_VALUES
  18. if __name__ == '__main__':
  19. parser = argparse.ArgumentParser(prog='zspotify',
  20. description='A Spotify downloader needing only a python interpreter and ffmpeg.')
  21. parser.add_argument('-ns', '--no-splash',
  22. action='store_true',
  23. help='Suppress the splash screen when loading.')
  24. parser.add_argument('--config-location',
  25. type=str,
  26. help='Specify the zs_config.json location')
  27. group = parser.add_mutually_exclusive_group(required=True)
  28. group.add_argument('urls',
  29. type=str,
  30. # action='extend',
  31. default='',
  32. nargs='*',
  33. help='Downloads the track, album, playlist, podcast episode, or all albums by an artist from a url. Can take multiple urls.')
  34. group.add_argument('-ls', '--liked-songs',
  35. dest='liked_songs',
  36. action='store_true',
  37. help='Downloads all the liked songs from your account.')
  38. group.add_argument('-p', '--playlist',
  39. action='store_true',
  40. help='Downloads a saved playlist from your account.')
  41. group.add_argument('-s', '--search',
  42. dest='search_spotify',
  43. action='store_true',
  44. help='Loads search prompt to find then download a specific track, album or playlist')
  45. group.add_argument('-d', '--download',
  46. type=str,
  47. help='Downloads tracks, playlists and albums from the URLs written in the file passed.')
  48. for configkey in CONFIG_VALUES:
  49. parser.add_argument(CONFIG_VALUES[configkey]['arg'],
  50. type=str,
  51. default=None,
  52. help='Specify the value of the ['+configkey+'] config value')
  53. parser.set_defaults(func=client)
  54. args = parser.parse_args()
  55. args.func(args)