Skip to content

Improve media detection and support more TV filename formats#34

Open
mozartsempiano wants to merge 2 commits intojamerst:masterfrom
mozartsempiano:master
Open

Improve media detection and support more TV filename formats#34
mozartsempiano wants to merge 2 commits intojamerst:masterfrom
mozartsempiano:master

Conversation

@mozartsempiano
Copy link

  • Improve media detection, TMDB fallback, and CLI key handling
  • Support absolute TV episode filenames and more video formats

Copy link
Owner

@jamerst jamerst left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Some good improvements here, just a few minor comments

}

private static bool IsAlternateProcessorRetryableStatus(string status)
=> status.StartsWith("Error: Failed to parse required information from filename", StringComparison.OrdinalIgnoreCase)
Copy link
Owner

Choose a reason for hiding this comment

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

Using the status strings to determine the reason for failure doesn't feel great

Could update ProcessAsync to return a status enum instead (e.g. Success, ParseFailure, NotFound etc)?

if (config.RenameFiles && IsAlreadyNamedCorrectly(taggingFile, targetFileName))
{
ui.SetStatus("File skipped - already named correctly", MessageType.Information);
return true;
Copy link
Owner

Choose a reason for hiding this comment

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

This will skip tagging the file as well as renaming if the name is already correct. We should probably still tag even if the name is correct, or at least make it configurable if you think that's a useful feature?


private async Task<MovieFileMetadata> GetMovieMetadataAsync(SearchMovie selectedResult, bool fileIsTaggable)
{
TMDbMovie movie = await tmdb.GetMovieAsync(selectedResult.Id);
Copy link
Owner

Choose a reason for hiding this comment

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

Do we need to refetch the movie here? Or is this to support the search language option since the SearchMovie could be in a different language from the desired tag language?

If so could optimise slightly to avoid the extra call if the languages match?

{
var fullPath = Path.GetFullPath(file.Path);
var match = Regex.Match(fullPath, config.ParsePattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
if (!match.Success && fullPath.Contains(Path.DirectorySeparatorChar))
Copy link
Owner

Choose a reason for hiding this comment

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

What's the purpose of this? fullPath will always contain DirectorySeparatorChar?


public string Language { get; set; } = "en";

public List<string> SearchLanguages { get; set; } = [];
Copy link
Owner

Choose a reason for hiding this comment

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

Should add a command line option for this - it can only be set from the config file currently

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 this pull request may close these issues.

2 participants