Introduction
Background¶
This is the very first version of the API. Some parts of it scrape data from HTML-formatted pages, while others fetch data directly from the REST API server.
Download Movie¶
This can be done in a very straightforward way:
Behind the scenes, this script does the following:
- Performs a movie search
- Presents the search results for the user to select one
- Downloads both the movie and subtitle files
Download with Progress Callback¶
from moviebox_api.v1 import DownloadTracker, MovieAuto
async def progress_callback(progress: DownloadTracker):
percent = (progress.downloaded_size / progress.expected_size) * 100
print(f"[{percent:.2f}%] Downloading {progress.saved_to.name}", end="\r")
async def main():
auto = MovieAuto(tasks=1)
await auto.run("Avatar", progress_hook=progress_callback)
if __name__ == "__main__":
import asyncio
asyncio.run(main)
from moviebox_api.v1 import DownloadTracker, MovieAuto
def progress_callback(progress: DownloadTracker):
percent = (progress.downloaded_size / progress.expected_size) * 100
print(f"[{percent:.2f}%] Downloading {progress.saved_to.name}", end="\r")
def main():
auto = MovieAuto(tasks=1)
auto.run_sync("Avatar", progress_hook=progress_callback)
if __name__ == "__main__":
main()
Why TV series lack Automagic
This is a deliberate choice by the developers. The current focus is more on implementing new features rather than adding miscellaneous ones. It may be implemented in the future, or you could submit a PR.