1. PHP / Говнокод #1328

    +154

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 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.";(");
      }
    ?>

    Прога, которая из базы mpd запихивает в mysql

    Запостил: guest, 06 Июля 2009

    Комментарии (1) RSS

    Добавить комментарий