%PDF- %PDF-
Direktori : /data/www_bck/varak.net_bck/wow2.varak.net/xml/ |
Current File : //data/www_bck/varak.net_bck/wow2.varak.net/xml/lfmget.old.php |
<?php die; error_reporting(0); include("../lib.php"); $tzac=getmicrotime(); include "getfile.php"; $usrs = file("recent.usr"); $count = 0; $spojeni = sqlite_open("recent2.db"); foreach($usrs as $usr) { $usr = trim($usr); $recent = download_file("http://ws.audioscrobbler.com/1.0/user/$usr/recenttracks.xml"); $res = simplexml_load_string($recent); //print_r($res); //mysql_select_db("waritko_eqdkp", $spojeni); $result = sqlite_query($spojeni, "select max(time) from recent where user like '$usr'"); $last = sqlite_fetch_single($result); foreach($res->track as $item) { $artist = str_replace("'", "''", $item->artist); $album = str_replace("'", "''", $item->album); $track = str_replace("'", "''", $item->name); $time = strtotime($item->date)+7200; if($time > $last) { sqlite_query($spojeni, "insert into recent(artist, album, track, time, user) values('$artist', '$album', '$track', $time, '$usr')"); $count++; } } } sqlite_close($spojeni); $mem = sprintf("%01.2f", memory_get_peak_usage(true)/(1024*2024)); $tkon=getmicrotime(); $time=$tkon-$tzac; $time = sprintf("%01.4f", $time); echo "Hotovo, importovano $count prehranych pisnicek\nImport trval $time sekund, bylo pouzito $mem MB pameti\n\n"; ?>