Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustomTkinter kullanarak GUI ekledim. #75

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

qweeren
Copy link

@qweeren qweeren commented Nov 18, 2024

Bu fork ile projeye ctk kullanarak projeye gui ekledim. cli ile yapılabilen çoğu şey gui üzerinden yapılabiliyor. gelecekte ayarlar sekmesi ekleyeceğim

qweeren and others added 26 commits November 17, 2024 22:51
bölüm fetchleme bozuk, düzeltemedim. yatıyorum. yarın bakarım
anime listing, episode listing, and episode streaming through mpv
to-do:
watch history
better gui
anime list pagination
downloading
no more simultaneous streaming bug.
fixed how pages work
…ith Fetch API

Previously, the `fetch_info` method in the `Anime` class used `execute_script` with `$.get` to fetch anime information. This approach caused a `JavascriptException` because:

- The `$.get` method is asynchronous, but `execute_script` expects synchronous execution.
- jQuery (`$`) might not be defined on the page, leading to an undefined reference.

To resolve this issue, the `fetch_info` method has been modified to use `execute_async_script` with the Fetch API, which handles asynchronous operations properly.

**Changes Made:**

- Replaced the use of `execute_script` with `execute_async_script` to accommodate asynchronous execution.
- Utilized the Fetch API to perform a GET request to `/anime/{self.slug}`.
- Implemented a callback function to return the fetched data back to the Python code.
- Added error handling to catch any exceptions during the fetch operation and return `null` if the fetch fails.
- Checked if the returned data is `None` and raised an exception if necessary.

**Benefits:**

- Fixes the `JavascriptException` caused by the improper handling of asynchronous JavaScript code.
- Eliminates the dependency on jQuery, ensuring compatibility even if jQuery is not loaded on the page.
- Enhances the reliability of fetching anime information by correctly handling asynchronous requests.

**Tested By:**

- Running the application and selecting various anime to ensure that the episode lists load correctly without errors.
- Verifying that the error no longer occurs and that the application functions as expected.

**References:**

- Selenium documentation on `execute_async_script`: https://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webdriver.WebDriver.execute_async_script
- Fetch API documentation: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

This commit ensures that the anime information is fetched reliably and resolves the issues related to asynchronous JavaScript execution.
@KebabLord
Copy link
Owner

Çaban için teşekkürler, üstünde baya vakit harcamışsın gibi görünüyor.
Lakin seninki artık bambaşka bir repo olmuş, bununla merge'lemek bana mantıksız geldi.

Repo'nu çalıştıramadım:

λ py turkanime_gui/main.py
Traceback (most recent call last):
  File "/home/owo/Github/ta_gui/turkanime_gui/main.py", line 2, in <module>
    from turkanime_api.objects import Anime
  File "/home/owo/Github/ta_gui/turkanime_gui/turkanime_api/__init__.py", line 2, in <module>
    from .objects import Anime,Bolum,Video
  File "/home/owo/Github/ta_gui/turkanime_gui/turkanime_api/objects.py", line 104
    info_table=re.findall(r'<div id="animedetay">(<table.*?</table>)',src)[0]
IndentationError: unexpected indent

Eğer ufak sorunları giderip çalışır vaziyete getirirsen bu repo'nun README kısmına yönlendirici bir link koyabilirim.

Senin fork'ta bir de pek çok silinmesi gereken dosya var .zip, .toc, .pyc, .pkg, .html uzantılı
repo'nun boyutu tam 122.46 megabyte artmış ve git geçmişinde 120bin satırlık diff var, incelemeyi güç kılıyor.

Tekrardan eforların için teşekkür ederim ama, kulağa güzel geliyor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants