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


PHP album::newTrack方法代码示例

本文整理汇总了PHP中album::newTrack方法的典型用法代码示例。如果您正苦于以下问题:PHP album::newTrack方法的具体用法?PHP album::newTrack怎么用?PHP album::newTrack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在album的用法示例。


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

示例1: do_track_by_track

function do_track_by_track($trackobject)
{
    // The difference between this and the above function is that this one takes tracks as they come in direct
    // from the backend - without being collectionised. This is faster and uses less RAM but does rely on the tags
    // being correct - they're filtered before being sent here.
    // Tracks must have disc and albumartist tags to be handled by this method.
    // The collectionizer was designed to sort tracks without those tags so if those tags exist they don't need
    // to be collectionized.
    global $mysqlc, $find_track, $update_track, $prefs;
    static $current_albumartist = null;
    static $current_album = null;
    static $current_domain = null;
    static $current_albumlink = null;
    static $albumobj = null;
    static $albumindex = null;
    static $albumartistindex = null;
    $artistname = $trackobject->get_sort_artist();
    if ($current_albumartist != $artistname) {
        $albumartistindex = check_artist($artistname, false);
    }
    if ($albumartistindex == null) {
        debuglog("ERROR! Checked artist " . $artistname . " and index is still null!", "MYSQL_TBT", 1);
        return false;
    }
    if ($current_albumartist != $artistname || $current_album != $trackobject->tags['Album'] || $current_domain != $trackobject->tags['domain'] || $trackobject->tags['X-AlbumUri'] != null && $trackobject->tags['X-AlbumUri'] != $current_albumlink) {
        $albumobj = new album($trackobject->tags['Album'], $artistname, $trackobject->tags['domain']);
        $albumobj->newTrack($trackobject);
        $albumindex = check_album($albumobj->name, $albumartistindex, $albumobj->uri, $albumobj->getImage('small'), $albumobj->getDate(), "0", $albumobj->getKey(), $albumobj->musicbrainz_albumid, $albumobj->domain, false);
        if ($albumindex == null) {
            debuglog("ERROR! Album index for " . $albumobj->name . " is still null!", "MYSQL_TBT", 1);
            return false;
        }
    } else {
        $albumobj->newTrack($trackobject, true);
    }
    $current_albumartist = $artistname;
    $current_album = $albumobj->name;
    $current_domain = $albumobj->domain;
    $current_albumlink = $albumobj->uri;
    foreach ($albumobj->tracks as $trackobj) {
        // The album we've just created must only have one track, but this makes sure we use the track object
        // that is part of the album. This MAY be important due to various assumptions and the fact that PHP
        // insists on copying variables rather than passing by reference.
        check_and_update_track($trackobj, $albumindex, $albumartistindex, $artistname);
    }
}
开发者ID:cyrilix,项目名称:rompr,代码行数:46,代码来源:backend.php


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