diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..e298065 --- /dev/null +++ b/Pipfile @@ -0,0 +1,13 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] +requests = "*" +redis = "*" + +[requires] +python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..df84f15 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,65 @@ +{ + "_meta": { + "hash": { + "sha256": "ab7c026fd34693d5315e0b6465d20fda7ca1f5c5eb74b8933675d1ff84cd10a7" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.7" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "certifi": { + "hashes": [ + "sha256:47f9c83ef4c0c621eaef743f133f09fa8a74a9b75f037e8624f83bd1b6626cb7", + "sha256:993f830721089fef441cdfeb4b2c8c9df86f0c63239f06bd025a76a7daddb033" + ], + "version": "==2018.11.29" + }, + "chardet": { + "hashes": [ + "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", + "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" + ], + "version": "==3.0.4" + }, + "idna": { + "hashes": [ + "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", + "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c" + ], + "version": "==2.8" + }, + "redis": { + "hashes": [ + "sha256:2100750629beff143b6a200a2ea8e719fcf26420adabb81402895e144c5083cf", + "sha256:8e0bdd2de02e829b6225b25646f9fb9daffea99a252610d040409a6738541f0a" + ], + "index": "pypi", + "version": "==3.0.1" + }, + "requests": { + "hashes": [ + "sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e", + "sha256:7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b" + ], + "index": "pypi", + "version": "==2.21.0" + }, + "urllib3": { + "hashes": [ + "sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39", + "sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22" + ], + "version": "==1.24.1" + } + }, + "develop": {} +} diff --git a/README.md b/README.md index f0e35b9..3dfb070 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,11 @@ Software to visualize Last.FM data. Built with Python. # Requirements This project uses Python 3 and requires Redis to store all data. + +This project also requires a Last.FM API key. To get one, simply go to the Last.FM api website and create a new application. Create an `apiKey.py` file with the following contents: + + apiKey = "YOUR_API_KEY_HERE" + apiSecret = "YOUR_API_SECRET_HERE" + +The project will include this file throughout to make requests as needed. +Make sure to add this file to your `.gitignore` file if you do make contributions to this repo. diff --git a/main.py b/main.py new file mode 100644 index 0000000..4431aa5 --- /dev/null +++ b/main.py @@ -0,0 +1,17 @@ +import requests +import redis +from apiKey import apiKey + +redisClient = redis.Redis() + +def add_tracks_to_database(tracks): + print("Doing!") + print(tracks) + +def add_user_to_queue(username): + url = 'https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=' + username + '&api_key=' + apiKey + '&format=json&limit=200' + r = requests.get(url) + content = r.json() + + if not 'error' in content: + redisClient.lpush('userQueue', username)