Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.3 develop - fix issue #144 Avoid Duplicate repeats on dynamic selections in shows #144 #177

Open
wants to merge 2 commits into
base: 5.3-develop
Choose a base branch
from

Conversation

btelliot
Copy link
Contributor

@btelliot btelliot commented Dec 24, 2024

OB Description

Fixes #144: [Avoid Duplicate repeats on dynamic selections in shows]
I've updated the playlist_model with some logic to handle preventing duplication of tracks.

The logic is as follows:

  1. Keep a list of station ids used, once all of the station ids have been used, delete the list and start a new one. This prevents repeating station ids right away.
  2. Keep a list of media items selected via dynamic selection. Only allow for repeats if all of them have been used.
  3. Manually selected media items have priority, but if a manually selected media item exists, it will not be added to a dynamic selection.
  4. Handle cases where there are too few media items to exhaustively avoid duplicates, or when a dynamic selection has fewer items than required for its usage in the playlist.
  5. If all unique items are exhausted, allow duplicates as a fallback.
  6. Make sure the function doesn't get stuck in a loop.

**IMPORTANT: Search previous suggestions before making a new one, as yours may be a duplicate. Do not create a Pull Request without creating an issue first.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

I've tested this on ob.cjucfm.com with a variety of playlists. I wrote a custom php script 'test_playlist_resolve.php' which can be used via console to test evaluate the updated function.

From the www root, of the machine running openbroadcaster run:
php test_playlist_resolve.php <playlist_id> <player_id>

Testing Environments

OpenBroadcaster Component and Version

  • OBServer 5.3-develop
  • OBPlayer 5.3-develop
  • Module
  • Other

Browser Version?

  • Chrome
  • Edge\IE
  • Firefox
  • Safari
  • Other

OS Version?

  • BSD
  • Debian
  • Raspberry OS
  • Ubuntu (Flavour)
  • Other

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code and corrected any misspellings
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant