rivenmedia / riven

Handle your Media Library with ease!
https://rivenmedia.github.io/wiki/
GNU General Public License v3.0
384 stars 51 forks source link

Episode/Shows not being created properly sometimes? #148

Closed dreulavelle closed 9 months ago

dreulavelle commented 9 months ago
Exception has occurred: AttributeError
'Program' object has no attribute 'core_manager'
  File "/home/spoked/docker/iceberg/backend/main.py", line 29, in run_in_thread
    yield
  File "/home/spoked/docker/iceberg/backend/main.py", line 55, in <module>
    app.program.start()
  File "/home/spoked/docker/iceberg/backend/program/__init__.py", line 36, in start
    self.core_manager = ServiceManager(self.media_items, True, Content, Plex, Scraping, Debrid, Symlinker)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/spoked/docker/iceberg/backend/utils/service_manager.py", line 10, in __init__
    self.initialize_services(services)
  File "/home/spoked/docker/iceberg/backend/utils/service_manager.py", line 28, in initialize_services
    new_service = service(self.media_items)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/spoked/docker/iceberg/backend/program/content/__init__.py", line 21, in __init__
    self._get_content()
  File "/home/spoked/docker/iceberg/backend/program/content/__init__.py", line 35, in _get_content
    service.run()
  File "/home/spoked/docker/iceberg/backend/program/content/overseerr.py", line 55, in run
    container = self.updater.create_items(new_items)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/spoked/docker/iceberg/backend/program/updaters/trakt.py", line 38, in create_items
    item = future.result()
           ^^^^^^^^^^^^^^^
  File "/home/spoked/docker/iceberg/backend/program/updaters/trakt.py", line 61, in _create_item
    item = create_item_from_imdb_id(imdb_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/spoked/docker/iceberg/backend/program/updaters/trakt.py", line 148, in create_item_from_imdb_id
    return _map_item_from_data(data, media_type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/spoked/docker/iceberg/backend/program/updaters/trakt.py", line 112, in _map_item_from_data
    item["number"] = getattr(data, "number")
                     ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'types.SimpleNamespace' object has no attribute 'number'

During handling of the above exception, another exception occurred:

  File "/home/spoked/docker/iceberg/backend/program/__init__.py", line 61, in stop
    for service in self.core_manager.services:
                   ^^^^^^^^^^^^^^^^^
  File "/home/spoked/docker/iceberg/backend/main.py", line 31, in run_in_thread
    app.program.stop()
  File "/home/spoked/docker/iceberg/backend/main.py", line 53, in <module>
    with server.run_in_thread():
AttributeError: 'Program' object has no attribute 'core_manager

line 112 of trakt is,

        case "episode":
            item["number"] = getattr(data, "number")
            return_item = Episode(item)

item imdb_id is tt1475582 which shows as a show from trakt reponse but ends up as an episode type

dreulavelle commented 9 months ago

trakt response for that that imdb id

https://api.trakt.tv/search/imdb/tt1475582?extended=full

[
    {
        "type": "show",
        "score": 1000,
        "show": {
            "title": "Sherlock",
            "year": 2010,
            "ids": {
                "trakt": 19792,
                "slug": "sherlock",
                "tvdb": 176941,
                "imdb": "tt1475582",
                "tmdb": 19885,
                "tvrage": 23433
            },
            "tagline": "A new sleuth for the 21st century.",
            "overview": "A modern update finds the famous sleuth and his doctor partner solving crime in 21st century London.",
            "first_aired": "2010-07-25T20:00:00.000Z",
            "airs": {
                "day": "Sunday",
                "time": "21:00",
                "timezone": "Europe/London"
            },
            "runtime": 90,
            "certification": "TV-14",
            "network": "BBC One",
            "country": "gb",
            "trailer": "https://youtube.com/watch?v=xK7S9mrFWL4",
            "homepage": "http://www.bbc.co.uk/programmes/b018ttws",
            "status": "ended",
            "rating": 8.92132,
            "votes": 45807,
            "comment_count": 146,
            "updated_at": "2024-01-18T19:39:25.000Z",
            "language": "en",
            "available_translations": [
                "ar",
                "bg",
                "...."
            ],
            "genres": [
                "drama",
                "crime",
                "mystery"
            ],
            "aired_episodes": 12
        }
    }
]
dreulavelle commented 9 months ago

for context, I have a lot of episodes from it, but missing some episodes..

overseerr shows.. image

dreulavelle commented 9 months ago

Sherlock is the one it messes up on, but Kakasanti has shown that his scrapes/downloads just fine 🤔

[2024-01-19 05:43:48 | DEBUG] <realdebrid._download_item> - Downloaded Sherlock S01
[2024-01-19 05:43:55 | DEBUG] <realdebrid._download_item> - Downloaded Sherlock S02
[2024-01-19 05:43:58 | DEBUG] <realdebrid._download_item> - Downloaded Sherlock S03
[2024-01-19 05:44:01 | DEBUG] <realdebrid._download_item> - Downloaded Sherlock S04
dreulavelle commented 9 months ago

Need to have content service pass item type along with imdb id. Currently grabbing the first item from trakt when searching, can return the wrong thing.