Commit graph

154 commits

Author SHA1 Message Date
Théophile Bastian
189fedb008 Web plugin: add type hint for g.lib 2025-11-15 21:02:43 +01:00
Théophile Bastian
666c412b0e plugins/web: fix endpoints /…/values/…
Following #4709 and #5447, the web plugin used single-quotes (ie. string
litteral) in the SQL query for table columns. Thus, for instance, the query
`GET /item/values/albumartist` would return the litteral "albumartist"
instead of a list of unique album artists.
2025-11-15 21:02:38 +01:00
Martin Atukunda
545213421b
feat(plugin/web): support for nexttrack keypress 2025-10-09 20:11:19 +03:00
Šarūnas Nejus
d93ddf8dd4
Do not use explicit indices for logging args when not needed 2025-08-30 23:10:21 +01:00
Šarūnas Nejus
9352a79e41
Replace percent formatting 2025-08-30 22:35:00 +01:00
Šarūnas Nejus
4a361bd501
Replace format calls with f-strings 2025-08-30 18:42:26 +01:00
Martin Atukunda
8126eaa0fa
Merge branch 'master' into feature/add-artist-to-item-entry-template 2025-07-15 13:58:25 +03:00
Šarūnas Nejus
4260162d44
Remove all Python 2 references 2025-07-08 11:37:34 +01:00
Šarūnas Nejus
7cada1c9f8
Remove no-op decargs 2025-07-08 11:37:33 +01:00
Šarūnas Nejus
0de27cbfb3
Merge branch 'master' into feature/add-artist-to-item-entry-template 2025-07-06 16:43:37 +01:00
Šarūnas Nejus
1a045c9166
Copy paste query, types from library to dbcore 2025-07-06 16:03:46 +01:00
Martin Atukunda
54e76368d0
Avoid rendering extraneous separators
handling cases where the artist or album data might be missing to avoid
rendering extraneous separators. Suggested by Copilot.
2025-07-06 12:22:02 +03:00
Martin Atukunda
7c799beda8
style(plugin/web): run djlint over html to clean it up a bit 2025-05-18 20:59:29 +03:00
Martin Atukunda
992d376d1b
feat(plugin/web): add artist and album to the item entry template 2025-05-18 20:59:29 +03:00
Martin Atukunda
a75d2b4aa6 Update beetsplug/web/static/beets.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-18 17:16:29 +01:00
Martin Atukunda
d1d58569e1 Update beetsplug/web/static/beets.js
don't pollute global scope with album_id

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-18 17:16:29 +01:00
Martin Atukunda
b0238d934e feat: plugins/web: use media session api for notifications.
The Media Session API provides a way to customize media notifications.
This commit updates the metadata for the media session whenever a new
track (item) starts playing.

https://developer.mozilla.org/en-US/docs/Web/API/Media_Session_API
2025-05-18 17:16:29 +01:00
Šarūnas Nejus
179ed13e09
Say bye to util._fsencoding 2025-04-21 12:41:57 +01:00
Andrew Rogl
04ee04150a
Reworked #4709 after latest release (#5447)
Fixes #4709 SQL use of Double Quoted Strings.
2024-09-30 10:28:15 +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
Max Goltzsche
6b929c6e72
web: fix range request support
Do not let the web plugin overwrite the Content-Length header with the full file length since flask/werkzeug sets the requested range's/chunk's size when handling a range request.
This allows to play large audio/opus files using e.g. a browser/firefox or gstreamer/mopidy without making a reverse-proxy/nginx emulate range request support and hide range-related headers from the backend.
2023-12-20 01:23:13 +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
Kian-Meng Ang
873a91c541 Fix typos
Found via `codespell -S ./test/rsrc,genres.txt -L
caf,fo,ue,searchin,crashers,crasher,te,skool,egal,nothin`
2023-09-25 12:52:26 +08:00
wisp3rwind
4ae1e8278c web: fix for breaking werkzeug change
cf. https://github.com/pallets/werkzeug/issues/2506

didn't check when part_isolating was introduced, but presumably, it
should be harmless to set this attribute for old werkzeug versions that
didn't have it yet
2023-04-29 11:37:46 +02:00
wisp3rwind
d24cf69269 remove old Python: remove util.text_string
This was a helper for situations when Python 2 and 3 APIs returned bytes
and unicode, respectively. In these situation, we should nowadays know
which of the two we receive, so there's no need to wrap & hide the
`bytes.decode()` anymore (when it is still required).

Detailed justification:

beets/ui/__init__.py:
- command line options are always parsed to str

beets/ui/commands.py:
- confuse's config.dump always returns str
- open(...) defaults to text mode, read()ing str

beetsplug/keyfinder.py:
- ...

beetsplug/web/__init__.py:
- internally, paths are always bytestrings
- additionally, I took the liberty to slighlty re-arrange the code: it
  makes sense to split off the basename first, since we're only
  interested in the unicode conversion of that part.

test/helper.py:
- capture_stdout() gives a StringIO, which yields str

test/test_ui.py:
- self.io, from _common.TestCase, ultimately contains a
  _common.DummyOut, which appears to be dealing with str (cf.
  DummyOut.get)
2022-12-24 13:09:26 +01:00
wisp3rwind
3510e6311d web: slight refactor to make path handling more readable
(at least, more readable to me)
2022-12-24 13:09:26 +01:00
vicholp
fde2ad3f65 fix get item file of web plugin 2022-08-03 01:22:35 -04:00
Lars Kruse
a09c80447a beetsplug/web: fix translation of query path
The routing map translator `QueryConverter` was misconfigured:
* decoding (parsing a path): splitting with "/" as tokenizer
* encoding (translating back to a path): joining items with "," as separator

This caused queries containing more than one condition (separated by a
slash) to return an empty result.  Queries with only a single condition
were not affected.

Instead the encoding should have used the same delimiter (the slash) for the
backward conversion.

How to reproduce:
* query: `/album/query/albumartist::%5Efoo%24/original_year%2B/year%2B/album%2B`
* resulting content in parsed argument `queries` in the `album_query` function:
    * previous (wrong): `['albumartist::^foo$,original_year+,year+,album+']`
    * new (correct): `['albumartist::^foo$', 'original_year+', 'year+', 'album+']`
2022-01-06 22:00:26 +01: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
Graham R. Cobb
4ffe9a2c45 Fixed bug where readonly value was not being read from config file.
Also simplified the setup of the `readonly` value in the tests which
fixes a test ordering issue found using --random-order.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-12 17:58:35 +00:00
Graham R. Cobb
51d22b765e Add tests for delete operations
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-11 18:02:38 +00:00
Graham R. Cobb
4a9652a9e4 Only allow DELETE or PATCH operations if "readonly" is set to true.
Note: default is false which is a **NOT BACKWARDS COMPATIBLE** change.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-11 18:02:38 +00:00
Graham R. Cobb
553e38fc11 Do not do backslash substitution on regex queries
As discussed in bug #3867, backslash replacement in query strings is a bit of a
hack but it is useful (see #3566 and #3567 for more discussion). However,
it breaks many regular expressions so this patch stops the replacement if the
query term contains '::', indicating it is a regex match.

This commit fixes #3867.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-08 16:58:05 +00:00
Graham R. Cobb
9986b9892c Fix bug where album artpath not returned when INCLUDE_PATHS is set
Track item paths and album artpaths should be removed from results unless
INCLUDE_PATHS is set. This works for items but for albums the artpath is always
removed.

This patch makes the artpath removal conditional on INCLUDE_PATHS not being set
and includes a regression test. Note: the default value for INCLUDE_PATHS is
False so no changes will be seen by users unless they already have
INCLUDE_PATHS set.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-06 15:25:48 +00:00
Cadel Watson
d1f93a26a6 Fix lint errors 2020-09-20 11:30:12 +10:00
Cadel Watson
a18b317240 Add PATCH method to item queries 2020-09-20 10:46:48 +10:00
Cadel Watson
afcde697e0 Add PATCH method to Items 2020-09-20 10:45:12 +10:00
Cadel Watson
29672a434f Add DELETE method to resource queries 2020-09-20 10:23:25 +10:00
Cadel Watson
76220fb148 Add DELETE method for items and albums 2020-09-20 10:18:07 +10:00
Sören Tempel
6a03afc65d web plugin: support path queries by separating them with a backslash
Without this change the web plugin does not support path queries as
slashes are currently used for joining keywords in the QueryConverter.
Moreover, flask cannot distinguish between an URL encoded and a plain
'/' character during routing [0]. To work around this issue without
introducing a breaking change (i.e. removing the QueryConverter) use the
backslash character for path queries and convert it later on.

Fixes #3566

[0]: https://github.com/pallets/flask/issues/900
2020-04-27 13:36:36 +02:00
Adrian Sampson
d43d54e21c Try to work around a Werkzeug change? 2020-02-06 22:22:54 -05:00
FichteFoll
aa31fea037
Update a lot of URLs to use HTTPS
*All* URLs were checked manually, but only once per domain!

I mostly concerned myself with URLs in documentation rather than source
code because the latter may or may not have impactful changes, while the
former should be straight forward.

Changes in addition to simply adding an s:

- changed pip and pypi references as their location has changed
- MPoD (iOS app) url redirects to Regelian, so I replaced those
- updated homebrew references

Notable observations:

- beets.io does have HTTPS set up properly (via gh-pages)
- beatport.py uses the old HTTP url for beatport
- as does lyrics.py for lyrics.wikia.com
- https://tomahawk-player.org/ expired long ago, but the http page
  redirects to https regardless
- none of the sourceforge subdomains have https (in 2019!)
2019-06-05 03:11:49 +02:00
Ryan Veach
1505ff071d changed flask cors import 2018-07-10 10:32:21 -05:00
Waweic
06d4fe254d Implement recommendations by sampsyo
Implemented all recommendations.
2018-03-06 17:49:20 +01:00
Waweic
3c3e579dcc Make programming style pep8 compliant 2018-03-01 20:20:38 +01:00
Waweic
d0fd41b474 Add unicode support for Python 2 and 3
Converts bytes to unicode using util.text_string, assuming that the
string is a UTF-8 string.
If that fails, it falls back to a hardcoded fallback filename.
2018-03-01 19:45:44 +01:00
Waweic
4df313e3ce Fix unicode problems in web plugin
Added Exception to the web plugin to catch non latin-1 characters and change them to ascii chars.
Added Description to the changelog file
2018-03-01 11:56:38 +01:00
Waweic
b94227a53d Merge https://github.com/waweic/beets into patch-2
Catch up
2018-02-27 22:03:50 +01:00
Adrian Sampson
453fd372a3 Flatten a config view (#2821) 2018-02-26 18:00:59 -05:00
Adrian Sampson
3b49da0c52 Merge pull request #2821 from Konubinix/master
Add a support for supports_credentials
2018-02-26 17:59:57 -05:00