Skip to content

Commit

Permalink
Created 'add_user_to_queue' function and updated readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
samwightt committed Jan 11, 2019
1 parent 0c9fe05 commit 26a1c5e
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -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"
65 changes: 65 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
17 changes: 17 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 26a1c5e

Please sign in to comment.