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

Letterboxd: skip miniseries and TV Shows #102

Closed
wants to merge 1 commit into from
Closed

Letterboxd: skip miniseries and TV Shows #102

wants to merge 1 commit into from

Conversation

miguelamaral
Copy link

Letterboxd have limited support for TV, which means the module will choke if a list contains a miniseries or TV Show, as they have empty data-tmdb-id attributes:

<body data-type="film" data-tmdb-type="movie" data-tmdb-id="">

See Small Axe or Wandavision. You can quickly test this by importing this list:

Processing Letterboxd List: https://letterboxd.com/randomfunnyname/list/small-axe
Traceback (most recent call last):
  File "[...]/.apps/plex-meta-manager/modules/config.py", line 463, in update_libraries
    builder.run_methods(collection_obj, collection_name, rating_key_map, movie_map, show_map)
  File "[...]/.apps/plex-meta-manager/modules/builder.py", line 744, in run_methods
    elif "letterboxd" in method:                        items_found += check_map(self.config.Letterboxd.get_items(method, value, self.library.Plex.language))
  File "[...]/.apps/plex-meta-manager/modules/letterboxd.py", line 52, in get_items
    movie_ids.append(self.get_tmdb_from_slug(slug, language))
  File "[...]/.apps/plex-meta-manager/modules/letterboxd.py", line 30, in get_tmdb_from_slug
    return self.get_tmdb(f"{self.url}{slug}", language)
  File "[...]/.apps/plex-meta-manager/modules/letterboxd.py", line 36, in get_tmdb
    return int(ids[0])
ValueError: invalid literal for int() with base 10: ''

Unknown Error: invalid literal for int() with base 10: ''

Also fixes a typo — header argument in send_request — and calls get_tmdb_from_slug instead of get_tmdb, which prevented the module from running at all in the first place.

Bear in mind my python knowledge is next to nonexistent, so there's probably a more robust way to address this.

Skip Miniseries / TV Shows, which have empty data-tmdb-id attributes. See: https://letterboxd.com/film/wandavision
@meisnate12
Copy link
Member

i mean you did a damn good job at figuring all that out I actually noticed your fork and already submitted the changes a little different to dev. There just wasn't a need for different error messages. but I appreciate you catching these bugs!

@meisnate12 meisnate12 closed this Mar 11, 2021
@miguelamaral
Copy link
Author

miguelamaral commented Mar 11, 2021

Ah, that's great! I switched from PAC and I've been enjoying this immensely, thanks for all the work!

Also, are there plans to cache Letterboxd data? Caching the Letterboxd film id [1] as a GUID once it's matched with TMDb, so the importer doesn't need to go through every film page every time it's run.

I've looked at https://github.com/meisnate12/Plex-Meta-Manager/blob/master/modules/cache.py but I doubt I could get that working on my own.

[1] Films have the data-film-id attribute in list pages as well so it should be relatively simple. Slugs could work too, but they can change.

@miguelamaral miguelamaral deleted the develop-letterboxd branch March 11, 2021 22:12
@meisnate12
Copy link
Member

Yea I could get that added to the cache. I would much enjoy not visiting every url of every movie on the list lol

This actually gives me some ideas for other parts of the program to go in the cache.

I'll see what I can get to this weekend.

meisnate12 added a commit that referenced this pull request Mar 12, 2021
@meisnate12
Copy link
Member

ok added the cache to develop and a better checking for TV Shows

meisnate12 added a commit that referenced this pull request Mar 12, 2021
@miguelamaral
Copy link
Author

Seems to be working! Had to update Letterboxd = LetterboxdAPI(self.Cache) though.

https://github.com/meisnate12/Plex-Meta-Manager/blob/develop/modules/config.py#L232

Is this right?

meisnate12 added a commit that referenced this pull request Mar 12, 2021
@meisnate12
Copy link
Member

i ended up doing it slightly differently for consistency but yea you were right

@miguelamaral
Copy link
Author

Running smoothly, thanks again!

There's a typo: if self.config.Cache: https://github.com/meisnate12/Plex-Meta-Manager/blob/a919a1bb5919973b7d15f641c57907ead98e6aec/modules/letterboxd.py#L68

Unrelated question, would it be possible to filter using (substrings of) filenames? I'm not sure the API has access to that data?

@meisnate12
Copy link
Member

Yea I think so the api has access to the file name of the movie

meisnate12 added a commit that referenced this pull request Mar 13, 2021
@meisnate12 meisnate12 mentioned this pull request Mar 13, 2021
@meisnate12 meisnate12 added bug Bug is with Plex Meta Manager enhancement New feature or request labels Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug is with Plex Meta Manager enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants