当前位置: 首页>>代码示例>>PHP>>正文


PHP mp3act_connect函数代码示例

本文整理汇总了PHP中mp3act_connect函数的典型用法代码示例。如果您正苦于以下问题:PHP mp3act_connect函数的具体用法?PHP mp3act_connect怎么用?PHP mp3act_connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mp3act_connect函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: resetDatabase

function resetDatabase()
{
    mp3act_connect();
    $query = array();
    $query[] = "TRUNCATE TABLE mp3act_songs";
    $query[] = "TRUNCATE TABLE mp3act_artists";
    $query[] = "TRUNCATE TABLE mp3act_albums";
    $query[] = "TRUNCATE TABLE mp3act_playlist";
    $query[] = "TRUNCATE TABLE mp3act_saved_playlists";
    $query[] = "TRUNCATE TABLE mp3act_genres";
    $query[] = "TRUNCATE TABLE mp3act_stats";
    $query[] = "TRUNCATE TABLE mp3act_playhistory";
    $query[] = "TRUNCATE TABLE mp3act_currentsong";
    foreach ($query as $q) {
        mysql_query($q);
    }
    $path = $GLOBALS['abs_path'] . "/art/";
    if (is_dir($path)) {
        if ($dh = opendir($path)) {
            while (($file = readdir($dh)) !== false) {
                if ($file != "." && $file != ".." && $file != ".svn") {
                    unlink($path . $file);
                }
            }
            closedir($dh);
        }
    }
    return 1;
}
开发者ID:benbruscella,项目名称:Grammafone,代码行数:29,代码来源:mp3act_functions.php

示例2: set_time_limit

<?php

include_once "mp3act_functions.php";
set_time_limit(0);
mp3act_connect();
// Play a song
if ($_SERVER['argv'][1] == 1) {
    $query = "SELECT song_id,filename FROM mp3act_songs WHERE song_id=" . $_SERVER['argv'][3] . " ORDER BY track";
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        updateNumPlays($row['song_id'], 0, $_SERVER['argv'][2]);
        setCurrentSong($row['song_id'], 0);
        playLocal($row['filename']);
    }
    $query = "DELETE FROM mp3act_currentsong";
    mysql_query($query);
    if (file_exists("/tmp/mp3act")) {
        unlink("/tmp/mp3act");
    }
    exec(getSystemSetting("phpbin") . " includes/play.php 3 {$id} > /dev/null 2>&1 &");
} elseif ($_SERVER['argv'][1] == 2) {
    $query = "SELECT song_id,filename FROM mp3act_songs WHERE album_id=" . $_SERVER['argv'][3] . " ORDER BY track";
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        updateNumPlays($row['song_id'], 0, $_SERVER['argv'][2]);
        setCurrentSong($row['song_id'], 0);
        playLocal($row['filename']);
    }
    $query = "DELETE FROM mp3act_currentsong";
    mysql_query($query);
    if (file_exists("/tmp/mp3act")) {
开发者ID:benbruscella,项目名称:Grammafone,代码行数:31,代码来源:play.php

示例3: updateStats

 function updateStats()
 {
     mp3act_connect();
     $query = "SELECT COUNT(DISTINCT album_id) as num_albums, \n              COUNT(DISTINCT artist_id) as num_artists, \n              COUNT(song_id) as num_songs, \n              SEC_TO_TIME(SUM(length)) as total_time, \n              SUM(size)/1024000000 as total_size \n              FROM mp3act_songs";
     $result = mysql_query($query);
     $row = mysql_fetch_assoc($result);
     $query = "DELETE FROM mp3act_stats";
     mysql_query($query);
     $query2 = "SELECT COUNT(genre_id) as num_genres FROM mp3act_genres";
     $result2 = mysql_query($query2);
     $row2 = mysql_fetch_assoc($result2);
     $query3 = "INSERT INTO mp3act_stats VALUES ( \n            " . $row['num_artists'] . ", \n            " . $row['num_albums'] . ",\n            " . $row['num_songs'] . ",\n            " . $row2['num_genres'] . ",\n            \"" . $row['total_time'] . "\",\n            \"" . $row['total_size'] . "GB\")" . "";
     mysql_query($query3);
 }
开发者ID:benbruscella,项目名称:Grammafone,代码行数:14,代码来源:addMusicClass.php

示例4: updateGenres

 function updateGenres()
 {
     mp3act_connect();
     $query = "DELETE FROM mp3act_genres";
     mysql_query($query);
     $query = "SELECT album_genre FROM mp3act_albums GROUP BY album_genre";
     $result = mysql_query($query);
     while ($genre = mysql_fetch_assoc($result)) {
         $query = "INSERT INTO mp3act_genres VALUES (NULL,\"" . $genre['album_genre'] . "\")";
         mysql_query($query);
     }
 }
开发者ID:benbruscella,项目名称:Grammafone,代码行数:12,代码来源:addMusicClass.php

示例5: getFileList

function getFileList($path)
{
    if ($path[strlen($path) - 1] != '/') {
        $path .= "/";
    }
    $path_sl = addslashes($path);
    $files = "";
    if (!is_dir($path)) {
        $files .= "Given path is not a directory, choose another path";
        return $files;
    }
    mp3act_connect();
    $resdir = @opendir($path);
    if ($resdir != false) {
        while (($entry = readdir($resdir)) !== false) {
            if (is_dir($path . $entry)) {
                if ($entry != "." && $entry != "..") {
                    $directory[] = $entry;
                }
            } else {
                /* filename, only add if it's an mp3 */
                if (strtolower(substr($entry, strlen($entry) - 4, 4)) == ".mp3") {
                    $file[] = $entry;
                }
            }
        }
        closedir($resdir);
        //array_multisort((strtolower($directory)), SORT_ASC, SORT_STRING, $directory);
        $count = 1;
        $dircount = 1;
        if (count($directory) > 0) {
            sort($directory);
            foreach ($directory as $entry) {
                $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = '');
                $files .= "<div class='impcell'>";
                $files .= "<input type='checkbox' name='importdir[]' value='{$count}' {$alt}/>";
                $files .= "<img src='img/gray10x10.png'></img>";
                $files .= "<img src='img/gray10x10.png'></img>";
                $files .= "<a href=\"#\" onclick=\"goToDirectory('{$path_sl}', {$dircount}); return false;\" title=\"Go to directory {$entry}\">{$entry}</a>";
                $files .= "</div>";
                $count++;
                $dircount++;
            }
        }
        $count = 1;
        // reset counter for files
        if (count($file) > 0) {
            sort($file);
            foreach ($file as $entry) {
                $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = '');
                $fileStatus = fileInDb($path . $entry);
                $files .= "<div class='impcell'>";
                $files .= "<input type='checkbox' name='importfile[]' value='{$count}' {$alt}/>";
                if ($fileStatus['in_db'] == true) {
                    $files .= "<img src='img/check.png' alt='Song is in database'></img>";
                } else {
                    $files .= "<img src='img/gray10x10.png'></img>";
                }
                if ($fileStatus['modified'] == true) {
                    $files .= "<img src='img/modified.png' alt='Song has been modified since it was imported'></img>";
                } else {
                    $files .= "<img src='img/gray10x10.png'></img>";
                }
                $files .= "{$entry}";
                $files .= "</div>";
                $count++;
            }
        }
    } else {
        return "Directory {$path} not open for reading, permission problem?";
    }
    return $files;
}
开发者ID:benbruscella,项目名称:Grammafone,代码行数:73,代码来源:browse.php


注:本文中的mp3act_connect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。