diff --git a/soitool/database.py b/soitool/database.py index d3123c39f3af4d2e7569d44758ab125788217803..12e6539850e172da47c8ba1a8d2c037bca1917c1 100644 --- a/soitool/database.py +++ b/soitool/database.py @@ -224,6 +224,20 @@ class Database: ).total_seconds() return seconds_to_update + def update_codebook_auto(self): + """ + Updates Codebook if it is less than 10 til next update. + + Returns + ------- + sec_to_next_update : float + Seconds to next update + """ + sec_to_next_update = self.seconds_to_next_update() + if sec_to_next_update < 10: + self.update_codebook() + return sec_to_next_update + def add_code_to(self, word, mode="ascii"): """ Generate and insert a code for the new word in DB-table CodeBook.