From 0bccfeb1b06c24bea1a0b690eddfafc26ee83962 Mon Sep 17 00:00:00 2001 From: tuz666 Date: Fri, 18 Feb 2022 23:41:43 +0100 Subject: [PATCH 01/21] Checked the following routes: - Pagination for latest arcsi at Home & Archive page (/item/latest) - A more efficient api for Shows page (/show/list) Updated swagger docs --- arcsi/api/item.py | 16 +- arcsi/api/show.py | 5 +- arcsi/static/component.json | 323 +++++++++++++++++++++--------------- arcsi/static/doc.json | 180 +++++++++----------- 4 files changed, 280 insertions(+), 244 deletions(-) diff --git a/arcsi/api/item.py b/arcsi/api/item.py index 4fac4fa5..e6abf162 100644 --- a/arcsi/api/item.py +++ b/arcsi/api/item.py @@ -62,14 +62,14 @@ def make_item(self, data, **kwargs): item_schema = ItemDetailsSchema() -item_archive_schema = ItemDetailsSchema(only = ("name", "number", "play_date", "language", - "description", "image_url", "play_file_name", "download_count")) -item_partial_schema = ItemDetailsSchema(partial=True,) -items_schema = ItemDetailsSchema(many=True) -items_archive_schema = ItemDetailsSchema(many=True, - only=("name", "description", - "play_date", "play_file_name", - "image_url", "download_count")) +item_archive_schema = ItemDetailsSchema( + only = ("id", "number", "name", "description", "language", "play_date", + "image_url", "play_file_name", "archived", "download_count", "shows")) +item_partial_schema = ItemDetailsSchema(partial = True,) +items_schema = ItemDetailsSchema(many = True) +items_archive_schema = ItemDetailsSchema(many = True, + only = ("id", "number", "name", "description", "language", "play_date", + "image_url", "play_file_name", "archived", "download_count", "shows")) headers = {"Content-Type": "application/json"} diff --git a/arcsi/api/show.py b/arcsi/api/show.py index bb893909..131a6a22 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -20,7 +20,6 @@ class ShowDetailsSchema(Schema): id = fields.Int() - name = fields.Str(required=True) active = fields.Boolean(required=True) name = fields.Str(required=True) description = fields.Str(required=True) @@ -83,8 +82,8 @@ def make_show(self, data, **kwargs): "day", "start", "end", "description", "archive_lahmastore_base_url")) shows_archive_schema = ShowDetailsSchema(many=True, - only=("active", "name", "cover_image_url", - "description", "archive_lahmastore_base_url")) + only=("id", "active", "name", "description", "cover_image_url", + "playlist_name", "archive_lahmastore_base_url")) headers = {"Content-Type": "application/json"} diff --git a/arcsi/static/component.json b/arcsi/static/component.json index 873af246..c43d852c 100644 --- a/arcsi/static/component.json +++ b/arcsi/static/component.json @@ -42,15 +42,9 @@ }, "item": { "properties": { - "id": { - "type": "integer", - "format": "int32", - "example": 1 - }, - "number": { - "type": "integer", - "format": "int32", - "example": 42 + "archived": { + "type": "boolean", + "example": true }, "name": { "type": "string", @@ -69,9 +63,24 @@ "type": "string", "example": "item-image_url" }, - "archived": { - "type": "boolean", - "example": true + "play_file_name": { + "type": "string", + "example": "item-play_file_name" + }, + "id": { + "type": "integer", + "format": "int32", + "example": 1 + }, + "number": { + "type": "integer", + "format": "int32", + "example": 42 + }, + "download_count": { + "type": "integer", + "format": "int32", + "example": 420 } } }, @@ -139,37 +148,76 @@ "$ref": "#/components/schemas/UserRequest" } }, - "ShowScheduleRequest": { + "ShowResponseBody": { "type": "object", "properties": { "active": { "type": "boolean" }, + "archive_lahmastore": { + "type": "boolean" + }, + "archive_mixcloud": { + "type": "boolean" + }, "name": { "type": "string" }, - "cover_image_url": { + "description": { "type": "string" }, - "day": { - "type": "integer", - "format": "int32" + "language": { + "type": "string" }, - "start": { + "playlist_name": { "type": "string" }, - "end": { + "archive_lahmastore_base_url": { "type": "string" }, - "description": { + "archive_mixcloud_base_url": { "type": "string" }, - "archive_lahmastore_base_url": { + "cover_image_url": { + "type": "string" + }, + "start": { "type": "string" + }, + "end": { + "type": "string" + }, + "day": { + "type": "integer", + "format": "int32" + }, + "frequency": { + "type": "integer", + "format": "int32" + }, + "week": { + "type": "integer", + "format": "int32" + }, + "id": { + "type": "integer", + "format": "int32" + }, + "users": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/user" + } + }, + "items": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/item" + } } } }, - "ShowArchiveRequest": { + "ShowsPageResponseBody": { "type": "object", "properties": { "active": { @@ -178,20 +226,30 @@ "name": { "type": "string" }, - "cover_image_url": { + "description": { "type": "string" }, - "description": { + "playlist_name": { "type": "string" }, "archive_lahmastore_base_url": { "type": "string" + }, + "cover_image_url": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int32" } } }, - "ShowSubPageRequest": { + "ShowScheduleRequest": { "type": "object", "properties": { + "active": { + "type": "boolean" + }, "name": { "type": "string" }, @@ -208,108 +266,79 @@ "end": { "type": "string" }, - "frequency": { - "type": "integer", - "format": "int32" - }, - "language": { - "type": "string" - }, - "active": { - "type": "boolean" - }, "description": { "type": "string" }, "archive_lahmastore_base_url": { "type": "string" - }, - "playlist_name": { - "type": "string" - }, - "items": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/ItemBasicRequest" - } } } }, - "ShowRequest": { + "ShowSubPageRequest": { "type": "object", "properties": { - "id": { - "type": "integer", - "format": "int32" - }, "name": { "type": "string" }, - "active": { - "type": "boolean" - }, - "description": { - "type": "string" - }, "cover_image_url": { "type": "string" }, - "language": { + "day": { + "type": "integer", + "format": "int32" + }, + "start": { "type": "string" }, - "playlist_name": { + "end": { "type": "string" }, "frequency": { "type": "integer", "format": "int32" }, - "day": { - "type": "integer", - "format": "int32" - }, - "start": { + "language": { "type": "string" }, - "end": { + "active": { + "type": "boolean" + }, + "description": { "type": "string" }, "archive_lahmastore_base_url": { "type": "string" }, - "users": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/user" - } + "playlist_name": { + "type": "string" }, "items": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/item" + "$ref": "#/components/schemas/ItemBasicRequest" } } } }, - "ShowScheduleRequests": { + "ShowResponseBodies": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/ShowScheduleRequest" + "$ref": "#/components/schemas/ShowResponseBody" } }, - "ShowArchiveRequests": { + "ShowsPageResponseBodies": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/ShowArchiveRequest" + "$ref": "#/components/schemas/ShowsPageResponseBody" } }, - "ShowRequests": { + "ShowScheduleRequests": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/ShowRequest" + "$ref": "#/components/schemas/ShowScheduleRequest" } }, - "ShowRequestPostBody": { + "ShowRequestBody": { "type": "object", "properties": { "active": { @@ -398,17 +427,44 @@ "user_email": "arcsi@lahmacun.hu" } }, - "ItemArchiveRequest": { + "ItemResponseBody": { "type": "object", "properties": { + "live": { + "type":"boolean" + }, + "broadcast": { + "type":"boolean" + }, + "airing": { + "type":"boolean" + }, + "archived": { + "type":"boolean" + }, + "archive_lahmastore": { + "type":"boolean" + }, + "archive_mixcloud": { + "type":"boolean" + }, "name": { "type": "string" }, + "description": { + "type": "string" + }, + "language": { + "type": "string" + }, "play_date": { "type": "string", "format": "date" }, - "description": { + "archive_lahmastore_canonical_url": { + "type": "string" + }, + "archive_mixcloud_canonical_url": { "type": "string" }, "image_url": { @@ -417,6 +473,17 @@ "play_file_name": { "type": "string" }, + "uploader": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int32" + }, + "number": { + "type": "integer", + "format": "int32" + }, "download_count": { "type": "integer", "format": "int32" @@ -424,30 +491,29 @@ "shows": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/ShowArchiveRequest" + "$ref": "#/components/schemas/show" } } } }, - "ItemSubPageRequest": { + "ItemArchiveResponseBody": { "type": "object", "properties": { + "archived": { + "type":"boolean" + }, "name": { "type": "string" }, - "number": { - "type": "integer", - "format": "int32" - }, - "play_date": { - "type": "string", - "format": "date" + "description": { + "type": "string" }, "language": { "type": "string" }, - "description": { - "type": "string" + "play_date": { + "type": "string", + "format": "date" }, "image_url": { "type": "string" @@ -455,38 +521,27 @@ "play_file_name": { "type": "string" }, - "download_count": { + "id": { "type": "integer", "format": "int32" - } - } - }, - "ItemBasicRequest": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "image_url": { - "type": "string" - }, - "play_date": { - "type": "string", - "format": "date" }, - "description": { - "type": "string" + "number": { + "type": "integer", + "format": "int32" }, "download_count": { "type": "integer", "format": "int32" }, - "play_file_name": { - "type": "string" + "shows": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/show" + } } } }, - "ItemRequest": { + "ItemSubPageRequest": { "type": "object", "properties": { "name": { @@ -515,49 +570,53 @@ "download_count": { "type": "integer", "format": "int32" + } + } + }, + "ItemBasicRequest": { + "type": "object", + "properties": { + "name": { + "type": "string" }, - "live": { - "type":"boolean" + "image_url": { + "type": "string" }, - "broadcast": { - "type":"boolean" + "play_date": { + "type": "string", + "format": "date" }, - "archive_lahmastore_base_url": { + "description": { "type": "string" }, - "shows": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/ShowArchiveRequest" - } + "download_count": { + "type": "integer", + "format": "int32" }, - "users": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/user" - } + "play_file_name": { + "type": "string" } } }, - "ItemArchiveRequests": { + "ItemResponseBodies": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/ItemBasicRequest" + "$ref": "#/components/schemas/ItemResponseBody" } }, - "ItemBasicRequests": { + "ItemArchiveResponseBodies": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/ItemBasicRequest" + "$ref": "#/components/schemas/ItemArchiveResponseBody" } }, - "ItemRequests": { + "ItemBasicRequests": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/ItemRequest" + "$ref": "#/components/schemas/ItemBasicRequest" } }, - "ItemRequestPostBody": { + "ItemRequestBody": { "type": "object", "properties": { "number": { diff --git a/arcsi/static/doc.json b/arcsi/static/doc.json index db55037a..b5b19d4f 100644 --- a/arcsi/static/doc.json +++ b/arcsi/static/doc.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "description": "Arcsi API doc", - "version": "0.9.5", + "version": "0.9.6", "title": "Arcsi", "contact": { "email": "it@lahmacun.hu" @@ -107,7 +107,7 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ShowRequests" + "$ref": "component.json#/components/schemas/ShowResponseBodies" } } } @@ -115,14 +115,23 @@ } } }, - "/show/schedule": { + "/show/{id}": { "get": { "tags": [ "Show Request" ], - "summary": "Return Shows for Ananasz Home and Schedule Page", + "summary": "Return Show for Arcsi Show Page", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "Show.id", + "type": "string" + } + ], "produces": [ - "text/html" + "application/json" ], "responses": { "200": { @@ -130,10 +139,13 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ShowScheduleRequests" + "$ref": "component.json#/components/schemas/ShowResponseBody" } } } + }, + "404": { + "description": "Show not found" } } } @@ -153,7 +165,7 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ShowArchiveRequests" + "$ref": "component.json#/components/schemas/ShowsPageResponseBodies" } } } @@ -161,23 +173,14 @@ } } }, - "/show/{id}": { + "/show/schedule": { "get": { "tags": [ "Show Request" ], - "summary": "Return Show for Arcsi Show Page", - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "description": "Show.id", - "type": "string" - } - ], + "summary": "Return Shows for Ananasz Home and Schedule Page", "produces": [ - "application/json" + "text/html" ], "responses": { "200": { @@ -185,7 +188,7 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ShowRequest" + "$ref": "component.json#/components/schemas/ShowScheduleRequests" } } } @@ -193,12 +196,12 @@ } } }, - "/show/{show_slug}/archive": { + "/show/{show_slug}/page": { "get": { "tags": [ - "Item Request" + "Show Request" ], - "summary": "Return Items for old WP Show Page", + "summary": "Return Show for Ananasz Show Subpage", "parameters": [ { "in": "path", @@ -209,7 +212,7 @@ } ], "produces": [ - "text/html" + "application/json" ], "responses": { "200": { @@ -217,7 +220,7 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ItemBasicRequests" + "$ref": "component.json#/components/schemas/ShowSubPageRequest" } } } @@ -228,23 +231,14 @@ } } }, - "/show/{show_slug}/page": { + "/item/all": { "get": { "tags": [ - "Show Request" - ], - "summary": "Return Show for Ananasz Show Subpage", - "parameters": [ - { - "in": "path", - "name": "show_slug", - "required": true, - "description": "Show.archive_lahmastore_base_url", - "type": "string" - } + "Item Request" ], + "summary": "Return Episodes for Arcsi Items Archive", "produces": [ - "application/json" + "text/html" ], "responses": { "200": { @@ -252,37 +246,29 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ShowSubPageRequest" + "$ref": "component.json#/components/schemas/ItemResponseBodies" } } } - }, - "404": { - "description": "Show not found" } } } }, - "/show/{show_slug}/episode/{episode_slug}": { + "/item/{id}": { "get": { "tags": [ "Item Request" ], - "summary": "Return Episode for Ananasz Episode Subpage", + "summary": "Return Episode for Arcsi Episode Page", "parameters": [ { "in": "path", - "name": "show_slug", - "required": true, - "description": "Show.archive_lahmastore_base_url", - "type": "string" - }, - { - "in": "path", - "name": "episode_slug", + "name": "id", "required": true, - "description": "Item.play_file_name + '.mp3'", - "type": "string" + "description": "Item Request ID", + "schema": { + "$ref": "component.json#/components/schemas/id" + } } ], "produces": [ @@ -294,36 +280,13 @@ "content": { "application/json": { "schema": { - "$ref": "component.json#/components/schemas/ItemSubPageRequest" + "$ref": "component.json#/components/schemas/ItemResponseBody" } } } }, "404": { - "description": "Episode not found" - } - } - } - }, - "/item/all": { - "get": { - "tags": [ - "Item Request" - ], - "summary": "Return Episodes for Arcsi Items Archive", - "produces": [ - "text/html" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "text/html": { - "schema": { - "$ref": "component.json#/components/schemas/ItemRequests" - } - } - } + "description": "Item not found" } } } @@ -359,7 +322,7 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ItemArchiveRequests" + "$ref": "component.json#/components/schemas/ItemArchiveResponseBodies" } } } @@ -367,64 +330,79 @@ } } }, - "/item/{id}": { + "/show/{show_slug}/archive": { "get": { "tags": [ "Item Request" ], - "summary": "Return Episode for Arcsi Episode Page", + "summary": "Return Items for old WP Show Page", "parameters": [ { "in": "path", - "name": "id", + "name": "show_slug", "required": true, - "description": "Item Request ID", - "schema": { - "$ref": "component.json#/components/schemas/id" - } + "description": "Show.archive_lahmastore_base_url", + "type": "string" } ], "produces": [ - "application/json" + "text/html" ], "responses": { "200": { "description": "OK", "content": { - "application/json": { + "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ItemRequest" + "$ref": "component.json#/components/schemas/ItemBasicRequests" } } } }, "404": { - "description": "Item not found" + "description": "Show not found" } } - }, - "delete": { + } + }, + "/show/{show_slug}/episode/{episode_slug}": { + "get": { "tags": [ "Item Request" ], - "summary": "Delete Item with given ID", + "summary": "Return Episode for Ananasz Episode Subpage", "parameters": [ { "in": "path", - "name": "id", + "name": "show_slug", "required": true, - "description": "Item Request ID", - "schema": { - "$ref": "component.json#/components/schemas/id" - } + "description": "Show.archive_lahmastore_base_url", + "type": "string" + }, + { + "in": "path", + "name": "episode_slug", + "required": true, + "description": "Item.play_file_name + '.mp3'", + "type": "string" } ], + "produces": [ + "application/json" + ], "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "component.json#/components/schemas/ItemSubPageRequest" + } + } + } }, "404": { - "description": "URL not found" + "description": "Episode not found" } } } From 1c3afeaaf845e9827a37b3f2db3531442c9f17e1 Mon Sep 17 00:00:00 2001 From: tuz666 Date: Sun, 20 Feb 2022 20:55:19 +0100 Subject: [PATCH 02/21] Added the search endpoint --- arcsi/api/item.py | 24 +++++++++-- arcsi/api/show.py | 25 +++++++++++- arcsi/static/doc.json | 94 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 137 insertions(+), 6 deletions(-) diff --git a/arcsi/api/item.py b/arcsi/api/item.py index e6abf162..288f18c3 100644 --- a/arcsi/api/item.py +++ b/arcsi/api/item.py @@ -9,6 +9,7 @@ from flask import flash, jsonify, make_response, request, send_file, url_for, redirect from flask import current_app as app from marshmallow import fields, post_load, Schema, ValidationError +from sqlalchemy import func from uuid import uuid4 @@ -20,7 +21,7 @@ save_file, item_duplications_number ) -from arcsi.api import arcsi +from . import arcsi from arcsi.handler.upload import DoArchive from arcsi.model import db from arcsi.model.item import Item @@ -51,7 +52,7 @@ class ItemDetailsSchema(Schema): shows = fields.List( fields.Nested( "ShowDetailsSchema", - only=("id", "name"), + only=("id", "name", "archive_lahmastore_base_url"), ), required=True, ) @@ -86,6 +87,7 @@ def list_items(): ) return items_schema.dumps(items) + @arcsi.route("/item/latest/", methods=["GET"]) def list_items_latest(): do = DoArchive() @@ -454,4 +456,20 @@ def edit_item(id): return make_response( jsonify(item_partial_schema.dump(item)), 200, headers ) - return "Some error happened, check server logs for details. Note that your media may have been uploaded (to DO and/or Azurcast)." \ No newline at end of file + return "Some error happened, check server logs for details. Note that your media may have been uploaded (to DO and/or Azurcast)." + + +@arcsi.route("/item/search", methods=["GET"]) +def search_item(): + do = DoArchive() + page = request.args.get('page', 1, type=int) + size = request.args.get('size', 12, type=int) + param = request.args.get('param', "", type=str) + items = Item.query.filter(func.lower(Item.name).contains(func.lower(param)) | func.lower(Item.description).contains(func.lower(param))).paginate( + page, size, False) + for item in items.items: + if item.image_url: + item.image_url = do.download( + item.shows[0].archive_lahmastore_base_url, item.image_url + ) + return items_schema.dumps(items.items) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index 131a6a22..91ade8c9 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -7,10 +7,11 @@ from flask import flash, jsonify, make_response, request, url_for from flask import current_app as app from marshmallow import fields, post_load, Schema, ValidationError +from sqlalchemy import func from werkzeug import secure_filename from .utils import archive, get_shows, save_file, slug, sort_for -from arcsi.api import arcsi +from . import arcsi from arcsi.handler.upload import DoArchive from arcsi.model import db from arcsi.model.show import Show @@ -94,15 +95,18 @@ def make_show(self, data, **kwargs): def list_shows(): return shows_schema.dumps(get_shows()) + @arcsi.route("/show/schedule", methods=["GET"]) def list_shows_for_schedule(): return shows_schedule_schema.dumps(get_shows()) + # We are gonna use this on the new page as the show/all @arcsi.route("/show/list", methods=["GET"]) def list_shows_page(): return shows_archive_schema.dumps(get_shows()) + # TODO /item//add route so that each upload has unique id to begin with # no need for different methods for `POST` & `PUT` @arcsi.route("/show/add", methods=["POST"]) @@ -260,6 +264,7 @@ def edit_show(id): jsonify(show_partial_schema.dump(show)), 200, headers ) + @arcsi.route("show/", methods=["GET"]) def view_show(id): do = DoArchive() @@ -280,6 +285,7 @@ def view_show(id): else: return make_response("Show not found", 404, headers) + # We use this route on the legacy front-end show page @arcsi.route("show//archive", methods=["GET"]) def view_show_archive(show_slug): @@ -331,4 +337,19 @@ def view_episode_archive(show_slug, episode_slug): for i in show.items: if i.play_file_name == episode_slug: return item_archive_schema.dump(i) - return make_response("Episode not found", 404, headers) \ No newline at end of file + return make_response("Episode not found", 404, headers) + + +@arcsi.route("/show/search", methods=["GET"]) +def search_show(): + do = DoArchive() + page = request.args.get('page', 1, type=int) + size = request.args.get('size', 12, type=int) + param = request.args.get('param', "", type=str) + shows = Show.query.filter(func.lower(Show.name).contains(func.lower(param)) | func.lower(Show.description).contains(func.lower(param))).paginate(page, size, False) + for show in shows.items: + if show.cover_image_url: + show.cover_image_url = do.download( + show.archive_lahmastore_base_url, show.cover_image_url + ) + return shows_archive_schema.dumps(shows.items) \ No newline at end of file diff --git a/arcsi/static/doc.json b/arcsi/static/doc.json index b5b19d4f..7026686d 100644 --- a/arcsi/static/doc.json +++ b/arcsi/static/doc.json @@ -173,6 +173,52 @@ } } }, + "/show/search/?size={size}&page={page}¶m={param}": { + "get": { + "tags": [ + "Show Request" + ], + "summary": "Return Shows which name or description contains the parameter", + "parameters": [ + { + "in": "path", + "name": "size", + "required": true, + "description": "page_size, default: 12", + "type": "string" + }, + { + "in": "path", + "name": "page", + "required": true, + "description": "page_number, default: 1", + "type": "string" + }, + { + "in": "path", + "name": "param", + "required": true, + "description": "search_parameter, default: 1", + "type": "string" + } + ], + "produces": [ + "text/html" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "text/html": { + "schema": { + "$ref": "component.json#/components/schemas/ShowResponseBodies" + } + } + } + } + } + } + }, "/show/schedule": { "get": { "tags": [ @@ -291,7 +337,7 @@ } } }, - "/item/latest/?size={size}&?page={page}": { + "/item/latest/?size={size}&page={page}": { "get": { "tags": [ "Item Request" @@ -330,6 +376,52 @@ } } }, + "/item/search/?size={size}&page={page}¶m={param}": { + "get": { + "tags": [ + "Item Request" + ], + "summary": "Return Items which name or description contains the parameter", + "parameters": [ + { + "in": "path", + "name": "size", + "required": true, + "description": "page_size, default: 12", + "type": "string" + }, + { + "in": "path", + "name": "page", + "required": true, + "description": "page_number, default: 1", + "type": "string" + }, + { + "in": "path", + "name": "param", + "required": true, + "description": "search_parameter, default: 1", + "type": "string" + } + ], + "produces": [ + "text/html" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "text/html": { + "schema": { + "$ref": "component.json#/components/schemas/ItemArchiveResponseBodies" + } + } + } + } + } + } + }, "/show/{show_slug}/archive": { "get": { "tags": [ From 6bdd4e50e8340aae1a3bad9f05518062f1be03ab Mon Sep 17 00:00:00 2001 From: tuz666 Date: Wed, 23 Feb 2022 18:26:57 +0100 Subject: [PATCH 03/21] /item/latest and /item/search now filters out future/premier episodes --- arcsi/api/item.py | 5 +++-- arcsi/api/show.py | 36 +++++++++++++++++++++++------------- arcsi/static/doc.json | 6 +++--- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/arcsi/api/item.py b/arcsi/api/item.py index 288f18c3..f8060d61 100644 --- a/arcsi/api/item.py +++ b/arcsi/api/item.py @@ -1,3 +1,4 @@ +from datetime import datetime, timedelta import json import os import requests @@ -88,12 +89,12 @@ def list_items(): return items_schema.dumps(items) -@arcsi.route("/item/latest/", methods=["GET"]) +@arcsi.route("/item/latest", methods=["GET"]) def list_items_latest(): do = DoArchive() page = request.args.get('page', 1, type=int) size = request.args.get('size', 12, type=int) - items = Item.query.order_by(Item.play_date.desc()).paginate( + items = Item.query.filter(Item.play_date < datetime.today() - timedelta(days=1)).order_by(Item.play_date.desc()).paginate( page, size, False) for item in items.items: if item.image_url: diff --git a/arcsi/api/show.py b/arcsi/api/show.py index 91ade8c9..bdbb4748 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -66,22 +66,16 @@ def make_show(self, data, **kwargs): return Show(**data) -show_schema = ShowDetailsSchema(only=("id", "name", "active", "description", - "cover_image_url", "playlist_name", "items", - "language", "frequency", "week", "day", "start", - "end", "archive_lahmastore", "archive_lahmastore_base_url", - "archive_mixcloud", "users")) -show_archive_schema = ShowDetailsSchema(only=("name", "cover_image_url", - "day", "start", "end", - "frequency", "language", - "active", "description", - "items")) +show_schema = ShowDetailsSchema() +show_archive_schema = ShowDetailsSchema(only=("id", "active", "name", "description", "cover_image_url", + "day", "start", "end", "frequency", "language", + "archive_lahmastore_base_url", "items")) show_partial_schema = ShowDetailsSchema(partial=True) shows_schema = ShowDetailsSchema(many=True) shows_schedule_schema = ShowDetailsSchema(many=True, - only=("active", "name", "cover_image_url", + only=("id", "active", "name", "description", "cover_image_url", "day", "start", "end", - "description", "archive_lahmastore_base_url")) + "archive_lahmastore_base_url", "items")) shows_archive_schema = ShowDetailsSchema(many=True, only=("id", "active", "name", "description", "cover_image_url", "playlist_name", "archive_lahmastore_base_url")) @@ -98,7 +92,23 @@ def list_shows(): @arcsi.route("/show/schedule", methods=["GET"]) def list_shows_for_schedule(): - return shows_schedule_schema.dumps(get_shows()) + do = DoArchive() + shows = Show.query.all() + for show in shows: + if show.cover_image_url: + show.cover_image_url = do.download( + show.archive_lahmastore_base_url, show.cover_image_url + ) + if show.items[0]: + app.logger.error(type(show)) + app.logger.error(show) + app.logger.error(type(show.items)) + app.logger.error(show.items) + app.logger.error(type(show.items[0])) + app.logger.error(show.items[0]) + app.logger.error(type(show.items.first())) + app.logger.error(show.items.first()) + return shows_schedule_schema.dumps(shows) # We are gonna use this on the new page as the show/all diff --git a/arcsi/static/doc.json b/arcsi/static/doc.json index 7026686d..d0a05e8e 100644 --- a/arcsi/static/doc.json +++ b/arcsi/static/doc.json @@ -173,7 +173,7 @@ } } }, - "/show/search/?size={size}&page={page}¶m={param}": { + "/show/search?size={size}&page={page}¶m={param}": { "get": { "tags": [ "Show Request" @@ -337,7 +337,7 @@ } } }, - "/item/latest/?size={size}&page={page}": { + "/item/latest?size={size}&page={page}": { "get": { "tags": [ "Item Request" @@ -376,7 +376,7 @@ } } }, - "/item/search/?size={size}&page={page}¶m={param}": { + "/item/search?size={size}&page={page}¶m={param}": { "get": { "tags": [ "Item Request" From 091be4918b3f8c8210997f5a1fbc28492e5de774 Mon Sep 17 00:00:00 2001 From: tuz666 Date: Thu, 24 Feb 2022 21:08:22 +0100 Subject: [PATCH 04/21] revert /shows/schedule modifications --- arcsi/api/show.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index bdbb4748..0bc593df 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -92,23 +92,7 @@ def list_shows(): @arcsi.route("/show/schedule", methods=["GET"]) def list_shows_for_schedule(): - do = DoArchive() - shows = Show.query.all() - for show in shows: - if show.cover_image_url: - show.cover_image_url = do.download( - show.archive_lahmastore_base_url, show.cover_image_url - ) - if show.items[0]: - app.logger.error(type(show)) - app.logger.error(show) - app.logger.error(type(show.items)) - app.logger.error(show.items) - app.logger.error(type(show.items[0])) - app.logger.error(show.items[0]) - app.logger.error(type(show.items.first())) - app.logger.error(show.items.first()) - return shows_schedule_schema.dumps(shows) + return shows_schedule_schema.dumps(get_shows()) # We are gonna use this on the new page as the show/all From 5bdb6b518fa4a5cdb556b82d954a90d97cd01b2a Mon Sep 17 00:00:00 2001 From: tuz666 Date: Thu, 24 Feb 2022 23:25:56 +0100 Subject: [PATCH 05/21] /item/latest now only returns archived episodes /item/search filters on date --- arcsi/api/item.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arcsi/api/item.py b/arcsi/api/item.py index f8060d61..95db1f67 100644 --- a/arcsi/api/item.py +++ b/arcsi/api/item.py @@ -94,8 +94,10 @@ def list_items_latest(): do = DoArchive() page = request.args.get('page', 1, type=int) size = request.args.get('size', 12, type=int) - items = Item.query.filter(Item.play_date < datetime.today() - timedelta(days=1)).order_by(Item.play_date.desc()).paginate( - page, size, False) + items = Item.query.filter(Item.play_date < datetime.today() - timedelta(days=1) + ).filter(Item.archived == True + ).order_by(Item.play_date.desc() + ).paginate(page, size, False) for item in items.items: if item.image_url: item.image_url = do.download( @@ -466,8 +468,10 @@ def search_item(): page = request.args.get('page', 1, type=int) size = request.args.get('size', 12, type=int) param = request.args.get('param', "", type=str) - items = Item.query.filter(func.lower(Item.name).contains(func.lower(param)) | func.lower(Item.description).contains(func.lower(param))).paginate( - page, size, False) + items = Item.query.filter(func.lower(Item.name).contains(func.lower(param)) | + func.lower(Item.description).contains(func.lower(param)) + ).filter(Item.play_date < datetime.today() - timedelta(days=1) + ).order_by(Item.play_date.desc()).paginate(page, size, False) for item in items.items: if item.image_url: item.image_url = do.download( From c5760bd793e32c4a86cd3ddf9c7a69597d221d6f Mon Sep 17 00:00:00 2001 From: tuz666 Date: Thu, 24 Feb 2022 23:39:46 +0100 Subject: [PATCH 06/21] /show/schedule returns show's frequency and language as well --- arcsi/api/show.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index 0bc593df..c082f2bb 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -74,7 +74,7 @@ def make_show(self, data, **kwargs): shows_schema = ShowDetailsSchema(many=True) shows_schedule_schema = ShowDetailsSchema(many=True, only=("id", "active", "name", "description", "cover_image_url", - "day", "start", "end", + "day", "start", "end", "frequency", "language", "archive_lahmastore_base_url", "items")) shows_archive_schema = ShowDetailsSchema(many=True, only=("id", "active", "name", "description", "cover_image_url", From 2afcf59f41733a7550592e3e17a57712b50f0738 Mon Sep 17 00:00:00 2001 From: tuz666 Date: Sun, 27 Feb 2022 12:35:59 +0100 Subject: [PATCH 07/21] return everything but items with /show/schedule items are now ordered by descending dates --- arcsi/api/show.py | 9 +++------ arcsi/model/show.py | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index c082f2bb..84fff2ae 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -72,13 +72,10 @@ def make_show(self, data, **kwargs): "archive_lahmastore_base_url", "items")) show_partial_schema = ShowDetailsSchema(partial=True) shows_schema = ShowDetailsSchema(many=True) -shows_schedule_schema = ShowDetailsSchema(many=True, - only=("id", "active", "name", "description", "cover_image_url", - "day", "start", "end", "frequency", "language", - "archive_lahmastore_base_url", "items")) +shows_schedule_schema = ShowDetailsSchema(many=True, exclude=("items",)) shows_archive_schema = ShowDetailsSchema(many=True, - only=("id", "active", "name", "description", "cover_image_url", - "playlist_name", "archive_lahmastore_base_url")) + only=("id", "active", "name", "description", "cover_image_url", + "playlist_name", "archive_lahmastore_base_url")) headers = {"Content-Type": "application/json"} diff --git a/arcsi/model/show.py b/arcsi/model/show.py index ea18e09a..72ea9d6b 100644 --- a/arcsi/model/show.py +++ b/arcsi/model/show.py @@ -25,6 +25,7 @@ class Show(db.Model): "Item", secondary=items_shows, backref=db.backref("shows"), + order_by="Item.play_date.desc()", lazy="dynamic", # TODO why is this not working? see item.shows assignment in api/item cascade_backrefs=False, From ebf92acf94ffda765e703ae8783ffade4878d01d Mon Sep 17 00:00:00 2001 From: tuz666 Date: Sun, 27 Feb 2022 13:31:50 +0100 Subject: [PATCH 08/21] updated swagger docs --- arcsi/static/component.json | 139 +++++++++++++++++++++--------------- arcsi/static/doc.json | 50 +++++++------ 2 files changed, 109 insertions(+), 80 deletions(-) diff --git a/arcsi/static/component.json b/arcsi/static/component.json index c43d852c..18309b3d 100644 --- a/arcsi/static/component.json +++ b/arcsi/static/component.json @@ -244,74 +244,107 @@ } } }, - "ShowScheduleRequest": { + "ShowScheduleResponseBody": { "type": "object", "properties": { "active": { "type": "boolean" }, - "name": { - "type": "string" + "archive_lahmastore": { + "type": "boolean" }, - "cover_image_url": { - "type": "string" + "archive_mixcloud": { + "type": "boolean" }, - "day": { - "type": "integer", - "format": "int32" + "name": { + "type": "string" }, - "start": { + "description": { "type": "string" }, - "end": { + "language": { "type": "string" }, - "description": { + "playlist_name": { "type": "string" }, "archive_lahmastore_base_url": { "type": "string" - } - } - }, - "ShowSubPageRequest": { - "type": "object", - "properties": { - "name": { + }, + "archive_mixcloud_base_url": { "type": "string" }, "cover_image_url": { "type": "string" }, - "day": { - "type": "integer", - "format": "int32" - }, "start": { "type": "string" }, "end": { "type": "string" }, + "day": { + "type": "integer", + "format": "int32" + }, "frequency": { "type": "integer", "format": "int32" }, - "language": { - "type": "string" + "week": { + "type": "integer", + "format": "int32" + }, + "id": { + "type": "integer", + "format": "int32" }, + "users": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/user" + } + } + } + }, + "ShowSubPageResponseBody": { + "type": "object", + "properties": { "active": { "type": "boolean" }, + "name": { + "type": "string" + }, "description": { "type": "string" }, - "archive_lahmastore_base_url": { + "language": { "type": "string" }, "playlist_name": { "type": "string" }, + "archive_lahmastore_base_url": { + "type": "string" + }, + "cover_image_url": { + "type": "string" + }, + "start": { + "type": "string" + }, + "end": { + "type": "string" + }, + "day": { + "type": "integer", + "format": "int32" + }, + "frequency": { + "type": "integer", + "format": "int32" + }, "items": { "type": "object", "additionalProperties": { @@ -332,10 +365,10 @@ "$ref": "#/components/schemas/ShowsPageResponseBody" } }, - "ShowScheduleRequests": { + "ShowScheduleResponseBodies": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/ShowScheduleRequest" + "$ref": "#/components/schemas/ShowScheduleResponseBody" } }, "ShowRequestBody": { @@ -541,25 +574,24 @@ } } }, - "ItemSubPageRequest": { + "ItemSubPageResponseBody": { "type": "object", "properties": { + "archived": { + "type":"boolean" + }, "name": { "type": "string" }, - "number": { - "type": "integer", - "format": "int32" - }, - "play_date": { - "type": "string", - "format": "date" + "description": { + "type": "string" }, "language": { "type": "string" }, - "description": { - "type": "string" + "play_date": { + "type": "string", + "format": "date" }, "image_url": { "type": "string" @@ -567,34 +599,23 @@ "play_file_name": { "type": "string" }, - "download_count": { + "id": { "type": "integer", "format": "int32" - } - } - }, - "ItemBasicRequest": { - "type": "object", - "properties": { - "name": { - "type": "string" }, - "image_url": { - "type": "string" - }, - "play_date": { - "type": "string", - "format": "date" - }, - "description": { - "type": "string" + "number": { + "type": "integer", + "format": "int32" }, "download_count": { "type": "integer", "format": "int32" }, - "play_file_name": { - "type": "string" + "shows": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/show" + } } } }, @@ -610,10 +631,10 @@ "$ref": "#/components/schemas/ItemArchiveResponseBody" } }, - "ItemBasicRequests": { + "ShowNestedItemResponsebodies": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/ItemBasicRequest" + "$ref": "#/components/schemas/item" } }, "ItemRequestBody": { diff --git a/arcsi/static/doc.json b/arcsi/static/doc.json index d0a05e8e..808bda75 100644 --- a/arcsi/static/doc.json +++ b/arcsi/static/doc.json @@ -23,11 +23,19 @@ "description": "API for requesting and return User details" }, { - "name": "Show Request", + "name": "Show Requests for Arcsi", "description": "API for requesting and return Show details" }, { - "name": "Item Request", + "name": "Show Requests for frontend", + "description": "API for requesting and return Show details" + }, + { + "name": "Item Requests for Arcsi", + "description": "API for requesting and return Item details" + }, + { + "name": "Item Requests for frontend", "description": "API for requesting and return Item details" } ], @@ -95,7 +103,7 @@ "/show/all": { "get": { "tags": [ - "Show Request" + "Show Requests for Arcsi" ], "summary": "Return Shows for Arcsi Show Archive", "produces": [ @@ -118,7 +126,7 @@ "/show/{id}": { "get": { "tags": [ - "Show Request" + "Show Requests for Arcsi" ], "summary": "Return Show for Arcsi Show Page", "parameters": [ @@ -153,7 +161,7 @@ "/show/list": { "get": { "tags": [ - "Show Request" + "Show Requests for frontend" ], "summary": "Return Shows for Ananasz Shows Page", "produces": [ @@ -176,7 +184,7 @@ "/show/search?size={size}&page={page}¶m={param}": { "get": { "tags": [ - "Show Request" + "Show Requests for frontend" ], "summary": "Return Shows which name or description contains the parameter", "parameters": [ @@ -222,7 +230,7 @@ "/show/schedule": { "get": { "tags": [ - "Show Request" + "Show Requests for frontend" ], "summary": "Return Shows for Ananasz Home and Schedule Page", "produces": [ @@ -234,7 +242,7 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ShowScheduleRequests" + "$ref": "component.json#/components/schemas/ShowScheduleResponseBodies" } } } @@ -245,7 +253,7 @@ "/show/{show_slug}/page": { "get": { "tags": [ - "Show Request" + "Show Requests for frontend" ], "summary": "Return Show for Ananasz Show Subpage", "parameters": [ @@ -266,7 +274,7 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ShowSubPageRequest" + "$ref": "component.json#/components/schemas/ShowSubPageResponseBody" } } } @@ -280,7 +288,7 @@ "/item/all": { "get": { "tags": [ - "Item Request" + "Item Requests for Arcsi" ], "summary": "Return Episodes for Arcsi Items Archive", "produces": [ @@ -303,7 +311,7 @@ "/item/{id}": { "get": { "tags": [ - "Item Request" + "Item Requests for Arcsi" ], "summary": "Return Episode for Arcsi Episode Page", "parameters": [ @@ -340,7 +348,7 @@ "/item/latest?size={size}&page={page}": { "get": { "tags": [ - "Item Request" + "Item Requests for frontend" ], "summary": "Return Latest Episodes for Ananasz Home and Archive Page", "parameters": [ @@ -379,7 +387,7 @@ "/item/search?size={size}&page={page}¶m={param}": { "get": { "tags": [ - "Item Request" + "Item Requests for frontend" ], "summary": "Return Items which name or description contains the parameter", "parameters": [ @@ -414,7 +422,7 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ItemArchiveResponseBodies" + "$ref": "component.json#/components/schemas/ItemResponseBodies" } } } @@ -425,7 +433,7 @@ "/show/{show_slug}/archive": { "get": { "tags": [ - "Item Request" + "Item Requests for Arcsi" ], "summary": "Return Items for old WP Show Page", "parameters": [ @@ -446,7 +454,7 @@ "content": { "text/html": { "schema": { - "$ref": "component.json#/components/schemas/ItemBasicRequests" + "$ref": "component.json#/components/schemas/ShowNestedItemResponsebodies" } } } @@ -460,7 +468,7 @@ "/show/{show_slug}/episode/{episode_slug}": { "get": { "tags": [ - "Item Request" + "Item Requests for frontend" ], "summary": "Return Episode for Ananasz Episode Subpage", "parameters": [ @@ -488,7 +496,7 @@ "content": { "application/json": { "schema": { - "$ref": "component.json#/components/schemas/ItemSubPageRequest" + "$ref": "component.json#/components/schemas/ItemSubPageResponseBody" } } } @@ -502,7 +510,7 @@ "/item/{id}/listen": { "get": { "tags": [ - "Item Request" + "Item Requests for Arcsi" ], "summary": "Listen Item with given ID", "parameters": [ @@ -537,7 +545,7 @@ "/item/{id}/download": { "get": { "tags": [ - "Item Request" + "Item Requests for Arcsi" ], "summary": "Download Item with given ID", "parameters": [ From c45dbb7d6a8c55c66fea4ea86f5881c9317492da Mon Sep 17 00:00:00 2001 From: tuz666 Date: Mon, 28 Feb 2022 22:22:46 +0100 Subject: [PATCH 09/21] added a /show/schedule2 route which gives back the latest, archived, already premiered episode --- arcsi/api/show.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index 84fff2ae..05a95aa0 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -7,7 +7,7 @@ from flask import flash, jsonify, make_response, request, url_for from flask import current_app as app from marshmallow import fields, post_load, Schema, ValidationError -from sqlalchemy import func +from sqlalchemy import false, func from werkzeug import secure_filename from .utils import archive, get_shows, save_file, slug, sort_for @@ -92,6 +92,32 @@ def list_shows_for_schedule(): return shows_schedule_schema.dumps(get_shows()) +@arcsi.route("/show/schedule2", methods=["GET"]) +def list_shows_for_schedule2(): + do = DoArchive() + shows = Show.query.all() + shows_json = shows_schema.dump(shows) + # iterate through shows + for show_json in shows_json: + if show_json["items"]: + latest_item_found = False + # iterate through show's items + for item in show_json["items"]: + # search for the first one which is archived & already aired + if (latest_item_found == False and + item["archived"] == True and + ((datetime.strptime(item["play_date"], "%Y-%m-%d") + timedelta(days=1)) < datetime.today())): + latest_item_found = True + item["image_url"] = do.download( + show_json["archive_lahmastore_base_url"], item["image_url"] + ) + show_json["items"] = item + # if there is no archived show return empty array + if (latest_item_found == False): + show_json["items"] = [] + return json.dumps(shows_json) + + # We are gonna use this on the new page as the show/all @arcsi.route("/show/list", methods=["GET"]) def list_shows_page(): From e986ef279d4f5a9df8e98060772f44dfcfc99022 Mon Sep 17 00:00:00 2001 From: tuz666 Date: Mon, 28 Feb 2022 22:31:45 +0100 Subject: [PATCH 10/21] schedule2 schema with required infos --- arcsi/api/show.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index 05a95aa0..6a1ba848 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -73,6 +73,10 @@ def make_show(self, data, **kwargs): show_partial_schema = ShowDetailsSchema(partial=True) shows_schema = ShowDetailsSchema(many=True) shows_schedule_schema = ShowDetailsSchema(many=True, exclude=("items",)) +shows_schedule2_schema = ShowDetailsSchema(many=True, + only=("id", "active", "name", "description", "cover_image_url", + "day", "start", "end", "frequency", "language", + "archive_lahmastore_base_url", "items")) shows_archive_schema = ShowDetailsSchema(many=True, only=("id", "active", "name", "description", "cover_image_url", "playlist_name", "archive_lahmastore_base_url")) @@ -96,7 +100,7 @@ def list_shows_for_schedule(): def list_shows_for_schedule2(): do = DoArchive() shows = Show.query.all() - shows_json = shows_schema.dump(shows) + shows_json = shows_schedule2_schema.dump(shows) # iterate through shows for show_json in shows_json: if show_json["items"]: From 7446eea0c6ce1609b2dde6524808f176057d905c Mon Sep 17 00:00:00 2001 From: tuz666 Date: Tue, 1 Mar 2022 19:05:17 +0100 Subject: [PATCH 11/21] proto /show//episode2/ --- arcsi/api/show.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index 6a1ba848..b7da3af9 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -10,7 +10,7 @@ from sqlalchemy import false, func from werkzeug import secure_filename -from .utils import archive, get_shows, save_file, slug, sort_for +from .utils import archive, get_shows, save_file, slug, sort_for, normalise from . import arcsi from arcsi.handler.upload import DoArchive from arcsi.model import db @@ -121,6 +121,30 @@ def list_shows_for_schedule2(): show_json["items"] = [] return json.dumps(shows_json) +@arcsi.route("/show/schedule3", methods=["GET"]) +def list_shows_for_schedule3(): + do = DoArchive() + shows = Show.query.all() + shows_json = shows_schedule2_schema.dump(shows) + # iterate through shows + for show_json in shows_json: + if show_json["items"]: + latest_item_found = False + # iterate through show's items + for item in show_json["items"]: + # search for the first one which is archived & already aired + if (latest_item_found == False and + item["archived"] == True and + ((datetime.strptime(item["play_date"], "%Y-%m-%d") + timedelta(days=1)) < datetime.today())): + latest_item_found = True + item["image_url"] = do.download( + show_json["archive_lahmastore_base_url"], item["image_url"] + ) + show_json["items"] = item + # if there is no archived show return empty array + if (latest_item_found == False): + show_json["items"] = [] + return json.dumps(shows_json) # We are gonna use this on the new page as the show/all @arcsi.route("/show/list", methods=["GET"]) @@ -360,6 +384,15 @@ def view_episode_archive(show_slug, episode_slug): return item_archive_schema.dump(i) return make_response("Episode not found", 404, headers) +@arcsi.route("show//episode2/", methods=["GET"]) +def view_episode_archive2(show_slug, episode_slug): + show_query = Show.query.filter_by(archive_lahmastore_base_url=show_slug) + show = show_query.first_or_404() + for i in show.items: + if (normalise(i.name) == episode_slug): + return item_archive_schema.dump(i) + return make_response("Episode not found", 404, headers) + @arcsi.route("/show/search", methods=["GET"]) def search_show(): From 9a47246ab98ad721e38ed81025278e95e6b2adc2 Mon Sep 17 00:00:00 2001 From: tuz666 Date: Tue, 1 Mar 2022 22:50:22 +0100 Subject: [PATCH 12/21] every item request returns a name_slug which we can use at: /show//item/ --- arcsi/api/item.py | 10 ++++++++-- arcsi/api/show.py | 47 +++++------------------------------------------ 2 files changed, 13 insertions(+), 44 deletions(-) diff --git a/arcsi/api/item.py b/arcsi/api/item.py index 95db1f67..cef7497c 100644 --- a/arcsi/api/item.py +++ b/arcsi/api/item.py @@ -19,6 +19,7 @@ broadcast_audio, dict_to_obj, media_path, + normalise, save_file, item_duplications_number ) @@ -35,6 +36,7 @@ class ItemDetailsSchema(Schema): required=True ) # TODO value can't be 0 -- reserved for show itself name = fields.Str(required=True, min=1) + name_slug = fields.Str(dump_only=True) description = fields.Str() language = fields.Str(max=5) play_date = fields.Date(required=True) @@ -65,12 +67,12 @@ def make_item(self, data, **kwargs): item_schema = ItemDetailsSchema() item_archive_schema = ItemDetailsSchema( - only = ("id", "number", "name", "description", "language", "play_date", + only = ("id", "number", "name", "name_slug", "description", "language", "play_date", "image_url", "play_file_name", "archived", "download_count", "shows")) item_partial_schema = ItemDetailsSchema(partial = True,) items_schema = ItemDetailsSchema(many = True) items_archive_schema = ItemDetailsSchema(many = True, - only = ("id", "number", "name", "description", "language", "play_date", + only = ("id", "number", "name", "name_slug", "description", "language", "play_date", "image_url", "play_file_name", "archived", "download_count", "shows")) headers = {"Content-Type": "application/json"} @@ -86,6 +88,7 @@ def list_items(): item.image_url = do.download( item.shows[0].archive_lahmastore_base_url, item.image_url ) + item.name_slug=normalise(item.name) return items_schema.dumps(items) @@ -103,6 +106,7 @@ def list_items_latest(): item.image_url = do.download( item.shows[0].archive_lahmastore_base_url, item.image_url ) + item.name_slug=normalise(item.name) return items_archive_schema.dumps(items.items) @@ -116,6 +120,7 @@ def view_item(id): item.image_url = do.download( item.shows[0].archive_lahmastore_base_url, item.image_url ) + item.name_slug=normalise(item.name) return item_schema.dump(item) else: return make_response("Item not found", 404, headers) @@ -477,4 +482,5 @@ def search_item(): item.image_url = do.download( item.shows[0].archive_lahmastore_base_url, item.image_url ) + item.name_slug=normalise(item.name) return items_schema.dumps(items.items) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index b7da3af9..350e0ed0 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -44,6 +44,7 @@ class ShowDetailsSchema(Schema): "description", "number", "name", + "name_slug", "play_file_name", "play_date", "image_url", @@ -93,11 +94,6 @@ def list_shows(): @arcsi.route("/show/schedule", methods=["GET"]) def list_shows_for_schedule(): - return shows_schedule_schema.dumps(get_shows()) - - -@arcsi.route("/show/schedule2", methods=["GET"]) -def list_shows_for_schedule2(): do = DoArchive() shows = Show.query.all() shows_json = shows_schedule2_schema.dump(shows) @@ -115,36 +111,13 @@ def list_shows_for_schedule2(): item["image_url"] = do.download( show_json["archive_lahmastore_base_url"], item["image_url"] ) + item["name_slug"] = normalise(item["name"]) show_json["items"] = item # if there is no archived show return empty array if (latest_item_found == False): show_json["items"] = [] return json.dumps(shows_json) -@arcsi.route("/show/schedule3", methods=["GET"]) -def list_shows_for_schedule3(): - do = DoArchive() - shows = Show.query.all() - shows_json = shows_schedule2_schema.dump(shows) - # iterate through shows - for show_json in shows_json: - if show_json["items"]: - latest_item_found = False - # iterate through show's items - for item in show_json["items"]: - # search for the first one which is archived & already aired - if (latest_item_found == False and - item["archived"] == True and - ((datetime.strptime(item["play_date"], "%Y-%m-%d") + timedelta(days=1)) < datetime.today())): - latest_item_found = True - item["image_url"] = do.download( - show_json["archive_lahmastore_base_url"], item["image_url"] - ) - show_json["items"] = item - # if there is no archived show return empty array - if (latest_item_found == False): - show_json["items"] = [] - return json.dumps(shows_json) # We are gonna use this on the new page as the show/all @arcsi.route("/show/list", methods=["GET"]) @@ -374,22 +347,12 @@ def view_show_page(show_slug): return make_response("Show not found", 404, headers) -@arcsi.route("show//episode/", methods=["GET"]) -def view_episode_archive(show_slug, episode_slug): - episode_slug = episode_slug + ".mp3" - show_query = Show.query.filter_by(archive_lahmastore_base_url=show_slug) - show = show_query.first_or_404() - for i in show.items: - if i.play_file_name == episode_slug: - return item_archive_schema.dump(i) - return make_response("Episode not found", 404, headers) - -@arcsi.route("show//episode2/", methods=["GET"]) -def view_episode_archive2(show_slug, episode_slug): +@arcsi.route("show//item/", methods=["GET"]) +def view_episode_archive(show_slug, item_slug): show_query = Show.query.filter_by(archive_lahmastore_base_url=show_slug) show = show_query.first_or_404() for i in show.items: - if (normalise(i.name) == episode_slug): + if (normalise(i.name) == item_slug): return item_archive_schema.dump(i) return make_response("Episode not found", 404, headers) From 678c2c0318b7cbc705cd56dea2b63179eaf90b8c Mon Sep 17 00:00:00 2001 From: tuz666 Date: Tue, 1 Mar 2022 22:56:49 +0100 Subject: [PATCH 13/21] added the original /show/schedule --- arcsi/api/show.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index 350e0ed0..e33087fc 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -89,11 +89,15 @@ def make_show(self, data, **kwargs): # We use this route on the legacy for a massive shows query @arcsi.route("/show/all", methods=["GET"]) def list_shows(): - return shows_schema.dumps(get_shows()) + return shows_schedule_schema.dumps(get_shows()) @arcsi.route("/show/schedule", methods=["GET"]) def list_shows_for_schedule(): + return shows_schema.dumps(get_shows()) + +@arcsi.route("/show/schedule2", methods=["GET"]) +def list_shows_for_schedule2(): do = DoArchive() shows = Show.query.all() shows_json = shows_schedule2_schema.dump(shows) From 87981df974656b673d8ec601cb9f066c58f02894 Mon Sep 17 00:00:00 2001 From: tuz666 Date: Tue, 1 Mar 2022 23:00:40 +0100 Subject: [PATCH 14/21] fix /show/schedule --- arcsi/api/show.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index e33087fc..c3699bd7 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -89,12 +89,12 @@ def make_show(self, data, **kwargs): # We use this route on the legacy for a massive shows query @arcsi.route("/show/all", methods=["GET"]) def list_shows(): - return shows_schedule_schema.dumps(get_shows()) + return shows_schema.dumps(get_shows()) @arcsi.route("/show/schedule", methods=["GET"]) def list_shows_for_schedule(): - return shows_schema.dumps(get_shows()) + return shows_schedule_schema.dumps(get_shows()) @arcsi.route("/show/schedule2", methods=["GET"]) def list_shows_for_schedule2(): From a863185d0bf0925585af8efad1c6db255f7f0a9b Mon Sep 17 00:00:00 2001 From: tuz666 Date: Tue, 1 Mar 2022 23:13:31 +0100 Subject: [PATCH 15/21] minor fix --- arcsi/api/show.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index c3699bd7..f815e298 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -355,9 +355,10 @@ def view_show_page(show_slug): def view_episode_archive(show_slug, item_slug): show_query = Show.query.filter_by(archive_lahmastore_base_url=show_slug) show = show_query.first_or_404() - for i in show.items: - if (normalise(i.name) == item_slug): - return item_archive_schema.dump(i) + for item in show.items: + if (normalise(item.name) == item_slug): + item.name_slug=item_slug + return item_archive_schema.dump(item) return make_response("Episode not found", 404, headers) From eb55a39ef1464285c9635ba6297dfaab1d335644 Mon Sep 17 00:00:00 2001 From: tuz666 Date: Wed, 2 Mar 2022 08:57:52 +0100 Subject: [PATCH 16/21] give back item_slug everywhere --- arcsi/api/show.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index f815e298..72911277 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -302,6 +302,8 @@ def view_show(id): serial_show = show_schema.dump(show) date_desc_episodes = sort_for(serial_show["items"], "play_date", "desc") serial_show["items"] = date_desc_episodes + for item in serial_show["items"]: + item["name_slug"] = normalise(item["name"]) return serial_show else: @@ -327,6 +329,7 @@ def view_show_archive(show_slug): show_item["image_url"] = do.download( show.archive_lahmastore_base_url, show_item["image_url"] ) + show_item["name_slug"]=normalise(show_item["name"]) return json.dumps(show_items) else: return make_response("Show not found", 404, headers) @@ -340,13 +343,21 @@ def view_show_archive(show_slug): # This will be the one that we are gonna use at the new page @arcsi.route("show//page", methods=["GET"]) def view_show_page(show_slug): + do = DoArchive() show_query = Show.query.filter_by(archive_lahmastore_base_url=show_slug) show = show_query.first() if show: # subquery = session.query(Item.id).filter(blabla -timedelta(day=1)).all().subquery() # query = session.query(Show).filter_by(blabla).(Item.id.in_(subquery)) + if show.cover_image_url: + show.cover_image_url = do.download( + show.archive_lahmastore_base_url, show.cover_image_url + ) show.items.filter(Item.play_date < datetime.today() - timedelta(days=1)).all() - return show_archive_schema.dump(show) + serial_show = show_archive_schema.dump(show) + for item in serial_show["items"]: + item["name_slug"]=normalise(item["name"]) + return serial_show else: return make_response("Show not found", 404, headers) From 4263327c69291712dda394389843ffe3974be6cf Mon Sep 17 00:00:00 2001 From: tuz666 Date: Wed, 2 Mar 2022 09:14:25 +0100 Subject: [PATCH 17/21] fix /show//page to filter not premiered items out --- arcsi/api/show.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index 72911277..995102be 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -353,8 +353,15 @@ def view_show_page(show_slug): show.cover_image_url = do.download( show.archive_lahmastore_base_url, show.cover_image_url ) - show.items.filter(Item.play_date < datetime.today() - timedelta(days=1)).all() serial_show = show_archive_schema.dump(show) + show_items = [ + show_item + for show_item in serial_show["items"] + if datetime.strptime(show_item.get("play_date"), "%Y-%m-%d") + + timedelta(days=1) + < datetime.today() + ] + serial_show["items"]=show_items for item in serial_show["items"]: item["name_slug"]=normalise(item["name"]) return serial_show From b5397469b49fa8d98f00515760133245f6eb081b Mon Sep 17 00:00:00 2001 From: tuz666 Date: Wed, 2 Mar 2022 11:21:43 +0100 Subject: [PATCH 18/21] fix image_url --- arcsi/api/show.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index 995102be..ecba5483 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -363,6 +363,9 @@ def view_show_page(show_slug): ] serial_show["items"]=show_items for item in serial_show["items"]: + item["image_url"] = do.download( + show.archive_lahmastore_base_url, item["image_url"] + ) item["name_slug"]=normalise(item["name"]) return serial_show else: @@ -371,10 +374,14 @@ def view_show_page(show_slug): @arcsi.route("show//item/", methods=["GET"]) def view_episode_archive(show_slug, item_slug): + do = DoArchive() show_query = Show.query.filter_by(archive_lahmastore_base_url=show_slug) show = show_query.first_or_404() for item in show.items: if (normalise(item.name) == item_slug): + item.image_url = do.download( + show.archive_lahmastore_base_url, item.image_url + ) item.name_slug=item_slug return item_archive_schema.dump(item) return make_response("Episode not found", 404, headers) From 1df647bed0a4375ebe29c7040e398da1e71fe738 Mon Sep 17 00:00:00 2001 From: tuz666 Date: Wed, 2 Mar 2022 11:28:39 +0100 Subject: [PATCH 19/21] update swagger /show//item/ --- arcsi/static/doc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcsi/static/doc.json b/arcsi/static/doc.json index 808bda75..72a5f212 100644 --- a/arcsi/static/doc.json +++ b/arcsi/static/doc.json @@ -465,7 +465,7 @@ } } }, - "/show/{show_slug}/episode/{episode_slug}": { + "/show/{show_slug}/item/{episode_slug}": { "get": { "tags": [ "Item Requests for frontend" From 009c7621ce28710264042539b264e30e74ca46ae Mon Sep 17 00:00:00 2001 From: tuz666 Date: Fri, 4 Mar 2022 23:25:27 +0100 Subject: [PATCH 20/21] added /show/schedule_by: this returns shows by day with the latest already premiered episode updated swagger docs --- arcsi/api/show.py | 28 ++++++++++++++++++++-------- arcsi/static/component.json | 23 ++++++++++++++++++++++- arcsi/static/doc.json | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 75 insertions(+), 10 deletions(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index ecba5483..923a2d86 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -70,14 +70,14 @@ def make_show(self, data, **kwargs): show_schema = ShowDetailsSchema() show_archive_schema = ShowDetailsSchema(only=("id", "active", "name", "description", "cover_image_url", "day", "start", "end", "frequency", "language", - "archive_lahmastore_base_url", "items")) + "playlist_name", "archive_lahmastore_base_url", "items")) show_partial_schema = ShowDetailsSchema(partial=True) shows_schema = ShowDetailsSchema(many=True) shows_schedule_schema = ShowDetailsSchema(many=True, exclude=("items",)) -shows_schedule2_schema = ShowDetailsSchema(many=True, +shows_schedule_by_schema = ShowDetailsSchema(many=True, only=("id", "active", "name", "description", "cover_image_url", "day", "start", "end", "frequency", "language", - "archive_lahmastore_base_url", "items")) + "playlist_name", "archive_lahmastore_base_url", "items")) shows_archive_schema = ShowDetailsSchema(many=True, only=("id", "active", "name", "description", "cover_image_url", "playlist_name", "archive_lahmastore_base_url")) @@ -94,15 +94,27 @@ def list_shows(): @arcsi.route("/show/schedule", methods=["GET"]) def list_shows_for_schedule(): - return shows_schedule_schema.dumps(get_shows()) + do = DoArchive() + shows = Show.query.filter(Show.active == True).all() + for show in shows: + if show.cover_image_url: + show.cover_image_url = do.download( + show.archive_lahmastore_base_url, show.cover_image_url + ) + return shows_schedule_schema.dumps(shows) -@arcsi.route("/show/schedule2", methods=["GET"]) -def list_shows_for_schedule2(): +@arcsi.route("/show/schedule_by", methods=["GET"]) +def list_shows_for_schedule_by(): do = DoArchive() - shows = Show.query.all() - shows_json = shows_schedule2_schema.dump(shows) + day = request.args.get('day', 1, type=int) + shows = Show.query.filter(Show.day == day and Show.active == True).all() + shows_json = shows_schedule_by_schema.dump(shows) # iterate through shows for show_json in shows_json: + if show_json["cover_image_url"]: + show_json["cover_image_url"] = do.download( + show_json["archive_lahmastore_base_url"], show_json["cover_image_url"] + ) if show_json["items"]: latest_item_found = False # iterate through show's items diff --git a/arcsi/static/component.json b/arcsi/static/component.json index 18309b3d..ae2efcab 100644 --- a/arcsi/static/component.json +++ b/arcsi/static/component.json @@ -37,6 +37,10 @@ "name": { "type": "string", "example": "show-name" + }, + "archive_lahmastore_base_url": { + "type": "string", + "example": "show-archive_lahmastore_base_url" } } }, @@ -50,6 +54,10 @@ "type": "string", "example": "item-name" }, + "name_slug": { + "type": "string", + "example": "item-name" + }, "description": { "type": "string", "example": "item-description" @@ -337,6 +345,10 @@ "end": { "type": "string" }, + "id": { + "type": "integer", + "format": "int32" + }, "day": { "type": "integer", "format": "int32" @@ -348,7 +360,7 @@ "items": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/ItemBasicRequest" + "$ref": "#/components/schemas/item" } } } @@ -484,6 +496,9 @@ "name": { "type": "string" }, + "name_slug": { + "type": "string" + }, "description": { "type": "string" }, @@ -538,6 +553,9 @@ "name": { "type": "string" }, + "name_slug": { + "type": "string" + }, "description": { "type": "string" }, @@ -583,6 +601,9 @@ "name": { "type": "string" }, + "name_slug": { + "type": "string" + }, "description": { "type": "string" }, diff --git a/arcsi/static/doc.json b/arcsi/static/doc.json index 72a5f212..692022a8 100644 --- a/arcsi/static/doc.json +++ b/arcsi/static/doc.json @@ -250,6 +250,38 @@ } } }, + "/show/schedule_by?day={day}": { + "get": { + "tags": [ + "Show Requests for frontend" + ], + "summary": "Return Shows for Ananasz Home and Schedule Page", + "parameters": [ + { + "in": "path", + "name": "day", + "required": true, + "description": "day, default: 1", + "type": "number" + } + ], + "produces": [ + "text/html" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "text/html": { + "schema": { + "$ref": "component.json#/components/schemas/ShowScheduleResponseBodies" + } + } + } + } + } + } + }, "/show/{show_slug}/page": { "get": { "tags": [ @@ -483,7 +515,7 @@ "in": "path", "name": "episode_slug", "required": true, - "description": "Item.play_file_name + '.mp3'", + "description": "normalize(Item.name) --> name_slug", "type": "string" } ], From 0741615f2b64aeacab7cf874e53c892febe4b248 Mon Sep 17 00:00:00 2001 From: tuz666 Date: Mon, 28 Mar 2022 16:17:41 +0200 Subject: [PATCH 21/21] swagger fix --- arcsi/api/show.py | 6 +++- arcsi/static/doc.json | 65 +++++++++++++++++++++++++++++-------------- 2 files changed, 49 insertions(+), 22 deletions(-) diff --git a/arcsi/api/show.py b/arcsi/api/show.py index 923a2d86..276b8bd9 100644 --- a/arcsi/api/show.py +++ b/arcsi/api/show.py @@ -92,6 +92,10 @@ def list_shows(): return shows_schema.dumps(get_shows()) +@arcsi.route("/show/all_without_items", methods=["GET"]) +def list_shows_without_items(): + return shows_schedule_schema.dumps(get_shows()) + @arcsi.route("/show/schedule", methods=["GET"]) def list_shows_for_schedule(): do = DoArchive() @@ -411,4 +415,4 @@ def search_show(): show.cover_image_url = do.download( show.archive_lahmastore_base_url, show.cover_image_url ) - return shows_archive_schema.dumps(shows.items) \ No newline at end of file + return shows_schedule_schema.dumps(shows.items) \ No newline at end of file diff --git a/arcsi/static/doc.json b/arcsi/static/doc.json index 692022a8..d16f9082 100644 --- a/arcsi/static/doc.json +++ b/arcsi/static/doc.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "description": "Arcsi API doc", - "version": "0.9.6", + "version": "0.9.7", "title": "Arcsi", "contact": { "email": "it@lahmacun.hu" @@ -19,15 +19,15 @@ ], "tags": [ { - "name": "User Request", - "description": "API for requesting and return User details" + "name": "Show Requests for frontend", + "description": "API for requesting and return Show details" }, { - "name": "Show Requests for Arcsi", - "description": "API for requesting and return Show details" + "name": "Item Requests for frontend", + "description": "API for requesting and return Item details" }, { - "name": "Show Requests for frontend", + "name": "Show Requests for Arcsi", "description": "API for requesting and return Show details" }, { @@ -35,8 +35,8 @@ "description": "API for requesting and return Item details" }, { - "name": "Item Requests for frontend", - "description": "API for requesting and return Item details" + "name": "User Request", + "description": "API for requesting and return User details" } ], "paths": { @@ -105,7 +105,7 @@ "tags": [ "Show Requests for Arcsi" ], - "summary": "Return Shows for Arcsi Show Archive", + "summary": "Return all Shows for Arcsi's Shows Page", "produces": [ "text/html" ], @@ -128,7 +128,7 @@ "tags": [ "Show Requests for Arcsi" ], - "summary": "Return Show for Arcsi Show Page", + "summary": "Return chosen Show for Arcsi's Show Subpage", "parameters": [ { "in": "path", @@ -163,7 +163,7 @@ "tags": [ "Show Requests for frontend" ], - "summary": "Return Shows for Ananasz Shows Page", + "summary": "Return all Shows for Ananasz's Shows Page", "produces": [ "text/html" ], @@ -181,12 +181,35 @@ } } }, + "/show/all_without_items": { + "get": { + "tags": [ + "Show Requests for frontend" + ], + "summary": "Return all Shows for Ananasz's Shows Page", + "produces": [ + "text/html" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "text/html": { + "schema": { + "$ref": "component.json#/components/schemas/ShowScheduleResponseBodies" + } + } + } + } + } + } + }, "/show/search?size={size}&page={page}¶m={param}": { "get": { "tags": [ "Show Requests for frontend" ], - "summary": "Return Shows which name or description contains the parameter", + "summary": "Return all searched Shows (their name or description contains the parameter)", "parameters": [ { "in": "path", @@ -232,7 +255,7 @@ "tags": [ "Show Requests for frontend" ], - "summary": "Return Shows for Ananasz Home and Schedule Page", + "summary": "Return all active Shows for Ananasz's Home and Schedule Page", "produces": [ "text/html" ], @@ -255,7 +278,7 @@ "tags": [ "Show Requests for frontend" ], - "summary": "Return Shows for Ananasz Home and Schedule Page", + "summary": "Return all active Shows airing on the chosen day for Ananasz's Home and Schedule Page", "parameters": [ { "in": "path", @@ -287,7 +310,7 @@ "tags": [ "Show Requests for frontend" ], - "summary": "Return Show for Ananasz Show Subpage", + "summary": "Return the chosen Show for Ananasz's Show Subpage", "parameters": [ { "in": "path", @@ -322,7 +345,7 @@ "tags": [ "Item Requests for Arcsi" ], - "summary": "Return Episodes for Arcsi Items Archive", + "summary": "Return all Items for Arcsi's Items Page", "produces": [ "text/html" ], @@ -345,7 +368,7 @@ "tags": [ "Item Requests for Arcsi" ], - "summary": "Return Episode for Arcsi Episode Page", + "summary": "Return the chosen Item for Arcsi's Item Subpage", "parameters": [ { "in": "path", @@ -382,7 +405,7 @@ "tags": [ "Item Requests for frontend" ], - "summary": "Return Latest Episodes for Ananasz Home and Archive Page", + "summary": "Return latest Items for Ananasz's Home and Archive Page", "parameters": [ { "in": "path", @@ -421,7 +444,7 @@ "tags": [ "Item Requests for frontend" ], - "summary": "Return Items which name or description contains the parameter", + "summary": "Return all searched Items (their name or description contains the parameter)", "parameters": [ { "in": "path", @@ -467,7 +490,7 @@ "tags": [ "Item Requests for Arcsi" ], - "summary": "Return Items for old WP Show Page", + "summary": "Return all Items for the given Show (was used by the old WP Show Page)", "parameters": [ { "in": "path", @@ -502,7 +525,7 @@ "tags": [ "Item Requests for frontend" ], - "summary": "Return Episode for Ananasz Episode Subpage", + "summary": "Return Item for Ananasz's Episode Subpage", "parameters": [ { "in": "path",