hansott / lastify
This package is abandoned and no longer maintained.
No replacement package was suggested.
Lastify syncs spotify playlists with your last.fm top tracks.
1.0.2
2016-03-12 13:56 UTC
Requires
- php: >=5.3.0
- dandelionmood/lastfm: 0.6.*
- jwilsson/spotify-web-api-php: ~1.2
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: 4.*
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ~2.3
This package is not auto-updated.
Last update: 2022-02-01 12:54:12 UTC
README
Lastify is a PHP library that syncs your music between Last.fm, Spotify, etc.
Install
Via Composer
$ composer require hansott/lastify
Usage
- Generate a spotify access token: Spotify Api Console (OAuth Scope: playlist-read-private, playlist-modify-public & playlist-modify-private)
- Create a last.fm API account and copy the api key: Create API account (Note: You cannot view your API account after creating.)
<?php error_reporting(-1); ini_set('display_errors', 'On'); require_once __DIR__.'/../vendor/autoload.php'; use HansOtt\Lastify\TrackInfo; use HansOtt\Lastify\Synchronizer; use HansOtt\Lastify\Services\LastFm; use HansOtt\Lastify\Services\Spotify; use HansOtt\Lastify\SyncProgressCallback; $lastFm = LastFm::connect('your-lastfm-api-key'); $spotify = Spotify::connect('your-spotify-access-token'); $synchronizer = new Synchronizer($spotify); $topTracks = $lastFm->getTopTracks('your-lastfm-username', 20); $lovedTracks = $lastFm->getLovedTracks('your-lastfm-username', 20); class ProgressCallback implements SyncProgressCallback { public function onProgress($current, $total, TrackInfo $currentItem) { echo sprintf("[%s/%s] Syncing %s \n", $current, $total, $currentItem->toString()); } } $synchronizer->syncToPlaylist('Top Tracks', $topTracks, new ProgressCallback()); $synchronizer->syncToPlaylist('Loved Tracks', $lovedTracks, new ProgressCallback());
~/Code/lastify master $ php examples/syncTopTracks.php [1/20] Syncing This Is the Life - Amy Macdonald [2/20] Syncing Banquet - Bloc Party [3/20] Syncing The Passenger - Iggy Pop [4/20] Syncing A Forest - The Cure [5/20] Syncing Not Alone - Time [6/20] Syncing Somebody Told Me - The Killers [7/20] Syncing This Modern Love - Bloc Party [8/20] Syncing Ex's & Oh's - Elle King [9/20] Syncing Octopus - Bloc Party [10/20] Syncing Ratchet - Bloc Party [11/20] Syncing Comptine d'un autre été, l'après-midi - Yann Tiersen [12/20] Syncing Soft Spoken Words - Trixie Whitley [13/20] Syncing Back to Black - Amy Winehouse [14/20] Syncing Pocket Piano - DJ Mehdi [15/20] Syncing Lucky Boy - DJ Mehdi [16/20] Syncing Starblazer - Deetron [17/20] Syncing Wappy Flirt - Original Mix - Hi-Lo [18/20] Syncing Signatune (Thomas Bangalter edit) - DJ Mehdi [19/20] Syncing Slowly - Festival Mix - Dropout [20/20] Syncing The Aviating - Alec Troniq
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email hansott at hotmail be instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.