示例#1
0
def test_notify(growlhost, growlport, growlpass):
    if not growlpass:
        password = autosub.GROWLPASS

    if growlpass:
        password = growlpass

    register = gntp.GNTPRegister()
    register.add_header('Application-Name', "Auto-Sub")
    register.add_notification('Test', True)
    register.add_notification('Subtitle Download', True)
    register.add_notification('Registration', True)
    register.add_header('Application-Icon',
                        'http://img826.imageshack.us/img826/1281/autosub.png')
    if password != "":
        register.set_password(password)
    if not _send_notify(register.encode(), growlhost, growlport):
        return False

    notice = gntp.GNTPNotice()
    notice.add_header('Application-Name', "Auto-Sub")
    notice.add_header('Notification-Name', "Test")
    notice.add_header('Notification-Title', "Testing notification")
    notice.add_header('Notification-Text',
                      "Testing Growl settings from Auto-Sub.")
    notice.add_header('Notification-Icon',
                      'http://img826.imageshack.us/img826/1281/autosub.png')
    if password != "":
        notice.set_password(password)
    return _send_notify(notice.encode(), growlhost, growlport)
def register_growl():
    register = gntp.GNTPRegister()
    register.add_header('Application-Name', "AutoSub")
    register.add_notification('Test', True)
    register.add_notification('Subtitle Download', True)
    if growl_pass != "":
        register.set_password(growl_pass)
    send_growl(growl_host, growl_port, register.encode())

    notice = gntp.GNTPNotice()
    notice.add_header('Application-Name', "AutoSub")
    notice.add_header('Notification-Name', "Test")
    notice.add_header('Notification-Title', "Testing notification")
    notice.add_header('Notification-Text',
                      "This is a test notification send by AutoSub, check!")
    if growl_pass != "":
        notice.set_password(growl_pass)
    send_growl(growl_host, growl_port, notice.encode())
示例#3
0
def test_notify():
    password = autosub.GROWLPASS

    register = gntp.GNTPRegister()
    register.add_header('Application-Name', "AutoSub")
    register.add_notification('Test', True)
    register.add_notification('Subtitle Download', True)
    if password != "":
        register.set_password(password)
    if not _send_notify(register.encode()):
        return False

    notice = gntp.GNTPNotice()
    notice.add_header('Application-Name', "AutoSub")
    notice.add_header('Notification-Name', "Test")
    notice.add_header('Notification-Title', "Testing notification")
    notice.add_header('Notification-Text',
                      "This is a test notification send by AutoSub, check!")
    if password != "":
        notice.set_password(password)
    return _send_notify(notice.encode())