From: Jacob Casper Date: Tue, 26 Jun 2018 23:56:59 +0000 (-0500) Subject: v0.3.2: X-Git-Url: https://git.jacobcasper.com/?p=Marketplaylister.git;a=commitdiff_plain;h=29d84c29eac4bafa7aa1370578bce9e8e0a8f2bc v0.3.2: commit 4028754e9fd79cdbf9906e0e99df33b004bee916 Author: Jacob Casper Date: Tue Jun 26 18:37:46 2018 -0500 Updated to new spotify credentials, less fragile marketplace date format --- diff --git a/callback.php b/callback.php index be99a1a..b6211da 100644 --- a/callback.php +++ b/callback.php @@ -49,7 +49,7 @@ /*'header' => "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($token_data) . "\r\n" . "Authorization: Basic " . base64_encode('868e2cba00de4819900dd8a647a7ba7d:' . CLIENT_SECRET) . "\r\n",*/ - 'header' => "Authorization: Basic " . base64_encode('868e2cba00de4819900dd8a647a7ba7d:' . CLIENT_SECRET) . " \r\n", + 'header' => "Authorization: Basic " . base64_encode('93a6f9c0375c45d4b348157691aa24e8:' . CLIENT_SECRET) . " \r\n", 'content' => $token_data ] ]; diff --git a/marketplay.php b/marketplay.php index b456ec8..6ff4b85 100644 --- a/marketplay.php +++ b/marketplay.php @@ -1,6 +1,6 @@ query('SELECT date FROM songs order by date desc limit 1'); $resultset = $query->fetch(); - $lastEpDT = new DateTime::createFromFormat(SQLITE_DATE_FORM, $resultset['date']; + $lastEpDT = DateTime::createFromFormat(SQLITE_DATE_FORM, $resultset['date']); $startDate = new DateTime; $episodeDatePages = []; $episodeTrackPages = []; diff --git a/mktplc.sqlite3 b/mktplc.sqlite3 index 5daf12d..68a6b17 100644 Binary files a/mktplc.sqlite3 and b/mktplc.sqlite3 differ diff --git a/mpfuncs.php b/mpfuncs.php index 051619a..870acaf 100644 --- a/mpfuncs.php +++ b/mpfuncs.php @@ -1,6 +1,6 @@ hasAttribute('class') && $header->getAttribute('class') === 'river--hed') { - $dateStringParts = explode('/', explode(':', $header->nodeValue)[0]); - if ( strlen($dateStringParts[2]) === 2 ) { - $dateStringParts[2] = '20' . $dateStringParts[2]; - } - $episodeDate = DateTime::createFromFormat(DATE_FORM, implode("/", $dateStringParts)); + $episodeAnchorHref = $header->firstChild->getAttribute('href'); + $dateString = explode('/', $episodeAnchorHref)[3]; + $episodeDate = DateTime::createFromFormat(DATE_FORM, $dateString); if ($episodeDate < $lastDate) { break; } @@ -47,4 +45,4 @@ } } return $episodeDates; - } \ No newline at end of file + } diff --git a/searchify.php b/searchify.php index 740f79f..949abf9 100644 --- a/searchify.php +++ b/searchify.php @@ -2,7 +2,7 @@ const BASE_URL = 'https://api.spotify.com/v1/'; // Currently updated manually whenever I get one from the server - const SPOT_TOKEN = 'BQCQTtwO2kiMcV_VDgfSmTXQzGlO47rUuPyc4oCHpRunPQx2ZhhVYOtksVZPMbSgoCy3cGiRMHMygon5-SleqfsP0lvRMQW3gm1Q_a8TRv5MfCGQdNwdUcUu_NBpcSjWDNUadWeg3ps-WTDWxjUWm_FOlfxMy7a2AdI_RHWZ0Lx56WHf8gYA4-YVUm_HxpqDlReqEkWE9DHppQ'; + const SPOT_TOKEN = 'BQBU1Qs3ROpkN9CwlQNpZS00khdSU61zuejyKbjS4KiIszK8aiLaTd9TfPiSH0OsmtWStOVL7ym-QYEBWyLX3qlFIN5peit0n6_B-LLtz4C8KSh3Dxj5O3jf4HSWf3fFISC4cLbznfSV3QnpQ4vdnCTehz4vT8V54XDiG2hX275Uw_gDHzKjqFWQo249-rY42rBv7pf555wQ2PSBymuZMcDlIDEeAbGiyRI'; $pdo = new PDO("sqlite:mktplc.sqlite3"); @@ -13,8 +13,7 @@ if ($stmt->execute()) { - print_r($stmt->fetchAll()); - exit(0); + #print_r($stmt->fetchAll()); while ($row = $stmt->fetch()) { $track_opts = [