Page 1 of 1

Pushbullet: add device-id

Posted: October 13th, 2017, 1:43 am
by pven
When using Sonarr and Radarr I can setup a specific device-id for pushbullet-notifications. Is it possible to add this feature to SABnzbd?

Re: Pushbullet: add device-id

Posted: October 13th, 2017, 2:14 am
by sander
Below is the SAB code. I see 'device', but AFAIK is not filled out. Could that be the device-id? Do you run from source?

Code: Select all

def send_pushbullet(title, msg, gtype, force=False, test=None):
    """ Send message to Pushbullet """

    if test:
        apikey = test.get('pushbullet_apikey')
        device = test.get('pushbullet_device')
    else:
        apikey = sabnzbd.cfg.pushbullet_apikey()
        device = sabnzbd.cfg.pushbullet_device()
    if not apikey:
        return T('Cannot send, missing required data')

    title = u'SABnzbd: ' + Tx(NOTIFICATION.get(gtype, 'other'))

    try:
        conn = httplib.HTTPSConnection('api.pushbullet.com:443')
        conn.request('POST', '/v2/pushes',
            json.dumps({
                'type': 'note',
                'device': device,
                'title': title,
                'body': msg}),
            headers={'Authorization': 'Bearer ' + apikey,
                     'Content-type': 'application/json'})
        res = conn.getresponse()
        if res.status != 200:
            logging.error(T('Bad response from Pushbullet (%s): %s'), res.status, res.read())
        else:
            logging.info('Successfully sent to Pushbullet')

    except:
        logging.warning(T('Failed to send pushbullet message'))
        logging.info('Traceback: ', exc_info=True)
        return T('Failed to send pushbullet message')
    return ''

Re: Pushbullet: add device-id

Posted: October 13th, 2017, 2:18 am
by pven
When device is empty it will send a notification to all devices (that is the default behavior for pushbullet).

I don't understand 'do you run from source'. I run SABnzbd on my Synology. :)

Re: Pushbullet: add device-id

Posted: October 13th, 2017, 3:24 am
by safihre
It was disabled, but not sure why: https://github.com/sabnzbd/sabnzbd/comm ... 7fed1b0606

I recommend that you instead use the Notification Script NZB-Notify https://github.com/caronc/nzb-notify
He supports the device ID and many more services, if you ever need them :)

Re: Pushbullet: add device-id

Posted: October 13th, 2017, 4:03 am
by pven
That one is new for me. Thanks, I will give it a try. :)

Re: Pushbullet: add device-id

Posted: October 19th, 2017, 3:10 pm
by shypike
It was disabled because it's not what people expect it to be.
It's not like "John's iPhone", but some internal ID.
You cannot lookup the IDs and the friendly names on the PushBullet website.
You need to do several API queries before you can show a selection list.
I didn't want to spend so much effort on it.

Re: Pushbullet: add device-id

Posted: October 26th, 2017, 2:25 am
by pven
nzb-notify works great. Thanks!