-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
download: use the Playback command instead of Download (#86)
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.
- Loading branch information
Showing
2 changed files
with
7 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -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 |