diff --git a/README.md b/README.md index f5ee31d..5f3d52b 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,18 @@ TCDD bilet yer kontrol programi sayesinde tcdd sitesine surekli girmek zorunda k ## Indir -[![Download - v2.2.1](https://img.shields.io/static/v1?label=Download&message=v2.2.1&color=2ea44f)](https://github.com/mcagriaksoy/tcdd-bilet-yer-kontrol/releases/download/v2.2.1/TCDD.Bilet.Bulma.Botu.v2.2.1.zip) +[![Download - v2.3](https://img.shields.io/static/v1?label=Download&message=v2.2.1&color=2ea44f)](https://github.com/mcagriaksoy/tcdd-bilet-yer-kontrol/releases/download/v2.2.1/TCDD.Bilet.Bulma.Botu.v2.2.1.zip) ## Versionlar +v2.3 +Bir Edge webdriver sorunu cozuldu. +Webdriver artik sayfanin yuklenmesini daha cok bekliyor. +Koltuk sayisini bulan regex algoritmasi yeniden yazildi. +UI tarafi: + - Artik kullanici saati 17,30 17.30 veya 17:30 cinsinde girebiliyor. + - Ayni sekilde tarihler -, ., / cinsinden de yazilabiliyor. + - Hata durumlari icin mekanizma eklendi. + v2.2.1 Chrome kaldirildi. Artik Edge ile tarama yapiliyor. Seleniumdan kaynaklanan bir hata sebebiyle .exe surumu bozuldu. Gecici sureyle GUI arkasinda konsol cikacak. diff --git a/src/DriverSetting.py b/src/DriverSetting.py index 1123f94..0ab669b 100644 --- a/src/DriverSetting.py +++ b/src/DriverSetting.py @@ -9,9 +9,17 @@ class DriverSetting: """Driver'ı ayarlar.""" + driver = None def driver_init(self): options = EdgeOptions() options.add_experimental_option('excludeSwitches', ['enable-logging']) - driver = Edge(service=EdgeService(EdgeChromiumDriverManager().install()), options=options) - return driver + options.add_experimental_option("detach", True) + self.driver = Edge(service=EdgeService(EdgeChromiumDriverManager().install()), options=options) + return self.driver + + def driver_quit(self): + self.driver.quit() + self.driver = None + return self.driver + diff --git a/src/__pycache__/Control.cpython-311.pyc b/src/__pycache__/Control.cpython-311.pyc deleted file mode 100644 index c00e35f..0000000 Binary files a/src/__pycache__/Control.cpython-311.pyc and /dev/null differ diff --git a/src/__pycache__/DriverGet.cpython-311.pyc b/src/__pycache__/DriverGet.cpython-311.pyc deleted file mode 100644 index 423cf7e..0000000 Binary files a/src/__pycache__/DriverGet.cpython-311.pyc and /dev/null differ diff --git a/src/__pycache__/DriverSetting.cpython-311.pyc b/src/__pycache__/DriverSetting.cpython-311.pyc deleted file mode 100644 index 0e7eed8..0000000 Binary files a/src/__pycache__/DriverSetting.cpython-311.pyc and /dev/null differ diff --git a/src/__pycache__/Rota.cpython-311.pyc b/src/__pycache__/Rota.cpython-311.pyc deleted file mode 100644 index d1e97f4..0000000 Binary files a/src/__pycache__/Rota.cpython-311.pyc and /dev/null differ diff --git a/src/__pycache__/Sehirler.cpython-311.pyc b/src/__pycache__/Sehirler.cpython-311.pyc deleted file mode 100644 index e909160..0000000 Binary files a/src/__pycache__/Sehirler.cpython-311.pyc and /dev/null differ diff --git a/src/__pycache__/error_codes.cpython-311.pyc b/src/__pycache__/error_codes.cpython-311.pyc deleted file mode 100644 index 6fdd56e..0000000 Binary files a/src/__pycache__/error_codes.cpython-311.pyc and /dev/null differ diff --git a/src/__pycache__/ui.cpython-311.pyc b/src/__pycache__/ui.cpython-311.pyc deleted file mode 100644 index 3939ebf..0000000 Binary files a/src/__pycache__/ui.cpython-311.pyc and /dev/null differ diff --git a/src/main.spec b/src/main.spec new file mode 100644 index 0000000..ac83afd --- /dev/null +++ b/src/main.spec @@ -0,0 +1,44 @@ +# -*- mode: python ; coding: utf-8 -*- + + +block_cipher = None + + +a = Analysis( + ['main.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False, +) +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + [], + name='main', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=False, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) diff --git a/src/sound/beep.mp3 b/src/sound/beep.mp3 deleted file mode 100644 index 99808c8..0000000 Binary files a/src/sound/beep.mp3 and /dev/null differ diff --git a/src/sound/notification.mp3 b/src/sound/notification.mp3 deleted file mode 100644 index 75c0579..0000000 Binary files a/src/sound/notification.mp3 and /dev/null differ diff --git a/src/ui.py b/src/ui.py index adb54b7..2c7e885 100644 --- a/src/ui.py +++ b/src/ui.py @@ -22,6 +22,7 @@ import error_codes as ErrCodes import PySimpleGUI as sg +g_isStopped = False def main(): def driver_setting(): @@ -35,7 +36,7 @@ def driver_get(drivers): def route(driver, first_location, last_location, date): """ Rota bilgilerini alır ve gerekli yerlere yazar.""" "" isError = Rota.Rota(driver, first_location, last_location, date).dataInput() - if isError == -1: + if isError == -1 or g_isStopped == True: window["Aramaya Başla"].update(disabled=False) window["Durdur!"].update(disabled=True) driver.quit() @@ -43,10 +44,10 @@ def route(driver, first_location, last_location, date): def kill_chrome(): """Chrome'u kapatır.""" - if platform == "win32": - system("taskkill /im chrome.exe /f") + if platform.system() == "Windows": + system("taskkill /im chromium.exe /f") else: - system("pkill chrome") + system("pkill chromium") def control(driver, time, delay_time, telegram_msg, bot_token, chat_id, ses): """Sayfada yer var mı yok mu kontrol eder.""" @@ -174,6 +175,9 @@ def control(driver, time, delay_time, telegram_msg, bot_token, chat_id, ses): def thread1(delay_time, telegram_msg, bot_token, chat_id, ses): """Arama dongusu!""" + global g_isStopped + g_isStopped = False + while True: """ Arama dongusu!""" driver = driver_setting() @@ -185,9 +189,6 @@ def thread1(delay_time, telegram_msg, bot_token, chat_id, ses): def thread2(): """Durdurma dongusu!""" window["log"].update(value="") - # Control.Control(data, None).kill_driver() - kill_chrome() - print("Web Surucusu Kapandi!") while True: event, values = window.read() @@ -200,6 +201,8 @@ def thread2(): if event == "Durdur!": window["Aramaya Başla"].update(disabled=False) window["Durdur!"].update(disabled=True) + global g_isStopped + g_isStopped = True t2 = Thread(target=thread2) t2.start()