mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-17 21:44:48 -04:00
Fix: Aphrodite UI enhancements
* New: Display UI before movies have loaded * Revised webpack bundling * New: Option for production build with profiling * Fixed: Faster hasDifferentItems and specialized OrOrder version * Fixed: Faster movie selector * Fixed: Speed up release processing, add indices (migration 161) * Fixed: Use a worker for UI fuzzy search * Fixed: Don't loop over all movies if we know none selected * Fixed: Strip UrlBase from UI events before sending to sentry Should mean that source maps are picked up correctly. * Better selection of jump bar items Show first, last and most common items * Fixed: Don't repeatedly re-render cells * Rework Movie Index and virtualTable * Corresponding improvements for AddListMovie and ImportMovie
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(161)]
|
||||
public class speed_improvements : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
// Auto indices SQLite is creating
|
||||
Create.Index("IX_MovieFiles_MovieId").OnTable("MovieFiles").OnColumn("MovieId");
|
||||
Create.Index("IX_AlternativeTitles_MovieId").OnTable("AlternativeTitles").OnColumn("MovieId");
|
||||
|
||||
// Speed up release processing (these are present in Sonarr)
|
||||
Create.Index("IX_Movies_CleanTitle").OnTable("Movies").OnColumn("CleanTitle");
|
||||
Create.Index("IX_Movies_ImdbId").OnTable("Movies").OnColumn("ImdbId");
|
||||
Create.Index("IX_Movies_TmdbId").OnTable("Movies").OnColumn("TmdbId");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Movies.AlternativeTitles;
|
||||
using NzbDrone.Core.Parser.RomanNumerals;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using CoreParser = NzbDrone.Core.Parser.Parser;
|
||||
|
||||
namespace NzbDrone.Core.Movies
|
||||
{
|
||||
@@ -18,6 +17,7 @@ namespace NzbDrone.Core.Movies
|
||||
bool MoviePathExists(string path);
|
||||
Movie FindByTitle(string cleanTitle);
|
||||
Movie FindByTitle(string cleanTitle, int year);
|
||||
List<Movie> FindByTitleInexact(string cleanTitle);
|
||||
Movie FindByImdbId(string imdbid);
|
||||
Movie FindByTmdbId(int tmdbid);
|
||||
Movie FindByTitleSlug(string slug);
|
||||
@@ -169,7 +169,6 @@ namespace NzbDrone.Core.Movies
|
||||
string cleanTitleWithRomanNumbers = cleanTitle;
|
||||
string cleanTitleWithArabicNumbers = cleanTitle;
|
||||
|
||||
|
||||
foreach (ArabicRomanNumeral arabicRomanNumeral in RomanNumeralParser.GetArabicRomanNumeralsMapping())
|
||||
{
|
||||
string arabicNumber = arabicRomanNumeral.ArabicNumeralAsString;
|
||||
@@ -182,23 +181,27 @@ namespace NzbDrone.Core.Movies
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result =
|
||||
Query.Where(movie => movie.CleanTitle == cleanTitleWithArabicNumbers).FirstWithYear(year) ??
|
||||
Query.Where(movie => movie.CleanTitle == cleanTitleWithRomanNumbers).FirstWithYear(year);
|
||||
result = Query.Where(movie => movie.CleanTitle == cleanTitleWithArabicNumbers || movie.CleanTitle == cleanTitleWithRomanNumbers)
|
||||
.FirstWithYear(year);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
|
||||
result = Query.Join<Movie, AlternativeTitle>(JoinType.Inner, m => m.AlternativeTitles, (m, t) => m.Id == t.MovieId)
|
||||
.Where(t => t.CleanTitle == cleanTitle || t.CleanTitle == cleanTitleWithArabicNumbers || t.CleanTitle == cleanTitleWithRomanNumbers)
|
||||
result = Query.Where<AlternativeTitle>(t => t.CleanTitle == cleanTitle || t.CleanTitle == cleanTitleWithArabicNumbers || t.CleanTitle == cleanTitleWithRomanNumbers)
|
||||
.FirstWithYear(year);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Movie> FindByTitleInexact(string cleanTitle)
|
||||
{
|
||||
var mapper = _database.GetDataMapper();
|
||||
mapper.AddParameter("queryTitle", cleanTitle);
|
||||
|
||||
return AddJoinQueries(mapper.Query<Movie>()).Where($"instr(@queryTitle, [t0].[CleanTitle])");
|
||||
}
|
||||
|
||||
public Movie FindByTmdbId(int tmdbid)
|
||||
{
|
||||
return Query.Where(m => m.TmdbId == tmdbid).FirstOrDefault();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -26,6 +25,7 @@ namespace NzbDrone.Core.Movies
|
||||
Movie AddMovie(Movie newMovie);
|
||||
List<Movie> AddMovies(List<Movie> newMovies);
|
||||
Movie FindByImdbId(string imdbid);
|
||||
Movie FindByTmdbId(int tmdbid);
|
||||
Movie FindByTitle(string title);
|
||||
Movie FindByTitle(string title, int year);
|
||||
Movie FindByTitleInexact(string title, int? year);
|
||||
@@ -58,7 +58,6 @@ namespace NzbDrone.Core.Movies
|
||||
private readonly IImportExclusionsService _exclusionService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
|
||||
public MovieService(IMovieRepository movieRepository,
|
||||
IEventAggregator eventAggregator,
|
||||
IBuildFileNames fileNameBuilder,
|
||||
@@ -167,7 +166,7 @@ namespace NzbDrone.Core.Movies
|
||||
newMovie.PathState = defaultState == MoviePathState.Dynamic ? MoviePathState.StaticOnce : MoviePathState.Static;
|
||||
}
|
||||
|
||||
_logger.Info("Adding Movie {0} Path: [{1}]", newMovie, newMovie.Path);
|
||||
_logger.Info("Adding Movie {0} Path: [{1}]", newMovie, newMovie.Path);
|
||||
|
||||
newMovie.CleanTitle = newMovie.Title.CleanSeriesTitle();
|
||||
newMovie.SortTitle = MovieTitleNormalizer.Normalize(newMovie.Title, newMovie.TmdbId);
|
||||
@@ -232,12 +231,16 @@ namespace NzbDrone.Core.Movies
|
||||
return _movieRepository.FindByImdbId(imdbid);
|
||||
}
|
||||
|
||||
public Movie FindByTmdbId(int tmdbid)
|
||||
{
|
||||
return _movieRepository.FindByTmdbId(tmdbid);
|
||||
}
|
||||
|
||||
private List<Movie> FindByTitleInexactAll(string title)
|
||||
{
|
||||
// find any movie clean title within the provided release title
|
||||
string cleanTitle = title.CleanSeriesTitle();
|
||||
var list = _movieRepository.All().Where(s => cleanTitle.Contains(s.CleanTitle))
|
||||
.Union(_movieRepository.All().Where(s => s.CleanTitle.Contains(cleanTitle))).ToList();
|
||||
var list = _movieRepository.FindByTitleInexact(cleanTitle);
|
||||
if (!list.Any())
|
||||
{
|
||||
// no movie matched
|
||||
@@ -258,8 +261,6 @@ namespace NzbDrone.Core.Movies
|
||||
.Select(s => s.movie)
|
||||
.ToList();
|
||||
|
||||
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using FluentValidation.Validators;
|
||||
using NzbDrone.Core.Movies;
|
||||
|
||||
@@ -20,7 +19,7 @@ namespace NzbDrone.Core.Validation.Paths
|
||||
|
||||
int tmdbId = (int)context.PropertyValue;
|
||||
|
||||
return (!_movieService.GetAllMovies().Exists(s => s.TmdbId == tmdbId));
|
||||
return (_movieService.FindByTmdbId(tmdbId) == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user