SMB Sync: from network drive to Photopilot
A small program that watches an SMB/Samba share (such as a StyleShoots machine) and automatically uploads photo folders as shoots and packshots.
A small program that watches an SMB/Samba share (such as a StyleShoots machine) and automatically uploads photo folders as shoots and packshots.
Folders named S-<set number> (e.g. S-1234) are uploaded as a shoot for that set.
Every other folder is considered an item: a scanned EAN/barcode or a public item number. Photos with back, side, or label in the filename are linked as that view — or via your own pattern, see below.
For StyleShoots setups that drop every file loose into the folder: set FLAT_PACKSHOT=true. Loose photos are grouped by article identifier (the part before the first underscore) and synced as packshots.
For StyleShoots setups that drop every file loose into the folder: set FLAT_PACKSHOT=true. Loose photos are grouped by article identifier (the part before the first underscore) and synced as packshots.
A folder is only synchronized if nothing has changed for 10 minutes. Unknown items are skipped and retried later. For packshots, we only remove the files that have actually been uploaded — the folder and the rest remain.
Choose the version for your system. The download is a .gz file: unpack with 7-Zip (Windows) or gunzip (macOS/Linux).
Download windows-amd64.exe.gz above, unpack it and place smbsync.exe in its own folder, for example C:\Photopilot\smbsync\.
CUSTOMER=Bedrijfsnaam
SMB_IP=192.168.1.10
SMB_USERNAME=styleshootssharing
SMB_PASSWORD=wachtwoord
SMB_MOUNT=StyleshootsDrive
START_DIR=sync
API_TOKEN=jouw-api-token
API_URL=https://app.photopilot.ai/api
LOG_LEVEL=info
TZ=Europe/Amsterdam
# Optioneel: StyleShoots-modus waarbij alle bestanden los in START_DIR staan
# (geen submap per artikel). Losse foto's worden gegroepeerd op artikel-
# identifier (het deel voor de eerste underscore) en als packshots gesynct.
FLAT_PACKSHOT=falseSMB_IP is the IP address of the machine with the share (e.g., the StyleShoots or your NAS). SMB_MOUNT is the name of the share itself and START_DIR the folder within the share that is synchronized. The account needs read and write permissions: uploaded files are removed from the share after upload.
Open Task Scheduler, create a task that starts smbsync.exe when the computer boots and set 'Start in' to the folder containing the .env. Choose 'Run whether user is logged on or not'.
Create a test folder with an EAN code as the name on the share, put a photo in it, and wait ±10 minutes. The photo will appear with the item in Photopilot and disappear from the share. The folder itself remains, containing a status.json as proof that it has been processed — photos we haven't uploaded also remain. Errors are automatically reported to us via Sentry.
By default, SMB Sync looks for the words back, side, and label in the filename; all other photos become their own packshot with that photo as the front. Not every studio names the view in the name. StyleShoots, for example, numbers per item: <EAN>_PNG_1 is the front, _PNG_2 the back, and _PNG_3 the optional side. Then specify the pattern yourself in your .env:
FRONT_IDENTIFIER=_PNG_1$
BACK_IDENTIFIER=_PNG_2$
SIDE_IDENTIFIER=_PNG_3$FRONT_IDENTIFIER Front Default: the first photo that doesn't belong to any other view.BACK_IDENTIFIER Back Default: back in the filename.SIDE_IDENTIFIER Side Default: side in the filename.LABEL_IDENTIFIER Label (care instructions) Default: label in the filename.With this setting, 8712345678906_PNG_1, _PNG_2, and _PNG_3 come in together as one packshot for item 8712345678906 — not as three separate photos. Is the side missing? Then that view simply remains empty.
Each pattern is case-insensitive and is tested on the filename without extension, so PNG_1 works just as well as _PNG_1$ (the $ sign means: at the end of the name). Once you set FRONT_IDENTIFIER, only photos matching one of these patterns will be uploaded — other files in the folder remain untouched. If you leave out a variable, the default rule applies.
The label photo is the extra photo of the care or composition label. LABEL_IDENTIFIER works exactly like the other three, with one thing to remember: variables you don't set retain their default. In the example above, LABEL_IDENTIFIER is still set to the word label. Three situations:
off (or none) also works for BACK_IDENTIFIER and SIDE_IDENTIFIER and is the only way to disable a default word. For FRONT_IDENTIFIER, off simply means reverting to the default: the first photo that doesn't belong to any other view.
Need help with the installation? We're happy to set it up together with you.