From b6f673687e5ebea7c00061c3fea612ffddce3a7b Mon Sep 17 00:00:00 2001
From: Jonas Heinrich <onny@project-insanity.org>
Date: Thu, 11 Feb 2021 17:30:37 +0100
Subject: [PATCH] add lastpub column to shows table

---
 CHANGELOG.md                                  |  2 +
 .../Version000100Date20210201162900.php       | 59 +++++++++++++++++++
 src/components/Table.vue                      |  4 +-
 src/services/ShowApi.js                       |  1 +
 4 files changed, 64 insertions(+), 2 deletions(-)
 create mode 100644 lib/Migration/Version000100Date20210201162900.php

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d04e379..c53a3ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,8 @@
 ## 0.2 - 2021-02
 
 ### Added
+- Start playback on clicking episode image
+  [#12](https://git.project-insanity.org/onny/nextcloud-app-podcast/-/issues/12) @onny
 - Start playback on clicking chapter mark
   [#90](https://git.project-insanity.org/onny/nextcloud-app-podcast/-/issues/90) @onny
 - Playing animation in episode chapter list
diff --git a/lib/Migration/Version000100Date20210201162900.php b/lib/Migration/Version000100Date20210201162900.php
new file mode 100644
index 0000000..5cd3ada
--- /dev/null
+++ b/lib/Migration/Version000100Date20210201162900.php
@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * Podcast App
+ *
+ * @author Jonas Heinrich
+ * @copyright 2021 Jonas Heinrich <onny@project-insanity.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+declare(strict_types=1);
+
+namespace OCA\Podcast\Migration;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\SimpleMigrationStep;
+use OCP\Migration\IOutput;
+
+class Version000100Date20210201162900 extends SimpleMigrationStep {
+
+	/**
+	 * @param IOutput $output
+	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+	 * @param array $options
+	 *
+	 * @return void
+	 */
+	public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
+	}
+
+	/**
+	 * @param IOutput $output
+	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+	 * @param array $options
+	 *
+	 * @return ISchemaWrapper
+	 */
+	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
+		/** @var ISchemaWrapper $schema */
+		$schema = $schemaClosure();
+		$table = $schema->getTable('shows');
+		$table->addColumn('lastpub', 'string');
+		return $schema;
+	}
+}
diff --git a/src/components/Table.vue b/src/components/Table.vue
index d661625..2912315 100644
--- a/src/components/Table.vue
+++ b/src/components/Table.vue
@@ -45,7 +45,7 @@
 					<div v-lazy:background-image="episode.imgURL"
 						class="episodeImage"
 						@click="doPlay(episode)">
-						<div :class="isPlaying ? 'pause' : 'play'" />
+						<div :class="episodePlaying(episode.id) ? 'pause' : 'play'" />
 					</div>
 				</td>
 				<td
@@ -135,7 +135,7 @@ export default {
 		...mapGetters([
 			'episodeLoaded',
 			'isPaused',
-			'isPlaying',
+			'episodePlaying',
 		]),
 	},
 	methods: {
diff --git a/src/services/ShowApi.js b/src/services/ShowApi.js
index f0b18af..854f094 100644
--- a/src/services/ShowApi.js
+++ b/src/services/ShowApi.js
@@ -39,6 +39,7 @@ export class ShowApi {
 			imgurl: show.smallImageURL,
 			title: show.title,
 			author: show.author,
+			lastpub: show.lastpub,
 		}
 		// lastpub: show.lastpub,
 		axios.defaults.headers.requesttoken = requesttoken
-- 
GitLab