-
Notifications
You must be signed in to change notification settings - Fork 4
QueueMovies Endpoint #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e52fe7c
init files
akash5100 0baadce
Adds queueMovie endpoint
akash5100 728e1e2
tweaks to docs build
akash5100 6c579d0
fix for failing docs build
akash5100 70c0fe0
init files
akash5100 0dcdded
Adds queueMovie endpoint
akash5100 a3e3e40
tweaks to docs build
akash5100 9958e17
fix for failing docs build
akash5100 57160dd
Merge with main
akash5100 c779f4a
test for queueMovie
akash5100 1dffc43
Fix failing test
akash5100 79d2f62
init files
akash5100 09fa86c
Adds queueMovie endpoint
akash5100 d69bd77
tweaks to docs build
akash5100 b25e1cc
fix for failing docs build
akash5100 9a2ba5e
test for queueMovie
akash5100 7819002
Fix failing test
akash5100 91d6862
Update docstring and utils for None datetime object
akash5100 e7bf69f
Refactor
akash5100 d417b62
Add example in docstr
akash5100 5c1b0cf
Merge branch 'main' into movies
akash5100 beb4ac7
remove quotes for values in docstring
akash5100 2cbe718
Merge branch 'main' into movies
akash5100 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| from typing import Optional | ||
| from datetime import datetime | ||
|
|
||
| from pydantic import validator | ||
|
|
||
| from hvpy.io import HvpyParameters, OutputType | ||
| from hvpy.utils import convert_date_to_isoformat | ||
|
|
||
|
|
||
| class queueMovieInputParameters(HvpyParameters): | ||
| """ | ||
| Handles the input parameters of the ``queueMovie`` API. | ||
|
|
||
| Attributes | ||
| ---------- | ||
| {Shared} | ||
| startTime | ||
| Datetime of the first frame of the movie. | ||
| endTime | ||
| Datetime of the final frame of the movie. | ||
| layers | ||
| Image datasource layers to include in the movie. | ||
| events | ||
| List of feature/event types and FRMs to use to annotate the movie. | ||
| eventsLabels | ||
| Boolean to indicate if the event labels should be included in the movie. | ||
| imageScale | ||
| Image scale in arcseconds per pixel. | ||
| format | ||
| Movie format (mp4, webm, flv). | ||
| Default value is "mp4", optional. | ||
| frameRate | ||
| Movie frames per second. | ||
| Default value is 15 frames per second, optional. | ||
| maxFrames | ||
| Maximum number of frames in the movie, can be capped by the server. | ||
| Default value is `None`, optional. | ||
| scale | ||
| Overlay an image scale indicator. | ||
| Default value is `None`, optional. | ||
| scaleType | ||
| Set the image scale indicator. | ||
| Default value is `None`, optional. | ||
| scaleX | ||
| Horizontal offset of the image scale indicator in arcseconds with respect to the center of the Sun. | ||
| Default value is `None`, optional. | ||
| scaleY | ||
| Vertical offset of the image scale indicator in arcseconds with respect to the center of the Sun. | ||
| Default value is `None`, optional. | ||
| movieLength | ||
| movie length in seconds. | ||
| Default value is `None`, optional. | ||
| watermark | ||
| Optionally overlay a Helioviewer.org watermark image. | ||
| Default value is `True`, optional. | ||
| width | ||
| Width of the field of view in pixels. (Used in conjunction width `x0`,`y0`, and height). | ||
| Default value is `None`, optional. | ||
| height | ||
| Height of the field of view in pixels. (Used in conjunction width `x0`,`y0`, and width). | ||
| Default value is `None`, optional. | ||
| x0 | ||
| The horizontal offset of the center of the field of view from the center of the Sun. Used in conjunction with `y0`, width, and height. | ||
| Default value is `None`, optional. | ||
| y0 | ||
| The vertical offset of the center of the field of view from the center of the Sun. Used in conjunction with `x0`, width, and height. | ||
| Default value is `None`, optional. | ||
| x1 | ||
| The horizontal offset of the top-left corner of the field of view with respect to the center of the Sun (in arcseconds). | ||
| Used in conjunction with `y1`, `x2`, and `y2`. | ||
| Default value is `None`, optional. | ||
| y1 | ||
| The vertical offset of the top-left corner of the field of view with respect to the center of the Sun (in arcseconds). | ||
| Used in conjunction with `x1`, `x2`, and `y2`. | ||
| Default value is `None`, optional. | ||
| x2 | ||
| The horizontal offset of the bottom-right corner of the field of view with respect to the center of the Sun (in arcseconds). | ||
| Used in conjunction with `x1`, `y1`, and `y2`. | ||
| Default value is `None`, optional. | ||
| y2 | ||
| The vertical offset of the bottom-right corner of the field of view with respect to the center of the Sun (in arcseconds). | ||
| Used in conjunction with `x1`, `y1`, and `x2`. | ||
| Default value is `None`, optional. | ||
| callback | ||
| Wrap the response object in a function call of your choosing. | ||
| Default value is `None`, optional. | ||
| size | ||
| Scale video to preset size. | ||
| Default value is 0, optional. | ||
| movieIcons | ||
| Display other user generated movies on the video. | ||
| Default value is `None`, optional. | ||
| followViewport | ||
| Rotate field of view of movie with Sun. | ||
| Default value is `None`, optional. | ||
| reqObservationDate | ||
| Viewport datetime. | ||
| Used when 'followViewport' enabled to shift viewport area to correct coordinates | ||
| Default value is `None`, optional. | ||
|
|
||
| References | ||
| ---------- | ||
| * `<https://api.helioviewer.org/docs/v2/api/api_groups/movies.html#queuemovie>`__ | ||
| {Shared} | ||
| """ | ||
|
|
||
| startTime: datetime | ||
| endTime: datetime | ||
| layers: str | ||
| events: str | ||
| eventsLabels: bool | ||
| imageScale: float | ||
| format: Optional[str] = "mp4" | ||
| frameRate: Optional[str] = "15" | ||
| maxFrames: Optional[str] = None | ||
| scale: Optional[bool] = None | ||
| scaleType: Optional[str] = None | ||
| scaleX: Optional[float] = None | ||
| scaleY: Optional[float] = None | ||
| movieLength: Optional[float] = None | ||
| watermark: Optional[bool] = True | ||
| width: Optional[str] = None | ||
| height: Optional[str] = None | ||
| x0: Optional[str] = None | ||
| y0: Optional[str] = None | ||
| x1: Optional[str] = None | ||
| y1: Optional[str] = None | ||
| x2: Optional[str] = None | ||
| y2: Optional[str] = None | ||
| callback: Optional[str] = None | ||
| size: Optional[int] = 0 | ||
| movieIcons: Optional[int] = None | ||
| followViewport: Optional[int] = None | ||
| reqObservationDate: Optional[datetime] = None | ||
| _date_validator = validator("startTime", "endTime", "reqObservationDate", allow_reuse=True)( | ||
| convert_date_to_isoformat | ||
| ) | ||
|
|
||
| def get_output_type(self) -> OutputType: | ||
| """ | ||
| Returns the output type of the API call. | ||
| """ | ||
| return OutputType.JSON |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| from datetime import datetime | ||
|
|
||
| import pytest | ||
|
|
||
| from hvpy import queueMovie | ||
| from hvpy.api_groups.movies.queue_movie import queueMovieInputParameters | ||
|
|
||
|
|
||
| def test_json_response(): | ||
| response = queueMovie( | ||
| startTime=datetime(2022, 7, 20, 12, 12, 12), | ||
| endTime=datetime(2022, 7, 21, 12, 12, 12), | ||
| layers="[12,7,22],[13,7,22]", | ||
| events="[AR,HMI_HARP;SPoCA,1],[CH,all,1]", | ||
| eventsLabels=False, | ||
| imageScale=1, | ||
| ) | ||
| assert response["id"] is not None | ||
| assert response["eta"] is not None | ||
| assert response["queue"] is not None | ||
| assert response["token"] is not None | ||
|
|
||
|
|
||
| def test_error_handling(): | ||
| with pytest.raises(TypeError, match="missing 1 required positional argument: 'imageScale'"): | ||
| queueMovie( | ||
| startTime=datetime(2022, 7, 20, 12, 12, 12), | ||
| endTime=datetime(2022, 7, 21, 12, 12, 12), | ||
| layers="[12,7,22],[13,7,22]", | ||
| events="[AR,HMI_HARP;SPoCA,1],[CH,all,1]", | ||
| eventsLabels=False, | ||
| ) | ||
|
|
||
|
|
||
| def test_url_property(): | ||
| params = queueMovieInputParameters( | ||
| startTime=datetime(2022, 7, 20, 12, 12, 12), | ||
| endTime=datetime(2022, 7, 21, 12, 12, 12), | ||
| layers="[12,7,22],[13,7,22]", | ||
| events="[AR,HMI_HARP;SPoCA,1],[CH,all,1]", | ||
| eventsLabels=False, | ||
| imageScale=1, | ||
| ) | ||
| assert params.url == "https://api.helioviewer.org/v2/queueMovie/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.