Commit graph

33 commits

Author SHA1 Message Date
Šarūnas Nejus
b3d434f58f
Delegate attribute access to logging 2025-08-30 23:10:21 +01:00
Šarūnas Nejus
d6b6ac3387
Replace logging f-strings with arguments 2025-08-30 23:10:21 +01:00
Šarūnas Nejus
4a361bd501
Replace format calls with f-strings 2025-08-30 18:42:26 +01:00
J0J0 Todos
cf557fb41b playlist: Use pathlib.Path and add types for is_m3u_file()
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2025-07-07 08:05:47 +02:00
J0J0 Todos
dcd3a9f7f4 playlist: Support m3u8 ending in playlist plugin 2025-07-07 07:58:59 +02:00
Šarūnas Nejus
1a045c9166
Copy paste query, types from library to dbcore 2025-07-06 16:03:46 +01:00
Šarūnas Nejus
161b0522bb
Update deprecated imports 2024-12-10 06:10:04 +00:00
Šarūnas Nejus
7d636d8f22
Add support for a specific type in InQuery 2024-04-30 22:20:36 +01:00
Šarūnas Nejus
68eee96c03
Define InQuery and use it in PlaylistQuery
While working on the DB optimisation I discovered one query which does
not follow the 'FieldQuery' interface - 'PlaylistQuery', so I looked
into it in more detail.

One special thing about it is that it uses 'IN' SQL operator, so
I defined 'InQuery' query class to have this logic outside of the
playlist context.

Otherwise, it seems like 'PlaylistQuery' is a field query, even if it
has a very special way of resolving values it wants to query. In the
future, we may want to consider moving this kind of custom
_initialisation_ logic away from '__init__' methods to
factory/@classmethod: this should make it more clear that the purpose of
such logic is to resolve the data that is required to define
a particular FieldQuery class fully.
2024-04-30 22:20:36 +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
wisp3rwind
bc7c447b3c beetsplug/playlist: actually use SQL clause
As far as I can tell, the fast SQL path was never used before, since a
query would use the default `clause()` implementation. It is only the
`FieldQuery.clause()` that could delegate to `col_clause()`, but
`PlaylistQuery` is not a `FieldQuery`.
2023-06-23 11:00:09 +02:00
wisp3rwind
09d2c87f29 typings: corrections for dbcore/queryparse
- Add NamedQuery abstract class to be able to express the expectation
  that a query should be such a query (and have a specific constructor
  signature) in construct_query_part
- slightly (and probably completely irrelevantly) improve Query.__hash__
- also, sprinkle some ABC/abstractmethod around to clarify things
2023-06-23 10:59:51 +02: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
Jacob Pavlock
124c882b4d un-ignore E221 2020-07-11 18:33:08 -07:00
MartyLake
076a82daa6 Review: Rename method 2019-07-24 00:09:52 +02:00
MartyLake
ee7f939336 Review: Remove stray blank line 2019-07-23 23:53:50 +02:00
MartyLake
aa1da3166f Review: Remove unnecessary parens 2019-07-23 23:53:17 +02:00
MartyLake
da864402d5 Review: Remove unnecessary get 2019-07-23 23:49:17 +02:00
MartyLake
d1ba309f36 Add a new method that copied pathlib.path.as_posix 2019-07-23 17:17:40 +02:00
Adrian Sampson
81c5ae3fdf
Merge pull request #3151 from Holzhaus/playlist-plugin-additions
playlist: Add auto-update functionality and more tests
2019-02-18 08:40:55 -05:00
Jan Holthuis
4ba5dfaa43 playlist: Remove leftover print call and fix 'auto' option access style 2019-02-18 09:13:39 +01:00
Jan Holthuis
7bca5cf549 playlist: Don't use syspath() when checking if path is absolute 2019-02-17 22:28:39 +01:00
Jan Holthuis
ee2cce4280 playlist: Work around Windows' Mandatory File Locking on playlist updates 2019-02-17 22:12:13 +01:00
Jan Holthuis
d991e2a7d8 playlist: Normalize path before lookup in changes dict 2019-02-17 21:51:09 +01:00
Adrian Sampson
9320db21eb
Merge pull request #3150 from beetbox/named-query
Add support for "named queries" and use them in the playlist plugin
2019-02-17 15:08:31 -05:00
Adrian Sampson
55ef2ffd39 Add future imports to playlist plugin 2019-02-17 14:02:26 -05:00
Adrian Sampson
7efc67eb03 playlist: Use new "named query" functionality 2019-02-17 13:52:00 -05:00
Jan Holthuis
6d42028057 playlist: Add playlist auto-update functionality 2019-02-17 19:38:21 +01:00
Jan Holthuis
4f1a468aa9 playlist: Restore case sensitivity in col_clause method 2019-02-17 17:34:36 +01:00
Jan Holthuis
055f2d3702 playlist: Also catch IOErrors to restore Python 2.7 compatiblity 2019-02-17 16:00:04 +01:00
Jan Holthuis
f9f2fa0e26 playlist: Restructure playlist reading code and add error handling 2019-02-17 15:17:10 +01:00
Jan Holthuis
19b92e1199 playlist: Improve speed in PlaylistQuery class
Implement the col_clause method for faster, sqlite-based querying. This
will only make a difference if the "fast" kwarg is set to True.
2019-02-17 14:38:36 +01:00
Jan Holthuis
a80a07f093 playlist: Add playlist plugin
Adds M3U playlist support as a query to beets and thus partially
resolves issue #123. The implementation is heavily based on #2380 by
Robin McCorkell.

It supports referencing playlists by absolute path:

    $ beet ls playlist:/path/to/someplaylist.m3u

It also supports referencing playlists by name. The playlist is then
seached in the playlist_dir and the ".m3u" extension is appended to the
name:

    $ beet ls playlist:anotherplaylist

The configuration for the plugin looks like this:

    playlist:
        relative_to: library
        playlist_dir: /path/to/playlists

The relative_to option specifies how relative paths in playlists are
handled. By default, paths are relative to the "library" directory. It
also possible to make them relative to the "playlist" or set the option
or set it to a fixed path.
2019-02-17 14:38:36 +01:00