-
Notifications
You must be signed in to change notification settings - Fork 1
Configuration Files
This page documents all configuration files used by foo_mac_scrobble, their locations, formats, and purposes.
The component uses several configuration files:
| File | Location | Format | Purpose |
|---|---|---|---|
| Session | ~/Library/foobar2000-v2/lastfm_session.json |
JSON | Last.fm credentials |
| Queue | ~/Library/foobar2000-v2/lastfm_scrobble_queue.json |
JSON | Offline scrobbles |
| Preferences | ~/Library/foobar2000-v2/config.sqlite |
Binary | foobar2000 config |
~/Library/foobar2000-v2/lastfm_session.json
Stores Last.fm authentication credentials after successful login.
{
"session_key": "d580d57f32848420e4155f4r4d5e6d8e",
"username": "lastfm_username"
}| Field | Type | Description |
|---|---|---|
session_key |
String | Last.fm API session key (32 hex chars) |
username |
String | Last.fm username for display |
- Created: After successful authentication
- Read: On component startup
- Updated: Only during re-authentication
- Deleted: When clearing session or re-authenticating
Recommendations:
- Keep file permissions restricted (readable only by your user)
- Don't share this file publicly
- Don't commit to version control
- If compromised, revoke access on Last.fm and re-authenticate
By default, the file has:
-rw-r--r-- 1 username staff 123 Nov 17 12:34 lastfm_session.jsonYou can manually edit this file, but:
- Stop foobar2000 first
- Use valid JSON syntax
- Ensure session key is valid (32 hex characters)
- Restart foobar2000 after editing
Example:
# Edit the session file
nano ~/Library/foobar2000-v2/lastfm_session.json
# Restart foobar2000
killall foobar2000
open /Applications/foobar2000.appFile doesn't exist:
- You haven't authenticated yet
- Session was cleared
- File was manually deleted
Invalid session key:
- Delete file and re-authenticate
- Check for JSON syntax errors
~/Library/foobar2000-v2/lastfm_scrobble_queue.json
Stores tracks waiting to be scrobbled (offline queue).
[
{
"artist": "Queen",
"track": "Bohemian Rhapsody",
"album": "A Night at the Opera",
"album_artist": "Queen",
"track_number": "11",
"mbid": "",
"timestamp": 1700000000
},
{
"artist": "Pink Floyd",
"track": "Comfortably Numb",
"album": "The Wall",
"album_artist": "Pink Floyd",
"track_number": "6",
"mbid": "",
"timestamp": 1700000120
}
]| Field | Type | Required | Description |
|---|---|---|---|
artist |
String | Yes | Artist name |
track |
String | Yes | Track title |
album |
String | No | Album name |
album_artist |
String | No | Album artist (if different from track artist) |
track_number |
String | No | Track number on album |
mbid |
String | No | MusicBrainz ID (usually empty) |
timestamp |
Integer | Yes | Unix timestamp (seconds since epoch) |
- Created: When first track is queued
- Read: On component startup
- Updated: When tracks are added or removed
- Persisted: After every queue change
- Deleted: When manually clearing queue
The background worker processes the queue:
- Every 30 seconds (if authenticated and online)
- Batches up to 50 tracks per API request
- Removes successfully submitted tracks
- Retains failed tracks for next attempt
| Queue Size | File Size | Processing Time |
|---|---|---|
| 10 tracks | ~2 KB | < 1 second |
| 100 tracks | ~20 KB | 2-3 seconds |
| 1,000 tracks | ~200 KB | 20-30 seconds |
| 10,000 tracks | ~2 MB | 3-5 minutes |
Note: Large queues (1000+) may indicate network issues.
View the queue:
cat ~/Library/foobar2000-v2/lastfm_scrobble_queue.jsonPretty-print with jq:
brew install jq
cat ~/Library/foobar2000-v2/lastfm_scrobble_queue.json | jqCount pending tracks:
cat ~/Library/foobar2000-v2/lastfm_scrobble_queue.json | jq 'length'You can edit the queue file:
- Stop foobar2000
- Edit with valid JSON syntax
- Ensure all required fields are present
- Use valid Unix timestamps
- Restart foobar2000
Example: Add a track manually
[
{
"artist": "The Beatles",
"track": "Here Comes the Sun",
"album": "Abbey Road",
"album_artist": "The Beatles",
"track_number": "7",
"mbid": "",
"timestamp": 1731844800
}
]Option 1: Delete the file
rm ~/Library/foobar2000-v2/lastfm_scrobble_queue.jsonOption 2: Empty the array
echo '[]' > ~/Library/foobar2000-v2/lastfm_scrobble_queue.jsonThen restart foobar2000.
Queue not processing:
- Check authentication status
- Verify internet connection
- Enable debug logging and check Console
Queue file corrupted:
Last.fm: Failed to parse queue file: [JSON parse error]
Solution: Delete and let component recreate:
rm ~/Library/foobar2000-v2/lastfm_scrobble_queue.jsonQueue growing indefinitely:
- Network issues preventing submission
- Invalid session key
- Last.fm API unavailable
Check Console logs for specific errors.
~/Library/foobar2000-v2/config.sqlite
Stores foobar2000's configuration database, including component settings.
sqlite
The component's preferences are stored using foobar2000's cfg_var system:
cfg_string cfg_api_key(guid_cfg_api_key, "");
cfg_string cfg_api_secret(guid_cfg_api_secret, "");
cfg_int cfg_scrobble_threshold(guid_cfg_threshold, 50);
cfg_bool cfg_debug_logging(guid_cfg_debug, false);| Setting | Type | Default | Description |
|---|---|---|---|
| API Key | String | Empty | Last.fm API Key |
| API Secret | String | Empty | Last.fm API Secret |
| Scrobble Threshold | Integer | 50 | Percentage of track (1-100) |
| Debug Logging | Boolean | false | Enable console logging |
- Automatic: Changes save immediately
- Thread-safe: SDK handles synchronization
- Crash-safe: Atomic writes via SDK
Option 1: Via foobar2000
- Preferences → Tools → Last.fm Scrobbler
- Clear API Key and Secret
- Set threshold to default (50%)
- Disable debug logging
Option 2: Reset entire foobar2000 config
rm -rf ~/Library/foobar2000-v2/config.sqliteThen restart foobar2000.
Backup preferences:
cp -r ~/Library/foobar2000-v2/config.sqlite ~/config.sqlite.backupRestore preferences:
rm -f ~/Library/foobar2000-v2/config.sqlite
cp ~/config.sqlite.backup ~/Library/foobar2000-v2/config.sqlite~/Library/foobar2000-v2/user-components/foo_mac_scrobble/foo_mac_scrobble.component/Contents/Info.plist
macOS bundle metadata.
XML Property List:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>foo_mac_scrobble</string>
<key>CFBundleIdentifier</key>
<string>com.foo.mac.scrobble</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>foo_mac_scrobble</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.2</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>| Key | Value | Description |
|---|---|---|
CFBundleIdentifier |
com.foo.mac.scrobble |
Unique bundle ID |
CFBundleShortVersionString |
0.1.2 |
User-facing version |
CFBundleVersion |
1 |
Build number |
CFBundleExecutable |
foo_mac_scrobble |
Binary name |
Not user-editable — managed by Xcode build system.
Quick reference for all configuration files:
# Session credentials
~/Library/foobar2000-v2/lastfm_session.json
# Offline queue
~/Library/foobar2000-v2/lastfm_scrobble_queue.json
# foobar2000 preferences (binary)
~/Library/foobar2000-v2/config.sqlite
# Installed component
~/Library/foobar2000-v2/user-components/foo_mac_scrobble/foo_mac_scrobble.component/
# Component binary
~/Library/foobar2000-v2/user-components/foo_mac_scrobble/foo_mac_scrobble.component/Contents/MacOS/foo_mac_scrobble
# Component metadata
~/Library/foobar2000-v2/user-components/foo_mac_scrobble/foo_mac_scrobble.component/Contents/Info.plist# Create backup directory
mkdir -p ~/foobar2000-backup/
# Backup session
cp ~/Library/foobar2000-v2/lastfm_session.json ~/foobar2000-backup/
# Backup queue (optional, will rebuild)
cp ~/Library/foobar2000-v2/lastfm_scrobble_queue.json ~/foobar2000-backup/
# Backup preferences (includes all foobar2000 settings)
cp -r ~/Library/foobar2000-v2/config.sqlite ~/foobar2000-backup/# Restore session
cp ~/foobar2000-backup/lastfm_session.json ~/Library/foobar2000-v2/
# Restore queue (optional)
cp ~/foobar2000-backup/lastfm_scrobble_queue.json ~/Library/foobar2000-v2/
# Restore preferences
rm -f ~/Library/foobar2000-v2/config.sqlite
cp ~/foobar2000-backup/config.sqlite ~/Library/foobar2000-v2/config.sqlite
# Restart foobar2000To move your setup to a new Mac:
-
On old Mac:
# Export component and config tar -czf foobar-lastfm-backup.tar.gz \ ~/Library/foobar2000-v2/lastfm_session.json \ ~/Library/foobar2000-v2/lastfm_scrobble_queue.json \ ~/Library/foobar2000-v2/config.sqlite
-
Transfer file to new Mac (via USB, AirDrop, cloud, etc.)
-
On new Mac:
# Install foobar2000 # Install foo_mac_scrobble component # Extract backup tar -xzf foobar-lastfm-backup.tar.gz -C ~/ # Start foobar2000
Ensure proper permissions:
# Session (sensitive)
chmod 600 ~/Library/foobar2000-v2/lastfm_session.json
# Queue (less sensitive)
chmod 644 ~/Library/foobar2000-v2/lastfm_scrobble_queue.json
# Config file
chmod 700 ~/Library/foobar2000-v2/config.sqliteNever:
- Commit session file to version control
- Share session file publicly
- Post session key in issues or forums
- Include in screenshots
If compromised:
- Delete
lastfm_session.json - Visit https://www.last.fm/settings/applications
- Revoke access for the component
- Re-authenticate in foobar2000
The component doesn't use environment variables, but you can set these for convenience:
# In ~/.zshrc or ~/.bash_profile
export FOOBAR_CONFIG="$HOME/Library/foobar2000-v2"
export LASTFM_SESSION="$FOOBAR_CONFIG/lastfm_session.json"
export LASTFM_QUEUE="$FOOBAR_CONFIG/lastfm_scrobble_queue.json"
# Usage:
cat $LASTFM_SESSION
cat $LASTFM_QUEUE- Troubleshooting Guide — Fixing config issues
- How It Works — How configs are used internally
- FAQ — Common questions about configuration
Questions about configuration files? Open an issue on GitHub.