Commit bc4759fc authored by Brian Guadalupe's avatar Brian Guadalupe

Merge branch 'patch-1' into 'master'

Miscellaneous changes

See merge request brian/mymusiclist!14
parents cef7513f 588026ad
......@@ -6,6 +6,7 @@ This is a work in progress as of now...
## Prerequisites
* Python 2.7/3.4 or later
* `virtualenv` (preferred)
* `musicbrainzngs` (required)
* SQLite3 (for testing)
* Add the `sqlite3` executable in your `PATH`
* MySQL (for the final version)
......@@ -24,21 +25,13 @@ This assumes both Python and Git have been already installed and added to the `P
* `. `*`path/to/venv/`*`bin/activate` (for Linux/Mac OS)
5. Install Django using `pip` (inside the virtualenv)
* `pip install django`
6. Install musicbrainzngs using `pip` (also inside the virtualenv)
* `pip install musicbrainzngs`
6. Make sure that the `migrations` folder is empty except for the `__init__.py` file
7. Delete the `db.sqlite3` file if it exists
8. Run the following commands (inside the virtualenv):
* `python manage.py makemigrations core playlist search tag user`
* `python manage.py migrate`
9. Open the `db.sqlite3` file in sqlite3, and run the following commands:
* *`sqlite> `* `.read SQL/sqlite3.sql`
* *`sqlite> `* `.quit`
10. Populate the songs database
* Run `python manage.py shell`
* ~~*`>>> `* `exec(open('./SQL/populate_songs.py').read())`~~ DOESN'T WORK YET!
* Instead, copy everything from `populate_songs.py` and then paste into the shell
* *`>>> `* `run()`
* This works for now...
11. Run the web server
8. Get the `SQL/freshdb` file then copy it into the root directory
9. Rename file to db.sqlite3
10. Run the web server
* `python manage.py runserver`
12. (Optional) Create admin account to access the admin interface
11. (Optional) Create admin account to access the admin interface
* `python manage.py createsuperuser`
\ No newline at end of file
=========DO NOT RUN===========
mymusiclist.sql
convert
extract.sql
Assuming you have sqlite3 installed and Django setup with migrations,
While in same directory as db.sqlite3, run:
Sqlite3
.open db.sqlite3
.read SQL/sqlite3.sql
If you're not yet migrated, then do this first:
python manage.py makemigrations core
python manage.py migrate
Now you can view tables with .tables and run sql statements
Assuming you have mysql installed, run:
Mysql
Use mymusiclist
Source sql/mysql.sql
File added
......@@ -2,6 +2,7 @@
import pprint
import musicbrainzngs
from musicbrainzngs import ResponseError
from musicbrainzngs import NetworkError
from core.models import Album
pp = pprint.PrettyPrinter(indent=4)
......@@ -18,12 +19,12 @@ def verifyAlbumArt(album, artist):
def fetchAlbumArt(name, artist):
debug("GET " + name + " " + artist)
results = musicbrainzngs.search_release_groups(name, limit = 3, artistname=artist, primarytype="album")
#pp.pprint(results['release-group-list'])
results = results['release-group-list']
resultid = results[0]['id']
debug("ID = " + resultid)
try:
results = musicbrainzngs.search_release_groups(name, limit = 3, artistname=artist, primarytype="album")
#pp.pprint(results['release-group-list'])
results = results['release-group-list']
resultid = results[0]['id']
debug("ID = " + resultid)
imagelist = musicbrainzngs.get_release_group_image_list(resultid)
except ResponseError:
debug("No image found.")
......
......@@ -24,7 +24,23 @@
Year: {{i.year}} </p>
</div>
<!-- ... -->
{% if request.user.is_authenticated %}
<!-- ... -->
<div class="w3-dropdown-hover">
<button id="search_type" class="w3-button" style="width:200px; text-align: left;"><i class="fa fa-caret-down"></i> </button>
<div class="w3-dropdown-content w3-bar-block w3-card-4">
<button class=" w3-bar-item w3-button">Update existing playlist</button>
<button onclick="alert('{{type}} id is {{i.id}}')">Show {{type}}</button>
<button class=" w3-bar-item w3-button">Create new playlist</button>
</div>
</div>
<!-- ... -->
{% endif %}
<!-- ... -->
{% endif %}
......@@ -41,7 +57,22 @@
{% endif %} </p>
{% endfor %}
</div>
<!-- ... -->
{% if request.user.is_authenticated %}
<!-- ... -->
<div class="w3-dropdown-hover">
<button id="search_type" class="w3-button" style="width:200px; text-align: left;"><i class="fa fa-caret-down"></i> </button>
<div class="w3-dropdown-content w3-bar-block w3-card-4">
<button class=" w3-bar-item w3-button">Update existing playlist</button>
<button onclick="alert('{{type}} id is {{i.id}}')">Show {{type}}</button>
<button class=" w3-bar-item w3-button">Create new playlist</button>
</div>
</div>
<!-- ... -->
{% endif %}
<!-- ... -->
{% endif %}
......@@ -56,6 +87,22 @@
<p>Artist: <a href="/artist/{{i.artist.id}}">{{i.artist.name}}</a><br>
Year: {{i.album.year}} </p>
</div>
<!-- ... -->
{% if request.user.is_authenticated %}
<!-- ... -->
<div class="w3-dropdown-hover">
<button id="search_type" class="w3-button" style="width:200px; text-align: left;"><i class="fa fa-caret-down"></i> </button>
<div class="w3-dropdown-content w3-bar-block w3-card-4">
<button class=" w3-bar-item w3-button">Update existing playlist</button>
<button onclick="alert('{{type}} id is {{i.id}}')">Show {{type}}</button>
<button class=" w3-bar-item w3-button">Create new playlist</button>
</div>
</div>
<!-- ... -->
{% endif %}
<!-- ... -->
{% endif %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment