Browse Source

Improve startup notification.

- Move hostname() from misc.py to growler.py.
- Improve startup notification
tags/0.7.4Beta2
shypike 13 years ago
parent
commit
dcb1b0b3dc
  1. 4
      SABnzbd.py
  2. 20
      sabnzbd/growler.py
  3. 11
      sabnzbd/misc.py

4
SABnzbd.py

@ -1521,8 +1521,8 @@ def main():
if sabnzbd.FOUNDATION:
import sabnzbd.osxmenu
sabnzbd.osxmenu.notify("SAB_Launched", None)
growler.send_notification('SABnzbd %s' % (sabnzbd.__version__),
"http://%s:%s/sabnzbd" % (browserhost, cherryport), 'startup')
growler.send_notification('SABnzbd%s' % growler.hostname(),
T('SABnzbd %s started') % sabnzbd.__version__, 'startup')
# Now's the time to check for a new version
check_latest_version()
autorestarted = False

20
sabnzbd/growler.py

@ -137,10 +137,7 @@ def register_growl():
error = None
host, port = sabnzbd.misc.split_host(sabnzbd.cfg.growl_server())
if host:
sys_name = '@' + sabnzbd.misc.hostname().lower()
else:
sys_name = ''
sys_name = hostname(host)
# Clean up persistent data in GNTP to make re-registration work
GNTPRegister.notifications = []
@ -304,3 +301,18 @@ def send_notification_center(title, msg, gtype):
else:
output = 'Notifier app not found'
return output.strip('*\n ')
#------------------------------------------------------------------------------
def hostname(host=True):
""" Return host's pretty name """
if sabnzbd.WIN32:
sys_name = os.environ.get('computername', 'unknown')
try:
sys_name = os.uname()[1]
except:
sys_name = 'unknown'
if host:
return '@%s' % sys_name.lower()
else:
return ''

11
sabnzbd/misc.py

@ -717,17 +717,6 @@ def split_host(srv):
#------------------------------------------------------------------------------
def hostname():
""" Return host's pretty name """
if sabnzbd.WIN32:
return os.environ.get('computername', 'unknown')
try:
return os.uname()[1]
except:
return 'unknown'
#------------------------------------------------------------------------------
def check_mount(path):
""" Return False if volume isn't mounted on Linux or OSX
Retry 6 times with an interval of 1 sec.

Loading…
Cancel
Save