aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorBobby <[email protected]>2024-12-14 20:29:18 -0500
committerBobby <[email protected]>2024-12-14 20:29:18 -0500
commitf3c53e383d36b2cfb2b4899c4d4bc3769b9ad1f8 (patch)
tree25f07946f3c72d7f5ea7ac99c7ca60cd10bcf231 /apps
parent944b2d923f2ba55d24e90daaef46f99d0e4a84b6 (diff)
downloadthatcomputerscientist-f3c53e383d36b2cfb2b4899c4d4bc3769b9ad1f8.tar.xz
thatcomputerscientist-f3c53e383d36b2cfb2b4899c4d4bc3769b9ad1f8.zip
pamphlet service for ads
Diffstat (limited to 'apps')
-rw-r--r--apps/stream/__init__.py0
-rw-r--r--apps/stream/admin.py3
-rw-r--r--apps/stream/apps.py6
-rw-r--r--apps/stream/migrations/__init__.py0
-rw-r--r--apps/stream/models.py3
-rw-r--r--apps/stream/songs.py107
-rw-r--r--apps/stream/tests.py3
-rw-r--r--apps/stream/urls.py9
-rw-r--r--apps/stream/views.py34
9 files changed, 0 insertions, 165 deletions
diff --git a/apps/stream/__init__.py b/apps/stream/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/apps/stream/__init__.py
+++ /dev/null
diff --git a/apps/stream/admin.py b/apps/stream/admin.py
deleted file mode 100644
index 8c38f3f3..00000000
--- a/apps/stream/admin.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.contrib import admin
-
-# Register your models here.
diff --git a/apps/stream/apps.py b/apps/stream/apps.py
deleted file mode 100644
index da754011..00000000
--- a/apps/stream/apps.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from django.apps import AppConfig
-
-
-class StreamConfig(AppConfig):
- default_auto_field = "django.db.models.BigAutoField"
- name = "apps.stream"
diff --git a/apps/stream/migrations/__init__.py b/apps/stream/migrations/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/apps/stream/migrations/__init__.py
+++ /dev/null
diff --git a/apps/stream/models.py b/apps/stream/models.py
deleted file mode 100644
index 71a83623..00000000
--- a/apps/stream/models.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.db import models
-
-# Create your models here.
diff --git a/apps/stream/songs.py b/apps/stream/songs.py
deleted file mode 100644
index a39e310f..00000000
--- a/apps/stream/songs.py
+++ /dev/null
@@ -1,107 +0,0 @@
-MUSIC_FILES = [
- {
- "id": 1,
- "songName": "Bling-Bang-Bang-Born.mp3",
- "title": "Bling Bang Bang Born",
- "artist": "CREEPY NUTS",
- "album": "Bling Bang Bang Born",
- },
- {
- "id": 2,
- "songName": "DADDY ! DADDY ! DO !.mp3",
- "title": "DADDY ! DADDY ! DO !",
- "artist": "Masayuki Suzuki",
- "album": "Kaguya-sama: Love Is War",
- },
- {
- "id": 3,
- "songName": "Duvet.mp3",
- "title": "Duvet",
- "artist": "Boa",
- "album": "Serial Experiments Lain",
- },
- {
- "id": 4,
- "songName": "Nandemonaiya - movie ver..mp3",
- "title": "Nandemonaiya - movie ver.",
- "artist": "RADWIMPS",
- "album": "Your Name",
- },
- {
- "id": 5,
- "songName": "Shinunoga E-Wa.mp3",
- "title": "Shinunoga E-Wa",
- "artist": "Fujii Kaze",
- "album": "HELP EVER HURT NEVER",
- },
- {
- "id": 6,
- "songName": "Sparkle - movie ver..mp3",
- "title": "Sparkle - movie ver.",
- "artist": "RADWIMPS",
- "album": "Your Name",
- },
- {
- "id": 7,
- "songName": "Zenzenzense - movie ver..mp3",
- "title": "Zenzenzense - movie ver.",
- "artist": "RADWIMPS",
- "album": "Your Name",
- },
- {
- "id": 8,
- "songName": "アイドル.mp3",
- "title": "アイドル",
- "artist": "YOASOBI",
- "album": "アイドル",
- },
- {
- "id": 9,
- "songName": "ただ声一つ.mp3",
- "title": "ただ声一つ",
- "artist": "ロクデナシ",
- "album": "ただ声一つ",
- },
- {
- "id": 10,
- "songName": "好きだから。.mp3",
- "title": "好きだから。",
- "artist": "『ユイカ』",
- "album": "好きだから。",
- },
- {
- "id": 11,
- "songName": "忘れてください.mp3",
- "title": "忘れてください",
- "artist": "Yorushika",
- "album": "忘れてください",
- },
- {
- "id": 12,
- "songName": "恋愛サーキュレーション.mp3",
- "title": "恋愛サーキュレーション",
- "artist": "物語シリーズ",
- "album": "Utamonogatari Special Edition",
- },
- {
- "id": 13,
- "songName": "知らないままで.mp3",
- "title": "知らないままで",
- "artist": "ロクデナシ",
- "album": "知らないままで",
- },
- {
- "id": 14,
- "songName": "言って。.mp3",
- "title": "言って。",
- "artist": "Yorushika",
- "album": "夏草が邪魔をする",
- },
- {
- "id": 15,
- "songName": "青のすみか.mp3",
- "title": "青のすみか",
- "artist": "Tatsuya Kitani",
- "album": "青のすみか",
- },
-]
diff --git a/apps/stream/tests.py b/apps/stream/tests.py
deleted file mode 100644
index 7ce503c2..00000000
--- a/apps/stream/tests.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/apps/stream/urls.py b/apps/stream/urls.py
deleted file mode 100644
index 4fc57ee5..00000000
--- a/apps/stream/urls.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from django.urls import path
-
-from . import views
-
-app_name = "stream"
-urlpatterns = [
- path("random-song", views.random_song, name="random_song"),
- path("song/<int:song_id>", views.stream_song, name="stream_song"),
-]
diff --git a/apps/stream/views.py b/apps/stream/views.py
deleted file mode 100644
index 5e341fb7..00000000
--- a/apps/stream/views.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# views.py
-import os
-import random
-from hashlib import md5
-from apps.stream.songs import MUSIC_FILES
-import requests
-from django.http import HttpResponse, JsonResponse
-
-CDN_URL = os.getenv("CDN_URL")
-MUSIC_FILES_COUNT = len(MUSIC_FILES)
-
-
-def get_stream_url(filename: str) -> str:
- return f"{CDN_URL}/music/{filename}"
-
-
-def random_song(request) -> JsonResponse:
- next_song_id = request.GET.get("next")
- if next_song_id:
- song = MUSIC_FILES[int(next_song_id) % MUSIC_FILES_COUNT]
- else:
- song = random.choice(MUSIC_FILES)
- return JsonResponse(song)
-
-
-def stream_song(request, song_id: int) -> HttpResponse:
- song = MUSIC_FILES[song_id - 1]
- stream_url = get_stream_url(song["songName"])
- response = requests.get(stream_url, stream=True)
-
- return HttpResponse(
- response.raw.read(),
- content_type=response.headers.get("Content-Type", "audio/mpeg"),
- )