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

New: if search results empty, use GetMovieByImdbId #9810

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

edwinbernadus
Copy link

Database Migration

NO

Description

Implement find by imdb id if search result is empty

Note: This is my first PR on this repo.
I'm aware that the issue is still on "Need Triage Status"
feel free to drop the PR. alternative suggestions are welcome.

Screenshot (if UI related)

NO

Todos

  • Tests

Issues Fixed or Closed by this PR

Copy link
Contributor

@bakerboy448 bakerboy448 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on 427 already does an IMDb search..? Why is this change needed? To not need the prefix?

Should this be done for tmdb too?

@edwinbernadus
Copy link
Author

  1. yes, the motivation of the PR is searching without prefix
  2. based on the ticket issue, only serve IMDB.
  3. i agree should be done for tmdb
    (since this is my first PR, i dont want to change more than issue ticket requirement)

should i go continue the PR?

Comment on lines 516 to 534
// if output is zero and format is ttXXXXXXXX, use GetMovieByImdbId
if (output.Count == 0 && title.Length == 10 && title.StartsWith("tt"))
{
var imdbid = title;
try
{
var movieLookup = GetMovieByImdbId(imdbid);
return new List<Movie>
{
new Movie { MovieMetadata = movieLookup }
};
}
catch (MovieNotFoundException)
{
return new List<Movie>();
}
}

return output;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, sounds good.

Just like #9754, I would rather prefer for this to happen in the MovieLookupController.

We like documented code, but that comment can be removed. output is somewhat confusing, and I think we should check if StartsWith("tt") and ^tt\d{7,8}$.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok got it. i'll edit it
thank you for the review

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need advise,
should i move the main logic to SkyHookProxy.cs ?

@github-actions github-actions bot added the Area: API Issue is related to the API label Feb 29, 2024
INamingConfigService namingService,
IMapCoversToLocal coverMapper,
IConfigService configService)
IProvideMovieInfo movieInfo,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we reformatting?

@@ -49,7 +51,9 @@ public object SearchByTmdbId(int tmdbId)
{
var availDelay = _configService.AvailabilityDelay;
var result = new Movie { MovieMetadata = _movieInfo.GetMovieInfo(tmdbId).Item1 };
var translation = result.MovieMetadata.Value.Translations.FirstOrDefault(t => t.Language == (Language)_configService.MovieInfoLanguage);
var translation =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we reformatting?

@@ -59,18 +63,40 @@ public object SearchByImdbId(string imdbId)
var result = new Movie { MovieMetadata = _movieInfo.GetMovieByImdbId(imdbId) };

var availDelay = _configService.AvailabilityDelay;
var translation = result.MovieMetadata.Value.Translations.FirstOrDefault(t => t.Language == (Language)_configService.MovieInfoLanguage);
var translation =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we reformatting?

@@ -79,12 +105,14 @@ private IEnumerable<MovieResource> MapToResource(IEnumerable<Movie> movies)

foreach (var currentMovie in movies)
{
var translation = currentMovie.MovieMetadata.Value.Translations.FirstOrDefault(t => t.Language == movieInfoLanguage);
var translation =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we reformatting?

var resource = currentMovie.ToResource(availDelay, translation);

_coverMapper.ConvertToLocalUrls(resource.Id, resource.Images);

var poster = currentMovie.MovieMetadata.Value.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Poster);
var poster =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we reformatting?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, this is unintended.
I'm gonna revert it

I think maybe automatic from the jetbrain IDE. Apologize for these one

@edwinbernadus
Copy link
Author

ready for review

  • jetbrain rider make me accidently do reformatting (sorry my bad, didn't check it again)
  • need more advise on some points
  1. PopulateFromImdbIfEmpty, what better name for this method
  2. where should i put this logic ? on the SkyHookProxy.cs or controller ?

@bakerboy448
Copy link
Contributor

Build fails..?

@bakerboy448 bakerboy448 removed their request for review March 1, 2024 13:44
@edwinbernadus
Copy link
Author

Build fails..?

fixed.
but i is still dont know how to solve Radarr.Radarr (Integration Integration Native FreeBSD) negative test

@mynameisbogdan
Copy link
Collaborator

Don't worry about that one, it's very flakey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: API Issue is related to the API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search by IMDB id without the prefix "imdb:"
3 participants