Add code in prevision of librefm support
authorpankkake <pankkake@headfucking.net>
Mon Feb 07 23:17:50 2011 +0100 (15 months ago)
changeset 2793eb4de0a942
parent 26 c13a897025a0
child 28 b72102437270
Add code in prevision of librefm support

(still waiting for their getArtists API call)
index.php
     1.1 --- a/index.php	Mon Feb 07 22:46:05 2011 +0100
     1.2 +++ b/index.php	Mon Feb 07 23:17:50 2011 +0100
     1.3 @@ -10,16 +10,21 @@
     1.4  $from_gazelle = post('from_gazelle');
     1.5  $from_dir_listing = post('from_dir_listing');
     1.6  $exclude = post('exclude', "Various Artists, VA");
     1.7 -$lastfm_username = post('lastfm_username');
     1.8 -$lastfm_min_playcount = (integer) post('lastfm_min_playcount', 30);
     1.9 +$scrobbler_service = post('scrobbler_service', 'lastfm');
    1.10 +$scrobbler_username = post('scrobbler_username');
    1.11 +$scrobbler_min_playcount = (integer) post('scrobbler_min_playcount', 30);
    1.12  
    1.13  $am = new ArtistsManager();
    1.14  $am->addFromDirlisting($from_dir_listing);
    1.15 -if (strlen($lastfm_username))
    1.16 +if (strlen($scrobbler_username))
    1.17  {
    1.18    require dirname(__FILE__).'/lastfm.php';
    1.19 -  $lfl = new LastFmLibrary('5f2c19c12fa6048504af671d1f111d2b', $lastfm_username);
    1.20 -  foreach ($lfl->getAllArtistNames($lastfm_min_playcount) as $artist)
    1.21 +  //if ($scrobbler_service == 'lastfm')
    1.22 +    $lfl = new LastFmLibrary('5f2c19c12fa6048504af671d1f111d2b',
    1.23 +                      $scrobbler_username, 'ws.audioscrobbler.com');
    1.24 +  //elseif ($scrobbler_service == 'librefm')
    1.25 +  //  $lfl = new LastFmLibrary(false, $scrobbler_username, 'alpha.libre.fm');
    1.26 +  foreach ($lfl->getAllArtistNames($scrobbler_min_playcount) as $artist)
    1.27      $am->addArtist($artist);
    1.28  }
    1.29  
    1.30 @@ -76,11 +81,11 @@
    1.31        <div>
    1.32        <p>Import artists from a <a href="http://www.last.fm/">Last.fm</a> account (<a href="http://alpha.libre.fm/">Libre.fm</a> support will come as soon as they implement the <code>library.getArtists</code> call).<br/>
    1.33        Note: If you have a lot of artists and/or use a low minimum playcount, it will take some time.</p>
    1.34 -      <label for="lastfm_username"><strong>Last.fm username: </strong></label>
    1.35 -      <input id="lastfm_username" name="lastfm_username" value="<?php echo htmlspecialchars($lastfm_username) ?>" size="20" />
    1.36 +      <label for="scrobbler_username"><strong>Last.fm username: </strong></label>
    1.37 +      <input id="scrobbler_username" name="scrobbler_username" value="<?php echo htmlspecialchars($scrobbler_username) ?>" size="20" />
    1.38        <br />
    1.39 -      <label for="lastfm_min_playcount"><strong>Minimum playcount: </strong></label>
    1.40 -      <input id="lastfm_min_playcount" name="lastfm_min_playcount" value="<?php echo htmlspecialchars($lastfm_min_playcount) ?>" size="20" />
    1.41 +      <label for="scrobbler_min_playcount"><strong>Minimum playcount: </strong></label>
    1.42 +      <input id="scrobbler_min_playcount" name="scrobbler_min_playcount" value="<?php echo htmlspecialchars($scrobbler_min_playcount) ?>" size="20" />
    1.43        </div>
    1.44  
    1.45        <div class="bigtextfield">