-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
351 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,38 @@ | ||
<?php | ||
if (isset($_GET['setlist_id'])) { | ||
$params = array(); | ||
$endpoint = 'setlist/' . $_GET['setlist_id']; | ||
if (isset($_GET['setlistId'])) { | ||
$sanitized_setlistId = filter_var($_GET['setlistId'], FILTER_SANITIZE_STRING); | ||
$endpoint = 'setlist/' . $_GET['setlistId']; | ||
} else if (isset($_GET['artistName'])) { | ||
$sanitized_artistName = filter_var($_GET['artistName'], FILTER_SANITIZE_STRING); | ||
$endpoint = 'search/setlists?artistName=' . urlencode($sanitized_artistName); | ||
|
||
if (isset($_GET['page'])) { | ||
$sanitized_p = filter_var($_GET['page'], FILTER_SANITIZE_NUMBER_INT); | ||
$endpoint .= '&p=' . $sanitized_p; | ||
} | ||
} else { | ||
require('inc/error.php'); | ||
raiseOWSError('No setlist ID provided', 404, 620); | ||
} | ||
|
||
$setlistfmrq = curl_init(); | ||
|
||
curl_setopt($setlistfmrq, CURLOPT_HTTPHEADER, [ | ||
"REMOTE_ADDR: " . $_SERVER['REMOTE_ADDR'], | ||
"HTTP_X_FORWARDED_FOR: " . $_SERVER['REMOTE_ADDR'], | ||
"Accept: application/json", | ||
"x-api-key: " . getenv('SETLISTFM_API_KEY') | ||
]); | ||
curl_setopt($setlistfmrq, CURLOPT_RETURNTRANSFER, true); | ||
curl_setopt($setlistfmrq, CURLOPT_HTTPHEADER, ["REMOTE_ADDR: $_SERVER[REMOTE_ADDR]", "HTTP_X_FORWARDED_FOR: $_SERVER[REMOTE_ADDR]", "Accept: application/json", "x-api-key: " . getenv('SETLISTFM_API_KEY')]); | ||
|
||
$qs = http_build_query($params); | ||
|
||
$fullRequest = 'https://api.setlist.fm/rest/1.0' . '/' . $endpoint . '?' . $qs; | ||
curl_setopt($setlistfmrq, CURLOPT_URL, 'https://api.setlist.fm/rest/1.0/' . $endpoint); | ||
|
||
curl_setopt($setlistfmrq, CURLOPT_URL, $fullRequest); | ||
|
||
$response = curl_exec($setlistfmrq); | ||
header('Content-Type: ' . curl_getinfo($setlistfmrq, CURLINFO_CONTENT_TYPE)); | ||
|
||
require_once('inc/analytics.php'); | ||
$ga = new Analytics(); | ||
$ga->timing('Setlist.fm Response Time', $method, round(curl_getinfo($setlistfmrq, CURLINFO_TOTAL_TIME) * 1000)); | ||
|
||
curl_close($setlistfmrq); | ||
echo $response; | ||
} else { | ||
require('inc/error.php'); | ||
raiseOWSError('No setlist ID provided', 404, 602); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/domains/scrobbleSetlist/partials/EmptySetlistMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useNavigate } from 'react-router-dom'; | ||
import { Trans } from 'react-i18next'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { faBolt, faArrowLeft, faGuitar } from '@fortawesome/free-solid-svg-icons'; | ||
|
||
export function EmptySetlistMessage() { | ||
const navigate = useNavigate(); | ||
|
||
const goBack = (e) => { | ||
e.preventDefault(); | ||
navigate(-1); | ||
}; | ||
|
||
return ( | ||
<div className="row"> | ||
<div className="col-12 text-center mt-4"> | ||
<FontAwesomeIcon icon={faBolt} transform="shrink-5 down-2 left-2 rotate-120" mask={faGuitar} size="4x" /> | ||
<p className="mt-2"> | ||
<Trans i18nKey="emptySetlist">This setlist seems to be empty.</Trans> | ||
</p> | ||
<a href="/scrobble/album" onClick={goBack} className="my-2"> | ||
<FontAwesomeIcon icon={faArrowLeft} /> <Trans i18nKey="goBack">Go back</Trans> | ||
</a> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { faMapMarkerAlt, faUser } from '@fortawesome/free-solid-svg-icons'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Link } from 'react-router-dom'; | ||
import { Card, CardBody } from 'reactstrap'; | ||
import type { Setlist } from 'utils/types/setlist'; | ||
|
||
export function SetlistCard({ | ||
setlist, | ||
className = '', | ||
linkArtist = false, | ||
}: { | ||
setlist: Setlist; | ||
className?: string; | ||
linkArtist?: boolean; | ||
}) { | ||
const { t } = useTranslation(); | ||
const shortMonth = t('dates.months.short', { returnObjects: true })[setlist.date.getMonth()]; | ||
|
||
const ArtistInfo = ( | ||
<> | ||
<FontAwesomeIcon icon={faUser} className="me-2" /> | ||
{setlist.artist} | ||
</> | ||
); | ||
|
||
return ( | ||
<Card className={className}> | ||
<CardBody className="row no-gutters px-4"> | ||
<div className="col-3 calendar-thing text-center bg-dark rounded-1 py-1" style={{ whiteSpace: 'nowrap' }}> | ||
<span className="month text-small lh-1 position-relative text-uppercase" style={{ top: '0.2em' }}> | ||
{shortMonth} | ||
</span> | ||
<span className="day d-block fs-1 lh-1 fw-bold py-0 my-0 text-white">{setlist.date.getDate()}</span> | ||
<small className="year text-small">{setlist.date.getFullYear()}</small> | ||
</div> | ||
<div className="col-9 ps-3"> | ||
<h3 className="h4 pt-1 text-truncate text-white">{setlist.venue.name}</h3> | ||
<span className="d-block text-truncate"> | ||
{linkArtist ? ( | ||
<Link | ||
to={`/scrobble/setlist/search/${encodeURIComponent(setlist.artist)}`} | ||
className="text-decoration-none" | ||
> | ||
{ArtistInfo} | ||
</Link> | ||
) : ( | ||
ArtistInfo | ||
)} | ||
</span> | ||
<small> | ||
<FontAwesomeIcon icon={faMapMarkerAlt} className="me-2" /> | ||
{setlist.venue.city} | ||
{setlist.venue.state ? `, ${setlist.venue.state}` : ''} <span>({setlist.venue.country})</span> | ||
</small> | ||
</div> | ||
</CardBody> | ||
</Card> | ||
); | ||
} |
Oops, something went wrong.