LibreTime: Radio Broadcast & Automation Platform
Go to file
Rob Hailman 2b43e51ed1
fix: playlist allocates inaccurate time to smartblocks (#3026)
### Description

In the existing logic of `retrieveMediaFiles`, the time remaining in
show is calculated incorrectly in some scenarios. Each time a duration
is subtracted from `showLimit`, it is not the duration of the files just
added, but instead the length of all files scheduled. This can cause
cases where a smart block set to "time remaining in show" fails to
completely fill the program.

For example, given a 30 minute show, and a playlist like follows:

1. a 5 minute track
2. another 5 minute track
3. smart block, set to time remaining in show

When item 1 is added, `showLimit` is reduced by 5 minutes as expected.
When item 2 is added, `showLimit` is reduced by 10 minutes (as both
items 1 and 2 are counted). As a result, the smart block is only run to
fill 15 minutes, leaving 5 minutes unfilled.

This PR resolves this issue, by recalculating `showLimit` from the
original duration rather than subtracting from a running total.

This change not does implement a new feature and should not require any
changes to documentation.

### Testing Notes

**What I did:**

- On a dev environment, set up a playlist as described above.
- Before applying this PR, created a show and scheduled playlist, and
confirmed issue was reproducible
- Applied PR and repeated, and confirmed show was filled completely.

Also repeated this testing with sample data from our production
instance.

Here is a sample schedule of the "before" case with sample data, showing
the issue

![image](https://github.com/libretime/libretime/assets/8541186/f91849fb-606f-410e-bef5-a7abc8e7b7f4)
The smartblock that scheduled the music is set to allow last track to
overflow, but 3m55s was left unscheduled.

Using the same playlist and same track library, here is a sample
schedule after the PR applied:

![image](https://github.com/libretime/libretime/assets/8541186/e9d46fbb-50e6-4859-a3de-f5a90a6021c0)
As expected, the show is fully scheduled with the last track
overflowing.
 
Additionally, I've applied this PR as a hot fix to our production
instance, where it has been running for a week without issue.

Also performed spot tests of playlists without smart blocks, smart
blocks scheduled directly (not in playlists) and autoloading playlists,
with no change in behaviour observed as a result of this change.

**How you can replicate my testing:**

Same test steps as I followed should be able to reproduce issue &
validate fix on any instance.

### **Links**

Not directly related to issue fixed by #3019, but also addresses the
issue of dead air left at end of blocks.

Co-authored-by: Kyle Robbertze <paddatrapper@users.noreply.github.com>
2024-06-05 17:01:57 +01:00
.github chore(main): release 4.1.0 (#2893) 2024-05-05 23:45:39 +02:00
analyzer chore(main): release 4.1.0 (#2893) 2024-05-05 23:45:39 +02:00
api chore(main): release 4.1.0 (#2893) 2024-05-05 23:45:39 +02:00
api-client chore(main): release 4.1.0 (#2893) 2024-05-05 23:45:39 +02:00
dev chore: add mailpit to dev setup 2023-06-02 07:44:34 +01:00
docker feat!: use nginx to serve media files (#2860) 2023-12-30 18:59:15 +01:00
docs docs: fix typo (#3027) 2024-06-05 16:54:12 +01:00
installer feat(installer): add the `--storage-path` flag (#2865) 2024-01-01 14:38:05 +01:00
legacy fix: playlist allocates inaccurate time to smartblocks (#3026) 2024-06-05 17:01:57 +01:00
playout chore(main): release 4.1.0 (#2893) 2024-05-05 23:45:39 +02:00
shared chore(main): release 4.1.0 (#2893) 2024-05-05 23:45:39 +02:00
tools chore(deps): update dependency pytest-cov to v5 (#2976) 2024-04-06 18:47:53 +02:00
worker chore(main): release 4.1.0 (#2893) 2024-05-05 23:45:39 +02:00
.codespellignore chore: release 3.2.0 (#2754) 2023-10-16 21:26:59 +02:00
.dockerignore feat: add container setup 2022-09-14 11:09:52 +02:00
.env.dev chore: move dev env files to dev subfolder 2023-04-12 08:11:21 +01:00
.gitattributes Create .gitattributes to ensure proper cloning with Windows Git 2017-04-09 14:41:52 -04:00
.gitignore chore: use a secure dev environment 2023-04-12 08:11:21 +01:00
.pre-commit-config.yaml chore(deps): update pre-commit hook codespell-project/codespell to v2.3.0 2024-05-30 01:58:26 +00:00
.vale.ini chore: reenable vale rule after fix (#2965) 2024-03-02 14:15:50 +01:00
CHANGELOG.md chore(main): release 4.1.0 (#2893) 2024-05-05 23:45:39 +02:00
CONTRIBUTING.md chore: fix CONTRIBUTING symlink again 2023-04-03 12:39:24 +02:00
Dockerfile feat: start celery worker programmatically (#2988) 2024-04-13 21:03:57 +02:00
LEGACY.md Add Table of Content to LEGACY file 2021-09-02 20:55:16 +02:00
LICENSE Small update to LICENSE 2021-09-02 16:06:26 +02:00
Makefile build: replace custom release script with release-please (#2817) 2023-12-22 19:19:12 +01:00
README.md docs: update chat links to point to matrix (#2571) 2023-05-30 11:49:37 +02:00
SECURITY.md docs: move release docs in the release section 2023-04-12 16:50:04 +01:00
Vagrantfile feat(installer)!: change default listen port to 8080 (#2852) 2023-12-29 17:49:07 +01:00
cloud-init.yml feat: rewrite cloud-init config (#2853) 2023-12-29 17:57:59 +01:00
codecov.yml test(worker): setup testing 2022-09-09 14:44:37 +02:00
docker-bake.json ci: use bake file for container build 2023-02-26 20:37:27 +02:00
docker-compose.override.yml fix: remove obsolete docker compose version (#2982) 2024-04-13 14:37:04 +02:00
docker-compose.yml fix: remove obsolete docker compose version (#2982) 2024-04-13 14:37:04 +02:00
install fix(installer): setup the worker entrypoint (#2996) 2024-04-18 14:27:20 +02:00
pyproject.toml chore: add isort pre-commit hook 2023-02-03 12:38:58 +01:00

README.md

LibreTime

Financial Contributors on Open Collective

LibreTime makes it easy to run your own online or terrestrial radio station. It is a community managed fork of the AirTime project.

It is managed by a friendly inclusive community of stations from around the globe that use, document and improve LibreTime. Join us in fixing bugs and in defining how we manage the codebase going forward.

Check out the documentation for more information and start broadcasting!

Please note that LibreTime is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

You can find details about our development process in the contributing guide.

Support

To get support for any questions or problems you might have using the software we have a forum at discourse.libretime.org. We are moving towards using the forum to provide community support and reserving the github issue queue for confirmed bugs and well-formed feature requests.

You can also contact us through Matrix (#libretime:matrix.org) where you can talk with other users and developers.

Contributors

Code Contributors

This project exists thanks to all the people who contribute.

Financial Contributors

Become a financial contributor and help us sustain our community on OpenCollective.

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website.

License

LibreTime is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.

Copyright (c) 2011-2017 Sourcefabric z.ú.

Copyright (c) 2017-2023 LibreTime Community

Please refer to the LEGACY file for more information.