v0.3.2:
authorJacob Casper <dev@jacobcasper.com>
Tue, 26 Jun 2018 23:56:59 +0000 (18:56 -0500)
committerJacob Casper <dev@jacobcasper.com>
Tue, 26 Jun 2018 23:56:59 +0000 (18:56 -0500)
commit 4028754e9fd79cdbf9906e0e99df33b004bee916
Author: Jacob Casper <jacob.thomas.casper@gmail.com>
Date:   Tue Jun 26 18:37:46 2018 -0500

    Updated to new spotify credentials, less fragile marketplace date format

callback.php
marketplay.php
marketscraper.php
mktplc.sqlite3
mpfuncs.php
searchify.php

index be99a1a..b6211da 100644 (file)
@@ -49,7 +49,7 @@
             /*'header' => "Content-type: application/x-www-form-urlencoded\r\n"\r
                      . "Content-Length: " . strlen($token_data) . "\r\n"\r
                      . "Authorization: Basic " . base64_encode('868e2cba00de4819900dd8a647a7ba7d:' . CLIENT_SECRET) . "\r\n",*/\r
-            'header' => "Authorization: Basic " . base64_encode('868e2cba00de4819900dd8a647a7ba7d:' . CLIENT_SECRET) . " \r\n",\r
+            'header' => "Authorization: Basic " . base64_encode('93a6f9c0375c45d4b348157691aa24e8:' . CLIENT_SECRET) . " \r\n",\r
             'content' => $token_data\r
         ]\r
     ];\r
index b456ec8..6ff4b85 100644 (file)
@@ -1,6 +1,6 @@
 <?php
     require 'secrets.php';
     $scopes = 'playlist-modify-private playlist-modify-public';
-    $url = 'https://accounts.spotify.com/en/authorize?response_type=code&client_id=868e2cba00de4819900dd8a647a7ba7d&scope=' . urlencode($scopes) . '&redirect_uri=' . urlencode(REDIRECT_URI) . '&state=' . $_GET['state'];
+    $url = 'https://accounts.spotify.com/en/authorize?response_type=code&client_id=93a6f9c0375c45d4b348157691aa24e8&scope=' . urlencode($scopes) . '&redirect_uri=' . urlencode(REDIRECT_URI) . '&state=' . $_GET['state'];
     header('Location: ' .$url);
     exit();
index ff55a5e..f7d56de 100644 (file)
@@ -13,7 +13,7 @@
     $query = $pdo->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 = [];
index 5daf12d..68a6b17 100644 (file)
Binary files a/mktplc.sqlite3 and b/mktplc.sqlite3 differ
index 051619a..870acaf 100644 (file)
@@ -1,6 +1,6 @@
 <?php\r
 \r
-    const DATE_FORM = 'm/d/Y';\r
+    const DATE_FORM = 'mdY';\r
 \r
     \r
     function parseEpisodePage(DomNodeList $divs): array {\r
       $episodeDates = [];\r
       foreach ($headers as $header) {\r
         if ($header->hasAttribute('class') && $header->getAttribute('class') === 'river--hed') {\r
-          $dateStringParts = explode('/', explode(':', $header->nodeValue)[0]);\r
-          if ( strlen($dateStringParts[2]) === 2 ) {\r
-            $dateStringParts[2] = '20' . $dateStringParts[2];\r
-          }\r
-          $episodeDate = DateTime::createFromFormat(DATE_FORM, implode("/", $dateStringParts));\r
+          $episodeAnchorHref = $header->firstChild->getAttribute('href');\r
+          $dateString = explode('/', $episodeAnchorHref)[3];\r
+          $episodeDate = DateTime::createFromFormat(DATE_FORM, $dateString);\r
           if ($episodeDate < $lastDate) {\r
             break;\r
           }\r
@@ -47,4 +45,4 @@
         }\r
       }\r
       return $episodeDates;\r
-    }
\ No newline at end of file
+    }\r
index 740f79f..949abf9 100644 (file)
@@ -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 = [