Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 28.5.0

* Removed: `ProjectKeyScopes.VIDEOS_PLAY`; video playback is covered by the `videos.read` scope
* Added: `renditions` to the `Video` model, listing the video's ready renditions
* Updated: `videos` method docs to describe guest playback under `videos.read`

## 28.4.0

* Added: `analytics` service to create, list, get, update and delete analytics properties
Expand Down
4 changes: 2 additions & 2 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def __init__(self):
self._endpoint = 'https://cloud.appwrite.io/v1'
self._global_headers = {
'content-type': '',
'user-agent': f'AppwritePythonSDK/28.4.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'user-agent': f'AppwritePythonSDK/28.5.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '28.4.0',
'x-sdk-version': '28.5.0',
'X-Appwrite-Response-Format': '2.7.2',
}
self._config = {}
Expand Down
1 change: 0 additions & 1 deletion appwrite/enums/project_key_scopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class ProjectKeyScopes(Enum):
REVIEWS_WRITE = "reviews.write"
PRESENCES_READ = "presences.read"
PRESENCES_WRITE = "presences.write"
VIDEOS_PLAY = "videos.play"
VIDEOS_READ = "videos.read"
VIDEOS_WRITE = "videos.write"
DEDICATEDDATABASES_EXECUTE = "dedicatedDatabases.execute"
Expand Down
6 changes: 6 additions & 0 deletions appwrite/models/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from .base_model import AppwriteModel
from ..enums.video_timeline_status import VideoTimelineStatus
from .video_rendition import VideoRendition


class Video(AppwriteModel):
Expand Down Expand Up @@ -61,6 +62,8 @@ class Video(AppwriteModel):
Thumbnail timeline job status: one of `pending`, `started`, `ready`, `skipped` (source has no video track) or `error`.
timelineerror : str
Why the timeline job failed. Empty unless `timelineStatus` is `error`.
renditions : List[VideoRendition]
Ready renditions of the video, lowest resolution first.
"""

id: str = Field(..., alias='$id')
Expand Down Expand Up @@ -88,6 +91,7 @@ class Video(AppwriteModel):
audiosamplerate: float = Field(..., alias='audioSampleRate')
timelinestatus: VideoTimelineStatus = Field(..., alias='timelineStatus')
timelineerror: str = Field(..., alias='timelineError')
renditions: List[VideoRendition] = Field(..., alias='renditions')
Comment thread
shimonewman marked this conversation as resolved.
Resolved

@model_validator(mode='before')
@classmethod
Expand Down Expand Up @@ -146,4 +150,6 @@ def _apply_defaults(cls, data: Any) -> Any:
data['timelineStatus'] = 'pending'
if 'timelineError' not in data and 'timelineerror' not in data:
data['timelineError'] = ''
if 'renditions' not in data:
data['renditions'] = []
return data
20 changes: 10 additions & 10 deletions appwrite/services/videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def list(
total: Optional[bool] = None,
) -> VideoList:
"""
Get a list of videos in the current project. Sessions receive only videos they can read according to each video's `$permissions`. API keys and admins receive the full project catalog. Playback uses the same document read ACL plus the `videos.play` (or `videos.read`) scope: a guest can stream a video that grants `read("any")` or `read("guests")` even though guests lack `videos.read` and will not see it in this list.
Get a list of videos in the current project. Sessions and guests receive only videos they can read according to each video's `$permissions`. API keys and admins receive the full project catalog. Each video includes its ready renditions. Guests hold `videos.read`, so a video that grants `read("any")` or `read("guests")` appears in this list and can be streamed.

Parameters
----------
Expand Down Expand Up @@ -74,7 +74,7 @@ def create(
"""
Create a video resource from an existing file in a storage bucket. The source file must be a video or audio file, and the caller must be able to read that file. Creating a video stores the document and queues timeline generation. The worker downloads the source, probes metadata, extracts embedded captions once, and deletes its working copy when finished. Sources with a video track also get a thumbnail timeline. Call create-rendition to package a streaming output.

An optional `name` defaults to the source file name. An optional `permissions` array sets the video document ACL (list, get, update, delete, manage child resources, and playback). By default, only the current user is granted all permissions; API keys and admins create with empty permissions when omitted. Guests with `videos.play` can stream when the video grants them read (`read("any")` or `read("guests")`).
An optional `name` defaults to the source file name. An optional `permissions` array sets the video document ACL (list, get, update, delete, manage child resources, and playback). By default, only the current user is granted all permissions; API keys and admins create with empty permissions when omitted. Guests can stream when the video grants them read (`read("any")` or `read("guests")`).

Uploaded caption files stay listed alongside auto-extracted tracks for the same language; when the current default is an auto-extracted track with that code, the upload takes the default flag.

Expand Down Expand Up @@ -166,7 +166,7 @@ def get(
video_id: str,
) -> Video:
"""
Get a video by its unique ID. This endpoint response returns a JSON object with the video metadata.
Get a video by its unique ID. This endpoint response returns a JSON object with the video metadata, including ready renditions.

Parameters
----------
Expand Down Expand Up @@ -541,7 +541,7 @@ def get_cmaf_hls_manifest(
"""
Get the top-level streaming manifest for a video output: an HLS master playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a player to begin adaptive playback.

Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session.
Guests can request this URL when they hold `videos.read` **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session.

For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`. Both masters point at the same fMP4 segment set.

Expand Down Expand Up @@ -585,7 +585,7 @@ def get_cmaf_dash_manifest(
"""
Get the top-level streaming manifest for a video output: an HLS master playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a player to begin adaptive playback.

Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session.
Guests can request this URL when they hold `videos.read` **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session.

For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`. Both masters point at the same fMP4 segment set.

Expand Down Expand Up @@ -629,7 +629,7 @@ def get_dash_manifest(
"""
Get the top-level streaming manifest for a video output: an HLS master playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a player to begin adaptive playback.

Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session.
Guests can request this URL when they hold `videos.read` **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session.

For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`. Both masters point at the same fMP4 segment set.

Expand Down Expand Up @@ -673,7 +673,7 @@ def get_hls_manifest(
"""
Get the top-level streaming manifest for a video output: an HLS master playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a player to begin adaptive playback.

Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session.
Guests can request this URL when they hold `videos.read` **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session.

For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`. Both masters point at the same fMP4 segment set.

Expand Down Expand Up @@ -719,7 +719,7 @@ def get_caption_manifest(
"""
Get the playable caption resource for a video output: an HLS captions playlist, or the WebVTT file itself for DASH.

Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read.
Guests can request this URL when they hold `videos.read` **and** the video document grants them read.

Parameters
----------
Expand Down Expand Up @@ -981,7 +981,7 @@ def get_thumbnail(
"""
Get a single thumbnail sheet from a video's timeline as an image. You can resize the returned image and choose its output format.

Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read.
Guests can request this URL when they hold `videos.read` **and** the video document grants them read.

Parameters
----------
Expand Down Expand Up @@ -1040,7 +1040,7 @@ def get_timeline(
"""
Get the WebVTT thumbnail timeline for a video, used to render scrubbing thumbnails in a player. Timeline generation is queued when the video is created. Subscribe to `videos.[videoId].timelines.update` for probe and terminal updates, or poll this endpoint until it returns a WebVTT document. Audio-only sources produce no timeline and this endpoint returns `video_timelines_not_found`.

Guests can request this URL when they hold `videos.play` (or `videos.read`) **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session.
Guests can request this URL when they hold `videos.read` **and** the video document grants them read. A video with `read("any")` or `read("guests")` is playable without a session.

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "appwrite"
version = "28.4.0"
version = "28.5.0"
description = "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
setuptools.setup(
name='appwrite',
packages=setuptools.find_packages(),
version='28.4.0',
version='28.5.0',
license='BSD-3-Clause',
description='Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API',
long_description=long_description,
Expand All @@ -18,7 +18,7 @@
maintainer='Appwrite Team',
maintainer_email='team@appwrite.io',
url='https://appwrite.io/support',
download_url='https://github.com/appwrite/sdk-for-python/archive/28.4.0.tar.gz',
download_url='https://github.com/appwrite/sdk-for-python/archive/28.5.0.tar.gz',
install_requires=[
'requests>=2.34.2,<3',
'urllib3>=2.8.0,<3',
Expand Down
3 changes: 3 additions & 0 deletions test/services/test_videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def test_create(self, m):
"audioSampleRate": 48000.0,
"timelineStatus": "ready",
"timelineError": "The requested file is not a valid video or audio file (ffprobe: Invalid data found when processing input)",
"renditions": [],
}
headers = {'Content-Type': 'application/json'}
m.request(
Expand Down Expand Up @@ -162,6 +163,7 @@ def test_get(self, m):
"audioSampleRate": 48000.0,
"timelineStatus": "ready",
"timelineError": "The requested file is not a valid video or audio file (ffprobe: Invalid data found when processing input)",
"renditions": [],
}
headers = {'Content-Type': 'application/json'}
m.request(
Expand Down Expand Up @@ -211,6 +213,7 @@ def test_update(self, m):
"audioSampleRate": 48000.0,
"timelineStatus": "ready",
"timelineError": "The requested file is not a valid video or audio file (ffprobe: Invalid data found when processing input)",
"renditions": [],
}
headers = {'Content-Type': 'application/json'}
m.request(
Expand Down
Loading