About
Folder Tunes is a script add-in for Directory Opus (DOpus) that allows users to associate audio files with specific folders so that the associated audio will play automatically when the folder is opened or when certain events occur in DOpus.
Features
- Multiple trigger events
Folder Tunes supports multiple trigger events, including folder navigation, tab activation, pane focus, and lister focus. Users can configure which events they want to trigger the associated audio files. - Play/stop options
Configure whether the associated audio files should play or stop when trigger events occur, ensuring that only one audio file plays at a time. - Configurable associations
Configure folder-to-audio associations using a dialog window, internal commands, or by manually editing the script add-in options. Associations can include the folder path, audio file path, enable/disable status, and lister layout name. - Layout-specific tunes
Play audio files only when associated folders are opened in specific lister layouts. This allows you to create more personalized presets, with unique audio themes tailored to each layout. - Export associations
Export folder-to-audio associations in a text file format so that it’s easy to backup, share, or transfer associations between different instances of DOpus. - Toolbar buttons
Folder Tunes provides pre-configured toolbar buttons that users can drag and drop onto their DOpus toolbars for quick access to the main dialog window and other commands.
Installation
-
Download: (1.0.0 requires DOpus 12.21) FolderTunes.js.txt (27.3 KB)
-
Drag the .js.txt file to Preferences / Toolbars / Scripts.
Usage
Once you have installed the Folder Tunes script add-in, you must configure associations between folders and audio files. There are multiple ways to do this. I will describe the recommended one.
I have prepared a menu that contains a few buttons with the most useful commands:
- Download the menu: Tunes.dcf (3.2 KB)
- Select "Settings / Customize Toolbar..." from your Lister and then drag the file to any toolbar you like.
You don’t have to use these buttons or any commands at all. Associations can also be entered manually in the add-in config. However, it might be easier and quicker to do through a user-friendly interface, and for that, you need buttons that call certain commands that this add-in provides.
In the "Tunes" menu, locate and click the "Associations" button to view the main dialog window for working with association entries. From there, you can manage all your associations grouped by lister layouts to which they belong. Associations made in this window will be applied as soon the window is closed by clicking on either the "X" or "Close" buttons.
Entry dialog that pops up when clicking on the "Edit" or "New" buttons:
Commands
In the list below, square brackets indicate optional parameters, and angle brackets indicate placeholder values that need to be replaced with actual values.
Command: SHOWLIST
Displays the main dialog window to manage folder-to-audio associations.
Usage: FolderTunes SHOWLIST
Command: STOP
Stops all currently playing audio files. Alias for native Play STOPALL
.
Usage: FolderTunes STOP
Command: PLAY
Plays the audio file associated with the specified folder or the current folder if not specified. If no audio file is associated with the folder, no action will be taken.
Usage: FolderTunes PLAY [FOLDER=<folder_path>] [AUDIO=<audio_path>]
Examples:
FolderTunes PLAY
- play audio file associated with the current folderFolderTunes PLAY FOLDER=C:\Music
- play audio file associated withC:\Music
folderFolderTunes PLAY AUDIO=C:\Music\song.mp3
- play specified audio file
Command: ASSIGN
Assigns or updates a folder-to-audio association. If the folder already has an association, the command can toggle the enable/disable status of the association.
Usage: FolderTunes ASSIGN=[dialog] FOLDER=<folder_path> AUDIO=<audio_path> [STATE=<1/0>] [LAYOUT=<layout_name>]
Examples:
FolderTunes ASSIGN FOLDER=C:\Music AUDIO=C:\Music\song.mp3
- assignssong.mp3
toC:\Music
folder.FolderTunes ASSIGN FOLDER=C:\Music
- displays a file picker, then assigns selected audio file to theC:\Music
folder.FolderTunes ASSIGN AUDIO=C:\Music\song.mp3
- displays a folder picker, then assignssong.mp3
to the selected folder.FolderTunes ASSIGN FOLDER=C:\Music AUDIO=C:\Music\song.mp3 STATE=0
- assigns audio file to folder and disables the entry.FolderTunes ASSIGN FOLDER={sourcepath$|noterm} STATE=toggle
- toggles the enable/disable status of the entry for the current folder. If there’s no entry assigned to the folder, it will display a file picker.FolderTunes ASSIGN FOLDER=C:\Music AUDIO=C:\Music\song.mp3 LAYOUT=Details
- assigns audio file to folder for the layout named "Details". The audio will only play in that layout.FolderTunes ASSIGN=dialog
- shows a dialog window for creating/editing an association entry.FolderTunes ASSIGN=dialog FOLDER=C:\Music AUDIO=C:\Music\song.mp3
- shows a dialog window for creating/editing an association entry and prepopulates it with paths to the folder and audio file.
Configuration
Associations
There are multiple ways to provide folder → audio associations to the plugin.
The most intuitive and easiest to use is through the dialog window that can be called using FolderTunes SHOWLIST
command. It provides a UI to view, create, edit, delete, filter, and export entries.
The content of that dialog is synced with the “entries” field in the config of the script. So you don’t have to use the dialog window and can manually type the associations in the configuration if you want:
-
Preferences → Scripts → Folder Tunes Configuration → entries
Enter every entry on a new line in the format described below. -
Preferences → Scripts → Folder Tunes Configuration → file
Enter the path to a file containing entries in the format described below.
You can use both “entries” and “file” at the same time. The associations from both sources will be combined.
Format
Basic: <folder_path>, <audio_path>
Full: <folder_path>, <audio_path>, <1/0 - enabled/disabled>, <lister_name>
Example:
C:\Program Files, C:\My Music\choir.m4a
C:\Projects, C:\My Music\instrumental.mp3, 1
C:\Wallpaper, C:\My Music\choir.m4a, 0, My Saved Lister
In the example above:
- Entry #1: Program Files → choir.m4a
- Entry #2: Projects → instrumental.mp3, ENABLED, applied to all lister layouts
- Entry #3: Wallpaper → choir.m4a, DISABLED, applied to the layout named “My Saved Lister”
Layouts with commas in their names are not supported. Please do not use names such as "My Saved, Lister" as they may not work correctly.
Triggers
Triggers define events that will cause audio to play or stop.
- Folder navigation - play audio file associated with the folder as you open it
- Tab activation - play audio file associated with the folder in the tab you’ve just switched to
- Pane focus - play audio file associated with the folder in the pane you’ve just focused
- Lister focus - play audio file associated with the folder in the active pane of the lister you’ve just focused
There are 2 config fields for each trigger: “play” and “stop”.
Let’s take "Folder navigation" for example:
playOnFolderChange - play audio file associated with the folder.
stopOnFolderChange - stop the previously played audio file. This option ensures that the audio that was playing for the folder you were previously in will be silenced. If it’s disabled, multiple audio files can play at the same time as you go though the folders.