Skip to content
Permalink
Browse files

Created a config file and added a notification sound for when a new

address has been added to the clipboard.
  • Loading branch information...
BradfordBach committed May 22, 2019
1 parent b82f9fc commit a626212274f81d8c0a4826042f1440efd07d5789
Showing with 13 additions and 1 deletion.
  1. +11 −1 NMS_Locator.py
  2. +2 −0 config.ini
  3. BIN notification.wav
@@ -3,6 +3,8 @@
import datetime
import time
import pyperclip
import winsound
import configparser
from shutil import copyfile

def get_current_location():
@@ -22,6 +24,9 @@ def get_current_location():
print(galactic_address)
pyperclip.copy(galactic_address)

if config.getboolean('SETTINGS', 'PLAY_NOTIFICATION'):
winsound.PlaySound('notification.wav', winsound.SND_FILENAME)

def get_file_mod_time():
return os.path.getmtime(save)

@@ -51,7 +56,7 @@ def enter_address_into_log(galactic_address, dt):
if is_date_in_log(dt):
bulk.write(galactic_address + '\n')
else:
bulk.write(dt.strftime("%B %d %Y") + '\n')
bulk.write('\n' + dt.strftime("%B %d %Y") + '\n')
bulk.write(galactic_address + '\n')

location_log.append([dt, galactic_address])
@@ -128,6 +133,10 @@ def add_years_to_location_log():
except ValueError:
pass

def load_config():
config = configparser.ConfigParser()
config.read('config.ini')
return config

def run_location_gatherer():
try:
@@ -143,6 +152,7 @@ def run_location_gatherer():

log_dir = os.getenv('LOCALAPPDATA') + os.sep + 'Programs' + os.sep + "NMS Locator"

config = load_config()
add_years_to_location_log()
location_log, log_loc = load_log()
create_bulk_log()
@@ -0,0 +1,2 @@
[SETTINGS]
PLAY_NOTIFICATION = False
BIN +221 KB notification.wav
Binary file not shown.

0 comments on commit a626212

Please sign in to comment.
You can’t perform that action at this time.