Commit e7a341a2 authored by Gink's avatar Gink

Increasing dummy data

parent 8d60a783
......@@ -10,6 +10,11 @@ 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:
......
-- Do NOT RUN
--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
(
"Taylor Swift",
......@@ -26,18 +26,89 @@ select ag.artistid, ag.name, "No description available" from artists_group ag wh
"Halsey",
"Jason Derulo",
"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
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
INSERT INTO Album(id, album_name, year, artist_id)
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
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;
--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
from artist join album on album.artist_id = artist.id join torrents_group tg on tg.id = album.id;
-- DO NOT RUN
create table user_account(
create table UserAccount(
id int unique primary key auto_increment,
first_name varchar(64) not null,
last_name varchar(64) not null,
email varchar(64) not null
);
create table artist(
create table Artist(
id int unique primary key auto_increment,
name varchar(64) not null,
description text
);
create table album(
create table Album(
id int unique primary key auto_increment,
album_name varchar(64) not null,
year int(4) not null,
......@@ -20,7 +20,7 @@ create table album(
FOREIGN KEY (artist_id) REFERENCES artist(id)
);
create table song(
create table Song(
id int unique primary key auto_increment,
song_name mediumtext not null,
genre varchar(128),
......@@ -32,7 +32,7 @@ create table song(
FOREIGN KEY (album_id) REFERENCES album(id)
);
create table music_playlist(
create table MusicPlaylist(
id int unique primary key auto_increment,
playlist_name varchar(32) not null,
is_public boolean not null,
......@@ -40,7 +40,7 @@ create table music_playlist(
FOREIGN KEY (owner_id) REFERENCES user_account(id)
);
create table music_entry(
create table MusicEntry(
id int unique primary key auto_increment,
order_in_playlist int unique not null,
rating ENUM('1','2','3','4','5','6','7','8','9','10'),
......@@ -50,12 +50,12 @@ create table music_entry(
FOREIGN KEY (song_id) REFERENCES song(id)
);
create table tag(
create table Tag(
id int unique primary key auto_increment,
name varchar(32) not null
)
create table tag_entry(
create table TagEntry(
tag_id int,
entry_id int unique,
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!!!
# python manage.py shell
# >>> exec(open('./SQL/populate_songs.py').read())
from core.models import *
def extract_song_title(s):
clean = []
i = 1
for t in s.split(' ÷'):
for t in s.split(u' ÷'):
if t == '': continue
u = t.strip('\n').split()
if u[0] == '.flac' or u[0] == '.mp3' or u[0] == '.dts':
......@@ -18,12 +20,12 @@ def extract_song_title(s):
def prettify_genre(g):
return ', '.join([h.replace('_',' ') for h in g.split()])
for song in Song.objects.filter(song_name__startswith="."):
songlst = extract_song_title(song.song_name)
for i in Song.objects.filter(song_name__startswith="."):
songlst = extract_song_title(i.song_name)
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
# song.delete()
i.delete()
# if something messed up above, uncomment these lines
# 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.
</p>
</div>
<div class="features main">
<div class="boxified main">
<h2>Features</h2>
<p>
<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