Skip to content
Snippets Groups Projects
Commit 7800393d authored by Simon Künzel's avatar Simon Künzel
Browse files

Add thumbnail target medium and remove thumbnail_url from lecture

parent a3d0708a
No related branches found
No related tags found
No related merge requests found
Pipeline #6739 failed
Pipeline: development

#6740

    ......@@ -2464,15 +2464,6 @@
    "optional": false,
    "type": "string"
    },
    "thumbnail_url": {
    "config_directly_modifiable": false,
    "id": "thumbnail_url",
    "notes": "URL to the lecture's thumbnail file (Maybe with a redirect)",
    "object_variant": null,
    "only_mod": false,
    "optional": false,
    "type": "string"
    },
    "time": {
    "config_directly_modifiable": true,
    "id": "time",
    ......@@ -2588,7 +2579,7 @@
    "tag": {
    "config_directly_modifiable": false,
    "id": "tag",
    "notes": "Tags are used to match uploaded files to targets. Tags must match [a-zA-Z0-9_]+. Every file has exactly one tag and this target takes the file with the tag specified here. No tag on a file is equivalent to an empty string tag",
    "notes": "Tags are used to match uploaded files to targets. Tags must match [a-zA-Z0-9_]*. Every file has exactly one tag and this target takes the file with the tag specified here. No tag on a file is equivalent to an empty string tag",
    "object_variant": "source_file",
    "only_mod": false,
    "optional": false,
    ......@@ -2817,15 +2808,6 @@
    "only_mod": false,
    "optional": false,
    "type": "datetime"
    },
    "visible": {
    "config_directly_modifiable": true,
    "id": "visible",
    "notes": "",
    "object_variant": null,
    "only_mod": true,
    "optional": false,
    "type": "boolean"
    }
    }
    },
    ......@@ -2900,7 +2882,8 @@
    "optional": false,
    "type": "int"
    }
    }
    },
    "thumbnail": {}
    },
    "id": "target_medium"
    },
    ......
    # Specification of the Web API for the Video-AG Website (v0.61).
    # Specification of the Web API for the Video-AG Website (v0.62).
    ## Introduction
    ......@@ -81,6 +81,7 @@ Currently, the following objects have a configuration:
    TODO parents
    TODO deleted
    TODO variants
    The types of these fields can be any of the [standard types](#Types), any or an array of such values.
    Right now the following types may appear as the type of a field:
    ......@@ -1588,6 +1589,7 @@ Additionally, the following objects may appear as the type of some field:
    <td>lecture</td>
    <td>May be null (deleted/not visible). Does not include chapters and media_sources</td>
    </tr>
    <tr><td><code>plain</code></td></tr>
    </tbody>
    </table>
    ......@@ -1833,11 +1835,6 @@ Additionally, the following objects may appear as the type of some field:
    <td>+string</td>
    <td>Name of the speaker</td>
    </tr>
    <tr>
    <td>thumbnail_url</td>
    <td>string</td>
    <td>URL to the lecture's thumbnail file (Maybe with a redirect)</td>
    </tr>
    <tr>
    <td>time</td>
    <td>+datetime</td>
    ......@@ -1921,7 +1918,7 @@ Additionally, the following objects may appear as the type of some field:
    <td rowspan="1"><code>source_file</code></td>
    <td>tag</td>
    <td>string</td>
    <td>Tags are used to match uploaded files to targets. Tags must match [a-zA-Z0-9_]+. Every file has exactly one tag and this target takes the file with the tag specified here. No tag on a file is equivalent to an empty string tag</td>
    <td>Tags are used to match uploaded files to targets. Tags must match [a-zA-Z0-9_]*. Every file has exactly one tag and this target takes the file with the tag specified here. No tag on a file is equivalent to an empty string tag</td>
    </tr>
    </tbody>
    </table>
    ......@@ -2106,11 +2103,6 @@ Additionally, the following objects may appear as the type of some field:
    <td>datetime</td>
    <td></td>
    </tr>
    <tr>
    <td>visible</td>
    <td>+!boolean</td>
    <td></td>
    </tr>
    </tbody>
    </table>
    ......@@ -2140,6 +2132,7 @@ Additionally, the following objects may appear as the type of some field:
    <td>string</td>
    <td>URL to the mediums's file (Maybe with a redirect)</td>
    </tr>
    <tr><td><code>plain_audio</code></td></tr>
    <tr>
    <td rowspan="4"><code>plain_video</code></td>
    <td>frame_rate_denominator</td>
    ......@@ -2161,6 +2154,7 @@ Additionally, the following objects may appear as the type of some field:
    <td>int</td>
    <td></td>
    </tr>
    <tr><td><code>thumbnail</code></td></tr>
    </tbody>
    </table>
    ......@@ -2269,6 +2263,14 @@ Possible `error_code`:
    ## Changelog
    ### v0.62
    * Removed `thumbnail_url` from `lecture`
    * Added new variant `thumbnail` to `target_medium`
    * Removed `visible` from `source_medium` (Only accessible by mods anyway)
    * Added missing variant `plain` to `featured` and `plain_audio` to `target_medium` which were mentioned nowhere before
    ### v0.61
    * Renamed `path` to `file_path` in `source_medium`
    ......
    # Specification of the Web API for the Video-AG Website (v0.61).
    # Specification of the Web API for the Video-AG Website (v0.62).
    ## Introduction
    ......@@ -73,6 +73,7 @@ Currently, the following objects have a configuration:
    TODO parents
    TODO deleted
    TODO variants
    The types of these fields can be any of the [standard types](#Types), any or an array of such values.
    Right now the following types may appear as the type of a field:
    ......@@ -139,6 +140,14 @@ Possible `error_code`:
    ## Changelog
    ### v0.62
    * Removed `thumbnail_url` from `lecture`
    * Added new variant `thumbnail` to `target_medium`
    * Removed `visible` from `source_medium` (Only accessible by mods anyway)
    * Added missing variant `plain` to `featured` and `plain_audio` to `target_medium` which were mentioned nowhere before
    ### v0.61
    * Renamed `path` to `file_path` in `source_medium`
    ......
    from flask import redirect
    from videoag_common.objects import *
    from api.routes import *
    # TODO
    @api_route("/resources/lecture_thumbnail/<int:lecture_id>", "GET", allow_while_readonly=True,
    no_documentation=True)
    def api_route_access_lecture_thumbnail(lecture_id: int):
    return redirect("https://video.fsmpi.rwth-aachen.de/files/thumbnail/l_17253.jpg")
    @api_route("/resources/target_medium/<int:target_medium_id>", "GET", allow_while_readonly=True,
    no_documentation=True)
    def api_route_access_target_medium(target_medium_id: int):
    is_mod = is_moderator()
    medium = database.query_one_or_none_and_expunge(TargetMedium.select(is_mod=True).where(TargetMedium.id == target_medium_id))
    if medium is None:
    raise ApiClientException(ERROR_UNKNOWN_OBJECT)
    if not medium.has_access(is_mod=is_mod):
    raise ApiClientException(ERROR_UNAUTHORIZED)
    # TODO
    if isinstance(medium, ThumbnailTargetMedium):
    return redirect("https://video.fsmpi.rwth-aachen.de/files/thumbnail/l_17253.jpg")
    else:
    return redirect("https://video.fsmpi.rwth-aachen.de/files/pub/23ws-buk/23ws-buk-231012-1080p.mp4")
    ......@@ -69,6 +69,7 @@ def api_request_get_query_int(id: str, default: int or None, min_value: int = MI
    return value
    # TODO we really want these?
    @api.app.errorhandler(400)
    def _handle_bad_request(e=None):
    if e is not None:
    ......
    ......@@ -165,6 +165,14 @@ class ObjectSpecification:
    for field_id in sorted(fields_by_id.keys()):
    res += fields_by_id[field_id].generate_markdown_row(row_span)
    row_span = None
    if variant is not None and len(fields_by_id) == 0:
    assert isinstance(variant, str)
    if variant.startswith("NOCODE:"):
    variant_str = variant[len("NOCODE:"):]
    else:
    variant_str = f"`{variant}`"
    res += f" <tr><td>{_markdown_to_html(variant_str)}</td></tr>\n"
    res += "</tbody>\n"
    res += "</table>\n\n"
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment