N4S4 / synology-api

A Python wrapper around Synology API
MIT License
391 stars 143 forks source link

DownloadStation: Add tasks_create (Improving Code Branch) #34

Closed nicholaschum closed 4 years ago

nicholaschum commented 4 years ago

Let me know what you guys think, this works great on my Telegram bot.

N4S4 commented 4 years ago

Perfect I will test it later and let you know In case if you have a repo on github or on a blog I can mention that the wrapper has been used for as an usage example in the readme file

Anyway I will let you know

nicholaschum commented 4 years ago

Perfect I will test it later and let you know In case if you have a repo on github or on a blog I can mention that the wrapper has been used for as an usage example in the readme file

Anyway I will let you know

Hey @N4S4, thanks for considering. Currently the repo we are using it with is not open sourced yet, as it is still in heavy development. We will be looking into open sourcing it upon completion, but we will definitely let you know!

Attached below is our bot working:

Screen Shot 2020-04-06 at 5 13 50 AM

This is the snippet of our code calls:

from synology_api.downloadstation import DownloadStation
instance = DownloadStation.login(DSM_ACCOUNT, DSM_PASSWORD, NAS_IP, NAS_PORT)

def __handle_link(message, link):
    try:
        instance.tasks_create(link)
        message.reply_text("Item added successfully.")
        return True
    except:
        message.reply_text("Failed to add item. Please try again.")
        return False

It handles our URI calls perfectly. Including links to .torrents, normal files and mirror links (mostly URI calls).

Screen Shot 2020-04-06 at 5 16 24 AM