Commit Graph

58 Commits

Author SHA1 Message Date
cwilvx 7450324514 update github ci token 2025-08-28 20:06:30 +03:00
cwilvx ebc740a5a5 refactor Paths and update build workflow
+ rename app_dir -> config_dir and config_dir to config_parent
+ bundle web client as zip
+ bundle and extract client zip when running pyinstaller builds
+ installer pyinstaller as main dependency
+ remove fallback client flag
+ handle already used port
+ add assethandler class
+ remove some startup logs
+ ignore wheels and client.zip files
2025-08-28 16:38:49 +03:00
michily e770606567 merge refactors pr #364 from @michilyy
* Save to DB only unique trackhashes

* Add check if track already exists in playlist

* replace all paths with `pathlib.Path`

* `architecture.md`:
* add config folder layout

`config.py`:
* fix bug where `pathlib.Path` cannot be serialized

`files.py`:
* remove unused imports
* update path concatenation to `pathlib.Path`
* add config-folder creation

`imgserver.py`:
* fix serialisation bug

`playlistlib.py`:
* update path concatenation to `pathlib.Path`

* update all `settings.Paths` usages to new singleton `Paths` class.

* update all usages of `settings.Paths`

* `files.py`:
* rework assets copy function.
* remove unused loop and unused `shutil.copy2` function

`settings.py`
* fix recursion exception in `Paths`

* `settings.py`:
* remove Singleton and `@property` todos from `Paths`

* `__init__.py`:
* remove now unused function `create_config_dir()`

`setup.files`:
* remove because merged into `settings.Paths()`
  for more central and clear flow how the base path gets decided

`settings.py`:
* add `copy_assets` function

`start_swingmusic.py`:
* add configurable settings.Paths class

`__main__.py`:
* update click to used correct default path

* remove wrong commited egg files

* remove change in the wrong branch

* add forgotten `property` decorator
update `get_files_and_dirs` to use pathlib where possible

`config.py`:
* update type annotation

`folders.py`:
* convert `pathlib` to posix path where needed for sub-functions

`folderlib.py`:
* rework `get_files_and_dirs` to use `pathlib` where possible

`settings.py`:
* add forgotten `@property`

`start_swingmusic.py`:
* remove second `log_startup_info()`

* `artistlib.py`:
* fix calling property
`tagger.py`:
* fix comparing elements in `pathlib.Path`

* add support for repeating lyrics.

* rework lyrics api and lib

* update most path functions.
add type-hint pathlib where needed

* for serialization paths are converted to posix path

* use `open` instead of `os.open`
update `metaclass` with constant

* fix initial config exception if empty file existed

* update `userConfig` with `InitVar` to be excluded from `asdict`

* remove `is_windows_slash()`
rework path function to use pathlib

* convert `pathlib.Path` to `str` for serialization

* fixing bug with str + pathlib

* `__main__.py`:
* update click to use package version
* remove now unused function `print_version`

`filesystem.py`:
* rework `CWD` to use importlib

`pyproject.toml`:
* disable namespace for `importlib.resources` to work correctly

* update `lyrics.py`:
* remove unused functions
* simplify functions

* fix bug where assets get created on root

* remove unused code

* update lyrics for clearer structure.

* add support for unsynced lyrics

* fix wrong return type in unsynced lyrics

* update `/check` to use `send_lyrics`

* prefer tags to duplicates

* `lyrics.py`:
* add docs to a function group

* `logger.py`:
* add logging config dict.
* combine Logging into one file
* add socket logger
* add debug mode to logger
* add JSONL formater

* `logger.py`:
* update config to directly use the formater.
resolves circular import exception

`__main__.py`:
* add logger setup to main

`start_swingmusic.py`:
* add debug option to cli

* `lyrics.py`:
* add offset support

* add `setuptools-scm` to get version from git

* add support for docker build with scm

* add support for docker build with scm
need someone who can test the changes workflow

* update all usage of `version.txt` to `metadata.version()`

* 2x update all usage of `version.txt` to `metadata.version()`

* update to no local_scheme version

* provide fix for #331.
convert `sql.Row` and `TrackTable` to dict before converting to dataclass.

* fix `__main__.py`:
* wrong import and uncommited changes
* add debug and base_path parameter

* fix logger pathlib

* add client build workflow

* set name

* split client from build

* try fixing builds

* try another fix

* try also another fix

* try again something new

* try again something new

* change runner

* fix failed run because of malformed runner

* add wheel builds

* remove systems from pure python build

* add isolated pyinstaller build

* artifacts with names

* wrong wheel path

* try fetch-depth for tag fetch

* disable fail-fast.
add wheel installation

* add install system packages

* add debug

* fix wheel install
fix pyinstaller spec file

* try fix for pyinstaller

* try another fix

* build on release

* add concrete release types

* only run on released or pre-released

* try release upload

* reformat upload

* fix needs tag

* identifiable pyinstaller builds

* compress client folder before uploading

* update to src build

* remove no more needed aarch64 build script
rename pyinstaller assets to lowercase

* remove unneeded code

* fix: save to DB only unique track hashes

* replace click with argparse

* set concrete types in argparse

* replace manuall path usages with pathlib

* remove unused `configs.py` file

* reformat `start_swingmusic.py`

* fix empty set startup exception

* optimizing static files serve function

* fixing bug in optimisation of static files serve function

* fix folder view bug

* colorlib.py:
* fix wrong type exception
* remove singe use Index_everything class
* update logging of populate.py

* cleanup files

* fix settings.py Paths copy function.
Created folder on file.

* add exist check to folder

* remove unused `INFO` class

* fix multiprocessing bug on windows

* potential icon fix for pyinstaller
fix multiple logging bug

* fix argparse config path bug
add jobs file

* cleanup code fragments
fix logging issue
add notes to function

* note that concurrent creates own sys.modules

* refactor some lyrics plugin condition
remove unused import from hashing

* refactor taglib.py

* update import statements to be static

* playlistlib.py:
* refactoring and more doc strings
populate.py:
* add poc bugfix
settings.py:
* add typehint

* possible bugfix for multitreading globals

* folder.py:
* add check if provided path is absolute
populate.py:
* add bug note
settings.py:
* add possible error from Singleton implementation
start_swingmusic.py:
* correct spelling
* pass resolved path to Paths
tagger.py:
* add logging

* trying out fixes for multithreading

* only upload results not metadata

* fix build action again

* folder.py:
* strictly use pathlib where possible

folderlib.py:
* add missing docstring to function, who really need it.

track.py:
* refactor some code

folder.py:
* refactor some more code

* Merge DBPath class and Paths class.
Update all usages of DBPath

folderslib.py:
* fix bug with logging

taglib.py:
* add missing docstring

settings.py:
* merge classes
* refactor

* network.py:
* add more docstring

config.py:
* update pathlib usage

tools.py:
* refactor
* add docstrings

* colorlib.py:
* add docstring

Refactor App builder into grouped config settings.

* update assets access for migration

* Update FUNDING.yml

* Update FUNDING.yml

* upgrade tinytag in requirements.txt

* update readme

* update license

* update readme

* Update README.md

* Update README.md

* cleanup requirements.txt
remove unused import in audio_segment.py
add entrypoint.sh for appimage support
update pyproject.toml for optional dependencies
add appimage to github workflow

* fix invalid workflow file

* AppImage build needs more research.
Commenting for now

* testing a new build workflow

* add libev installation

* update workflow to new optional dependencies

* trying again another fix

* finally fix all optional deps installation correctly

* remove AppImage poc

* albumslib.py:
* add docstring

folder.py:
* add unix path fix

update logger name to `__name__`

* update build with docker
update Dockerfile with git
fix typo in lyrics.py
add dynamic deps back

* add log for static folder

* add missing import

* add some more todos

* add support for AppImages even when it's not perfect.

* quick bugfix for wrong appimage config path

* fix uploading not finding AppImages builds aka wrong pattern

* optimise docker build by using artifacts.
Add client path option.
change docstring to sphinx format

* add todos

* Now support AppImages for real:
manually build AppImage as we are building a complex project.

* fix missing dep in AppImage build

* add full AppImage metadata

* add missing image file.

* only update swingmusic appimage not tool

* add todo and fix AppImage build again.

* Try fixing some path mixup in AppImage build

* add debug tag to action

* correct path to appimage folder

* do not download tool before checkout

* Another fix for path in appimage build

* extend config files with more information

* default client dir is now inside the config dir.
TODOs updated.

* default client dir is now inside the config dir.
TODOs updated.
Add priority todos.

* Auto download client when client not found.
Respects user provided dir.

* rename `requests` submodule to `request`

* poc for arm AppImage builds

* try out another fix

* fix typo in build.yml

* add missing arch tag

* fix uploading double names

* unique naming

* enable fallback version for project.

* do not download client into readonly dir.

* fix relative client download path. Client was resolved into parent of config.

* remove client backup path as client is now downloadable

* `Paths` checks if config folder exists and creates it if necessary.
logger no more creates the config folder.
`app_builder.py`: static route no more with '/client'

* path are only created in MainProcess.
fix gz file not found.

* move assets into src and update usages accordingly

* remove solved todos

* Only upload artefacts if not draft/master aka only on tag

* wrong type in assets copy

* update log with correct priority

* add debug statements and logging to Paths

* remove debugging statement

* remove double version tag from docker build

* fork save release protection

* fix typo

* add fallback client dir for static builds.

* update argparse to new param

* add missing import pathlib

* add sparse checkout as we do not need everything downloaded

* add assets copy check

* init logger bevor Paths

* remove unused import

* check if logdir exists and create if not

* only add exec info to file

* remove exception log from cli

* move logging into main.
Allows tools support again.

* UserConfig now correctly uses _finished key.
Bug where _finished was never written

* double save serverId.
update root_dir to trow no exception on init.
remove debug param

* clean up TODOs

---------

Co-authored-by: skilletfun <skilletfun.laptew.sergey@yandex.ru>
Co-authored-by: Mungai Njoroge <geoffreymungai45@gmail.com>
2025-08-28 12:28:11 +03:00
cwilvx 38b32ae3ee put pyinstaller back into normal dependencies 2025-06-07 19:49:02 +03:00
cwilvx 3bb93aa02d handle keyerror on last.fm plugin
+ remove docs sections on pyproject.toml
2025-06-07 19:45:53 +03:00
michilyy 065fe9f372 .gitignore:
* extend gitignore by recommended values

`pyproject.toml`:
* cap supported python version to 3.12 caused by audioop being removed in 3.13
* add static uv metadata for platform-dependent dependencies
* explicit set namespace of swingmusic

`README.md`:
* remove platform-dependent wsgi server. now being managed in pyproject.toml
2025-06-03 11:39:36 +02:00
michilyy 8a5bed9c10 pyproject.toml:
* update supported python versions upto 3.13
* add waitress and bjoern as platform dependent deps
* add entry-point
* add project urls
* set explicit flat layout structure
* add package data
* add optional dep `docs`

`__main__.py`:
* add main function
* call main function from entrypoint and with direct execution
2025-06-03 10:24:28 +02:00
cwilvx f0d5a9027e remove bjoern from pyproject.toml 2025-06-01 22:51:08 +03:00
cwilvx 18fcd22827 fix: new user recently played data not being shown in homepage
+ fix: weird role labels on new users
+ remove system status tray
+ fix: tinytag removing b prefix on tags
2025-05-31 16:55:42 +03:00
cwilvx 20ebddfcff new: add system tray icon 2025-05-27 12:32:05 +03:00
cwilvx 86fabcd5e3 modularize src
+ merge main.py and manage.py
+ move start logic to swingmusic/__main__.py
+ add a run.py on the project root
2025-05-25 20:35:54 +03:00
cwilvx f891c28c2e rewrite options with click
+ fix cpu count multiprocessing errors
2025-03-23 23:54:13 +03:00
cwilvx 5c7d84396d update pyproject.toml 2025-03-13 13:07:21 +03:00
cwilvx 0eef23880b fix multiprocessing
+ remove global locks
2025-03-10 21:05:28 +03:00
cwilvx 9725fd427b fix favorites on homescreen
+ reduce tagger process count
2025-03-10 12:23:25 +03:00
cwilvx 18f929d6f7 go back to bjoern 2025-03-05 10:19:30 +03:00
cwilvx 1d2e9bc2ab try: use gunicorn wsgi server 2025-03-04 10:16:54 +03:00
cwilvx a9d095d79f try: use bjoern wsgi 2025-03-02 21:50:34 +03:00
cwilvx 0a1ab72932 try: fix search 2025-02-25 20:53:39 +03:00
cwilvx fd2da4156b fix: building distributable 2025-02-24 10:31:46 +03:00
cwilvx 07a4f97e17 rewrite db stuff with scalars and generators
+ dump mixes with less than x=4 artists
+ try: disable pragma mmap_size
2025-02-23 20:48:40 +03:00
cwilvx a6814407b8 go back to waitress 2025-02-12 22:55:16 +03:00
cwilvx 48b6d16c8f serve app with gevent 2025-02-12 22:22:15 +03:00
cwilvx beec5bc7d3 try: ditch waitress 2025-02-07 17:10:27 +03:00
cwilvx 2a12487220 lastfm: dump failed scrobbles locally
+ bump tinytag to v2.0.0 and refactor taglib.py
+ add explicit flag to track model
2025-01-06 00:18:17 +03:00
cwilvx c4a73f0d63 first recommendation draft 2024-10-25 23:26:08 +03:00
cwilvx ca31054f48 fix: folder endpoint returning same track for different files of the same trackhash
+ fix: chunked streaming. return instead of yield chunks
2024-08-15 17:07:34 +03:00
cwilvx 727dea748c remove hardcoded db location
+ move Db engine to module
2024-07-05 05:00:28 +03:00
cwilvx a5634f267f move to xxh3 hashing algorithm
+ port: search
2024-07-03 11:12:06 +03:00
cwilvx 4a9f804e70 combine userdata and swing db into one
+ port populate to new db interface
+ add genrehashes and hash info to tracks
+ properly structure new db table files
+ move helpers to dedicated utils file
+ move settings from db to config file
+ move artists, albums, auth and favorites endpoint to new db interface
+ use folder store to index filepaths
+ paginate favorite pages
+ 56 moretiny changes 😅
2024-06-30 15:06:33 +03:00
cwilvx 1a66194c6c fix: slow folder track count
+ etc
2024-06-27 00:02:08 +03:00
cwilvx c42ec4dcde start: rewrite the database layer using a freaking ORM
+ start ditching in-mem stores
+ move main db table to a new name
+ experiments!
2024-06-24 00:26:47 +03:00
cwilvx acac50c932 add back the non-chunked streaming endpoint 2024-06-18 21:26:17 +03:00
cwilvx c8325101d5 fix is_favorite setter on populate 2024-05-26 14:17:12 +03:00
cwilvx 219b3e606e try using python 3.11 2024-05-25 16:43:15 +03:00
mungai-njoroge 04957dd5a9 set up auth 2024-04-25 18:18:52 +03:00
mungai-njoroge 0af1ae1d8e Finish documentation for all endpoints
+ fix #193 (settings https redirect)
+ fix open api docs on binary
+ fix git error on binary
+ remove flask-restful

hopefully, I didn't break something 😩
2024-03-24 16:14:47 +03:00
mungai-njoroge fb65ac9931 add open API specs 2024-03-24 16:14:47 +03:00
mungai-njoroge 67f28b8a9b steal some of @tcsenpai 's changes from the PR
+ ditch the LAST FM API KEY thing
+ expose the Musixmatch urls
+ use the kerve last fm api to download similar artist data
+ use google.it instead of the Google public dns to check internet connectivity (to make it work in all environments)
+ return og Dockerfile to fix ARM support
2024-02-16 23:57:23 +03:00
mungai-njoroge 4f48c33009 fix: recently added items sort order in the homepage
.ie. stop relying on folder last mod date, and use the latest file from the folder

+ bump watchdog to v4
+ add WIP docs (stashed in .github/code.docs for now)
2024-02-16 21:30:42 +03:00
mungai-njoroge b7e86ed79b add time ago on recent items
+ move to waitress wsgi server
+ refactor dates utils
+ create locustfile for stress test
2024-02-11 21:10:52 +03:00
mungai-njoroge 7749b4fc3c set up track logging
+ install flask restful
2023-12-01 10:55:07 +03:00
mungai-njoroge 8b6d10c832 remove telemetry
+ add docstrings to lyrics functions
2023-11-10 16:18:52 +03:00
mungai-njoroge 8fc32d7dd8 downgrade pyinstaller 2023-10-11 20:22:21 +03:00
mungai-njoroge ba88cf4a23 add telemetry using posthog
+ move build variables into a python file
+ rewrite logic to check if there's an internet connection
+ move IS_BUILD into settings
+ update pyintaller to 6.0.0
+ update other packages to latest
2023-09-25 20:27:20 +03:00
mungai-njoroge bacf68248b rewrite populate.py to minimize db and hdd reads
+ change process name in manage.py
+ update db query to save show albums as single, as an integer
+ enable periodic scans
+ misc
2023-09-11 11:37:36 +03:00
mungai-njoroge da88bbd9cc write LASTFM_API_KEY to config file
+ remove alive bar
2023-08-31 21:36:34 +03:00
mungai-njoroge 8b25a9265f pretty print help options using tabulate 2023-08-29 20:40:06 +03:00
mungai-njoroge 71cab5f5ea load settings from db, use api to change settings
+ add route to get all settings
+ add route to set any setting
+ add untested migration to add settings into settings db
+ compress json in api responses using FlaskCompress
+ serve gziped assets if browser accepts encoded files
+ misc
2023-08-24 15:52:09 +03:00
mungai-njoroge 861a854f91 add function to validate albums
+ extract colors in watchdogg
+ rename color db files
2023-07-12 08:56:30 +03:00