Skip to content

Commit df09e43

Browse files
committed
download: use the Playback command instead of Download
On my TrackMix Wifi, both API commands work the same way, but Download is limited to about 800kB/s, while Playback hits about 4MB/s. So, replace the Download command with Playback by default for get_file. The "method" optional argument can be used to switch back to Download for people who need it.
1 parent b0bcb9f commit df09e43

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Diff for: reolinkapi/handlers/api_handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _execute_command(self, command: str, data: List[Dict], multi: bool = False)
121121
try:
122122
if self.token is None:
123123
raise ValueError("Login first")
124-
if command == 'Download':
124+
if command == 'Download' or command == 'Playback':
125125
# Special handling for downloading an mp4
126126
# Pop the filepath from data
127127
tgt_filepath = data[0].pop('filepath')

Diff for: reolinkapi/mixins/download.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
class DownloadAPIMixin:
22
"""API calls for downloading video files."""
3-
def get_file(self, filename: str, output_path: str) -> bool:
3+
def get_file(self, filename: str, output_path: str, method = 'Playback') -> bool:
44
"""
55
Download the selected video file
6+
On at least Trackmix Wifi, it was observed that the Playback method
7+
yields much improved download speeds over the Download method, for
8+
unknown reasons.
69
:return: response json
710
"""
811
body = [
912
{
10-
"cmd": "Download",
13+
"cmd": method,
1114
"source": filename,
1215
"output": filename,
1316
"filepath": output_path
1417
}
1518
]
16-
resp = self._execute_command('Download', body)
19+
resp = self._execute_command(method, body)
1720

1821
return resp

0 commit comments

Comments
 (0)