Šarūnas Nejus
b38a4f59c7
Add annotation for LibModel.length property
2025-08-26 12:24:33 +01:00
Sebastian Mohr
9ed6ca613d
Added an option to define the field to use for equal chance sampling
2025-08-22 12:00:34 +02:00
Šarūnas Nejus
15515bec95
Replace random.Random with random module
2025-08-19 15:00:41 +01:00
Sebastian Mohr
bacaa57f8d
Cached property for length & forgot sorted.
2025-08-13 12:27:12 +02:00
Sebastian Mohr
fb529d7a73
Overall refactor of random plugin. Added length property to albums.
2025-08-10 22:24:30 +02:00
Sebastian Mohr
3941fd31ae
Added typehints and some more tests.
2025-08-09 14:38:53 +02:00
Sebastian Mohr
36ca9424b3
Moved functions from random.py into random plugin. Removed random.py
2025-08-09 13:40:57 +02:00
Šarūnas Nejus
afe97cf31e
Do not assign args to query
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
85a17ee503
Reformat the codebase
2024-09-21 11:57:48 +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
Andrew Rogl
1ec87a3bdd
pyupgrade beetsplug and tests
...
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
Carl Suster
9147fabb97
random: beets.util.random -> beets.random
2019-04-07 18:46:11 +10:00
Carl Suster
f35944f49c
random: move implementation to beets.util.random
2019-04-06 11:06:19 +11:00
Adrian Sampson
641e62f2e0
Vastly simplify main random function
...
This is the payoff from the earlier refactorings: the control flow is now
consistent and clear, and the two factors (time vs. number, equal-chance or
not) are orthogonal. See also #2322 .
2016-12-26 17:04:21 -05:00
Adrian Sampson
33eb4ff91b
Refactor time-based selection ( #2322 )
2016-12-26 17:01:02 -05:00
Adrian Sampson
d053f98e81
random: Refactor equal chance logic
2016-12-26 16:43:47 -05:00
Adrian Sampson
5bbf16c2b1
Refactor length calculation ( #2322 )
...
Also, avoid setting an unnecessary field on the album objects. :/
2016-12-26 16:32:03 -05:00
Adrian Sampson
4c2457d6ce
Refactor random plugin a bit
...
Separate the callback function from the random selection logic.
2016-12-26 16:27:31 -05:00
diomekes
1bc5456986
random: make --album work with --time
2016-12-17 17:24:58 -05:00
diomekes
fc8411f3b8
random: add --time option, update docs
2016-12-15 16:15:38 -05:00
Johnny Robeson
db782a2404
wrap 2 results in a list in cue and random plugin
2016-09-14 00:40:53 -04:00
Adrian Sampson
e54c7eec3d
Standardize __future__ imports without parentheses
...
Since the list is short enough now, we don't need parentheses for the line
wrap. This is a little less ugly.
2016-02-28 15:03:51 -08:00
Peter Kessen
456565b6f2
Removed import of unicode_literals from plugins
...
* play
* plexpudate
* random
* replaygain
2016-02-20 14:22:45 +01:00
Jack Wilsdon
12cd5306b7
Update copyright dates to 2016
2015-12-30 15:42:06 +00:00
Peter Kessen
3eb8008b11
added encoding as comment in files
...
added line like
# -*- coding: utf-8 -*-
to all files with correct license in header
2015-11-19 18:41:01 +01:00
Bruno Cauet
ea1dc1eb19
Plugins conversion cont.
2015-03-05 17:40:32 +01:00
Bruno Cauet
650305c9a1
All suitable plugins use CommonOptionsParser features
2015-03-05 17:03:02 +01:00
Adrian Sampson
b8dab9cf9f
Merge pull request #1247 from brunal/future
...
Use all __future__ imports in beets core
Conflicts:
beetsplug/web/__init__.py
test/test_embedart.py
2015-01-26 17:02:07 -08:00
Bruno Cauet
4e904c78af
Simplify LibModel format management
...
Delete `ui.format_` and then `ui.print_obj`. Simply ensure that when
there is no format it defaults to '' = default format = config option.
2015-01-26 23:09:56 +01:00
Bruno Cauet
62cd6e37aa
Update ui.print_obj_(), add ui.format_()
...
Code now relies on `format()` for items and albums displaying/logging.
`ui.print_()` calls `unicode()` or `str()` on the strings so for most
usages calling `ui.print_(obj)` replaces `ui.print_(obj, lib, None)`.
Where there is a special format `ui.print_(format(obj, fmt))` is fine,
but when `fmt` can be None then one has to call
`ui.print_(ui.format_(obj, fmt))` -- which is what `ui.print_obj` now
does.
2015-01-25 21:07:03 +01:00
Bruno Cauet
a5026100a3
All plugins use unicode_literals
...
Given that part of them has no test I may have broke them
2015-01-20 16:22:27 +01:00
Bruno Cauet
90b388b775
Use __future__ imports but unicode_literals everywhere
...
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.
Goal is smoothing the transition to python 3.
2015-01-19 12:25:16 +01:00
Frederik “Freso” S. Olesen
4b1f0cbf48
Happy 2015. ;)
...
See 7a410f636b
Command used:
git grep -l 'Copyright 201'|xargs sed -i -E 's/Copyright 201./Copyright 2015/'`
2015-01-08 21:37:09 +01:00
Adrian Sampson
e5a9db1cac
fix up some indentation warnings in plugins
2014-04-13 17:55:49 -07:00
Fabrice Laporte
3ead936fe5
flake8 cleaning beetsplug/*
...
Remaining warnings are related to visual indentation.
2014-04-13 23:24:57 +02:00
Adrian Sampson
f70ddfbd1d
deduplicate albums() and items() methods
...
This also drops the keyword arguments to these methods, which were vestigial.
2013-09-08 23:18:58 -07:00
Adrian Sampson
4555d69803
random: py26 fix
2013-06-12 16:09:41 -07:00
Adrian Sampson
6f2c1d81bd
random -e ( #263 ): fix some short responses
...
This slight modification to the selection algorithm avoids the situation in
which too many objects are chosen for a given artist and fewer than N objects
are eventually returned. We do this by implementing "selection without
replacement" literally: we choose objects one at a time and pop them from the
population when they are selected.
2013-05-19 11:00:52 -07:00
Georges Dubus
5dbff4a8eb
Fixed the randomness of the equal change to have more than one song by artist
2013-05-19 17:22:19 +02:00
Georges Dubus
bcae495c50
Added a -e option to random that makes the distribution even among artists
2013-05-03 18:19:44 +02:00
Adrian Sampson
7a410f636b
happy new year ✨
...
For future reference, this command did the trick:
ack -l 'Copyright 201' | xargs perl -pi -E 's/Copyright 201./Copyright 2013/'
2013-01-11 10:43:41 -08:00
Adrian Sampson
51e9c519d4
plugin renames: fuzzy and random
...
Renamed fuzzy_search to fuzzy and rdm to random. These names should be easier
to remember since they are the same as the commands they provide.
--HG--
rename : beetsplug/fuzzy_search.py => beetsplug/fuzzy.py
rename : beetsplug/rdm.py => beetsplug/random.py
rename : docs/plugins/fuzzy_search.rst => docs/plugins/fuzzy.rst
rename : docs/plugins/rdm.rst => docs/plugins/random.rst
2012-12-23 14:46:20 -08:00