fix bugs
This commit is contained in:
		
							parent
							
								
									239c0730c0
								
							
						
					
					
						commit
						2e5dec5cac
					
				| @ -44,7 +44,7 @@ from twisted.protocols.basic import NetstringReceiver | |||||||
| from twisted.internet import reactor, task | from twisted.internet import reactor, task | ||||||
| 
 | 
 | ||||||
| # Things we import from the main hblink module | # Things we import from the main hblink module | ||||||
| from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, mk_aliases, aprs_upload, sendAprs | from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, mk_aliases | ||||||
| from dmr_utils3.utils import bytes_3, int_id, get_alias | from dmr_utils3.utils import bytes_3, int_id, get_alias | ||||||
| from dmr_utils3 import decode, bptc, const | from dmr_utils3 import decode, bptc, const | ||||||
| import config | import config | ||||||
| @ -245,7 +245,7 @@ def decdeg2dms(dd): | |||||||
| def user_setting_write(dmr_id, setting, value): | def user_setting_write(dmr_id, setting, value): | ||||||
| ##    try: | ##    try: | ||||||
|     # Open file and load as dict for modification |     # Open file and load as dict for modification | ||||||
|         with open("./user_settings.txt", 'r') as f: |         with open(user_settings_file, 'r') as f: | ||||||
| ##            if f.read() == '{}': | ##            if f.read() == '{}': | ||||||
| ##                user_dict = {} | ##                user_dict = {} | ||||||
|             user_dict = ast.literal_eval(f.read()) |             user_dict = ast.literal_eval(f.read()) | ||||||
| @ -264,7 +264,7 @@ def user_setting_write(dmr_id, setting, value): | |||||||
|             f.close() |             f.close() | ||||||
|             logger.info('Loaded user settings. Preparing to write...') |             logger.info('Loaded user settings. Preparing to write...') | ||||||
|     # Write modified dict to file |     # Write modified dict to file | ||||||
|         with open("./user_settings.txt", 'w') as user_dict_file: |         with open(user_settings_file, 'w') as user_dict_file: | ||||||
|             user_dict_file.write(str(user_dict)) |             user_dict_file.write(str(user_dict)) | ||||||
|             user_dict_file.close() |             user_dict_file.close() | ||||||
|             logger.info('User setting saved') |             logger.info('User setting saved') | ||||||
| @ -1898,7 +1898,7 @@ if __name__ == '__main__': | |||||||
|                 systems[system] = routerHBP(system, CONFIG, report_server) |                 systems[system] = routerHBP(system, CONFIG, report_server) | ||||||
|             reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP']) |             reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP']) | ||||||
|             logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system]) |             logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system]) | ||||||
|     aprs_upload(CONFIG) |     #aprs_upload(CONFIG) | ||||||
| 
 | 
 | ||||||
|     def loopingErrHandle(failure): |     def loopingErrHandle(failure): | ||||||
|         logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure) |         logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure) | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								config.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								config.py
									
									
									
									
									
								
							| @ -106,7 +106,6 @@ def build_config(_config_file): | |||||||
|     CONFIG['GLOBAL'] = {} |     CONFIG['GLOBAL'] = {} | ||||||
|     CONFIG['REPORTS'] = {} |     CONFIG['REPORTS'] = {} | ||||||
|     CONFIG['LOGGER'] = {} |     CONFIG['LOGGER'] = {} | ||||||
|     CONFIG['APRS'] = {} |  | ||||||
|     CONFIG['GPS_DATA'] = {} |     CONFIG['GPS_DATA'] = {} | ||||||
|     CONFIG['ALIASES'] = {} |     CONFIG['ALIASES'] = {} | ||||||
|     CONFIG['SYSTEMS'] = {} |     CONFIG['SYSTEMS'] = {} | ||||||
| @ -184,15 +183,6 @@ def build_config(_config_file): | |||||||
|                     'STALE_TIME': config.getint(section, 'STALE_DAYS') * 86400, |                     'STALE_TIME': config.getint(section, 'STALE_DAYS') * 86400, | ||||||
|                 }) |                 }) | ||||||
| 
 | 
 | ||||||
|             elif section == 'APRS': |  | ||||||
|                 CONFIG['APRS'].update({ |  | ||||||
|                     'ENABLED': config.getboolean(section, 'ENABLED'), |  | ||||||
|                     'CALLSIGN': config.get(section, 'CALLSIGN'), |  | ||||||
|                     'REPORT_INTERVAL': config.getint(section, 'REPORT_INTERVAL'), |  | ||||||
|                     'SERVER': config.get(section, 'SERVER'), |  | ||||||
|                     'MESSAGE': config.get(section, 'MESSAGE') |  | ||||||
|                 }) |  | ||||||
| 
 |  | ||||||
|             elif config.getboolean(section, 'ENABLED'): |             elif config.getboolean(section, 'ENABLED'): | ||||||
|                 if config.get(section, 'MODE') == 'PEER': |                 if config.get(section, 'MODE') == 'PEER': | ||||||
|                     CONFIG['SYSTEMS'].update({section: { |                     CONFIG['SYSTEMS'].update({section: { | ||||||
|  | |||||||
| @ -238,7 +238,7 @@ def decdeg2dms(dd): | |||||||
| def user_setting_write(dmr_id, setting, value): | def user_setting_write(dmr_id, setting, value): | ||||||
| ##    try: | ##    try: | ||||||
|     # Open file and load as dict for modification |     # Open file and load as dict for modification | ||||||
|         with open("./user_settings.txt", 'r') as f: |         with open(user_settings_file, 'r') as f: | ||||||
| ##            if f.read() == '{}': | ##            if f.read() == '{}': | ||||||
| ##                user_dict = {} | ##                user_dict = {} | ||||||
|             user_dict = ast.literal_eval(f.read()) |             user_dict = ast.literal_eval(f.read()) | ||||||
| @ -257,7 +257,7 @@ def user_setting_write(dmr_id, setting, value): | |||||||
|             f.close() |             f.close() | ||||||
|             logger.info('Loaded user settings. Preparing to write...') |             logger.info('Loaded user settings. Preparing to write...') | ||||||
|     # Write modified dict to file |     # Write modified dict to file | ||||||
|         with open("./user_settings.txt", 'w') as user_dict_file: |         with open(user_settings_file, 'w') as user_dict_file: | ||||||
|             user_dict_file.write(str(user_dict)) |             user_dict_file.write(str(user_dict)) | ||||||
|             user_dict_file.close() |             user_dict_file.close() | ||||||
|             logger.info('User setting saved') |             logger.info('User setting saved') | ||||||
|  | |||||||
| @ -34,7 +34,7 @@ def mailbox_write(call, dmr_id, time, message, recipient): | |||||||
| 
 | 
 | ||||||
| def aprs_filter(packet): | def aprs_filter(packet): | ||||||
| 
 | 
 | ||||||
|     user_settings = ast.literal_eval(os.popen('cat ../../user_settings.txt').read()) |     user_settings = ast.literal_eval(os.popen('cat ' + user_settings_file).read()) | ||||||
|     if 'addresse' in aprslib.parse(packet): |     if 'addresse' in aprslib.parse(packet): | ||||||
|         #print(aprslib.parse(packet)) |         #print(aprslib.parse(packet)) | ||||||
|         recipient = re.sub('-.*','', aprslib.parse(packet)['addresse']) |         recipient = re.sub('-.*','', aprslib.parse(packet)['addresse']) | ||||||
| @ -71,7 +71,7 @@ if __name__ == '__main__': | |||||||
|     user_settings_file = mailbox_file = parser.get('GPS_DATA', 'USER_SETTINGS_FILE') |     user_settings_file = mailbox_file = parser.get('GPS_DATA', 'USER_SETTINGS_FILE') | ||||||
| 
 | 
 | ||||||
|     AIS = aprslib.IS(aprs_login, passwd=int(aprs_passcode), host=aprs_server, port=int(aprs_port)) |     AIS = aprslib.IS(aprs_login, passwd=int(aprs_passcode), host=aprs_server, port=int(aprs_port)) | ||||||
|     user_settings = ast.literal_eval(os.popen('cat ../../user_settings.txt').read()) |     user_settings = ast.literal_eval(os.popen('cat ' + user_settings_file).read()) | ||||||
|     print('APRS message receive script for GPS/Data Application.\nAuthor: Eric, KF7EEL - kf7eel@qsl.net') |     print('APRS message receive script for GPS/Data Application.\nAuthor: Eric, KF7EEL - kf7eel@qsl.net') | ||||||
|     AIS.set_filter(parser.get('GPS_DATA', 'APRS_FILTER')) |     AIS.set_filter(parser.get('GPS_DATA', 'APRS_FILTER')) | ||||||
|     AIS.connect() |     AIS.connect() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user