================================
Rclone Portable Music Sync
================================

This setup allows for portable synchronization of a music library from an SMB share
to a local directory using Rclone. All Rclone binaries, configuration, and logs
are stored within a ".sync" subfolder, making the setup self-contained.

--------------------------------
Directory Structure
--------------------------------

It's recommended to have the following structure within your main music folder
(e.g., Z:\Music\Navidrome\):

Z:\Music\Navidrome\
|-- .sync\
|   |-- bin\
|   |   `-- rclone.exe      (Rclone executable)
|   |-- config\
|   |   `-- rclone.conf     (Rclone configuration file)
|   `-- logs\               (Directory for log files)
|-- Library\                (Your local music library - target for sync)
|-- sync.bat                (The synchronization script)
`-- README.txt              (This file)

--------------------------------
Setup Instructions
--------------------------------

1.  Download Rclone:
    *   Download the latest Rclone version for Windows (e.g., rclone-vx.xx.x-windows-amd64.zip)
        from the official Rclone website: https://rclone.org/downloads/
    *   Extract "rclone.exe" from the archive.

2.  Place Rclone Executable:
    *   Create the directory: Z:\Music\Navidrome\.sync\bin\
    *   Copy the extracted "rclone.exe" into Z:\Music\Navidrome\.sync\bin\

3.  Create Rclone Configuration:
    *   Create the directory: Z:\Music\Navidrome\.sync\config\
    *   Open a Command Prompt (cmd.exe) or PowerShell.
    *   Navigate to your main music directory:
        Z:
        cd \Music\Navidrome
    *   Run the Rclone configuration command, explicitly telling it where to save the config file:
        .\.sync\bin\rclone.exe config --config ".\.sync\config\rclone.conf"
    *   Follow the Rclone prompts to create a new remote for your SMB share:
        -   Choose 'n' (New remote).
        -   For 'name>', enter: smb_music
            (This name is used in sync.bat. If you choose a different name,
             you'll need to update sync.bat accordingly).
        -   For 'Type of storage to configure. >', find 'smb' in the list and
            enter its number or type 'smb'.
        -   For 'host>', enter the hostname or IP address of your SMB server
            (e.g., CT-SMB-PROD).
        -   For 'user>', enter your SMB username (leave blank for anonymous if applicable).
        -   For 'port>', press Enter for default (445).
        -   For 'pass>', Rclone will prompt you to enter your password.
            Choose 'y' (Yes, type in my own password) and enter it.
        -   For 'domain>', enter your SMB domain (e.g., WORKGROUP or your
            Active Directory domain). Leave blank if not applicable.
        -   For 'Edit advanced config? (y/n)>', choose 'n' (No).
        -   Review the summary. If OK, choose 'y' (Yes this is OK).
        -   Choose 'q' (Quit config).
    *   This will create the "rclone.conf" file in Z:\Music\Navidrome\.sync\config\

4.  Verify sync.bat:
    *   Ensure "sync.bat" is in Z:\Music\Navidrome\
    *   The script is pre-configured to use the remote name "smb_music" and the
        source path "media/music" on that remote.
        Adjust the SOURCE_REMOTE variable in "sync.bat" if your SMB remote name
        or path on the share differs.
        Example line in sync.bat:
        set SOURCE_REMOTE=smb_music:media/music

--------------------------------
How to Use
--------------------------------

Open a Command Prompt or PowerShell in the Z:\Music\Navidrome\ directory.

1.  Normal Sync:
    To run a full synchronization (copies new/changed files from SMB to local,
    deletes local files not on SMB):
    .\sync.bat

2.  Dry Run (Simulate Sync):
    To see what Rclone *would* do without actually making any changes:
    .\sync.bat --dry-run
    OR
    .\sync.bat -n

    Review the output carefully to ensure it matches your expectations.

--------------------------------
Log Files
--------------------------------

*   Each sync operation creates a log file in the Z:\Music\Navidrome\.sync\logs\ directory.
*   Log files are named with a timestamp in YYYYMMDD_HHMMSS format,
    e.g., rclone_sync_20231027_103000.log
*   These logs contain detailed information about the sync process, including
    transferred files, errors, and statistics.

--------------------------------
Customization
--------------------------------

*   checkers & transfers:
    The "sync.bat" script uses --checkers=8 and --transfers=8. You can adjust
    these values based on your network and SMB server performance by editing
    the script.

*   pause command:
    The "pause" command at the end of "sync.bat" keeps the command window open
    after execution. You can remove or comment it out (by adding "rem " at the
    start of the line: "rem pause") if you run the script via Task Scheduler or
    don't need to see the final output immediately.