Commit graph

29 commits

Author SHA1 Message Date
Šarūnas Nejus
1c16b2b308
Replace string concatenation (' + ')
- Join hardcoded strings
- Replace concatenated variables with f-strings
2025-08-30 23:10:15 +01:00
Šarūnas Nejus
4a361bd501
Replace format calls with f-strings 2025-08-30 18:42:26 +01:00
Sebastian Mohr
dc6f07d705 Added typing_extensions to all python version. Removed sys.version checks 2025-08-04 11:19:14 +02:00
Šarūnas Nejus
a8ad7df064
Use Item.field_query for queries that receive user input 2025-01-19 01:09:11 +00:00
Šarūnas Nejus
161b0522bb
Update deprecated imports 2024-12-10 06:10:04 +00:00
Šarūnas Nejus
51f9dd229e
Use PEP585 lowercase collections typing annotations 2024-12-10 06:10:03 +00:00
Šarūnas Nejus
85a17ee503
Reformat the codebase 2024-09-21 11:57:48 +01:00
Arkadiy Illarionov
1c020b8264 Check Python version instead of catching ImportError 2024-06-22 19:55:52 +03:00
Arkadiy Illarionov
859072ee9e Use typing_extensions only when needed
Self was added in Python 3.11
TypeAlias was added in Python 3.10
2024-06-22 16:02:24 +03:00
Šarūnas Nejus
2800a323a2
Revert "Make queries fast, filter all flexible attributes (#5240)"
This reverts commit 143b9202f3, reversing
changes made to 8508a57d77.
2024-06-19 21:51:44 +01:00
Šarūnas Nejus
e0c50c5501
Remove slow lookups from beetsplug/aura
It seems like previously filtering by flexible attributes did not work
- I'd receive '{"data": []}' trying to GET `/aura/tracks?filter[play_count]=11`

Now this works, not only for tracks, but for `/aura/artists` and
`/aura/albums` too.

Additionally, this improves `/aura/tracks` response time significantly.
I tried loading the default of 500 tracks from my library:

On `master`, it took ~20s
After this commit, it takes under 1s.
2024-06-16 15:28:46 +01:00
Šarūnas Nejus
f388ff6ec1
Replace py3_path with builtin os.fsdecode
`os.fsdecode` has only been available since Python 3.2.
2024-06-16 00:52:37 +01:00
Šarūnas Nejus
e9ce625879
Dedupe get_attribute_converter 2024-05-07 21:15:00 +01:00
Šarūnas Nejus
6ee734685d
Feed in app context and args into Document to allow testing
This will be help with testing each of the documents which do not
any more depend on the 'global' `current_app` and `request`. These two
can now be provided at the time the objects are instantiated.
2024-05-07 19:55:02 +01:00
Serene-Arc
a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10:00
Adrian Sampson
1fad3d01ae
aura: Sanitize filenames in image IDs
When constructing paths to image files to serve, we previously spliced
strings from URL requests directly into the path to be opened. This is
theoretically worrisome because it could allow clients to read other
files that they are not supposed to read.

I'm not actually sure this is a real security problem because Flask's
URL parsing should probably rule out IDs that have `/` in them anyway.
But out of an abundance of caution, this now prevents paths from showing
up in IDs at all---and also prevents `.` and `..` from being valid
names.
2021-11-26 15:35:07 -05:00
Andrew Rogl
1ec87a3bdd pyupgrade beetsplug and tests
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
Callum Brown
a24a094562 AURA: Small updates to docs and set server version 2021-03-07 18:24:57 +00:00
Callum Brown
a54ee43d57 AURA: Allow '-' character in filter attribute 2021-03-07 14:23:17 +00:00
Callum Brown
477eed3b25 AURA: Use py3_path rather than displayable_path
displayable_path may remove 'bad' characters, yielding a wrong path.

Also use track.path rather than track.destination() as that is where
the file is actually located rather than where it should be located
according to the beets path system.
2021-03-07 10:25:20 +00:00
Callum Brown
2fe2f4f31e AURA: Ensure CORS allowed origins are strings 2021-03-06 13:30:31 +00:00
Callum Brown
fbc76887ad AURA: Fix styling when formatting error strings 2021-03-06 13:22:28 +00:00
Callum Brown
07cfaaa3b3 AURA: Simplify if statements
Get rid of ` is not None`
Change `len(x) == 0` to `not x`
Change `x is None` to `not x`
2021-03-06 12:44:32 +00:00
Callum Brown
b1baeb37f1 AURA: replace translate_attribute with a dict.get 2021-03-06 12:08:35 +00:00
Callum Brown
7e819d2a2e AURA: Update artist-mbid attribute to use '-' 2021-03-06 12:01:02 +00:00
Callum Brown
e067298224 Add default config values in create_app()
So if not run through beet aura then default values will be available
2020-10-28 18:56:45 +00:00
Callum Brown
e8aa96ef72 AURA: Add argument info to docstrings
Follows the google docstring style:
https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings
2020-09-27 18:58:39 +01:00
Callum Brown
51c3f310e9 AURA: Fix docstrings for tox -e lint 2020-09-27 18:09:16 +01:00
Callum Brown
5c875c50de AURA: Add aura plugin and docs 2020-09-21 20:24:41 +01:00