aqt.mediasrv
============

.. py:module:: aqt.mediasrv


Attributes
----------

.. autoapisummary::

   aqt.mediasrv.logger
   aqt.mediasrv.app
   aqt.mediasrv.DynamicRequest
   aqt.mediasrv.post_handler_list
   aqt.mediasrv.exposed_backend_list
   aqt.mediasrv.post_handlers


Classes
-------

.. autoapisummary::

   aqt.mediasrv.LocalFileRequest
   aqt.mediasrv.BundledFileRequest
   aqt.mediasrv.NotFound
   aqt.mediasrv.PageContext
   aqt.mediasrv.LegacyPage
   aqt.mediasrv.MediaServer


Functions
---------

.. autoapisummary::

   aqt.mediasrv.favicon
   aqt.mediasrv.handle_request
   aqt.mediasrv.is_sveltekit_page
   aqt.mediasrv.congrats_info
   aqt.mediasrv.get_deck_configs_for_update
   aqt.mediasrv.update_deck_configs
   aqt.mediasrv.get_scheduling_states_with_context
   aqt.mediasrv.set_scheduling_states
   aqt.mediasrv.import_done
   aqt.mediasrv.import_request
   aqt.mediasrv.import_csv
   aqt.mediasrv.import_anki_package
   aqt.mediasrv.import_json_file
   aqt.mediasrv.import_json_string
   aqt.mediasrv.search_in_browser
   aqt.mediasrv.change_notetype
   aqt.mediasrv.deck_options_require_close
   aqt.mediasrv.deck_options_ready
   aqt.mediasrv.save_custom_colours
   aqt.mediasrv.raw_backend_request
   aqt.mediasrv.legacy_page_data


Module Contents
---------------

.. py:data:: logger

.. py:data:: app

.. py:class:: LocalFileRequest

   .. py:attribute:: root
      :type:  str


   .. py:attribute:: path
      :type:  str


.. py:class:: BundledFileRequest

   .. py:attribute:: path
      :type:  str


.. py:class:: NotFound

   .. py:attribute:: message
      :type:  str


.. py:data:: DynamicRequest

.. py:class:: PageContext

   Bases: :py:obj:`enum.IntEnum`


   Enum where members are also (and must be) ints


   .. py:attribute:: UNKNOWN


   .. py:attribute:: EDITOR


   .. py:attribute:: REVIEWER


   .. py:attribute:: PREVIEWER


   .. py:attribute:: CARD_LAYOUT


   .. py:attribute:: DECK_OPTIONS


   .. py:attribute:: NON_LEGACY_PAGE


   .. py:attribute:: ADDON_PAGE


.. py:class:: LegacyPage

   .. py:attribute:: html
      :type:  str


   .. py:attribute:: context
      :type:  PageContext


.. py:class:: MediaServer(mw: aqt.main.AnkiQt)

   Bases: :py:obj:`threading.Thread`


   A class that represents a thread of control.

   This class can be safely subclassed in a limited fashion. There are two ways
   to specify the activity: by passing a callable object to the constructor, or
   by overriding the run() method in a subclass.



   .. py:attribute:: daemon
      :value: True


      A boolean value indicating whether this thread is a daemon thread.

      This must be set before start() is called, otherwise RuntimeError is
      raised. Its initial value is inherited from the creating thread; the
      main thread is not a daemon thread and therefore all threads created in
      the main thread default to daemon = False.

      The entire Python program exits when only daemon threads are left.




   .. py:attribute:: is_shutdown
      :value: False



   .. py:method:: run() -> None

      Method representing the thread's activity.

      You may override this method in a subclass. The standard run() method
      invokes the callable object passed to the object's constructor as the
      target argument, if any, with sequential and keyword arguments taken
      from the args and kwargs arguments, respectively.




   .. py:method:: shutdown() -> None


   .. py:method:: getPort() -> int


   .. py:method:: set_page_html(id: int, html: str, context: PageContext = PageContext.UNKNOWN) -> None


   .. py:method:: get_page(id: int) -> LegacyPage | None


   .. py:method:: get_page_html(id: int) -> str | None


   .. py:method:: get_page_context(id: int) -> PageContext | None


   .. py:method:: clear_page_html(id: int) -> None


.. py:function:: favicon() -> flask.Response

.. py:function:: handle_request(pathin: str) -> flask.Response

.. py:function:: is_sveltekit_page(path: str) -> bool

.. py:function:: congrats_info() -> bytes

.. py:function:: get_deck_configs_for_update() -> bytes

.. py:function:: update_deck_configs() -> bytes

.. py:function:: get_scheduling_states_with_context() -> bytes

.. py:function:: set_scheduling_states() -> bytes

.. py:function:: import_done() -> bytes

.. py:function:: import_request(endpoint: str) -> bytes

.. py:function:: import_csv() -> bytes

.. py:function:: import_anki_package() -> bytes

.. py:function:: import_json_file() -> bytes

.. py:function:: import_json_string() -> bytes

.. py:function:: search_in_browser() -> bytes

.. py:function:: change_notetype() -> bytes

.. py:function:: deck_options_require_close() -> bytes

.. py:function:: deck_options_ready() -> bytes

.. py:function:: save_custom_colours() -> bytes

.. py:data:: post_handler_list

.. py:data:: exposed_backend_list
   :value: ['latest_progress', 'get_custom_colours', 'get_deck_names', 'i18n_resources',...


.. py:function:: raw_backend_request(endpoint: str) -> collections.abc.Callable[[], bytes]

.. py:data:: post_handlers

.. py:function:: legacy_page_data() -> flask.Response

