Commits

Laurent Bachelier committed 9d9ecfd

Get user and host once per run

  • Participants
  • Parent commits f8119e9

Comments (0)

Files changed (1)

rtorrentnotify/__init__.py

 import hashlib
 import json
 
+USER = getpass.getuser()
+HOST = socket.gethostname()
+
 
 class Encoder(json.JSONEncoder):
     def default(self, obj):
 
 class RssEvent(Event):
     def get_guid(self):
-        return rss2.Guid("%s@%s:%s_%s" % (getpass.getuser(),
-                         socket.gethostname(),
+        return rss2.Guid("%s@%s:%s_%s" % (USER,
+                         HOST,
                          self.name,
                          hashlib.md5(self.desc.encode('utf-8') + str(self.datetime)).hexdigest()),
                          False