Author Topic: Auto Update Playlist Order Plugin  (Read 1715 times)

fiso64

  • Jr. Member
  • **
  • Posts: 76
Forum post that inspired this: https://getmusicbee.com/forum/index.php?topic=42360.0
Github: https://github.com/fiso64/MusicBee-Auto-Update-Playlist-Order

Auto Update Playlist Order Plugin for MusicBee

This MusicBee plugin automatically updates the "natural" play order of static playlists based on your custom configurations.

Problem

MusicBee static playlists have a "natural play order" which is initially determined by the order tracks were added. Sorting or shuffling playlists in MusicBee does not change this natural order. As explained in the MusicBee wiki:

Quote
Every static playlist has an official track order, called its "natural order" or "playlist order", which by default is the order in which you added the tracks. When tracks are dragged to or sent to a playlist, they are always added to the end of Playlist Order. You can see the order if the # column is displayed in the main panel. Shuffling or sorting tracks will not change the natural order.
If it is not in order, you can choose "Update Play Order" in the List menu and it will be renumbered to match the current order.

This can lead to unexpected results when exporting playlists (e.g., to m3u files) or syncing to external devices, as they will follow the natural play order, not the sorted view you see in MusicBee. You might have to manually use "List -> Update Play Order" for each playlist to fix this before syncing or exporting.

This plugin can automate this "Update Play Order" step whenever a playlist is modified.

How it works

This plugin allows you to define sorting rules for specific playlists. When a configured playlist is updated (tracks added or removed), the plugin will:

1. Apply your defined sort criteria.
2. Update the playlist's "natural play order" to reflect the sorted order.

This ensures that the play order is always what you expect, even when exported or synced.

Configuration

1. Go to Preferences > Plugins.
2. Find "Auto Update Playlist Order" and click Configure.
3. In the configuration window:
    * Playlist Name: Select a playlist from the dropdown.
        * Select "AllPlaylists" to define default sorting rules for all playlists.
        * Individual playlist configurations override the "AllPlaylists" default configuration.
    * Order Configuration: Click the "Configure" button to set up sorting rules for the selected playlist.
        * In the "Configure Playlist Order" window, you can add multiple sorting criteria. For each criterion:
            * Order By: Choose a tag or file property to sort by (e.g., "Date Added", "Album", "Artist").
            * Descending: Check if you want to sort in descending order.
            * Manual Order:
                * Use ascending to prevent a playlist from being affected by "AllPlaylists" sorting rules
                * Use descending to add new tracks at the start of the playlist

Notes:
* You will need to update your configuration whenever you rename the playlists.
* Manual Order (ascending) is only needed when you want to exclude a playlist from "AllPlaylists" sorting

Usage

Once configured, the plugin will automatically update the play order of the specified playlists in the following situations:

* Playlist Updated: When you add or remove tracks from a configured playlist.
* Configuration Changes: When you modify the playlist configurations in the plugin's settings and click "Ok".
* Manual Update: Click the "Update All" button in the configuration window to force an update of all configured playlists.

Installation

Note: The plugin is new and little testing has been done; it's recommended to back up your playlists first.

1. Download the the latest release here.
2. Extract the files into the MusicBee Plugins folder (usually located at `MusicBee\Plugins`).
3. Restart MusicBee.
4. The plugin should now be available in Preferences > Plugins.
Last Edit: February 02, 2025, 03:27:08 PM by fiso64

BoringName

  • Sr. Member
  • ****
  • Posts: 916
3.  In the configuration window:
    *   **Playlist Name**: Select a playlist from the dropdown.
    *   **Order Configuration**: Click the "Configure" button to set up sorting rules for the selected playlist.
        *   In the "Configure Playlist Order" window, you can add multiple sorting criteria. For each criterion:
            *   **Order By**: Choose a tag or file property to sort by (e.g., "Date Added", "Album", "Artist").
            *   **Descending**: Check if you want to sort in descending order.
        *   Click "Ok" to save the sorting rules for the playlist.
4.  Click "Ok" to save the plugin configuration.

**Note: You will need to update your configuration whenever you rename the playlists.**

I haven't looked at the source code but I think the API provides the functionality where you could have a global option for this where a set rule could apply to all playlists. For those lazy users that don't want to configure every playlist...

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1733
  • Heal The World
Cool stuff. Thanks for sharing.
Regarding the direct download link on your start-post, if data monitoring interests you (be it today or years from now), then:

The direct G Drive Github link above will make your dashboard stats come up short in the future.
Strength and Honour (2025)

fiso64

  • Jr. Member
  • **
  • Posts: 76
I haven't looked at the source code but I think the API provides the functionality where you could have a global option for this where a set rule could apply to all playlists. For those lazy users that don't want to configure every playlist...

I'll add this option in the next version

fiso64

  • Jr. Member
  • **
  • Posts: 76
Github link above will make your dashboard stats come up short in the future.
I don't really mind, but thanks for the heads up

fiso64

  • Jr. Member
  • **
  • Posts: 76

fiso64

  • Jr. Member
  • **
  • Posts: 76
Version 1.2.0

### Added
 - Playlists can now be set to be sorted by manual order, descending in order to always prepend files at the top rather than append at the bottom

 ### Changed
- Removed exclusions configuration for "AllPlaylists" as exclusions can now be added by creating a playlist sorting rule with manual order
  - **Important:** Not compatible with the previous configs; exclusions will have to be re-added manually.
 - 500ms debounce for playlist update just in case

https://github.com/fiso64/MusicBee-Auto-Update-Playlist-Order/releases/tag/v1.2.0