audioscrobbler.php

来自「Bug tracker, and reporter.」· PHP 代码 · 共 629 行 · 第 1/2 页

PHP
629
字号
     * Utility function that returns a list of people with similar listening preferences to this user     * @return SimpleXML object containing result set     *     */    public function userGetNeighbours()    {        $service = "/{$this->get('version')}/user/{$this->get('user')}/neighbours.xml";        return $this->_getInfo($service);    }    /**     * Utility function that returns a list of the 10 most recent tracks played by this user     * @return SimpleXML object containing result set     *     */    public function userGetRecentTracks()    {        $service = "/{$this->get('version')}/user/{$this->get('user')}/recenttracks.xml";        return $this->_getInfo($service);    }    /**     * Utility function that returns a list of the 10 tracks most recently banned by this user     * @return SimpleXML object containing result set     *     */    public function userGetRecentBannedTracks()    {        $service = "/{$this->get('version')}/user/{$this->get('user')}/recentbannedtracks.xml";        return $this->_getInfo($service);    }    /**     * Utility function that returns a list of the 10 tracks most recently loved by this user     * @return SimpleXML object containing result set     *     */    public function userGetRecentLovedTracks()    {        $service = "/{$this->get('version')}/user/{$this->get('user')}/recentlovedtracks.xml";        return $this->_getInfo($service);    }    /**     * Utility function that returns a list of dates of available weekly charts for a this user     * Should actually be named userGetWeeklyChartDateList() but we have to follow audioscrobbler's naming     * @return SimpleXML object containing result set     *     */    public function userGetWeeklyChartList()    {        $service = "/{$this->get('version')}/user/{$this->get('user')}/weeklychartlist.xml";        return $this->_getInfo($service);    }    /**     * Utility function that returns weekly album chart data for this user     * @return SimpleXML object containing result set     *     * @param integer $from optional UNIX timestamp for start of date range     * @param integer $to optional UNIX timestamp for end of date range     */    public function userGetWeeklyAlbumChart($from = NULL, $to = NULL)    {        $params = "";        if ($from != NULL && $to != NULL) {            $from = (int)$from;            $to = (int)$to;            $params = "from={$from}&to={$to}";        }        $service = "/{$this->get('version')}/user/{$this->get('user')}/weeklyalbumchart.xml";        return $this->_getInfo($service, $params);    }    /**     * Utility function that returns weekly artist chart data for this user     * @return SimpleXML object containing result set     *     * @param integer $from optional UNIX timestamp for start of date range     * @param integer $to optional UNIX timestamp for end of date range     */    public function userGetWeeklyArtistChart($from = NULL, $to = NULL)    {        $params = "";        if ($from != NULL && $to != NULL) {            $from = (int)$from;            $to = (int)$to;            $params = "from={$from}&to={$to}";        }        $service = "/{$this->get('version')}/user/{$this->get('user')}/weeklyartistchart.xml";        return $this->_getInfo($service, $params);    }    /**     * Utility function that returns weekly track chart data for this user     * @return SimpleXML object containing result set     *     * @param integer $from optional UNIX timestamp for start of date range     * @param integer $to optional UNIX timestamp for end of date range     */    public function userGetWeeklyTrackChart($from = NULL, $to = NULL)    {        $params = "";        if ($from != NULL && $to != NULL) {            $from = (int)$from;            $to = (int)$to;            $params = "from={$from}&to={$to}";        }        $service = "/{$this->get('version')}/user/{$this->get('user')}/weeklytrackchart.xml";        return $this->_getInfo($service, $params);    }    //////////////////////////////////////////////////////////    ///////////////////////  ARTIST  /////////////////////////    //////////////////////////////////////////////////////////    /**     * Public functions for retrieveing artist-specific information     *     */    /**     * Utility function that returns a list of artists similiar to this artist     * @return SimpleXML object containing result set     *     */    public function artistGetRelatedArtists()    {        $service = "/{$this->get('version')}/artist/{$this->get('artist')}/similar.xml";        return $this->_getInfo($service);    }    /**     * Utility function that returns a list of this artist's top listeners     * @return SimpleXML object containing result set     *     */    public function artistGetTopFans()    {        $service = "/{$this->get('version')}/artist/{$this->get('artist')}/fans.xml";        return $this->_getInfo($service);    }    /**     * Utility function that returns a list of this artist's top-rated tracks     * @return SimpleXML object containing result set     *     */    public function artistGetTopTracks()    {        $service = "/{$this->get('version')}/artist/{$this->get('artist')}/toptracks.xml";        return $this->_getInfo($service);    }    /**     * Utility function that returns a list of this artist's top-rated albums     * @return SimpleXML object containing result set     *     */    public function artistGetTopAlbums()    {        $service = "/{$this->get('version')}/artist/{$this->get('artist')}/topalbums.xml";        return $this->_getInfo($service);    }    /**     * Utility function that returns a list of this artist's top-rated tags     * @return SimpleXML object containing result set     *     */    public function artistGetTopTags()    {        $service = "/{$this->get('version')}/artist/{$this->get('artist')}/toptags.xml";        return $this->_getInfo($service);    }    //////////////////////////////////////////////////////////    ///////////////////////  ALBUM  //////////////////////////    //////////////////////////////////////////////////////////    public function albumGetInfo()    {        $service = "/{$this->get('version')}/album/{$this->get('artist')}/{$this->get('album')}/info.xml";        return $this->_getInfo($service);    }    //////////////////////////////////////////////////////////    ///////////////////////  TRACKS //////////////////////////    //////////////////////////////////////////////////////////    public function trackGetTopFans()    {        $service = "/{$this->get('version')}/track/{$this->get('artist')}/{$this->get('track')}/fans.xml";        return $this->_getInfo($service);    }    public function trackGetTopTags()    {        $service = "/{$this->get('version')}/track/{$this->get('artist')}/{$this->get('track')}/toptags.xml";        return $this->_getInfo($service);    }    //////////////////////////////////////////////////////////    ///////////////////////  TAGS   //////////////////////////    //////////////////////////////////////////////////////////    public function tagGetTopTags()    {        $service = "/{$this->get('version')}/tag/toptags.xml";        return $this->_getInfo($service);    }    public function tagGetTopAlbums()    {        $service = "/{$this->get('version')}/tag/{$this->get('tag')}/topalbums.xml";        return $this->_getInfo($service);    }    public function tagGetTopArtists()    {        $service = "/{$this->get('version')}/tag/{$this->get('tag')}/topartists.xml";        return $this->_getInfo($service);    }    public function tagGetTopTracks()    {        $service = "/{$this->get('version')}/tag/{$this->get('tag')}/toptracks.xml";        return $this->_getInfo($service);    }    //////////////////////////////////////////////////////////    /////////////////////// GROUPS  //////////////////////////    //////////////////////////////////////////////////////////    public function groupGetWeeklyChartList()    {        $service = "/{$this->get('version')}/group/{$this->get('group')}/weeklychartlist.xml";        return $this->_getInfo($service);    }    public function groupGetWeeklyArtistChartList($from = NULL, $to = NULL)    {        if ($from != NULL && $to != NULL) {            $from = (int)$from;            $to = (int)$to;            $params = "from={$from}&$to={$to}";        } else {            $params = "";        }        $service = "/{$this->get('version')}/group/{$this->get('group')}/weeklyartistchart.xml";        return $this->_getInfo($service, $params);    }    public function groupGetWeeklyTrackChartList($from = NULL, $to = NULL)    {        if ($from != NULL && $to != NULL) {            $from = (int)$from;            $to = (int)$to;            $params = "from={$from}&to={$to}";        } else {            $params = "";        }        $service = "/{$this->get('version')}/group/{$this->get('group')}/weeklytrackchart.xml";        return $this->_getInfo($service, $params);    }    public function groupGetWeeklyAlbumChartList($from = NULL, $to = NULL)    {        if ($from != NULL && $to != NULL) {            $from = (int)$from;            $to = (int)$to;            $params = "from={$from}&to={$to}";        } else {            $params = "";        }        $service = "/{$this->get('version')}/group/{$this->get('group')}/weeklyalbumchart.xml";        return $this->_getInfo($service, $params);    }    /**     * Saves the provided error information to this instance     *     * @param  integer $errno     * @param  string  $errstr     * @param  string  $errfile     * @param  integer $errline     * @param  array   $errcontext     * @return void     */    protected function _errorHandler($errno, $errstr, $errfile, $errline, array $errcontext)    {        $this->_error = array(            'errno'      => $errno,            'errstr'     => $errstr,            'errfile'    => $errfile,            'errline'    => $errline,            'errcontext' => $errcontext            );    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?