Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions backend/Api/MdbListController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,19 @@ private static List<MdbListRating> FilterAndOrderRatings(List<MdbListRating> all
var result = new List<MdbListRating>();
foreach (var source in sources)
{
if (ratingsBySource.TryGetValue(source, out var rating))
var lookupSource = source;
if (string.Equals(source, "rtAudience", StringComparison.OrdinalIgnoreCase) ||
string.Equals(source, "tomatoes_audience", StringComparison.OrdinalIgnoreCase))
{
lookupSource = "popcorn";
}

if (ratingsBySource.TryGetValue(lookupSource, out var rating))
{
// Clone the rating object to prevent mutating the cached instance in memory
var ratingClone = new MdbListRating
{
Source = rating.Source,
Source = source,
Value = rating.Value,
Score = rating.Score,
Votes = rating.Votes,
Expand Down
3 changes: 2 additions & 1 deletion backend/Pages/configPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ <h3 class="sectionTitle">Web Plugin Status</h3>

var RATING_SOURCES = [
{ id: 'tomatoes', label: 'Rotten Tomatoes' },
{ id: 'rtAudience', label: 'RT Audience Score' },
{ id: 'tomatoes_audience', label: 'RT Audience Score' },
{ id: 'imdb', label: 'IMDb' },
{ id: 'tmdb', label: 'TMDB' },
{ id: 'metacritic', label: 'Metacritic' },
Expand All @@ -1044,6 +1044,7 @@ <h3 class="sectionTitle">Web Plugin Status</h3>
var ordered = [];
if (selectedIds && selectedIds.length > 0) {
selectedIds.forEach(function(id) {
if (id === 'rtAudience') id = 'tomatoes_audience';
var src = RATING_SOURCES.find(function(s) { return s.id === id; });
if (src) { ordered.push({ id: src.id, label: src.label, checked: true }); selectedSet[id] = true; }
});
Expand Down
11 changes: 11 additions & 0 deletions backend/Services/MoonfinSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ public MoonfinSettingsProfile ResolveProfile(MoonfinUserSettings settings, strin
}
}

if (resolved.MdblistRatingSources != null)
{
for (var i = 0; i < resolved.MdblistRatingSources.Count; i++)
{
if (string.Equals(resolved.MdblistRatingSources[i], "rtAudience", StringComparison.OrdinalIgnoreCase))
{
resolved.MdblistRatingSources[i] = "tomatoes_audience";
}
}
}

return resolved;
}

Expand Down
Loading