limit custom playlist items to 100

This commit is contained in:
cwilvx
2024-08-04 19:31:22 +03:00
parent e562fa691d
commit 6d2aac084d
5 changed files with 20 additions and 43 deletions
-1
View File
@@ -56,4 +56,3 @@
- Duplicates on search - Duplicates on search
- Audio stops on ending - Audio stops on ending
- Port account settings to config on the frontend
-3
View File
@@ -14,7 +14,6 @@ from pydantic import BaseModel, Field
from flask_openapi3 import Tag from flask_openapi3 import Tag
from flask_openapi3 import APIBlueprint from flask_openapi3 import APIBlueprint
# from app.db.sqlite.auth import SQLiteAuthMethods as authdb
from app.db.userdata import UserTable from app.db.userdata import UserTable
from app.utils.auth import check_password, hash_password from app.utils.auth import check_password, hash_password
from app.config import UserConfig from app.config import UserConfig
@@ -307,8 +306,6 @@ def get_all_users(query: GetAllUsersQuery):
Get all users (if you're an admin, you will also receive accounts settings) Get all users (if you're an admin, you will also receive accounts settings)
""" """
config = UserConfig() config = UserConfig()
# config.enableGuest = True
# config.usersOnLogin = True
settings = { settings = {
"enableGuest": False, "enableGuest": False,
"usersOnLogin": config.usersOnLogin, "usersOnLogin": config.usersOnLogin,
+5
View File
@@ -200,6 +200,11 @@ def get_playlist(path: PlaylistIDPath, query: GetPlaylistQuery):
is_custom = playlistid in {p["name"] for p in custom_playlists} is_custom = playlistid in {p["name"] for p in custom_playlists}
if is_custom: if is_custom:
if query.start != 0:
return {
"tracks": [],
}
handler = next( handler = next(
p["handler"] for p in custom_playlists if p["name"] == playlistid p["handler"] for p in custom_playlists if p["name"] == playlistid
) )
+15 -24
View File
@@ -6,14 +6,12 @@ from pydantic import BaseModel, Field
from app.api.auth import admin_required from app.api.auth import admin_required
from app.db.userdata import PluginTable from app.db.userdata import PluginTable
from app.lib.index import IndexEverything, index_everything from app.lib.index import index_everything
from app.logger import log from app.logger import log
from app.settings import Info, SessionVarKeys from app.settings import Info
from app.store.albums import AlbumStore from app.store.albums import AlbumStore
from app.store.artists import ArtistStore from app.store.artists import ArtistStore
from app.store.tracks import TrackStore from app.store.tracks import TrackStore
from app.utils.generators import get_random_str
from app.utils.threading import background
from app.config import UserConfig from app.config import UserConfig
bp_tag = Tag(name="Settings", description="Customize stuff") bp_tag = Tag(name="Settings", description="Customize stuff")
@@ -154,15 +152,15 @@ def get_root_dirs():
# maps settings to their parser flags # maps settings to their parser flags
mapp = { # mapp = {
"artist_separators": SessionVarKeys.ARTIST_SEPARATORS, # "artist_separators": SessionVarKeys.ARTIST_SEPARATORS,
"extract_feat": SessionVarKeys.EXTRACT_FEAT, # "extract_feat": SessionVarKeys.EXTRACT_FEAT,
"remove_prod": SessionVarKeys.REMOVE_PROD, # "remove_prod": SessionVarKeys.REMOVE_PROD,
"clean_album_title": SessionVarKeys.CLEAN_ALBUM_TITLE, # "clean_album_title": SessionVarKeys.CLEAN_ALBUM_TITLE,
"remove_remaster": SessionVarKeys.REMOVE_REMASTER_FROM_TRACK, # "remove_remaster": SessionVarKeys.REMOVE_REMASTER_FROM_TRACK,
"merge_albums": SessionVarKeys.MERGE_ALBUM_VERSIONS, # "merge_albums": SessionVarKeys.MERGE_ALBUM_VERSIONS,
"show_albums_as_singles": SessionVarKeys.SHOW_ALBUMS_AS_SINGLES, # "show_albums_as_singles": SessionVarKeys.SHOW_ALBUMS_AS_SINGLES,
} # }
@api.get("") @api.get("")
@@ -178,9 +176,9 @@ def get_all_settings():
return config return config
@background # @background
def reload_all_for_set_setting(): # def reload_all_for_set_setting():
reload_everything(get_random_str()) # reload_everything(get_random_str())
class SetSettingBody(BaseModel): class SetSettingBody(BaseModel):
@@ -227,19 +225,12 @@ class SetSettingBody(BaseModel):
# return {"result": value} # return {"result": value}
@background
def index_stuff():
IndexEverything()
pass
@api.get("/trigger-scan") @api.get("/trigger-scan")
def trigger_scan(): def trigger_scan():
""" """
Triggers scan for new music Triggers scan for new music
""" """
index_stuff() index_everything()
return {"msg": "Scan triggered!"} return {"msg": "Scan triggered!"}
-15
View File
@@ -5,7 +5,6 @@ Contains default configs
import os import os
import subprocess import subprocess
import sys import sys
from typing import Any
from app import configs from app import configs
@@ -231,20 +230,6 @@ class SessionVars:
SHOW_ALBUMS_AS_SINGLES = False SHOW_ALBUMS_AS_SINGLES = False
# TODO: Find a way to eliminate this class without breaking typings
class SessionVarKeys:
EXTRACT_FEAT = "EXTRACT_FEAT"
REMOVE_PROD = "REMOVE_PROD"
CLEAN_ALBUM_TITLE = "CLEAN_ALBUM_TITLE"
REMOVE_REMASTER_FROM_TRACK = "REMOVE_REMASTER_FROM_TRACK"
DO_PERIODIC_SCANS = "DO_PERIODIC_SCANS"
PERIODIC_SCAN_INTERVAL = "PERIODIC_SCAN_INTERVAL"
MERGE_ALBUM_VERSIONS = "MERGE_ALBUM_VERSIONS"
ARTIST_SEPARATORS = "ARTIST_SEPARATORS"
SHOW_ALBUMS_AS_SINGLES = "SHOW_ALBUMS_AS_SINGLES"
class TCOLOR: class TCOLOR:
""" """
Terminal colors Terminal colors