From 54639a7f552d0ad41c8a813e01bba3c7e5439b01 Mon Sep 17 00:00:00 2001 From: Paul Kirby Date: Thu, 25 Oct 2018 19:44:08 -0500 Subject: [PATCH] Successfully publishing to speech. --- .gitignore | 3 +++ classes/LBRY_Speech.php | 12 ++++++------ lbry_config.example.php | 4 ++++ 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 lbry_config.example.php diff --git a/.gitignore b/.gitignore index 99e6bbc..46dc632 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ tmp/* !*.gitkeep + +#Ignore config file +lbry_config.php diff --git a/classes/LBRY_Speech.php b/classes/LBRY_Speech.php index 5428420..e4bc0a9 100644 --- a/classes/LBRY_Speech.php +++ b/classes/LBRY_Speech.php @@ -56,14 +56,14 @@ class LBRY_Speech error_log(print_r($attachment, true)); // TODO: set post meta to see if already uploaded - $file_url = $attachment->guid; - $file_url = str_replace(site_url(), '', $file_url); - $cfile = curl_file_create($file_url, $attachment->post_mime_type, $attachment->post_name); + $file_url = get_attached_file($attachment->ID); + $cfile = new CURLFile($file_url, $attachment->post_mime_type, $attachment->post_name . '.jpg'); $params = array( 'name' => $attachment->post_name, 'file' => $cfile, - 'title' => $attachment->post_title + 'title' => $attachment->post_title, + 'type' => $attachment->post_mime_type ); $result = $this->request('publish', $params); @@ -97,8 +97,8 @@ class LBRY_Speech /** * Sends a cURL request to the Speech URL - * @param string $method The method to call on the LBRY API - * @param array $params The Parameters to send the LBRY API Call + * @param string $method The method to call on the Speech API + * @param array $params The Parameters to send the Speech API Call * @return string The cURL response */ private function request($method, $params = array()) diff --git a/lbry_config.example.php b/lbry_config.example.php new file mode 100644 index 0000000..391e692 --- /dev/null +++ b/lbry_config.example.php @@ -0,0 +1,4 @@ +