rename send_file.py -> stream.py

This commit is contained in:
cwilvx
2024-05-10 12:08:57 +03:00
parent 999b802f7d
commit 1e857c1e89
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -23,7 +23,6 @@ from app.api import (
imgserver,
playlist,
search,
send_file,
settings,
lyrics,
plugins,
@@ -31,6 +30,7 @@ from app.api import (
home,
getall,
auth,
stream,
)
# TODO: Move this description to a separate file
@@ -96,7 +96,7 @@ def create_api():
with app.app_context():
app.register_api(album.api)
app.register_api(artist.api)
app.register_api(send_file.api)
app.register_api(stream.api)
app.register_api(search.api)
app.register_api(folder.api)
app.register_api(playlist.api)
+3 -1
View File
@@ -3,11 +3,13 @@ Contains all the track routes.
"""
import os
import time
from flask import Blueprint, send_file, request, Response
from flask_openapi3 import APIBlueprint, Tag
from pydantic import BaseModel, Field
from app.api.apischemas import TrackHashSchema
from app.lib.pydub.pydub.audio_segment import AudioSegment
from app.lib.trackslib import get_silence_paddings
from app.store.tracks import TrackStore
@@ -70,7 +72,7 @@ def send_file_as_chunks(filepath: str, audio_type: str) -> Response:
"""
# NOTE: +1 makes sure the last byte is included in the range.
# NOTE: -1 is used to convert the end index to a 0-based index.
chunk_size = 1024 * 512
chunk_size = 1024 * 360 # 360 KB
# Get file size
file_size = os.path.getsize(filepath)