Compare commits

1 Commits

Author SHA1 Message Date
d8e4b0f6dd Improve installation instructions 2019-08-23 11:07:42 -04:00
2 changed files with 40 additions and 35 deletions

View File

@@ -8,47 +8,51 @@ These instructions will get you a copy of the project up and running on your loc
### Prerequisites ### Prerequisites
Before starting the setup, make sure Python 3 and PostgreSQL is installed on your system. - Python 3
- `pip`
- PostgreSQL
#### On Debian/Ubunu
``` shell
sudo apt-get install python3-pip
sudo apt-get install postgresql
sudo apt-get install python-psycopg2
sudo apt-get install libpq-dev
pip install --user virtualenv
```
<!--- installation steps {{{ --> <!--- installation steps {{{ -->
### Installing ### Installing
1. Use the pip tool to install `virtualenv`. See this [guide](http://docs.python-guide.org/en/latest/dev/virtualenvs/) for further details. 1. Create a virtual environment.
``` shell
virtualenv /path/to/new/virtual/environment
```
``` 1. `cd` into the directory you just created a virtual environment in,
pip install --user pipenv
```
2. Create a virtual environment.
```
python3 -m venv /path/to/new/virtual/environment
```
3. `cd` into the directory you just created a virtual environment in,
and clone the GitHub repo: and clone the GitHub repo:
``` shell
cd /path/to/new/virtual/environment
git clone https://github.com/Kevin-Mok/spotify-lib-vis
```
``` 1. Activate the virtual environment from the command line.
cd /path/to/new/virtual/environment ``` shell
git clone https://github.com/Kevin-Mok/spotify-lib-vis # activate.fish if you're using fish shell
``` source bin/activate
4. Activate the virtual environment from the command line. ```
``` 1. `cd` into the repository root directory and install all dependencies using `pip`.
# activate.fish if you're using fish shell ``` shell
source bin/activate cd spotify-lib-vis
``` pip3 install -r requirements.txt
5. `cd` into the repository root directory and install all ```
dependencies using `pip`.
``` 1. Run `reset_db.sh` to create the database and start the server.
cd spotify-lib-vis ``` shell
pip install -r requirements.txt ./scripts/reset_db.sh
``` ```
6. Run `reset_db.sh` to create the database and start the server.
```
./scripts/reset_db.sh
```
<!--- }}} installation steps --> <!--- }}} installation steps -->

View File

@@ -1,5 +1,6 @@
-- select t.name as track, a.name as artist -- select t.name as track, a.name as artist
select substring(t.name for 50) as track, a.name as artist, count(t.id) select distinct on (1)
timestamp, substring(t.name for 50) as track, a.name as artist
from api_history as h from api_history as h
join api_track as t join api_track as t
on h.track_id = t.id on h.track_id = t.id
@@ -7,6 +8,6 @@ join api_track_artists ta
on ta.track_id = t.id on ta.track_id = t.id
join api_artist a join api_artist a
on a.id = ta.artist_id on a.id = ta.artist_id
group by t.id, a.id order by timestamp desc
order by count(t.id) desc; -- ;
-- limit 10; limit 20;