amcquade / fresh_script

Find Spotify tracks posted to the HipHopHeads subreddit and add them to a Spotify playlist.
MIT License
91 stars 61 forks source link

Consolidate configuration to a single file #62

Open pricebenjamin opened 4 years ago

pricebenjamin commented 4 years ago

Currently, fresh.py reads from three separate configuration files: .config.ini, credentials.json, and praw.ini.

To make initialization easier for new users, I propose we expect a single configuration file, config.ini (no longer hidden), with the following structure:

[spotify]
username = <username>
client_id = <client_id>
client_secret = <client_secret>
redirect_uri = <redirect_uri>

[reddit]
username = <username>
client_id = <client_id>
client_secret = <client_secret>

Note that we request the reddit username as well. This allows us to create a user-agent string that better follows the reddit API rules. (Better user-agent strings will be requested in a separate issue.)

pricebenjamin commented 4 years ago

I've created a branch which implements the above proposal, but it does so at the cost of trampling over other contributors' code. A more community-friendly approach should be taken before creating a pull request. I'll leave a link as a resource for future work on this issue.

https://github.com/pricebenjamin/fresh_script/tree/consolidate-config

dtcrout commented 4 years ago

Maybe there's something that can be used from my Spotify project? I've made a PR on this project in regards to the config, but since then it's been improved:

Maybe these features can be added to the project?

pricebenjamin commented 4 years ago

@dtcrout, your project is a great reference. Thank you for the input!

Having a tool, like a Makefile, generate a skeleton config file is also a good idea. This could perhaps be addressed in a separate issue.

We would still need to address the problem of consolidating all configuration parameters into one file.