mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
rename send_file.py -> stream.py
This commit is contained in:
+2
-2
@@ -23,7 +23,6 @@ from app.api import (
|
|||||||
imgserver,
|
imgserver,
|
||||||
playlist,
|
playlist,
|
||||||
search,
|
search,
|
||||||
send_file,
|
|
||||||
settings,
|
settings,
|
||||||
lyrics,
|
lyrics,
|
||||||
plugins,
|
plugins,
|
||||||
@@ -31,6 +30,7 @@ from app.api import (
|
|||||||
home,
|
home,
|
||||||
getall,
|
getall,
|
||||||
auth,
|
auth,
|
||||||
|
stream,
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: Move this description to a separate file
|
# TODO: Move this description to a separate file
|
||||||
@@ -96,7 +96,7 @@ def create_api():
|
|||||||
with app.app_context():
|
with app.app_context():
|
||||||
app.register_api(album.api)
|
app.register_api(album.api)
|
||||||
app.register_api(artist.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(search.api)
|
||||||
app.register_api(folder.api)
|
app.register_api(folder.api)
|
||||||
app.register_api(playlist.api)
|
app.register_api(playlist.api)
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ Contains all the track routes.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
from flask import Blueprint, send_file, request, Response
|
from flask import Blueprint, send_file, request, Response
|
||||||
from flask_openapi3 import APIBlueprint, Tag
|
from flask_openapi3 import APIBlueprint, Tag
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
from app.api.apischemas import TrackHashSchema
|
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.lib.trackslib import get_silence_paddings
|
||||||
|
|
||||||
from app.store.tracks import TrackStore
|
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 makes sure the last byte is included in the range.
|
||||||
# NOTE: -1 is used to convert the end index to a 0-based index.
|
# 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
|
# Get file size
|
||||||
file_size = os.path.getsize(filepath)
|
file_size = os.path.getsize(filepath)
|
||||||
Reference in New Issue
Block a user