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

Error: Downloader.get_instant_availability() missing 1 required positional argument: 'item_type' #921

Open
AdaptCharm opened this issue Nov 29, 2024 · 0 comments · May be fixed by #924
Open

Comments

@AdaptCharm
Copy link

OS:

Ubuntu 24.04.1 LTS

Riven version:

  • Backend: 0.20.1
  • Frontend: 0.17.0

More version details:

  • Docker: 27.3.1, build ce12230
  • Backend image: spoked/riven:dev
  • Frontend image: spoked/riven-frontend:latest

Reproduction steps:

  1. Navigate to http://localhost:3000/tv/95612
  2. Click the "Scrape Manually" button
  3. Paste the magnet link and/or click the "Fetch Streams" button

Expected result:

No TypeError exception should be thrown when initiating a manual scrape from the frontend.

Actual result:

TypeError: Downloader.get_instant_availability() missing 1 required positional argument: 'item_type'

Log:

Click to toggle
24-11-28 23:30:36 | 👾 API       | main.dispatch - POST /api/v1/items/retry - 200 - 0.33s
24-11-28 23:30:37 | 🐞 DEBUG     | event_manager.add_event_to_running - Added Item ID show_154955 to running events.
24-11-28 23:30:37 | 🐞 DEBUG     | event_manager.remove_event_from_running - Removed Item ID show_154955 from running events.
24-11-28 23:30:37 | 👾 API       | main.dispatch - GET /api/v1/items/95612 - 200 - 0.04s
24-11-28 23:31:10 | 👻 SCRAPER   | zilean.scrape - Found 3 streams for Home for Christmas
24-11-28 23:31:10 | 🤷‍ NOT_FOUND | torrentio.scrape - No streams found for Home for Christmas
24-11-28 23:31:10 | 👻 SCRAPER   | knightcrawler.scrape - Found 1 streams for Home for Christmas
24-11-28 23:31:11 | 👻 SCRAPER   | mediafusion.scrape - Found 18 streams for Home for Christmas
24-11-28 23:31:16 | 👻 SCRAPER   | orionoid.scrape - Found 5 streams for Home for Christmas
24-11-28 23:31:16 | 🐞 DEBUG     | __init__.scrape - Scraped Home for Christmas with 27 results, removed 8 duplicate hashes
24-11-28 23:31:16 | 👻 SCRAPER   | shared._parse_results - Processing 19 results for Home for Christmas
24-11-28 23:31:16 | 👻 SCRAPER   | shared._parse_results - Found 2 streams for Home for Christmas
24-11-28 23:31:16 | 👻 SCRAPER   | shared._parse_results - Kept 2 streams for Home for Christmas after processing bucket limit
24-11-28 23:31:16 | 🐞 DEBUG     | __init__.scrape - [Show] Parsed 'Home for Christmas' with rank 13150 (c24400c070b347a391c41b4e62c0610b7007d4fb): 'Home.for.Christmas.S01.NORWEGIAN.1080p.NF.WEBRip.DDP5.1.x264-STRiFE[rartv]'
24-11-28 23:31:16 | 🐞 DEBUG     | __init__.scrape - [Show] Parsed 'Home for Christmas' with rank 13150 (f0a46262336a370df4d785f2d9ab4500af17a3d3): 'Home.for.Christmas.S01.NORWEGIAN.720p.NF.WEBRip.DDP5.1.x264-STRiFE[rartv]'
24-11-28 23:31:16 | ❌ ERROR     | main.dispatch - Exception during request processing: Downloader.get_instant_availability() missing 1 required positional argument: 'item_type'
Traceback (most recent call last):

  File "/app/.venv/lib/python3.11/site-packages/anyio/streams/memory.py", line 111, in receive
    return self.receive_nowait()
           │    └ <function MemoryObjectReceiveStream.receive_nowait at 0x733dafd053a0>
           └ MemoryObjectReceiveStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_rece...
  File "/app/.venv/lib/python3.11/site-packages/anyio/streams/memory.py", line 106, in receive_nowait
    raise WouldBlock
          └ <class 'anyio.WouldBlock'>

anyio.WouldBlock


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/app/.venv/lib/python3.11/site-packages/anyio/streams/memory.py", line 124, in receive
    return receiver.item
           └ MemoryObjectItemReceiver(task_info=AsyncIOTaskInfo(id=126708557253888, name='Task-74'), item=None)

AttributeError: 'MemoryObjectItemReceiver' object has no attribute 'item'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 159, in call_next
    message = await recv_stream.receive()
                    │           └ <function MemoryObjectReceiveStream.receive at 0x733dafd05440>
                    └ MemoryObjectReceiveStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_rece...
  File "/app/.venv/lib/python3.11/site-packages/anyio/streams/memory.py", line 126, in receive
    raise EndOfStream
          └ <class 'anyio.EndOfStream'>

anyio.EndOfStream


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/riven/src/main.py", line 29, in dispatch
    response = await call_next(request)
                     │         └ <starlette.middleware.base._CachedRequest object at 0x733da1f90390>
                     └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x733da258d8a0>

  File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    raise app_exc
          └ TypeError("Downloader.get_instant_availability() missing 1 required positional argument: 'item_type'")
  File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
          │    │   │      │                      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x733da189dd00>
          │    │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x733da24b4f40>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('172.28.0.4', 8080), 'c...
          │    └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x733da7baa3d0>
          └ <__main__.LoguruMiddleware object at 0x733da6bd0f90>
  File "/app/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
          │                            │    │    │     │      │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x733da189dd00>
          │                            │    │    │     │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x733da24b4f40>
          │                            │    │    │     └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('172.28.0.4', 8080), 'c...
          │                            │    │    └ <starlette.requests.Request object at 0x733da16d1150>
          │                            │    └ <fastapi.routing.APIRouter object at 0x733da68d5510>
          │                            └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x733da7baa3d0>
          └ <function wrap_app_handling_exceptions at 0x733dae236480>
  File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x733da1c04f40>
          │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x733da24b4f40>
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('172.28.0.4', 8080), 'c...
          └ <fastapi.routing.APIRouter object at 0x733da68d5510>
  File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x733da1c04f40>
          │    │                │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x733da24b4f40>
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('172.28.0.4', 8080), 'c...
          │    └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x733da68d5510>>
          └ <fastapi.routing.APIRouter object at 0x733da68d5510>
  File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
    await route.handle(scope, receive, send)
          │     │      │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x733da1c04f40>
          │     │      │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x733da24b4f40>
          │     │      └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('172.28.0.4', 8080), 'c...
          │     └ <function Route.handle at 0x733dae237b00>
          └ APIRoute(path='/api/v1/scrape/scrape/{id}', name='scrape_item', methods=['GET'])
  File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
    await self.app(scope, receive, send)
          │    │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x733da1c04f40>
          │    │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x733da24b4f40>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('172.28.0.4', 8080), 'c...
          │    └ <function request_response.<locals>.app at 0x733da69aaac0>
          └ APIRoute(path='/api/v1/scrape/scrape/{id}', name='scrape_item', methods=['GET'])
  File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
          │                            │    │        │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x733da1c04f40>
          │                            │    │        │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x733da24b4f40>
          │                            │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('172.28.0.4', 8080), 'c...
          │                            │    └ <starlette.requests.Request object at 0x733da16d1bd0>
          │                            └ <function request_response.<locals>.app.<locals>.app at 0x733da1c06c00>
          └ <function wrap_app_handling_exceptions at 0x733dae236480>
  File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x733da1c07920>
          │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x733da24b4f40>
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('172.28.0.4', 8080), 'c...
          └ <function request_response.<locals>.app.<locals>.app at 0x733da1c06c00>
  File "/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
    response = await func(request)
                     │    └ <starlette.requests.Request object at 0x733da16d1bd0>
                     └ <function get_request_handler.<locals>.app at 0x733da69aac00>
  File "/app/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
                         └ <function run_endpoint_function at 0x733db10c5800>
  File "/app/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
                 │                 │         │       └ {'id': 'show_154955', 'request': <starlette.requests.Request object at 0x733da16d1bd0>}
                 │                 │         └ <function scrape_item at 0x733da6c0b420>
                 │                 └ <fastapi.dependencies.models.Dependant object at 0x733da6803990>
                 └ <function run_in_threadpool at 0x733dae42afc0>
  File "/app/.venv/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
                 │     │         │        │      └ ()
                 │     │         │        └ functools.partial(<function scrape_item at 0x733da6c0b420>, id='show_154955', request=<starlette.requests.Request object at 0...
                 │     │         └ <function run_sync at 0x733dafe97b00>
                 │     └ <module 'anyio.to_thread' from '/app/.venv/lib/python3.11/site-packages/anyio/to_thread.py'>
                 └ <module 'anyio' from '/app/.venv/lib/python3.11/site-packages/anyio/__init__.py'>
  File "/app/.venv/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
                 └ <function get_async_backend at 0x733dafe94a40>
  File "/app/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
    return await future
                 └ <Future finished exception=TypeError("Downloader.get_instant_availability() missing 1 required positional argument: 'item_typ...
  File "/app/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 943, in run
    result = context.run(func, *args)
             │       │   │      └ ()
             │       │   └ functools.partial(<function scrape_item at 0x733da6c0b420>, id='show_154955', request=<starlette.requests.Request object at 0...
             │       └ <method 'run' of '_contextvars.Context' objects>
             └ <_contextvars.Context object at 0x733da18d8a80>

  File "/riven/src/routers/secure/scrape.py", line 222, in scrape_item
    stream_containers = downloader.get_instant_availability([stream for stream in streams.keys()])
                        │          │                                              │       └ <method 'keys' of 'dict' objects>
                        │          │                                              └ {'c24400c070b347a391c41b4e62c0610b7007d4fb': <Stream #126708548193936
                        │          │                                                 id = None
                        │          │                                                 infohash = 'c24400c070b347a391c41b4e62c0610...
                        │          └ <function Downloader.get_instant_availability at 0x733da7ba6840>
                        └ <program.services.downloaders.Downloader object at 0x733da6821210>

TypeError: Downloader.get_instant_availability() missing 1 required positional argument: 'item_type'
24-11-28 23:31:17 | 👾 API       | main.dispatch - GET /api/v1/scrape/scrape/show_154955 - 500 - 6.73s
arao pushed a commit to arao/riven that referenced this issue Nov 30, 2024
Post updating debrid instant availability api fix in recent days,
manual scraping endpoints logic require modification to be compaitible
with updated models. In this commit, gap in models are addressed,
ensuring no model change is introduced, saving changes on UI end.

In longer term, it can be looked upon if model change need to be propagated
to UI as well.

[Testing]

Following testing mechanism is utilised.
- Setup riven, riven-frontend in docker env.
- Post correcting the issue, ensured manual scrapping and requested scrapping both are working optimally.
- Ensure Symlinks are generated and data is indexed in updater. Currently validated with plex only.
@arao arao linked a pull request Nov 30, 2024 that will close this issue
2 tasks
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 a pull request may close this issue.

1 participant