$query["q"] ]; } elseif (str_ends_with($host, ".bandcamp.com") && !$path) { $file = "artist"; $data = [ "name" => explode(".", $host)[0] ]; } elseif (str_ends_with($host, ".bandcamp.com")) { $file = "release"; $data = [ "artist" => explode(".", $host)[0], "type" => explode("/", $path)[0], "name" => explode("/", $path)[1] ]; } elseif ($host === "f4.bcbits.com") { $file = "image"; $data = [ "file" => basename($link) ]; } elseif ($host === "t4.bcbits.com") { $file = "audio"; $data = [ "directory" => explode("/", $path)[1], "format" => explode("/", $path)[2], "file" => explode("/", $path)[3], "token" => $query["token"] ]; } else return $link; return $file . ".php?" . http_build_query($data); }; function prefix_link($link, $parameter) { if (!filter_var($link, FILTER_VALIDATE_URL)) return $link = "https://" . urlencode($_GET[$parameter]) . ".bandcamp.com" . $link; else return $link; }; function resize_link($link, $size) { $host = parse_url($link, PHP_URL_HOST); if ($host !== "f4.bcbits.com") return $link; $file = pathinfo($link)["filename"]; $ext = pathinfo($link)["extension"]; return "https://" . $host . "/img/" . explode("_", $file)[0] . "_" . $size . "." . $ext; }; ?>