Pushbullet: add device-id

Want something added? Ask for it here.
Post Reply
pven
Release Testers
Release Testers
Posts: 114
Joined: August 21st, 2009, 5:00 am

Pushbullet: add device-id

Post 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?
User avatar
sander
Release Testers
Release Testers
Posts: 8812
Joined: January 22nd, 2008, 2:22 pm

Re: Pushbullet: add device-id

Post 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 ''
pven
Release Testers
Release Testers
Posts: 114
Joined: August 21st, 2009, 5:00 am

Re: Pushbullet: add device-id

Post 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. :)
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Pushbullet: add device-id

Post 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 :)
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
pven
Release Testers
Release Testers
Posts: 114
Joined: August 21st, 2009, 5:00 am

Re: Pushbullet: add device-id

Post by pven »

That one is new for me. Thanks, I will give it a try. :)
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Pushbullet: add device-id

Post 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.
pven
Release Testers
Release Testers
Posts: 114
Joined: August 21st, 2009, 5:00 am

Re: Pushbullet: add device-id

Post by pven »

nzb-notify works great. Thanks!
Post Reply