开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: Tool for sBITX log


 


Here is some code from an opensource sqlite logger dolphinlog.? just need to convert field names.? I would do it but my pi is dead.?
?
?
? ? @staticmethod
? ? def export_adif_adi(db_filename, adi_filename):
? ? ? ? try:
? ? ? ? ? ? ADIF_VER = '3.0.4'
? ? ? ? ? ? PROG_ID = 'dolphinlog'
? ? ? ? ? ? ('Connecting to database: {}'.format(db_filename))
? ? ? ? ? ? db = sqlite3.connect(db_filename)
? ? ? ? ? ? cursor = db.cursor()
? ? ? ? ? ? cursor.execute('SELECT * FROM qso ORDER BY id')
? ? ? ? ? ? names = list(map(lambda x: x[0], cursor.description))
? ? ? ? ? ? dat = datetime.datetime.utcnow()
? ? ? ? ? ? f = open(adi_filename, 'w')
? ? ? ? ? ? f.write('Generated on {} at {} UTC\n\n'.format(dat.strftime('%Y-%m-%d'), dat.strftime('%H:%M:%S')))
? ? ? ? ? ? f.write('<adif_ver:{}:>{}\n'.format(len(ADIF_VER), ADIF_VER))
? ? ? ? ? ? f.write('<programid:{}:>{}\n'.format(len(PROG_ID), PROG_ID))
? ? ? ? ? ? f.write('<eoh>\n\n')
? ? ? ? ? ? for row in cursor:
? ? ? ? ? ? ? ? for i in range(len(row)):
? ? ? ? ? ? ? ? ? ? if names[i] == 'id' or names[i] == 'programid':
? ? ? ? ? ? ? ? ? ? ? ? continue
? ? ? ? ? ? ? ? ? ? if str(row[i]) == '':
? ? ? ? ? ? ? ? ? ? ? ? continue
? ? ? ? ? ? ? ? ? ? f.write('<{}:{}:>{}\n'.format(names[i], len(str(row[i])), str(row[i])))
? ? ? ? ? ? ? ? f.write('<eor>\n\n')
? ? ? ? ? ? f.close()
? ? ? ? except Exception as e:
? ? ? ? ? ? # Roll back any change if something goes wrong
? ? ? ? ? ? db.rollback()
? ? ? ? ? ? log.error('Something wrong.')
? ? ? ? ? ? raise e
? ? ? ? finally:
? ? ? ? ? ? # Close the db connection
? ? ? ? ? ? db.close()

? ? def export_adif_adx(self):
? ? ? ? pass

On Thu, May 18, 2023 at 6:19?AM <jacobs@...> wrote:
I agree, we need a program that will generate an adif file. Even better if it were generated automatically by the Sbitx software.?
--
Bob AA4FJ

Join [email protected] to automatically receive all group messages.