Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mymusiclist
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Brian Guadalupe
mymusiclist
Commits
f12e61dd
Commit
f12e61dd
authored
Nov 20, 2017
by
Deion Menor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into w3_styling
parents
ebd70c01
bc4759fc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
46 deletions
+62
-46
README.md
README.md
+7
-14
README.txt
SQL/README.txt
+0
-25
freshdb
SQL/freshdb
+0
-0
exthook.py
core/exthook.py
+6
-5
sqlite3
sqlite3
+0
-0
search.html
templates/search.html
+49
-2
No files found.
README.md
View file @
f12e61dd
...
@@ -6,6 +6,7 @@ This is a work in progress as of now...
...
@@ -6,6 +6,7 @@ This is a work in progress as of now...
## Prerequisites
## Prerequisites
*
Python 2.7/3.4 or later
*
Python 2.7/3.4 or later
*
`virtualenv`
(preferred)
*
`virtualenv`
(preferred)
*
`musicbrainzngs`
(required)
*
SQLite3 (for testing)
*
SQLite3 (for testing)
*
Add the
`sqlite3`
executable in your
`PATH`
*
Add the
`sqlite3`
executable in your
`PATH`
*
MySQL (for the final version)
*
MySQL (for the final version)
...
@@ -24,21 +25,13 @@ This assumes both Python and Git have been already installed and added to the `P
...
@@ -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)
*
`. `
*`path/to/venv/`*
`bin/activate`
(for Linux/Mac OS)
5.
Install Django using
`pip`
(inside the virtualenv)
5.
Install Django using
`pip`
(inside the virtualenv)
*
`pip install django`
*
`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
6.
Make sure that the
`migrations`
folder is empty except for the
`__init__.py`
file
7.
Delete the
`db.sqlite3`
file if it exists
7.
Delete the
`db.sqlite3`
file if it exists
8.
Run the following commands (inside the virtualenv):
8.
Get the
`SQL/freshdb`
file then copy it into the root directory
*
`python manage.py makemigrations core playlist search tag user`
9.
Rename file to db.sqlite3
*
`python manage.py migrate`
10.
Run the web server
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
*
`python manage.py runserver`
*
`python manage.py runserver`
1
2
.
(Optional) Create admin account to access the admin interface
1
1
.
(Optional) Create admin account to access the admin interface
*
`python manage.py createsuperuser`
*
`python manage.py createsuperuser`
\ No newline at end of file
SQL/README.txt
deleted
100644 → 0
View file @
ebd70c01
=========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
SQL/freshdb
0 → 100644
View file @
f12e61dd
File added
core/exthook.py
View file @
f12e61dd
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
pprint
import
pprint
import
musicbrainzngs
import
musicbrainzngs
from
musicbrainzngs
import
ResponseError
from
musicbrainzngs
import
ResponseError
from
musicbrainzngs
import
NetworkError
from
core.models
import
Album
from
core.models
import
Album
pp
=
pprint
.
PrettyPrinter
(
indent
=
4
)
pp
=
pprint
.
PrettyPrinter
(
indent
=
4
)
...
@@ -18,12 +19,12 @@ def verifyAlbumArt(album, artist):
...
@@ -18,12 +19,12 @@ def verifyAlbumArt(album, artist):
def
fetchAlbumArt
(
name
,
artist
):
def
fetchAlbumArt
(
name
,
artist
):
debug
(
"GET "
+
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
:
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
)
imagelist
=
musicbrainzngs
.
get_release_group_image_list
(
resultid
)
except
ResponseError
:
except
ResponseError
:
debug
(
"No image found."
)
debug
(
"No image found."
)
...
...
sqlite3
deleted
100644 → 0
View file @
ebd70c01
templates/search.html
View file @
f12e61dd
...
@@ -24,7 +24,23 @@
...
@@ -24,7 +24,23 @@
Year: {{i.year}}
</p>
Year: {{i.year}}
</p>
</div>
</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 %}
{% endif %}
...
@@ -41,7 +57,22 @@
...
@@ -41,7 +57,22 @@
{% endif %}
</p>
{% endif %}
</p>
{% endfor %}
{% endfor %}
</div>
</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 %}
{% endif %}
...
@@ -56,6 +87,22 @@
...
@@ -56,6 +87,22 @@
<p>
Artist:
<a
href=
"/artist/{{i.artist.id}}"
>
{{i.artist.name}}
</a><br>
<p>
Artist:
<a
href=
"/artist/{{i.artist.id}}"
>
{{i.artist.name}}
</a><br>
Year: {{i.album.year}}
</p>
Year: {{i.album.year}}
</p>
</div>
</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 %}
{% endif %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment