Skip to content

Commit

Permalink
Hide the auto update btn #236
Browse files Browse the repository at this point in the history
Fixed where we were not populating the emby episodes #435

Fixed #1048 issue 1,2,4
  • Loading branch information
tidusjar committed Feb 3, 2017
1 parent f60eec4 commit 16b6b6a
Show file tree
Hide file tree
Showing 8 changed files with 1,757 additions and 1,746 deletions.
2 changes: 1 addition & 1 deletion Ombi.Api.Models/Emby/EmbyEpisodeInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class EmbyEpisodeInformation
public object[] Taglines { get; set; }
public object[] Genres { get; set; }
public string[] SeriesGenres { get; set; }
public int CommunityRating { get; set; }
public float CommunityRating { get; set; }
public int VoteCount { get; set; }
public long RunTimeTicks { get; set; }
public string PlayAccess { get; set; }
Expand Down
4 changes: 3 additions & 1 deletion Ombi.Services/Jobs/EmbyAvailabilityChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ public async Task<IEnumerable<EmbyEpisodes>> GetEpisodes(int theTvDbId)
var ep = await EpisodeRepo.CustomAsync(async connection =>
{
connection.Open();
var result = await connection.QueryAsync<EmbyEpisodes>("select * from EmbyEpisodes where ProviderId = @ProviderId", new { ProviderId = theTvDbId });
var result = await connection.QueryAsync<EmbyEpisodes>(@"select ee.* from EmbyEpisodes ee inner join EmbyContent ec
on ee.ParentId = ec.EmbyId
where ec.ProviderId = @ProviderId", new { ProviderId = theTvDbId });

return result;
});
Expand Down
24 changes: 5 additions & 19 deletions Ombi.Services/Jobs/EmbyEpisodeCacher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public void CacheEpisodes(EmbySettings settings)
{
var epInfo = EmbyApi.GetInformation(ep.Id, EmbyMediaType.Episode, settings.ApiKey,
settings.AdministratorId, settings.FullUri);
if (epInfo.EpisodeInformation?.ProviderIds?.Tvdb == null)
{
continue;
}
model.Add(new EmbyEpisodes
{
EmbyId = ep.Id,
Expand All @@ -82,7 +86,7 @@ public void CacheEpisodes(EmbySettings settings)
EpisodeTitle = ep.Name,
ParentId = ep.SeriesId,
ShowTitle = ep.SeriesName,
ProviderId = epInfo.EpisodeInformation.ProviderIds.Tmdb
ProviderId = epInfo.EpisodeInformation.ProviderIds.Tvdb
});
}

Expand All @@ -108,15 +112,6 @@ public void Start()
return;
}

var jobs = Job.GetJobs();
var job = jobs.FirstOrDefault(x => x.Name.Equals(JobNames.EmbyEpisodeCacher, StringComparison.CurrentCultureIgnoreCase));
if (job != null)
{
if (job.LastRun > DateTime.Now.AddHours(-11)) // If it's been run in the last 11 hours
{
return;
}
}
Job.SetRunning(true, JobNames.EmbyEpisodeCacher);
CacheEpisodes(s);
}
Expand All @@ -141,15 +136,6 @@ public void Execute(IJobExecutionContext context)
return;
}

var jobs = Job.GetJobs();
var job = jobs.FirstOrDefault(x => x.Name.Equals(JobNames.EmbyEpisodeCacher, StringComparison.CurrentCultureIgnoreCase));
if (job != null)
{
if (job.LastRun > DateTime.Now.AddHours(-11)) // If it's been run in the last 11 hours
{
return;
}
}
Job.SetRunning(true, JobNames.EmbyEpisodeCacher);
CacheEpisodes(s);
}
Expand Down
4 changes: 2 additions & 2 deletions Ombi.UI/Jobs/Scheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ private IEnumerable<ITrigger> CreateTriggers()
var embyEpisode =
TriggerBuilder.Create()
.WithIdentity("EmbyEpisodeCacher", "Emby")
//.StartAt(DateBuilder.FutureDate(10, IntervalUnit.Minute))
.StartAt(DateBuilder.FutureDate(10, IntervalUnit.Minute))
.StartNow()
//.StartAt(DateBuilder.FutureDate(10, IntervalUnit.Minute))
.WithSimpleSchedule(x => x.WithIntervalInHours(s.EmbyEpisodeCacher).RepeatForever())
.Build();

Expand Down
24 changes: 17 additions & 7 deletions Ombi.UI/Modules/Admin/AdminModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,15 @@ private Negotiator Plex()
private async Task<Response> SavePlex()
{
var plexSettings = this.Bind<PlexSettings>();
var valid = this.Validate(plexSettings);
if (!valid.IsValid)
{
return Response.AsJson(valid.SendJsonError());
}

if (plexSettings.Enable)
{
var valid = this.Validate(plexSettings);
if (!valid.IsValid)
{
return Response.AsJson(valid.SendJsonError());
}
}


if (plexSettings.Enable)
Expand All @@ -462,7 +466,7 @@ private async Task<Response> SavePlex()
}
}

if (string.IsNullOrEmpty(plexSettings.MachineIdentifier))
if (string.IsNullOrEmpty(plexSettings.MachineIdentifier) && plexSettings.Enable)
{
//Lookup identifier
var server = PlexApi.GetServer(plexSettings.PlexAuthToken);
Expand Down Expand Up @@ -1166,7 +1170,13 @@ private async Task<Negotiator> GetScheduledJobs()
FaultQueueHandler = s.FaultQueueHandler,
PlexEpisodeCacher = s.PlexEpisodeCacher,
PlexUserChecker = s.PlexUserChecker,
UserRequestLimitResetter = s.UserRequestLimitResetter
UserRequestLimitResetter = s.UserRequestLimitResetter,
EmbyAvailabilityChecker = s.EmbyAvailabilityChecker,
EmbyContentCacher = s.EmbyContentCacher,
EmbyEpisodeCacher = s.EmbyEpisodeCacher,
EmbyUserChecker = s.EmbyUserChecker,
RadarrCacher = s.RadarrCacher,
WatcherCacher = s.WatcherCacher
};
return View["SchedulerSettings", model];
}
Expand Down
Loading

0 comments on commit 16b6b6a

Please sign in to comment.