- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
<?php
$br="
";
include "functions.php";
mconnect();
$result=mysql_query("TRUNCATE base");
$tags=file_get_contents("tag_cache");
$tags=str_replace("'","\'",$tags);
$tags=explode("songList begin",$tags);
$j=0;
for($i=1; $i<count($tags); $i++)
{
$tmp=explode("songList end",$tags[$i]);
$tbase[$j++]=$tmp[0];
}
$j=0;
for($i=0; $i<count($tbase); $i++)
{
$tmp=explode("key: ", $tbase[$i]);
for($i2=1; $i2<count($tmp); $i2++)
$element[$j++]=$tmp[$i2];
}
for($i=0; $i<count($element); $i++)
{
$tmp=explode($br."file: ",$element[$i]);
$track[$i]['key']=$tmp[0];
$tmp=explode($br."Time: ",$tmp[1]);
$track[$i]['file']=$tmp[0];
$tmp=explode($br."Artist: ",$tmp[1]);
$track[$i]['Time']=$tmp[0];
$tmp=explode($br."Title: ", $tmp[1]);
$track[$i]['Artist']=$tmp[0];
$tmp=explode($br."Album: ", $tmp[1]);
$track[$i]['Title']=$tmp[0];
$tmp=explode($br."Track: ", $tmp[1]);
$track[$i]['Album']=$tmp[0];
$tmp=explode($br."Date: ", $tmp[1]);
$track[$i]['Track']=$tmp[0];
$tmp=explode($br."Genre: ", $tmp[1]);
$track[$i]['Date']=$tmp[0];
$tmp=explode($br."mtime: ", $tmp[1]);
$track[$i]['Genre']=$tmp[0];
$track[$i]['mtime']=$tmp[1];
$track[$i]['Size']=filesize(str_replace("\'","'", $track[$i]['file']));
}
for($i=0; $i<count($track); $i++)
{
// echo $track[$i]['Artist']." - ".$track[$i]['Album'].": ".$track[$i]['Title']."; " . round($track[$i]['Time']/60) . "m " .$track[$i]['Time']%60 . "s<hr>";
$request="INSERT INTO base (file, Time, Artist, Title, Album, Track, Date, Genre, mtime, Size) VALUES ('".
$track[$i]['file']."', '"
.$track[$i]['Time']."', '"
.$track[$i]['Artist']."', '"
.$track[$i]['Title']."', '"
.$track[$i]['Album']."', '"
.$track[$i]['Track']."', '"
.$track[$i]['Date']."', '"
.$track[$i]['Genre']."', '"
.$track[$i]['mtime']."', '"
.$track[$i]['Size']."')";
echo $request."<hr>";
$result=mysql_query($request) or die(mysql_error().$i.";(");
}
?>
guest 07.07.2009 03:36 # 0