• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Syncing the playlists to disk

    Scheduled Pinned Locked Moved
    Feature Suggestions
    5
    6
    848
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      petko10
      last edited by

      Hi, the player looks great, but the feature mentioned in the title is a must for me (for non-automatic playlists of course). The use case is the following: I have my collection in a directory, in which there's a folder "playlists". The collection gets synchronized on several devices. Optimally the music player playlists should be synchronized with the playlist folder in the collection. I'd be willing to put in the work to make it happen if I get some pointers as to where/how such a feature would best be integrated.

      jonasJ 1 Reply Last reply Reply Quote 6
      • jonasJ
        jonas @petko10
        last edited by jonas

        @petko10
        The playlists are stored in SQL.
        Reloading playlists from files will be a bit tricky to do. The other way, syncing playlists to disk would be easier and makes more sense.
        An option for this could be added to the playlist settings. This needs to be done in the Playlist Backend: https://github.com/strawberrymusicplayer/strawberry/blob/master/src/playlist/playlistbackend.cpp
        You can see how playlists are saved to file in the Playlist Manager here:
        https://github.com/strawberrymusicplayer/strawberry/blob/master/src/playlist/playlistmanager.cpp

        An easier solution would be that you just create a script that retrieves the playlists from SQL and saves to them to files.

        1 Reply Last reply Reply Quote 0
        • K
          Kolai
          last edited by

          Sync playlist to a file would be good. I want to use the player on my computer and put out a playlist and add the playist to my DLNA server so my Streaming box can pick up the playlist as well and i can play what i want and not just some random stuff.

          1 Reply Last reply Reply Quote 1
          • A
            AllKind
            last edited by

            That would be a very useful feature for me!
            Also it would help to solve the problem I had in: https://github.com/strawberrymusicplayer/strawberry/issues/1403

            I think it would be nice if you could select the playlists you want to be saved. Like right click on the playlist tab -> Automatically save to file.

            1 Reply Last reply Reply Quote 1
            • Sharky-PIS
              Sharky-PI
              last edited by

              @jonas any possibility to add this feature - automatically save some/all playlists to disk on edit?

              Paired with duplicate detection, this would mean users aren't solely relying on the strawberry database to preserve the sanctity of their playlists.

              Thanks!

              1 Reply Last reply Reply Quote 0
              • Sharky-PIS
                Sharky-PI
                last edited by

                Strawberry Playlist Sync Tool

                Sync your Strawberry Music Player playlists to disk M3U files with duplicate detection, automatic backups, and smart conflict resolution.

                Features

                • Duplicate Detection: Find and remove duplicate tracks within playlists
                  • Exact duplicates (same file added multiple times)
                  • Optional fuzzy matching (same title/artist, different files)
                • Playlist Sync: Export database playlists to M3U files
                  • Creates timestamped backups before overwriting
                  • Shows what's added/removed before syncing
                  • Add-only mode to preserve disk entries
                  • Recursive subdirectory scanning
                  • Multiple playlist directory support
                • Backup Rotation: Automatically clean up old backup files
                  • Keep N backups per playlist (default: 3)
                  • Delete backups older than N days (default: 60)
                  • Count takes priority (always keeps minimum backups)
                • Never-Sync List: Skip utility playlists you don't want exported
                  • Managed via neversync.txt in your playlist folder
                  • Interactive prompts to add playlists during review

                Requirements

                • Python 3.6+ (standard library only, no pip installs needed)
                • Linux, macOS, or Windows

                Installation

                1. Save the script to your preferred location, e.g.:
                  ~/.local/share/strawberry/strawberry/strawberry-playlist-sync.py
                2. Make it executable (Linux/macOS):
                  chmod +x strawberry-playlist-sync.py
                3. Optionally create a desktop shortcut (see below).

                Usage

                Interactive Mode

                ./strawberry-playlist-sync.py
                Presents a menu to choose between duplicate checking, syncing, and backup cleanup.

                Command-Line Mode

                Dry run (preview changes without writing):
                ./strawberry-playlist-sync.py -s -p ~/Music/playlists --dry-run

                Dry run with full track details:
                ./strawberry-playlist-sync.py -s -p ~/Music/playlists --dry-run -v

                Sync playlists to disk:
                ./strawberry-playlist-sync.py -s -p ~/Music/playlists

                Sync including subdirectories:
                ./strawberry-playlist-sync.py -s -p ~/Music/playlists -r

                Check for duplicates:
                ./strawberry-playlist-sync.py -d

                Include fuzzy duplicates (same song, different files):
                ./strawberry-playlist-sync.py -d --fuzzy

                Clean up old backups:
                ./strawberry-playlist-sync.py -c -n 5 -a 30
                (Keep 5 backups, delete those older than 30 days)

                Run all operations:
                ./strawberry-playlist-sync.py -d -s -c -p ~/Music/playlists

                Automated mode (no prompts):
                ./strawberry-playlist-sync.py -s -p ~/Music/playlists -y

                Multiple Directories

                ./strawberry-playlist-sync.py -s -p ~/Music/playlists -p /media/usb/playlists

                Command-Line Options
                ┌─────────────────────────┬─────────────────────────────────────────────────┐
                │ Option │ Description │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ -d, --check-duplicates │ Find and remove duplicate tracks │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ --fuzzy │ Include fuzzy duplicates in check │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ -s, --sync │ Sync database playlists to disk │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ -c, --cleanup-backups │ Clean up old backup files │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ -p, --playlist-dir PATH │ Playlist folder (can be used multiple times) │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ -r, --recursive │ Scan subdirectories for M3U files │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ --add-only │ Only add tracks, preserve existing disk entries │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ --db-path PATH │ Path to strawberry.db (auto-detects if not set) │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ -n, --keep-count N │ Backups to keep per playlist (default: 3) │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ -a, --max-age DAYS │ Max backup age in days (default: 60) │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ --dry-run │ Preview changes without writing │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ -v, --verbose │ Show full track details (with --dry-run) │
                ├─────────────────────────┼─────────────────────────────────────────────────┤
                │ -y, --yes │ Skip confirmation prompts │
                └─────────────────────────┴─────────────────────────────────────────────────┘
                Never-Sync List

                To exclude playlists from syncing (e.g., utility playlists for finding missing metadata):

                1. During interactive review, when you skip a playlist, you'll be asked if you want to add it to the never-sync list.
                2. Or manually edit neversync.txt in your playlist folder:

                Playlists listed here will be skipped during sync operations.

                NoComposerSP
                BitrateLessThan129SP
                UnratedSP

                Desktop Shortcut (Linux)

                Create a shell script on your desktop:

                #!/bin/bash

                Strawberry Playlist Sync

                ~/.local/share/strawberry/strawberry/strawberry-playlist-sync.py -s -p ~/Music/playlists -r

                Save as strawberry-playlist-sync.sh and make executable with chmod +x.

                Database Locations

                The script auto-detects Strawberry's database in these locations:

                • Linux: ~/.local/share/strawberry/strawberry/strawberry.db
                • macOS: ~/Library/Application Support/Strawberry/strawberry/strawberry.db
                • Windows: ~/AppData/Local/strawberry/strawberry/strawberry.db

                Use --db-path to specify a custom location.

                Notes

                • Safe to run with Strawberry open: The script only reads from the database (except for duplicate removal), so syncing while Strawberry is running is fine. For
                  duplicate removal, close Strawberry first.
                • Backups: Before overwriting any M3U file, a timestamped backup is created in a backups/ subfolder.
                • M3U Format: Uses extended M3U with #EXTINF:seconds,Artist - Title lines.
                • Path Handling: Automatically converts database file:// URLs to filesystem paths and handles URL-encoded characters.

                License

                Public domain / CC0. Use however you like.

                Created by me and Claude Code tonight.

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post
                Powered by NodeBB | Contributors