#1 feed: source weight

Closed
opened 6 years ago by boyska · 0 comments
boyska commented 6 years ago

with a8f59b75 feed is actually not only about feeds: it can pick music from both music and directories.

A nice addition might be to add weights to those sources: weights are only relevant to --random, and can bias the randomness towards one of the source.

Usage

./feed --weights 2:5 http://a.b/feed.xml /mydir/ This means that a result from mydir has much more chances to be picked than a result from the feed. To be meaningful, the number of the weights must match the number of arguments. So,

./feed --weights 2:5 A B C is incorrect, because there are three sources with only two weights. A fix could be

./feed --weights 2:5:1 A B C

Implementation

The biggest choice is whether we must first choose which source we want to use (using weights) and then apply the normal algorithm; or if all the source must be expanded, each audio assigned the weight of the source, and the random algorithm applied.

The second choice will actually say that running ./feed --weight 2:5 A B will actually favor A, if A contains 20 files and B contains only 3 (20*2 = 40, 3*5 = 15).

The first choice is simpler to implement, makes computing faster (no need to "expand" all sources) and has a more predictable behaviour.

with a8f59b75 feed is actually not only about feeds: it can pick music from both music and directories. A nice addition might be to add weights to those sources: weights are only relevant to `--random`, and can bias the randomness towards one of the source. ## Usage `./feed --weights 2:5 http://a.b/feed.xml /mydir/` This means that a result from `mydir` has much more chances to be picked than a result from the feed. To be meaningful, the number of the weights must match the number of arguments. So, `./feed --weights 2:5 A B C` is incorrect, because there are three sources with only two weights. A fix could be `./feed --weights 2:5:1 A B C` ## Implementation The biggest choice is whether we must first choose which source we want to use (using weights) and then apply the normal algorithm; or if all the source must be expanded, each audio assigned the weight of the source, and the random algorithm applied. The second choice will actually say that running `./feed --weight 2:5 A B` will actually favor A, if A contains 20 files and B contains only 3 (20*2 = 40, 3*5 = 15). The first choice is simpler to implement, makes computing faster (no need to "expand" all sources) and has a more predictable behaviour.
boyska referenced this issue from a commit 6 years ago
Sign in to join this conversation.
No Milestone
No assignee
1 Participants
Loading...
Cancel
Save
There is no content yet.