mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-03 17:10:59 +03:00
EDMC.py: Use monitor.journal_newest_filename()
This commit is contained in:
parent
a8e534c5ae
commit
43bae13418
10
EDMC.py
10
EDMC.py
@ -7,9 +7,8 @@ import json
|
|||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
from os.path import getmtime, join
|
from os.path import getmtime
|
||||||
from time import sleep, time
|
from time import sleep, time
|
||||||
from typing import TYPE_CHECKING, Any, List, Optional
|
from typing import TYPE_CHECKING, Any, List, Optional
|
||||||
|
|
||||||
@ -65,8 +64,6 @@ l10n.Translations.install_dummy()
|
|||||||
SERVER_RETRY = 5 # retry pause for Companion servers [s]
|
SERVER_RETRY = 5 # retry pause for Companion servers [s]
|
||||||
EXIT_SUCCESS, EXIT_SERVER, EXIT_CREDENTIALS, EXIT_VERIFICATION, EXIT_LAGGING, EXIT_SYS_ERR, EXIT_ARGS = range(7)
|
EXIT_SUCCESS, EXIT_SERVER, EXIT_CREDENTIALS, EXIT_VERIFICATION, EXIT_LAGGING, EXIT_SYS_ERR, EXIT_ARGS = range(7)
|
||||||
|
|
||||||
JOURNAL_RE = re.compile(r'^Journal(Beta)?\.[0-9]{12}\.[0-9]{2}\.log$')
|
|
||||||
|
|
||||||
|
|
||||||
def versioncmp(versionstring) -> List:
|
def versioncmp(versionstring) -> List:
|
||||||
"""Quick and dirty version comparison assuming "strict" numeric only version numbers."""
|
"""Quick and dirty version comparison assuming "strict" numeric only version numbers."""
|
||||||
@ -225,10 +222,7 @@ sys.path: {sys.path}'''
|
|||||||
monitor.currentdir = config.default_journal_dir
|
monitor.currentdir = config.default_journal_dir
|
||||||
|
|
||||||
logger.debug(f'logdir = "{monitor.currentdir}"')
|
logger.debug(f'logdir = "{monitor.currentdir}"')
|
||||||
logfiles = sorted((x for x in os.listdir(monitor.currentdir) if JOURNAL_RE.search(x)),
|
logfile = monitor.journal_newest_filename(monitor.currentdir)
|
||||||
key=lambda x: x.split('.')[1:])
|
|
||||||
|
|
||||||
logfile = join(monitor.currentdir, logfiles[-1])
|
|
||||||
|
|
||||||
logger.debug(f'Using logfile "{logfile}"')
|
logger.debug(f'Using logfile "{logfile}"')
|
||||||
with open(logfile, 'r', encoding='utf-8') as loghandle:
|
with open(logfile, 'r', encoding='utf-8') as loghandle:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user