app\models\Beatmapset::oszDownloadURL PHP Method

oszDownloadURL() public method

todo: generalize method
public oszDownloadURL ( $noVideo = 1 )
    public function oszDownloadURL($noVideo = 1)
    {
        $mirrors = config('osu.beatmap_processor.mirrors_to_use');
        $mirror = BeatmapMirror::find($mirrors[array_rand($mirrors)]);
        $diskFilename = $serveFilename = $this->filename;
        $time = time();
        $checksum = md5("{$this->beatmapset_id}{$diskFilename}{$serveFilename}{$time}{$noVideo}{$mirror->secret_key}");
        $url = "{$mirror->base_url}d/{$this->beatmapset_id}?fs=" . rawurlencode($serveFilename) . '&fd=' . rawurlencode($diskFilename) . "&ts={$time}&cs={$checksum}&u=0&nv={$noVideo}";
        return $url;
    }