diff --git a/README.md b/README.md
index 64e5927..eab5cee 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1 @@
-Nama : Kevin Ivan Eda Radhiyya
-
-NPM : 2201233210
-
-Kelas : PBP B
\ No newline at end of file
+Ubah
\ No newline at end of file
diff --git a/akun/__init__.py b/akun/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/akun/admin.py b/akun/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/akun/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/akun/apps.py b/akun/apps.py
new file mode 100644
index 0000000..8ed3838
--- /dev/null
+++ b/akun/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class AkunConfig(AppConfig):
+ default_auto_field = "django.db.models.BigAutoField"
+ name = "akun"
diff --git a/akun/deskripsi.txt b/akun/deskripsi.txt
new file mode 100644
index 0000000..15bad12
--- /dev/null
+++ b/akun/deskripsi.txt
@@ -0,0 +1,2 @@
+akun ini untuk nampilin dashboard-> kan ada beberapa role yang kenak -> tpai tetep pengguna
+ini fungsinya.
\ No newline at end of file
diff --git a/akun/migrations/__init__.py b/akun/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/akun/models.py b/akun/models.py
new file mode 100644
index 0000000..71a8362
--- /dev/null
+++ b/akun/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/akun/templates/dashboard.html b/akun/templates/dashboard.html
new file mode 100644
index 0000000..a689553
--- /dev/null
+++ b/akun/templates/dashboard.html
@@ -0,0 +1,105 @@
+
+
+ {% include 'nav.html' %}
+
+
+
+
+ Dashboard
+
+
+
+ Dashboard
+ Informasi Profil Pengguna
+
+ Nama: {{ request.session.user_data.nama }}
+ Email: {{ request.session.user_data.email }}
+
+ {% if not request.session.user_data.is_label %}
+ {% if request.session.user_data.is_premium %}
+ Status Langganan: Premium
+ {% else %}
+ Status Langganan: Non Premium
+ {% endif %}
+ {% endif %}
+
+
+ {% if request.session.user_data.is_label%}
+
+ Kontak: {{user_data.kontak }}
+ {% endif %}
+
+ {% if not request.session.user_data.is_label%}
+ Kota Asal: {{ user_data.kota_asal }}
+ {% if request.session.user_data.gender == 0 %}
+ Gender: Perempuan
+ {% else %}
+ Gender: Laki-laki
+ {% endif%}
+ Tempat Lahir: {{ user_data.tempat_lahir }}
+ Tanggal Lahir: {{ user_data.tanggal_lahir }}
+ {% endif %}
+ {% if request.session.user_data.roles %}
+ Role:
+ {% for role in request.session.user_data.roles %}
+ {% if not forloop.first %}, {% endif %}
+ {{ role }}
+ {% endfor %}
+
+ {% endif %}
+
+
+ {% if not request.session.user_data.is_label and not request.session.user_data.is_artist and not request.session.user_data.is_songwriter and not request.session.user_data.is_podcaster %}
+ {% if playlists %}
+ Daftar Playlist
+
+ {% for playlist in playlists %}
+ {{ playlist }}
+ {% endfor %}
+
+ {% else %}
+ Belum Memiliki Playlist
+ {% endif %}
+ {% endif %}
+
+ {% if request.session.user_data.is_artist or request.session.user_data.is_songwriter and not request.session.user_data.is_podcaster%}
+ {% if songs %}
+ Daftar Lagu
+
+ {% for song in songs %}
+ {{ song }}
+ {% endfor %}
+
+ {% else %}
+ Belum Memiliki Lagu
+ {% endif %}
+
+ {% endif %}
+
+ {% if request.session.user_data.is_podcaster %}
+ {% if podcasts %}
+ Daftar Podcast
+
+ {% for podcast in podcasts %}
+ {{ podcast }}
+ {% endfor %}
+
+ {% else %}
+ Belum Memiliki Podcast
+ {% endif %}
+ {% endif %}
+
+ {% if request.session.user_data.is_label %}
+ {% if albums %}
+ Daftar Album
+
+ {% for album in albums %}
+ {{ album }}
+ {% endfor %}
+
+ {% else %}
+ Belum Memproduksi Album
+ {% endif %}
+ {% endif %}
+
+
diff --git a/akun/templates/home.html b/akun/templates/home.html
new file mode 100644
index 0000000..dab8ebd
--- /dev/null
+++ b/akun/templates/home.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+ Marmut
+
+
+
+
+
+
+
+
+
+
+
diff --git a/akun/templates/list_tables.html b/akun/templates/list_tables.html
new file mode 100644
index 0000000..98a90cd
--- /dev/null
+++ b/akun/templates/list_tables.html
@@ -0,0 +1,14 @@
+
+
+
+ List of Tables
+
+
+ Tables in Database
+
+ {% for table in tables %}
+ {{ table }}
+ {% endfor %}
+
+
+
diff --git a/akun/templates/login.html b/akun/templates/login.html
new file mode 100644
index 0000000..80f623a
--- /dev/null
+++ b/akun/templates/login.html
@@ -0,0 +1,34 @@
+
+
+
+
+
+ Form Login
+
+
+
+
+
+
+
+
+
+
diff --git a/akun/templates/register_choice.html b/akun/templates/register_choice.html
new file mode 100644
index 0000000..ba43b0b
--- /dev/null
+++ b/akun/templates/register_choice.html
@@ -0,0 +1,19 @@
+ {% include 'nav.html' %}
+
+
+
+
+
+
+ Pilihan Registrasi
+
+
+ Pilihan Registrasi
+ Silakan pilih peran Anda:
+
+
+
+
diff --git a/akun/templates/register_label.html b/akun/templates/register_label.html
new file mode 100644
index 0000000..9275c17
--- /dev/null
+++ b/akun/templates/register_label.html
@@ -0,0 +1,41 @@
+
+
+{% include 'nav.html' %}
+
+
+
+
+
+ Register Label
+
+
+
+
+
+
diff --git a/akun/templates/register_pengguna.html b/akun/templates/register_pengguna.html
new file mode 100644
index 0000000..f4bd0cd
--- /dev/null
+++ b/akun/templates/register_pengguna.html
@@ -0,0 +1,70 @@
+
+{% include 'nav.html' %}
+
+
+
+
+
+ Register Pengguna
+
+
+
+
+
+
diff --git a/akun/tests.py b/akun/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/akun/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/akun/urls.py b/akun/urls.py
new file mode 100644
index 0000000..6e58264
--- /dev/null
+++ b/akun/urls.py
@@ -0,0 +1,12 @@
+from django.urls import path
+from .views import *
+app_name = 'akun'
+
+urlpatterns = [
+ path('login/', login_with_postgres, name='login' ),
+ path('register_choice/', register_choice, name='register_choice'),
+ path('dashboard/', dashboard, name='dashboard'),
+ path('register/pengguna/', register_pengguna, name='register_pengguna'),
+ path('register/label/', register_label, name='register_label'),
+ path('logout/', logout_view, name='logout'),
+]
\ No newline at end of file
diff --git a/akun/views.py b/akun/views.py
new file mode 100644
index 0000000..2690074
--- /dev/null
+++ b/akun/views.py
@@ -0,0 +1,464 @@
+import logging
+import random
+from django.shortcuts import render
+from django.shortcuts import render, redirect
+from django.contrib.auth import authenticate, login
+from django.contrib import messages
+import uuid
+# from .forms import LoginForm -> ga usah pakai form langsung dari login.html aja(?)
+import json
+from django.db import connection
+# from connect_postgres import execute_sql_query
+from django.shortcuts import render, redirect
+from django.contrib.auth.decorators import login_required
+from django.http import JsonResponse,HttpResponseRedirect
+import datetime
+import uuid
+from django.views.decorators.csrf import csrf_exempt
+from django.contrib import messages
+from django.contrib.auth.hashers import check_password
+from django.urls import reverse
+import psycopg2
+from django.shortcuts import render, redirect
+from django.contrib import messages
+from django.db import connection
+# Create your views here.
+
+def dashboard(request):
+ # Ambil data pengguna dari session
+ user_data = request.session.get('user_data', {})
+
+ # Initialize role flags
+ user_data.update({
+ 'is_artist': False,
+ 'is_songwriter': False,
+ 'is_podcaster': False,
+ 'is_label': False,
+ 'is_pengguna': False,
+ 'is_premium' : False,
+ 'roles': [],
+
+
+ })
+ #cek apakah dia premium atau tidak di table premium
+ query_premium = f"SELECT 1 FROM marmut.premium WHERE email = '{user_data.get('email')}'"
+ with connection.cursor() as cursor:
+ cursor.execute(query_premium)
+ user_data['is_premium'] = cursor.fetchone() is not None
+
+ # Check for Artist
+ query_artist = f"SELECT 1 FROM marmut.artist WHERE email_akun = '{user_data.get('email')}'"
+ with connection.cursor() as cursor:
+ cursor.execute(query_artist)
+ user_data['is_artist'] = cursor.fetchone() is not None
+ user_data['roles'].append('Artist') if user_data['is_artist'] else ''
+
+ # Check for Pengguna
+ query_pengguna = f"SELECT 1 FROM marmut.akun WHERE email = '{user_data.get('email')}'"
+ with connection.cursor() as cursor:
+ cursor.execute(query_pengguna)
+ user_data['is_pengguna'] = cursor.fetchone() is not None
+ user_data['roles'].append('Pengguna') if user_data['is_pengguna'] else ''
+
+ # Check for Songwriter
+ query_songwriter = f"SELECT 1 FROM marmut.songwriter WHERE email_akun = '{user_data.get('email')}'"
+ with connection.cursor() as cursor:
+ cursor.execute(query_songwriter)
+ user_data['is_songwriter'] = cursor.fetchone() is not None
+ user_data['roles'].append('Songwriter') if user_data['is_songwriter'] else ''
+
+ # Check for Podcaster
+ query_podcaster = f"SELECT 1 FROM marmut.podcaster WHERE email = '{user_data.get('email')}'"
+ with connection.cursor() as cursor:
+ cursor.execute(query_podcaster)
+ user_data['is_podcaster'] = cursor.fetchone() is not None
+ user_data['roles'].append('Podcaster') if user_data['is_podcaster'] else ''
+
+ # Check for Label
+ query_label = f"SELECT 1 FROM marmut.label WHERE email = '{user_data.get('email')}'"
+ with connection.cursor() as cursor:
+ cursor.execute(query_label)
+ user_data['is_label'] = cursor.fetchone() is not None
+ user_data['roles'].append('Label') if user_data['is_label'] else ''
+
+ # Update session with user_data
+ user_data['is_logged_in'] = any([user_data['is_artist'], user_data['is_songwriter'], user_data['is_podcaster'], user_data['is_label'], user_data['is_pengguna']])
+ print("cekk")
+ print(user_data['is_logged_in'])
+ request.session['user_data'] = user_data
+
+ # Query to get user info
+ if user_data.get('is_label'):
+ query_info = f"""
+ SELECT nama, email, kontak
+ FROM marmut.label
+ WHERE email = '{user_data.get('email')}'
+ """
+ else:
+ query_info = f"""
+ SELECT email, nama, kota_asal, gender, tempat_lahir, tanggal_lahir
+ FROM marmut.akun
+ WHERE email = '{user_data.get('email')}'
+ """
+
+ with connection.cursor() as cursor:
+ cursor.execute(query_info)
+ columns = [col[0] for col in cursor.description]
+ user_info = dict(zip(columns, cursor.fetchone()))
+
+ playlists = []
+ songs_artist = []
+ songs_songwriter = []
+ podcasts = []
+ albums = []
+
+ # Contoh query untuk pengguna biasa
+ if not user_data.get('is_label'):
+ query_playlists = f"""
+ SELECT judul
+ FROM marmut.user_playlist
+ WHERE email_pembuat = '{user_data.get('email')}'
+ """
+ with connection.cursor() as cursor:
+ cursor.execute(query_playlists)
+ playlists = [row[0] for row in cursor.fetchall()]
+
+ # Kalau dia artist
+ if user_data.get('is_artist'):
+ query_songs_artist = f"""
+ SELECT k.judul
+ FROM marmut.konten k
+ JOIN marmut.song s ON k.id = s.id_konten
+ JOIN marmut.artist a ON s.id_artist = a.id
+ WHERE a.email_akun = '{user_data.get('email')}'
+ """
+ with connection.cursor() as cursor:
+ cursor.execute(query_songs_artist)
+ songs_artist = [row[0] for row in cursor.fetchall()]
+
+ # Kalau dia songwriter
+ if user_data.get('is_songwriter'):
+ query_songs_songwriter = f"""
+ SELECT k.judul
+ FROM marmut.konten k
+ JOIN marmut.songwriter_write_song sws ON k.id = sws.id_song
+ JOIN marmut.songwriter sw ON sws.id_songwriter = sw.id
+ WHERE sw.email_akun = '{user_data.get('email')}'
+ """
+ with connection.cursor() as cursor:
+ cursor.execute(query_songs_songwriter)
+ songs_songwriter = [row[0] for row in cursor.fetchall()]
+
+ # Kalau dia podcaster
+ if user_data.get('is_podcaster'):
+ query_podcasts = f"""
+ SELECT k.judul
+ FROM marmut.konten k
+ JOIN marmut.podcast p ON k.id = p.id_konten
+ WHERE p.email_podcaster = '{user_data.get('email')}'
+ """
+ with connection.cursor() as cursor:
+ cursor.execute(query_podcasts)
+ podcasts = [row[0] for row in cursor.fetchall()]
+
+ # Kalau dia label
+ if user_data.get('is_label'):
+ query_albums = f"""
+ SELECT a.judul
+ FROM marmut.album a
+ JOIN marmut.label l ON a.id_label = l.id
+ WHERE l.email = '{user_data.get('email')}'
+ """
+ with connection.cursor() as cursor:
+ cursor.execute(query_albums)
+ albums = [row[0] for row in cursor.fetchall()]
+
+ context = {
+ 'user_data': user_info,
+ 'playlists': playlists,
+ 'songs_artist': songs_artist,
+ 'songs_songwriter': songs_songwriter,
+ 'podcasts': podcasts,
+ 'albums': albums
+ }
+ print(user_data)
+ print("albummmm")
+ print(albums)
+
+ return render(request, 'dashboard.html', context)
+
+#coba yang baru login nya
+@csrf_exempt
+def login_with_postgres(request):
+ if request.method == 'POST':
+ email = request.POST.get('email')
+ password = request.POST.get('password')
+
+
+ # Query untuk mencari pengguna atau label berdasarkan email dan mengambil passwordnya
+ query_akun = f"SELECT email, password, nama FROM marmut.akun WHERE email = %s"
+ query_label = f"SELECT email, password, nama FROM marmut.label WHERE email = %s"
+
+ user_akun = None
+
+ with connection.cursor() as cursor:
+ cursor.execute(query_akun, [email])
+ user_akun = cursor.fetchone()
+
+ if not user_akun:
+ cursor.execute(query_label, [email])
+ user_akun = cursor.fetchone()
+
+ if user_akun:
+ email, stored_password, nama = user_akun
+
+ # Check if the provided password matches the stored password
+ if stored_password == password:
+ # Check for roles
+ queries = {
+ 'is_artist': f"SELECT 1 FROM marmut.artist WHERE email_akun = %s",
+ 'is_songwriter': f"SELECT 1 FROM marmut.songwriter WHERE email_akun = %s",
+ 'is_podcaster': f"SELECT 1 FROM marmut.podcaster WHERE email = %s",
+ }
+ roles = {}
+ for role, query in queries.items():
+ cursor.execute(query, [email])
+ roles[role] = cursor.fetchone() is not None
+
+ # Check if the user is a label
+ is_label = False
+ cursor.execute(query_label, [email])
+ if cursor.fetchone():
+ is_label = True
+
+ # Set user data in session
+ request.session['user_data'] = {
+ 'email': email,
+ 'nama': nama,
+ 'is_premium': False, # Modify this if you need to set it dynamically
+ 'is_artist': roles.get('is_artist', False),
+ 'is_songwriter': roles.get('is_songwriter', False),
+ 'is_podcaster': roles.get('is_podcaster', False),
+ 'is_label': is_label,
+ 'is_logged_in': True,
+ 'roles': roles
+ }
+
+ user_data = request.session['user_data']
+ email = user_data['email']
+ try:
+ cursor.execute("DELETE FROM marmut.premium WHERE email = %s", (email,))
+ except psycopg2.Error as e:
+ if 'Premium period still valid' in str(e):
+ user_data['is_prem'] = True
+ else:
+ messages.error(request, e)
+ if 'is_prem' not in user_data:
+ user_data['is_prem'] = False
+
+ # cursor.execute("SELECT * FROM marmut.premium WHERE email = %s", (email,))
+ # prem_flag = cursor.fetchone()
+ # print(email)
+ # print(prem_flag)
+ # # Jika None -> non prem
+
+ # # Jika pengguna premium
+ # if (prem_flag):
+ # email = prem_flag[0]
+ # query = """
+ # SELECT *
+ # FROM marmut.transaction
+ # WHERE email = %s
+ # ORDER BY timestamp_dimulai DESC
+ # LIMIT 1;
+ # """
+ # cursor.execute(query, (email,))
+ # latest_transaction = cursor.fetchone()
+
+ # if latest_transaction:
+ # timestamp_berakhir = latest_transaction[4]
+ # if timestamp_berakhir < datetime.datetime.now():
+ # cursor.execute("DELETE FROM marmut.downloaded_song WHERE email_downloader = %s", (email,))
+ # cursor.execute("DELETE FROM marmut.premium WHERE email = %s", (email,))
+ # cursor.execute("INSERT INTO marmut.nonpremium (email) VALUES (%s)", (email,))
+ # else:
+ # user_data['is_prem'] = True
+
+
+ print("\n================ DEBUG AREA ================")
+ print(request.session['user_data'])
+ print("\n")
+ user_data = request.session['user_data']
+ for key, value in user_data.items():
+ print(key + ": " + str(value))
+ print("================ DEBUG AREA ================\n")
+
+ # return redirect('akun:dashboard')
+ response = redirect('akun:dashboard')
+ response.set_cookie('email', email)
+ return response
+ else:
+ messages.error(request, 'Maaf, password yang Anda masukkan salah.')
+ else:
+ messages.error(request, 'Pengguna tidak ditemukan.')
+
+ return render(request, "login.html")
+
+#show_home
+def home(request):
+ return render(request, 'home.html')
+
+#register yang dasar
+def register_choice(request):
+ return render(request, 'register_choice.html')
+
+#register label
+def register_label(request):
+ if request.method == 'POST':
+ email = request.POST.get('email')
+ password = request.POST.get('password')
+ nama = request.POST.get('nama')
+ kontak = request.POST.get('kontak')
+
+ with connection.cursor() as cursor:
+ id_hak_cipta = uuid.uuid4()
+ rate_pemilik_hak_cipta = random.randint(101,999)
+ cursor.execute("""
+ INSERT INTO marmut.pemilik_hak_cipta (id, rate_royalti)
+ VALUES(%s, %s)
+ """, [id_hak_cipta, rate_pemilik_hak_cipta])
+
+ id_label = uuid.uuid4()
+ cursor.execute("""
+ INSERT INTO marmut.label (id, email, password, nama, kontak, id_pemilik_hak_cipta)
+ VALUES (%s, %s, %s, %s, %s, %s)
+ """, [id_label, email, password, nama, kontak, id_hak_cipta])
+
+ return redirect('/akun/login') # Ubah 'login' sesuai dengan nama URL untuk halaman login
+
+ return render(request, 'register_label.html')
+
+#register pengguna
+@csrf_exempt
+def register_pengguna(request):
+ if request.method == 'POST':
+ email = request.POST.get('email')
+ password = request.POST.get('password')
+ nama = request.POST.get('nama')
+ gender = request.POST.get('gender')
+ tempat_lahir = request.POST.get('tempat_lahir')
+ tanggal_lahir = request.POST.get('tanggal_lahir')
+ kota_asal = request.POST.get('kota_asal')
+ roles = request.POST.getlist('role')
+ print("======================= INI ISI ROLES =======================")
+ print(roles)
+ is_verified = True
+
+ if len(roles) == 0:
+ is_verified = False
+ print("======================= MASUKKKKK KEEEEE UNVERIFIED =======================")
+ with connection.cursor() as cursor:
+ cursor.execute("""
+ INSERT INTO marmut.akun (email, password, nama, gender, tempat_lahir, tanggal_lahir, is_verified, kota_asal)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
+ """, [email, password, nama, gender, tempat_lahir, tanggal_lahir, is_verified, kota_asal])
+
+ if 'Podcaster' in roles:
+ print("======================= MASUKKKKK KEEEEE PODCASTER =======================")
+ print(email)
+ cursor.execute("""
+ SET search_path TO marmut;
+ INSERT INTO marmut.podcaster (email)
+ VALUES (%s)
+ """, [email])
+
+
+ if (len(roles) >= 2) & ('Artist' in roles) & ('Songwriter' in roles):
+ print("======================= MASUKKKKK KE ARTIST && SONGWRITER=======================")
+ id_pemilik_hak_cipta = uuid.uuid4()
+ rate_pemilik_hak_cipta = random.randint(100,999)
+ cursor.execute("""
+ INSERT INTO marmut.pemilik_hak_cipta (id, rate_royalti)
+ VALUES(%s, %s)
+ """, [id_pemilik_hak_cipta, rate_pemilik_hak_cipta])
+
+ artist_id = uuid.uuid4()
+ cursor.execute("""SELECT * FROM marmut.akun WHERE email = %s LIMIT 1;""", [email])
+ email_akun = cursor.fetchall()
+ email_akun = email_akun[0][0]
+ query_insert_artist = """
+ INSERT INTO marmut.artist (id, email_akun, id_pemilik_hak_cipta)
+ VALUES (%s, %s, %s)
+ """
+ cursor.execute(query_insert_artist, (artist_id, email_akun, id_pemilik_hak_cipta))
+
+ songwriter_id = uuid.uuid4()
+ cursor.execute("""SELECT * FROM marmut.akun WHERE email = %s LIMIT 1;""", [email])
+ email_akun = cursor.fetchall()
+ email_akun = email_akun[0][0]
+ query_insert_songwriter = """
+ INSERT INTO marmut.songwriter (id, email_akun, id_pemilik_hak_cipta)
+ VALUES (%s, %s, %s)
+ """
+ cursor.execute(query_insert_songwriter, (songwriter_id, email_akun, id_pemilik_hak_cipta))
+
+ else:
+ if 'Artist' in roles:
+ print("======================= MASUKKKKK KE ARTIST =======================")
+ id_pemilik_hak_cipta = uuid.uuid4()
+ rate_pemilik_hak_cipta = random.randint(100,999)
+ cursor.execute("""
+ INSERT INTO marmut.pemilik_hak_cipta (id, rate_royalti)
+ VALUES(%s, %s)
+ """, [id_pemilik_hak_cipta, rate_pemilik_hak_cipta])
+
+ artist_id = uuid.uuid4()
+ cursor.execute("""SELECT * FROM marmut.akun WHERE email = %s LIMIT 1;""", [email])
+ email_akun = cursor.fetchall()
+ email_akun = email_akun[0][0]
+ query_insert_artist = """
+ INSERT INTO marmut.artist (id, email_akun, id_pemilik_hak_cipta)
+ VALUES (%s, %s, %s)
+ """
+ cursor.execute(query_insert_artist, (artist_id, email_akun, id_pemilik_hak_cipta))
+
+ if 'Songwriter' in roles:
+ print("======================= MASUKKKKK KEEEEE SONGWRITER =======================")
+ id_pemilik_hak_cipta = uuid.uuid4()
+ rate_pemilik_hak_cipta = random.randint(100,999)
+ cursor.execute("""
+ INSERT INTO marmut.pemilik_hak_cipta (id, rate_royalti)
+ VALUES(%s, %s)
+ """, [id_pemilik_hak_cipta, rate_pemilik_hak_cipta])
+
+ songwriter_id = uuid.uuid4()
+ cursor.execute("""SELECT * FROM marmut.akun WHERE email = %s LIMIT 1;""", [email])
+ email_akun = cursor.fetchall()
+ email_akun = email_akun[0][0]
+ query_insert_songwriter = """
+ INSERT INTO marmut.songwriter (id, email_akun, id_pemilik_hak_cipta)
+ VALUES (%s, %s, %s)
+ """
+ cursor.execute(query_insert_songwriter, (songwriter_id, email_akun, id_pemilik_hak_cipta))
+
+ return HttpResponseRedirect('/akun/login/')
+ # except psycopg2.Error as error:
+ # messages.error(request, f'{error}')
+ # except Exception as error:
+ # messages.error(request, f'{error}')
+ return render(request, 'register_pengguna.html')
+
+logger = logging.getLogger(__name__)
+
+def logout_view(request):
+ # Cetak nama pengguna sebelum menghapus sesi
+ logger.info(f"Nama pengguna sebelum logout: {request.session.get('username')}")
+
+ # Hapus data sesi
+ request.session.flush()
+
+ # Cetak nama pengguna setelah menghapus sesi
+ logger.info(f"Nama pengguna setelah logout: {request.session.get('username')}")
+
+ # Redirect ke halaman login
+ return redirect('akun:login')
\ No newline at end of file
diff --git a/album_song_royalti/__init__.py b/album_song_royalti/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/album_song_royalti/admin.py b/album_song_royalti/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/album_song_royalti/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/album_song_royalti/apps.py b/album_song_royalti/apps.py
new file mode 100644
index 0000000..fe3645c
--- /dev/null
+++ b/album_song_royalti/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class AlbumSongRoyaltiConfig(AppConfig):
+ default_auto_field = "django.db.models.BigAutoField"
+ name = "album_song_royalti"
diff --git a/album_song_royalti/bener.py b/album_song_royalti/bener.py
new file mode 100644
index 0000000..995a371
--- /dev/null
+++ b/album_song_royalti/bener.py
@@ -0,0 +1,109 @@
+
+def create_album(request):
+ user_data = request.session.get('user_data', {})
+ email = user_data.get('email', None)
+
+ if request.method == "POST":
+ #print(request.POST)
+ for a in request.POST:
+ print(a, request.POST[a])
+ judul_album = request.POST.get('judul_album')
+ label_str = request.POST.get('label')
+ label_id = label_str[13:49]
+ judul_lagu = request.POST.get('judul_lagu')
+ artists = request.POST.get('artist')
+ print(artists)
+ songwriters = request.POST.getlist('songwriter[]')
+ genres = request.POST.getlist('genre[]')
+ durasi = request.POST.get('durasi')
+ #ambil tanggal sekarang
+ tanggal_rilis = datetime.datetime.now()
+ tahun = tanggal_rilis.year
+
+
+
+ #carik di artist_id pakai query dah
+ with connection.cursor() as cursor:
+ cursor.execute("SELECT id FROM marmut.artist WHERE email_akun = %s", [artists])
+ artist_id = cursor.fetchone()[0]
+
+ print(artist_id)
+
+ genre_masuk = []
+ #isinya nomor idnya
+ for genre in genres:
+ print(genre)
+ with connection.cursor() as cursor:
+ cursor.execute("SELECT DISTINCT genre FROM marmut.genre")
+ ada_genre = cursor.fetchall()
+ ada_genre = ada_genre[int(genre)]
+ ada_genre_2 = ada_genre[0]
+ genre_masuk.append(ada_genre_2)
+
+
+
+ #ambil dari nomor genre ke query
+ print(songwriters)
+ if user_data['is_songwriter']:
+ with connection.cursor() as cursor:
+ cursor.execute("SELECT DISTINCT id FROM marmut.songwriter WHERE email_akun = %s", (email,))
+ songwriter_orangnya = cursor.fetchall()
+ songwriters.append(str(songwriter_orangnya[0][0]))
+ songwriter_ids = [songwriter for songwriter in songwriters]
+
+
+ #sekarnag bagian insert data ke database
+ album_id = str(uuid.uuid4())
+ song_id = str(uuid.uuid4())
+ with connection.cursor() as cursor:
+ cursor.execute("INSERT INTO marmut.konten (id, judul, tanggal_rilis, tahun, durasi) VALUES (%s, %s, %s, %s, %s)", [song_id, judul_lagu, tanggal_rilis, tahun, durasi])
+ cursor.execute("INSERT INTO marmut.album (id, judul, jumlah_lagu, id_label, total_durasi) VALUES (%s, %s, %s, %s, %s)", [album_id, judul_album, 1, label_id, int(durasi)])
+ cursor.execute("INSERT INTO marmut.song (id_konten, id_artist, id_album) VALUES (%s, %s, %s)", [song_id, artist_id, album_id])
+ for genre_id in genre_masuk:
+ cursor.execute("INSERT INTO marmut.genre (id_konten, genre) VALUES (%s, %s)", [song_id, genre_id])
+ for songwriter_id in songwriter_ids:
+ cursor.execute("INSERT INTO marmut.songwriter_write_song (id_songwriter, id_song) VALUES (%s, %s)", [songwriter_id, song_id])
+
+
+ #NEXT HABIS INI KAYAKNYA AMBIL SEMUA SYANG BISA PUNYA ROYALTI DAH SEPERTI ARTIST, LABEL, SONGWRITER
+ # TAPI MASALAHNYA RIYALTI NYA GA TAU BERAPAAN
+ return HttpResponse(f'Album {judul_album} berhasil dibuat dengan artist: {label_str}{(artists)}, songwriters: {", ".join(songwriters)}, genres: {", ".join(genres)}, durasi: {durasi} menit.')
+ #ambil labels dulu dari database, sekalian dengan key nya
+ with connection.cursor() as cursor:
+ cursor.execute("SELECT id, nama FROM marmut.label")
+ labels = cursor.fetchall()
+ #petakan ke dictionary
+ labels = [{'id': label[0], 'nama': label[1]} for label in labels]
+
+ cursor.execute("SELECT id, email_akun FROM marmut.artist")
+ artists = cursor.fetchall()
+ #petakan ke dictionary
+ artists = [{'id': artist[0], 'email_akun': artist[1]} for artist in artists]
+
+
+ cursor.execute("SELECT id, email_akun FROM marmut.songwriter WHERE email_akun != %s", (email,))
+ songwriters = cursor.fetchall()
+ #petakan ke dictionary
+ songwriters = [{'id': songwriter[0], 'email_akun': songwriter[1]} for songwriter in songwriters]
+
+ cursor.execute("SELECT DISTINCT genre FROM marmut.genre")
+ genres = cursor.fetchall()
+ #petakan ke dictionary -> enumparate
+ genres = [{'id': idx, 'genre': genre[0]} for idx, genre in enumerate(genres)]
+
+ print(genres)
+ print(labels)
+ print(songwriters)
+ print(artists)
+
+
+
+
+
+ return render(request, 'create_album.html', {
+ 'labels': labels,
+ 'artists': artists,
+ 'songwriters': songwriters,
+ 'genres': genres,
+ })
+
\ No newline at end of file
diff --git a/album_song_royalti/create_album.py b/album_song_royalti/create_album.py
new file mode 100644
index 0000000..7dfbc57
--- /dev/null
+++ b/album_song_royalti/create_album.py
@@ -0,0 +1,119 @@
+def create_album(request):
+ user_data = request.session.get('user_data', {})
+ is_artist = user_data.get('is_artist', False)
+ is_songwriter = user_data.get('is_songwriter', False)
+ user_id = user_data.get('user_id', None)
+ email = user_data.get('email', None)
+
+ print("test userdata")
+ print(user_data)
+ if not (is_artist or is_songwriter):
+ return HttpResponse("You are not authorized to access this page", status=403)
+
+ if request.method == "POST":
+ print("Semua data dalam request.POST:")
+ for a in request.POST:
+ print(a)
+ judul_album = request.POST.get('judul_album')
+ print(judul_album)
+ label_id = request.POST.get('label')
+ print("label iddddddddddd")
+ print(label_id)
+ album_id = str(uuid.uuid4())
+ artists = request.POST.getlist('artist[]')
+ print("kasik artist")
+
+
+ #untuk section lagu pertama
+ judul_lagu = request.POST['judul_lagu']
+ artist_id = request.POST.get('artist')
+
+ songwriter_ids = request.POST.getlist('songwriter.id')
+ print(songwriter_ids)
+ genre_ids = request.POST.getlist('genre.id')
+ durasi = request.POST['durasi']
+ song_id = str(uuid.uuid4())
+ print(song_id)
+ tanggal_rilis = datetime.datetime.now()
+ tahun = tanggal_rilis.year
+ print(album_id)
+
+ #insert ke table konteen dulu
+ with connection.cursor() as cursor:
+ cursor.execute("INSERT INTO marmut.konten (id, judul, tanggal_rilis, tahun, durasi) VALUES (%s, %s, %s, %s, %s)", [song_id, judul_lagu, tanggal_rilis, tahun, durasi])
+ #cursor.execute("INSERT INTO marmut.artist (artist_id, song_id) VALUES (%s, %s)", [artist_id, song_id])
+ #masukkan ke album
+ cursor.execute("INSERT INTO marmut.album (id, judul, jumlah_lagu, id_label, total_durasi) VALUES (%s, %s, %s, %s, %s)", [album_id, judul_album, 1, label_id, int(durasi)])
+
+ with connection.cursor() as cursor:
+ #ke table song -> artistnya pasti satu
+ cursor.execute("INSERT INTO marmut.song (id_konten, id_artist, id_album) VALUES (%s, %s, %s)", [song_id, artist_id, album_id])
+
+ for genre_id in genre_ids:
+ cursor.execute("INSERT INTO marmut.genre (id_konten, genre) VALUES (%s, %s)", [song_id, genre_id])
+ #ini ga perlu karena dia sudah ada di table songwriter
+ # for songwriter_id in songwriter_ids:
+ # cursor.execute("INSERT INTO marmut.songwriter_writes_song (songwriter_id, song_id) VALUES (%s, %s)", [songwriter_id, song_id])
+
+ #songwriter_write_song
+ for songwriter_id in songwriter_ids:
+ cursor.execute("INSERT INTO marmut.songwriter_write_song (id_songwriter, id_song) VALUES (%s, %s)", [songwriter_id, song_id])
+
+
+
+ # #insert into table song dulu -> biarin album id null dulu, ntar diupdate
+ # with connection.cursor() as cursor:
+ # cursor.execute("INSERT INTO marmut.song (id_konten, id_artist) VALUES (%s, %s, %s)", [song_id, judul_lagu, durasi])
+ # for songwriter_id in songwriter_ids:
+ # cursor.execute("INSERT INTO marmut.songwriter_writes_song (songwriter_id, song_id) VALUES (%s, %s)", [songwriter_id, song_id])
+
+
+
+
+
+ # return redirect(reverse('create_lagu', args=[album_id]))
+ return HttpResponseRedirect(reverse('list_album_artist'))
+ with connection.cursor() as cursor:
+ cursor.execute("SELECT id, nama FROM marmut.label")
+ labels = cursor.fetchall()
+
+ #jika is_artist true
+ if not user_data['is_artist'] :
+ print("dia bukan artist")
+ cursor.execute("SELECT id, nama FROM marmut.artist JOIN marmut.akun ON artist.email_akun = akun.email")
+ artists = cursor.fetchall()
+ else:
+ cursor.execute("SELECT id, nama FROM marmut.artist JOIN marmut.akun ON artist.email_akun = akun.email WHERE akun.email = %s", [email])
+ artists = cursor.fetchall()
+
+ #jika is_songwriter true
+ #jika is_songwriter true
+ if user_data['is_songwriter']:
+ print(" songwriter adalah true")
+ cursor.execute("""SELECT id, nama FROM marmut.songwriter
+ JOIN marmut.akun ON songwriter.email_akun = akun.email
+ WHERE akun.email != %s
+ """, [email])
+ songwriters = cursor.fetchall()
+ cursor.execute("SELECT id, nama FROM marmut.songwriter JOIN marmut.akun ON songwriter.email_akun = akun.email WHERE akun.email = %s", [email])
+
+ # Tambahkan data songwriter pengguna ke dalam list songwriters
+ # user_songwriter = cursor.fetchone()
+ # if user_songwriter:
+ # songwriters.append(user_songwriter)
+ else:
+ print("songwriter bukan trueee")
+ cursor.execute("SELECT id, nama FROM marmut.songwriter JOIN marmut.akun ON songwriter.email_akun = akun.email")
+ songwriters = cursor.fetchall()
+
+
+ cursor.execute("SELECT DISTINCT genre FROM marmut.genre")
+ genres = cursor.fetchall()
+
+ context = {
+ 'labels': labels,
+ 'artists': artists,
+ 'songwriters': songwriters,
+ 'genres': genres,
+ }
+ return render(request, 'create_album.html', context)
diff --git a/album_song_royalti/migrations/__init__.py b/album_song_royalti/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/album_song_royalti/models.py b/album_song_royalti/models.py
new file mode 100644
index 0000000..71a8362
--- /dev/null
+++ b/album_song_royalti/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/album_song_royalti/simpen_cek_royalti.py b/album_song_royalti/simpen_cek_royalti.py
new file mode 100644
index 0000000..79b8dcb
--- /dev/null
+++ b/album_song_royalti/simpen_cek_royalti.py
@@ -0,0 +1,39 @@
+def cek_royalti(request):
+ user_data = request.session.get('user_data', {})
+ user_email = user_data.get('email', '')
+
+ if user_data.get('is_label'):
+ with connection.cursor() as cursor:
+ cursor.execute("""
+ SET SEARCH_PATH TO MARMUT;
+ SELECT
+ S.id_konten AS id_song,
+ PHC.id AS id_pemilik_hak_cipta,
+ (CAST(S.total_play AS NUMERIC) * CAST(PHC.rate_royalti AS NUMERIC)) AS TotalRoyalti
+ FROM
+ LABEL L
+ JOIN ALBUM A ON L.id = A.id_label
+ JOIN SONG S ON S.id_album = A.id
+ JOIN KONTEN K ON K.id = S.id_konten
+ JOIN PEMILIK_HAK_CIPTA PHC ON L.id_pemilik_hak_cipta = PHC.id
+ WHERE
+ L.email = %s
+ """, [user_email])
+ royalty_data = cursor.fetchall()
+
+ # Update the ROYALTI table for each song
+ for row in royalty_data:
+ id_song = row[0]
+ id_pemilik_hak_cipta = row[1]
+ total_royalti = row[2]
+
+ cursor.execute("""
+ UPDATE ROYALTI
+ SET jumlah = %s
+ WHERE id_pemilik_hak_cipta = %s AND id_song = %s
+ """, [total_royalti, id_pemilik_hak_cipta, id_song])
+
+ context = {
+ 'royalty_list': royalty_data
+ }
+ return render(request, 'cek_royalti.html', context)
diff --git a/album_song_royalti/templates/cek_royalti.html b/album_song_royalti/templates/cek_royalti.html
new file mode 100644
index 0000000..a96e4e6
--- /dev/null
+++ b/album_song_royalti/templates/cek_royalti.html
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+ Cek Royalti
+
+
+
+
+
+
Cek Royalti
+
+
+ {% if royalti_artist %}
+
Royalti sebagai Artist
+
+
+
+ Judul Lagu
+ Judul Album
+ Total Play
+ Total Download
+ Total Royalti Didapat
+
+
+
+ {% for royalti in royalti_artist %}
+
+ {{ royalti.0 }}
+ {{ royalti.1 }}
+ {{ royalti.2 }}
+ {{ royalti.3 }}
+ {{ royalti.4 }}
+
+ {% endfor %}
+
+
+ {% endif %}
+
+ {% if royalti_songwriter %}
+
+
Royalti sebagai Songwriter
+
+
+
+ Judul Lagu
+ Judul Album
+ Total Play
+ Total Download
+ Total Royalti Didapat
+
+
+
+ {% for royalti in royalti_songwriter %}
+
+ {{ royalti.0 }}
+ {{ royalti.1 }}
+ {{ royalti.2 }}
+ {{ royalti.3 }}
+ {{ royalti.4 }}
+
+ {% endfor %}
+
+
+ {% endif %}
+
+ {% if royalti_label %}
+
+
Royalti sebagai Label
+
+
+
+ Judul Lagu
+ Judul Album
+ Total Play
+ Total Download
+ Total Royalti Didapat
+
+
+
+ {% for royalti in royalti_label %}
+
+ {{ royalti.0 }}
+ {{ royalti.1}}
+ {{ royalti.2 }}
+ {{ royalti.3 }}
+ {{ royalti.4 }}
+
+ {% endfor %}
+
+
+ {% endif %}
+
+
+
diff --git a/album_song_royalti/templates/create_album.html b/album_song_royalti/templates/create_album.html
new file mode 100644
index 0000000..9382735
--- /dev/null
+++ b/album_song_royalti/templates/create_album.html
@@ -0,0 +1,68 @@
+
+
+
+
+ Create Album
+
+
+ Create Album
+
+
+
diff --git a/album_song_royalti/templates/create_lagu.html b/album_song_royalti/templates/create_lagu.html
new file mode 100644
index 0000000..58b29af
--- /dev/null
+++ b/album_song_royalti/templates/create_lagu.html
@@ -0,0 +1,59 @@
+
+
+
+
+ Create Lagu
+
+
+
+ Create lagu untuk di Album {{judul_album}} - {{album_id}}
+
+
+
diff --git a/album_song_royalti/templates/daftar_lagu.html b/album_song_royalti/templates/daftar_lagu.html
new file mode 100644
index 0000000..aea026f
--- /dev/null
+++ b/album_song_royalti/templates/daftar_lagu.html
@@ -0,0 +1,37 @@
+
+
+
+ Daftar Lagu pada Album {{ album.judul }}
+
+
+ Daftar Lagu pada Album {{ album.judul }}
+
+
+
+ Judul
+ Durasi
+ Total Play
+ Total Download
+ Action
+
+
+
+ {% for song in song_list %}
+
+ {{ song.judul }}
+ {{ song.durasi }} menit
+ {{ song.total_play }}
+ {{ song.total_download }}
+
+ Lihat Detail
+
+
+
+ {% endfor %}
+
+
+
+
diff --git a/album_song_royalti/templates/entry_album_song_create_list.html b/album_song_royalti/templates/entry_album_song_create_list.html
new file mode 100644
index 0000000..b356f2d
--- /dev/null
+++ b/album_song_royalti/templates/entry_album_song_create_list.html
@@ -0,0 +1,28 @@
+
+
+
+
+ {% include 'nav.html' %}
+
+
+
+ Pilihan Registrasi
+
+
+ CRUD KELOLA ALBUM & SONG
+
+
+
+
diff --git a/album_song_royalti/templates/kelola_album_song.html b/album_song_royalti/templates/kelola_album_song.html
new file mode 100644
index 0000000..c7b3275
--- /dev/null
+++ b/album_song_royalti/templates/kelola_album_song.html
@@ -0,0 +1,194 @@
+
+
+
+
+
+
+
+
+
+
+ CRUD Kelola Album & Song
+
+
+
+
+
+ CREATE ALBUM
+
+
+
+ LIST ALBUM
+
+
+
+ CREATE LAGU
+
+
+
+ DAFTAR LAGU PADA ALBUM1
+
+
+ Judul
+ Durasi
+ Total Play
+ Total Download
+ Action
+
+
+
+ Lagu1
+ 2 menit
+ 3
+ 0
+
+ Lihat Detail
+ Hapus
+
+
+
+ Lagu2
+ 3 menit
+ 2
+ 2
+
+ Lihat Detail
+ Hapus
+
+
+
+
+
+
diff --git a/album_song_royalti/templates/lihat_detail_lagu.html b/album_song_royalti/templates/lihat_detail_lagu.html
new file mode 100644
index 0000000..b0eb06f
--- /dev/null
+++ b/album_song_royalti/templates/lihat_detail_lagu.html
@@ -0,0 +1,39 @@
+
+
+ {% include 'nav.html' %}
+
+ Detail Lagu
+
+
+ Detail Lagu
+
+ {% if song %}
+
+
+ ID
+ {{ song.id }}
+
+
+ Judul
+ {{ song.judul }}
+
+
+ Durasi
+ {{ song.durasi }} menit
+
+
+ Total Play
+ {{ song.total_play }}
+
+
+ Total Download
+ {{ song.total_download }}
+
+
+ {% else %}
+ Lagu tidak ditemukan.
+ {% endif %}
+
+
+
+
diff --git a/album_song_royalti/templates/list_album.html b/album_song_royalti/templates/list_album.html
new file mode 100644
index 0000000..a4b7015
--- /dev/null
+++ b/album_song_royalti/templates/list_album.html
@@ -0,0 +1,36 @@
+
+
+
+
+ Daftar Album - Label
+
+
+ Daftar Album
+
+
+
+ Judul
+ Jumlah Lagu
+ Total Durasi
+ Action
+
+
+
+ {% for album in album_list %}
+
+ {{ album.judul }}
+ {{ album.jumlah_lagu }}
+ {{ album.total_durasi }} menit
+
+ Lihat Daftar Lagu
+
+
+
+ {% endfor %}
+
+
+
+
diff --git a/album_song_royalti/templates/list_album_artist.html b/album_song_royalti/templates/list_album_artist.html
new file mode 100644
index 0000000..c37b6fd
--- /dev/null
+++ b/album_song_royalti/templates/list_album_artist.html
@@ -0,0 +1,76 @@
+
+
+
+ Daftar Album - Artist/Songwriter
+
+
+ Daftar Album
+ Buat Album Baru
+
+ {% if album_list_songwriter %}
+ Daftar Album As Songwriter
+
+
+
+ Judul
+ Label
+ Jumlah Lagu
+ Total Durasi
+ Action
+
+
+
+ {% for album in album_list_songwriter %}
+
+ {{ album.judul }}
+ {{ album.label }}
+ {{ album.jumlah_lagu }}
+ {{ album.total_durasi }} menit
+
+ Lihat Daftar Lagu
+ Tambah Lagu
+
+
+
+ {% endfor %}
+
+
+ {% endif %}
+
+ {% if album_list_artist %}
+ Daftar Album As Artist
+
+
+
+ Judul
+ Label
+ Jumlah Lagu
+ Total Durasi
+ Action
+
+
+
+ {% for album in album_list_artist %}
+
+ {{ album.judul }}
+ {{ album.label }}
+ {{ album.jumlah_lagu }}
+ {{ album.total_durasi }} menit
+
+ Lihat Daftar Lagu
+ Tambah Lagu
+
+
+
+ {% endfor %}
+
+
+ {% endif %}
+
+
diff --git a/album_song_royalti/templates/list_lagu.html b/album_song_royalti/templates/list_lagu.html
new file mode 100644
index 0000000..d73a04e
--- /dev/null
+++ b/album_song_royalti/templates/list_lagu.html
@@ -0,0 +1,41 @@
+
+
+
+{% include 'nav.html' %}
+
+
+
+ Daftar Lagu
+
+
+ Daftar Lagu pada Album {{ album.judul }}
+
+
+
+ Judul
+ Durasi
+ Total Play
+ Total Download
+ Action
+
+
+
+ {% for lagu in lagu_list %}
+
+ {{ lagu.judul }}
+ {{ lagu.durasi }} menit
+ {{ lagu.total_play }}
+ {{ lagu.total_download }}
+
+ Lihat Detail
+
+
+
+ {% endfor %}
+
+
+
+
diff --git a/album_song_royalti/templates/multiselect_form.html b/album_song_royalti/templates/multiselect_form.html
new file mode 100644
index 0000000..fdc142e
--- /dev/null
+++ b/album_song_royalti/templates/multiselect_form.html
@@ -0,0 +1,18 @@
+
+
+
+ Multiselect Example
+
+
+
+
+
\ No newline at end of file
diff --git a/album_song_royalti/templates/rd_kelola_album_and_song.html b/album_song_royalti/templates/rd_kelola_album_and_song.html
new file mode 100644
index 0000000..388a9b4
--- /dev/null
+++ b/album_song_royalti/templates/rd_kelola_album_and_song.html
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+ CRUD Kelola Album & Song
+
+
+
+
+
+
+
+
+
+ Kelola Album
+
+
+
+
+
+ LIST ALBUM
+
+
+
+ DAFTAR LAGU PADA ALBUM1
+
+
+ Judul
+ Durasi
+ Total Play
+ Total Download
+ Action
+
+
+
+ Lagu1
+ 2 menit
+ 3
+ 0
+
+ Lihat Detail
+ Hapus
+
+
+
+ Lagu2
+ 3 menit
+ 2
+ 2
+
+ Lihat Detail
+ Hapus
+
+
+
+
+
+
diff --git a/album_song_royalti/templates/styles.css b/album_song_royalti/templates/styles.css
new file mode 100644
index 0000000..77ee017
--- /dev/null
+++ b/album_song_royalti/templates/styles.css
@@ -0,0 +1,104 @@
+.navbar {
+ background-color: #007bff; /* Warna latar belakang navbar */
+ overflow: hidden;
+}
+
+.navbar ul {
+ list-style-type: none; /* Menghilangkan bullet list */
+ margin: 0;
+ padding: 0;
+}
+
+.navbar li {
+ float: left;
+}
+
+.navbar li a {
+ display: block;
+ color: white;
+ text-align: center;
+ padding: 14px 16px;
+ text-decoration: none;
+}
+
+.navbar li a:hover {
+ background-color: #0056b3; /* Warna latar belakang saat mouse hover */
+}
+
+
+
+* {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+}
+
+body {
+ font-family: Arial, sans-serif;
+ line-height: 1.6;
+ background-color: #f4f4f4;
+ padding: 20px;
+}
+
+.container {
+ max-width: 1200px;
+ margin: 0 auto;
+}
+
+h2 {
+ margin-bottom: 20px;
+}
+
+form {
+ background: #fff;
+ padding: 20px;
+ border-radius: 5px;
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
+}
+
+form label {
+ font-weight: bold;
+ display: block;
+ margin-bottom: 5px;
+}
+
+form input[type="text"],
+form select {
+ width: 100%;
+ padding: 10px;
+ margin-bottom: 10px;
+ border: 1px solid #ccc;
+ border-radius: 5px;
+}
+
+form input[type="submit"] {
+ background: #007bff;
+ color: #fff;
+ border: none;
+ padding: 10px 20px;
+ cursor: pointer;
+ border-radius: 5px;
+}
+
+table {
+ width: 100%;
+ border-collapse: collapse;
+ margin-top: 20px;
+}
+
+table th,
+table td {
+ padding: 10px;
+ border: 1px solid #ccc;
+ text-align: left;
+}
+
+table th {
+ background-color: #f2f2f2;
+}
+
+a {
+ text-decoration: none;
+ color: #007bff;
+ margin-right: 10px;
+}
diff --git a/album_song_royalti/tes.py b/album_song_royalti/tes.py
new file mode 100644
index 0000000..7e87357
--- /dev/null
+++ b/album_song_royalti/tes.py
@@ -0,0 +1,6 @@
+#Impory uuid
+import uuid
+
+#buat uuid
+album_id = str(uuid.uuid4())
+print(album_id)
\ No newline at end of file
diff --git a/album_song_royalti/tes_multi.html b/album_song_royalti/tes_multi.html
new file mode 100644
index 0000000..bf81f08
--- /dev/null
+++ b/album_song_royalti/tes_multi.html
@@ -0,0 +1,19 @@
+
+
+Multi-selection
+
+
+
+
+
+
+