Commit e7a341a2 authored by Gink's avatar Gink

Increasing dummy data

parent 8d60a783
...@@ -10,6 +10,11 @@ Sqlite3 ...@@ -10,6 +10,11 @@ Sqlite3
.open db.sqlite3 .open db.sqlite3
.read SQL/sqlite3.sql .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 Now you can view tables with .tables and run sql statements
Assuming you have mysql installed, run: Assuming you have mysql installed, run:
......
-- Do NOT RUN -- Do NOT RUN
--artist extraction --artist extraction
INSERT INTO artist(id, name, description) INSERT INTO Artist(id, name, description)
select ag.artistid, ag.name, "No description available" from artists_group ag where ag.name in select ag.artistid, ag.name, "No description available" from artists_group ag where ag.name in
( (
"Taylor Swift", "Taylor Swift",
...@@ -26,18 +26,89 @@ select ag.artistid, ag.name, "No description available" from artists_group ag wh ...@@ -26,18 +26,89 @@ select ag.artistid, ag.name, "No description available" from artists_group ag wh
"Halsey", "Halsey",
"Jason Derulo", "Jason Derulo",
"ClariS", "ClariS",
"Post Malone" "Post Malone",
"5 Seconds of Summer",
"21 Savage",
"Adam Lambert",
"Adele",
"Alan Walker",
"Alessia Cara",
"Alesso",
"American Authors",
"Andy Grammer",
"Ariana Grande",
"Backstreet Boys",
"Bastille",
"Bebe Rexha",
"Big Sean",
"Bruno Mars",
"Calvin Harris",
"Camila Cabello",
"Cardiknox",
"The Chainsmokers",
"Charlie Puth",
"Chris Brown",
"Coldplay",
"David Guetta",
"Dawin",
"Daya",
"DJ Khaled",
"DNCE",
"Drake",
"Echosmith",
"Ellie Goulding",
"Fall Out Boy",
"Fetty Wap",
"Fifth Harmony",
"Flo Rida",
"Galantis",
"Hinder",
"Jay Sean",
"Imagine Dragons",
"Jason Derulo",
"Jason Mraz",
"Jessie J",
"Jonas Blue",
"Justin Bieber",
"Justin Timberlake",
"Katy Perry",
"Khalid",
"Lifehouse",
"Lorde",
"Maroon 5",
"Martin Garrix",
"Meghan Trainor",
"Miley Cyrus",
"Moderat",
"Nelly",
"Ne-Yo",
"Nicki Minaj",
"Owl City",
"Rihanna",
"Rixton",
"Sam Smith",
"The Script",
"Secondhand Serenade",
"Selena Gomez",
"Shawn Mendes",
"Sia",
"Starship",
"Troye Sivan",
"Twenty One Pilots",
"Wiz Khalifa",
"Zara Larsson",
"Zedd"
); );
--album extraction --album extraction
INSERT INTO album(id, album_name, year, artist_id) INSERT INTO Album(id, album_name, year, artist_id)
select tg.id, name, year, (select artistid from torrents_artists where groupid=tg.id order by importance asc limit 1) as artistidv select distinct tg.id, name, year, (select artistid from torrents_artists where groupid=tg.id order by importance asc limit 1) as artistidv
from torrents_group tg join torrents_artists ta on ta.groupid = tg.id from torrents_group tg join torrents_artists ta on ta.groupid = tg.id
where (select artistid from torrents_artists where groupid=tg.id order by importance asc limit 1) where (select artistid from torrents_artists where groupid=tg.id order by importance asc limit 1)
in (select id from artist) and (ta.artistid in (select id from artist)) and tg.releasetype=1 order by tg.id; in (select id from artist) and (ta.artistid in (select id from artist)) and tg.releasetype=1 order by tg.id;
--song extraction --song extraction
INSERT INTO song(song_name, genre, artist_id, album_id) INSERT INTO Song(song_name, genre, artist_id, album_id)
select (select filelist from torrents where groupid=album.id order by time desc limit 1), tg.taglist , artist.id, album.id select (select filelist from torrents where groupid=album.id order by time desc limit 1), tg.taglist , artist.id, album.id
from artist join album on album.artist_id = artist.id join torrents_group tg on tg.id = album.id; from artist join album on album.artist_id = artist.id join torrents_group tg on tg.id = album.id;
-- DO NOT RUN -- DO NOT RUN
create table user_account( create table UserAccount(
id int unique primary key auto_increment, id int unique primary key auto_increment,
first_name varchar(64) not null, first_name varchar(64) not null,
last_name varchar(64) not null, last_name varchar(64) not null,
email varchar(64) not null email varchar(64) not null
); );
create table artist( create table Artist(
id int unique primary key auto_increment, id int unique primary key auto_increment,
name varchar(64) not null, name varchar(64) not null,
description text description text
); );
create table album( create table Album(
id int unique primary key auto_increment, id int unique primary key auto_increment,
album_name varchar(64) not null, album_name varchar(64) not null,
year int(4) not null, year int(4) not null,
...@@ -20,7 +20,7 @@ create table album( ...@@ -20,7 +20,7 @@ create table album(
FOREIGN KEY (artist_id) REFERENCES artist(id) FOREIGN KEY (artist_id) REFERENCES artist(id)
); );
create table song( create table Song(
id int unique primary key auto_increment, id int unique primary key auto_increment,
song_name mediumtext not null, song_name mediumtext not null,
genre varchar(128), genre varchar(128),
...@@ -32,7 +32,7 @@ create table song( ...@@ -32,7 +32,7 @@ create table song(
FOREIGN KEY (album_id) REFERENCES album(id) FOREIGN KEY (album_id) REFERENCES album(id)
); );
create table music_playlist( create table MusicPlaylist(
id int unique primary key auto_increment, id int unique primary key auto_increment,
playlist_name varchar(32) not null, playlist_name varchar(32) not null,
is_public boolean not null, is_public boolean not null,
...@@ -40,7 +40,7 @@ create table music_playlist( ...@@ -40,7 +40,7 @@ create table music_playlist(
FOREIGN KEY (owner_id) REFERENCES user_account(id) FOREIGN KEY (owner_id) REFERENCES user_account(id)
); );
create table music_entry( create table MusicEntry(
id int unique primary key auto_increment, id int unique primary key auto_increment,
order_in_playlist int unique not null, order_in_playlist int unique not null,
rating ENUM('1','2','3','4','5','6','7','8','9','10'), rating ENUM('1','2','3','4','5','6','7','8','9','10'),
...@@ -50,12 +50,12 @@ create table music_entry( ...@@ -50,12 +50,12 @@ create table music_entry(
FOREIGN KEY (song_id) REFERENCES song(id) FOREIGN KEY (song_id) REFERENCES song(id)
); );
create table tag( create table Tag(
id int unique primary key auto_increment, id int unique primary key auto_increment,
name varchar(32) not null name varchar(32) not null
) )
create table tag_entry( create table TagEntry(
tag_id int, tag_id int,
entry_id int unique, entry_id int unique,
FOREIGN KEY (tag_id) REFERENCES tag(id), FOREIGN KEY (tag_id) REFERENCES tag(id),
......
This source diff could not be displayed because it is too large. You can view the blob instead.
# -*- coding: utf-8 -*-
# run in Django shell ONLY!!! # run in Django shell ONLY!!!
# python manage.py shell # python manage.py shell
# >>> exec(open('./SQL/populate_songs.py').read()) # >>> exec(open('./SQL/populate_songs.py').read())
from core.models import * from core.models import *
def extract_song_title(s): def extract_song_title(s):
clean = [] clean = []
i = 1 i = 1
for t in s.split(' ÷'): for t in s.split(u' ÷'):
if t == '': continue if t == '': continue
u = t.strip('\n').split() u = t.strip('\n').split()
if u[0] == '.flac' or u[0] == '.mp3' or u[0] == '.dts': if u[0] == '.flac' or u[0] == '.mp3' or u[0] == '.dts':
...@@ -18,12 +20,12 @@ def extract_song_title(s): ...@@ -18,12 +20,12 @@ def extract_song_title(s):
def prettify_genre(g): def prettify_genre(g):
return ', '.join([h.replace('_',' ') for h in g.split()]) return ', '.join([h.replace('_',' ') for h in g.split()])
for song in Song.objects.filter(song_name__startswith="."): for i in Song.objects.filter(song_name__startswith="."):
songlst = extract_song_title(song.song_name) songlst = extract_song_title(i.song_name)
for e in songlst: for e in songlst:
Song.objects.create(song_name=e, genre=prettify_genre(song.genre), artist=song.artist, album=song.album) Song.objects.create(song_name=e, genre=prettify_genre(i.genre), artist=i.artist, album=i.album)
# uncomment the next line if you want to delete the original entry after parsing # uncomment the next line if you want to delete the original entry after parsing
# song.delete() i.delete()
# if something messed up above, uncomment these lines # if something messed up above, uncomment these lines
# for song in Song.objects.exclude(song_name__startswith="."): # for song in Song.objects.exclude(song_name__startswith="."):
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -12,7 +12,7 @@ MyMusicList is the answer. ...@@ -12,7 +12,7 @@ MyMusicList is the answer.
</p> </p>
</div> </div>
<div class="features main"> <div class="boxified main">
<h2>Features</h2> <h2>Features</h2>
<p> <p>
<div class="img-container"> <div class="img-container">
......
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