alienlebarge / lastfm-sync
Kirby plugin to synchronize loved tracks from Last.fm and automatically create jam pages
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:kirby-plugin
pkg:composer/alienlebarge/lastfm-sync
Requires
- php: >=7.4
- getkirby/composer-installer: ^1.1
Requires (Dev)
- phpunit/phpunit: ^9.5
README
Kirby plugin to synchronize loved tracks from Last.fm and automatically create jam pages.
Installation
- Place the
lastfm-sync
folder insite/plugins/
- Configure options in
site/config/config.php
Configuration
return [ 'alienlebarge.lastfm-sync' => [ 'apiKey' => 'your-lastfm-api-key', 'user' => 'your-lastfm-username', 'webhookLimit' => 20, 'webhookSecret' => 'your-webhook-secret', 'contentDir' => 'jams' ] ];
Options
apiKey
: Last.fm API keyuser
: Last.fm usernamewebhookLimit
: Number of tracks to retrieve (default: 20)webhookSecret
: Security token for webhookcontentDir
: Content directory (default: 'jams')
Usage
Webhook
Synchronization via POST webhook:
curl -X POST "https://your-site.com/lastfm-sync/cron/sync-jams" -d "secret=your-webhook-secret"
Or call the URL directly with GET parameter:
curl -X POST "https://your-site.com/lastfm-sync/cron/sync-jams?secret=your-webhook-secret"
Page Methods
// In a template or controller $result = $page->syncJams(50); // Sync max 50 tracks
Site Methods
// Access to service $syncService = site()->lastfmSync(); $result = $syncService->sync(20);
Response
{ "success": true, "message": "Jams synchronization completed via Last.fm plugin", "data": { "total": 20, "imported": 2, "skipped": 18, "errors": 0 } }
Security
The webhook uses a secret token for authentication. Configure webhookSecret
in your options.
License
MIT