Location: PHPKode > projects > Axis Groupware > musiclib/unused/tunez/test2.php
<?

include ("tunez.inc.php");
include ("tunez_admin.inc.php");

		$kweerie = "SELECT * from songs where song_id='1100'";
		$result = mysql_db_query("tunez", $kweerie);
		$row = mysql_fetch_array($result);

		$filename = $row[filename];

		$filehandle = fopen("$filename","r");
		$size = filesize("$filename");
		// Get the last 128 bytes and see if there's a TAG there
		$seek = fseek($filehandle, $size-128);
		$tag = fgets($filehandle,128);
   
		echo "$size DE TAG: <pre>$tag</pre><br>";   
		if (strstr("$tag", "TAG") || strstr("$tag", "tag")) 
		{
			echo "TAG exists.... overwriting....";
			$seek = fseek($filehandle, $size-128);
		}
		else
		{
			echo "Not Tagged yet... doing it now";
			$seek = fseek($filehandle, $size);
		}
		echo "<br>genre is $genre";
		$genre = chr($genre);
		echo "<br>genre is $genre";
		

		$kweerie = "UPDATE songs SET artist='$artist', songtitle='$songtitle', filename='$filename', album='$album', year='$year', genre='$genre' WHERE song_id='$song_id'";
		echo "\n$kweerie\n";
		
		mysql_db_query("tunez", $kweerie);
		if (mysql_error()) { echo mysql_error();}

		$artist = stripslashes($artist);
		$songtitle = stripslashes($songtitle);
		$album = stripslashes($album);

		$tag = "TAG";

		$tag .= $artist;
		$nrOfSpaces = 30  - strlen($artist);
		$tag .= gimmeSpaces($nrOfSpaces);

		$tag .= $songtitle;
		$nrOfSpaces = 30  - strlen($songtitle);
		$tag .= gimmeSpaces($nrOfSpaces);

		$tag .= $album;
		$nrOfSpaces = 30  - strlen($album);
		$tag .= gimmeSpaces($nrOfSpaces);

		$tag .= $year;
		$tag .=  "http://tunez.sourceforge.net  ";
		$tag .= $genre;
		fputs($filehandle, "$tag", 128);
		fputs($filehandle, " ", 128);

		fclose($filehandle);
		echo "<BR><BR><PRE>TAG1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901<BR>$tag";
}
displayFooter();
?>
</body>
</html>





Return current item: Axis Groupware