Menu

Add album / cover art within album directory

Help
Karl
2005-08-09
2013-04-16
  • Karl

    Karl - 2005-08-09

    i have my music directories set up as /artist/album with a jpg of the album art within each album directory.  is there an easy way to modify the admin_updateDb.php to link the album art during recursion?

     
    • Philip Lowman

      Philip Lowman - 2005-08-11

      Buried deep within the updateDb code is the following snippit:

              else {
                  print "<p>New song found: <b>$filename</b><br>";
                  $song = new Song(NULL, $filename);
                  $song->read_data_from_file(TRUE);
                  $song->add_to_db(1);
                  echo "</p>";
              }

      After the $song->read_data_from_file(TRUE) call you should be guaranteed
      to have a valid album_id which you can get with $song->album_id.  You
      can use this and the "album.class.php" code (which you might need to
      include) to modify the appropriate album table row.

      $album = new Album($song->album_id);
      $album->load();
      $album->small_album_cover = "http://server/path/to/small/art.jpg";
      $album->large_album_cover = "http://server/path/to/large/art.jpg";
      $album->save();

      ...although inefficient should probably work for your needs.  You'll
      need to figure out a way to provide the path to the album art which you
      would have to somehow make available via HTTP.  One way would be to add
      symbolic links for all of your art to some kind of common image
      directory, alternatively you could open up access to your audio files
      via HTTP and block the downloading of audio files (if this is a concern)
      through .htaccess files.

      Also, the above hack would only work for new songs.  You would have to
      devise a new script to detect if album art was updated or handle it
      manually by updating the SQL tables or writing a script to modify the
      album table.

       

Log in to post a comment.