Skip to content
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

download: use the Playback command instead of Download #86

Merged
merged 1 commit into from
Dec 11, 2024
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
2 changes: 1 addition & 1 deletion reolinkapi/handlers/api_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _execute_command(self, command: str, data: List[Dict], multi: bool = False)
try:
if self.token is None:
raise ValueError("Login first")
if command == 'Download':
if command == 'Download' or command == 'Playback':
# Special handling for downloading an mp4
# Pop the filepath from data
tgt_filepath = data[0].pop('filepath')
Expand Down
9 changes: 6 additions & 3 deletions reolinkapi/mixins/download.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
class DownloadAPIMixin:
"""API calls for downloading video files."""
def get_file(self, filename: str, output_path: str) -> bool:
def get_file(self, filename: str, output_path: str, method = 'Playback') -> bool:
"""
Download the selected video file
On at least Trackmix Wifi, it was observed that the Playback method
yields much improved download speeds over the Download method, for
unknown reasons.
:return: response json
"""
body = [
{
"cmd": "Download",
"cmd": method,
"source": filename,
"output": filename,
"filepath": output_path
}
]
resp = self._execute_command('Download', body)
resp = self._execute_command(method, body)

return resp
Loading