public EmbyEpisodeSync(ISettingsService <EmbySettings> s, IEmbyApi api, ILogger <EmbyEpisodeSync> l, IEmbyContentRepository repo) { _api = api; _logger = l; _settings = s; _repo = repo; }
public UserManagementModule(ISettingsService <PlexRequestSettings> pr, ICustomUserMapper m, IPlexApi plexApi, ISettingsService <PlexSettings> plex, IRepository <UserLogins> userLogins, IExternalUserRepository <PlexUsers> plexRepo , ISecurityExtensions security, IRequestService req, IAnalytics ana, ISettingsService <EmbySettings> embyService, IEmbyApi embyApi, IExternalUserRepository <EmbyUsers> embyRepo) : base("usermanagement", pr, security) { #if !DEBUG Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx); #endif UserMapper = m; PlexApi = plexApi; PlexSettings = plex; UserLoginsRepo = userLogins; PlexUsersRepository = plexRepo; PlexRequestSettings = pr; RequestService = req; Analytics = ana; EmbySettings = embyService; EmbyApi = embyApi; EmbyRepository = embyRepo; Get["/"] = x => Load(); Get["/users", true] = async(x, ct) => await LoadUsers(); Post["/createuser", true] = async(x, ct) => await CreateUser(); Get["/local/{id}"] = x => LocalDetails((Guid)x.id); Get["/plex/{id}", true] = async(x, ct) => await PlexDetails(x.id); Get["/permissions"] = x => GetEnum <Permissions>(); Get["/features"] = x => GetEnum <Features>(); Post["/updateuser", true] = async(x, ct) => await UpdateUser(); Post["/deleteuser"] = x => DeleteUser(); }
/// <summary> /// Initializes a new instance of the <see cref="TesterController" /> class. /// </summary> public TesterController(INotificationService service, IDiscordNotification notification, IEmailNotification emailN, IPushbulletNotification pushbullet, ISlackNotification slack, IPushoverNotification po, IMattermostNotification mm, IPlexApi plex, IEmbyApi emby, IRadarrApi radarr, ISonarrApi sonarr, ILogger <TesterController> log, IEmailProvider provider, ICouchPotatoApi cpApi, ITelegramNotification telegram, ISickRageApi srApi, INewsletterJob newsletter, IMobileNotification mobileNotification, ILidarrApi lidarrApi, IGotifyNotification gotifyNotification) { Service = service; DiscordNotification = notification; EmailNotification = emailN; PushbulletNotification = pushbullet; SlackNotification = slack; PushoverNotification = po; MattermostNotification = mm; PlexApi = plex; RadarrApi = radarr; EmbyApi = emby; SonarrApi = sonarr; Log = log; EmailProvider = provider; CouchPotatoApi = cpApi; TelegramNotification = telegram; SickRageApi = srApi; Newsletter = newsletter; MobileNotification = mobileNotification; LidarrApi = lidarrApi; GotifyNotification = gotifyNotification; }
public async Task Execute(IJobExecutionContext job) { var settings = await _settings.GetSettingsAsync(); Api = _apiFactory.CreateClient(settings); await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Emby Episode Sync Started"); foreach (var server in settings.Servers) { if (server.EmbySelectedLibraries.Any() && server.EmbySelectedLibraries.Any(x => x.Enabled)) { var tvLibsToFilter = server.EmbySelectedLibraries.Where(x => x.Enabled && x.CollectionType == "tvshows"); foreach (var tvParentIdFilter in tvLibsToFilter) { _logger.LogInformation($"Scanning Lib for episodes '{tvParentIdFilter.Title}'"); await CacheEpisodes(server, tvParentIdFilter.Key); } } else { await CacheEpisodes(server, string.Empty); } } await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Emby Episode Sync Finished"); _logger.LogInformation("Emby Episode Sync Finished - Triggering Metadata refresh"); await OmbiQuartz.TriggerJob(nameof(IRefreshMetadata), "System"); }
public async Task <Either <BaseError, List <EmbyCollection> > > GetCollectionLibraryItems(string address, string apiKey) { try { // TODO: should we enumerate collection libraries here? if (_memoryCache.TryGetValue("emby_collections_library_item_id", out string itemId)) { IEmbyApi service = RestService.For <IEmbyApi>(address); EmbyLibraryItemsResponse items = await service.GetCollectionLibraryItems(apiKey, itemId); return(items.Items .Map(ProjectToCollection) .Somes() .ToList()); } return(BaseError.New("Emby collection item id is not available")); } catch (Exception ex) { _logger.LogError(ex, "Error getting Emby collection library items"); return(BaseError.New(ex.Message)); } }
public ApplicationTesterModule(ICouchPotatoApi cpApi, ISonarrApi sonarrApi, IPlexApi plexApi, ISickRageApi srApi, IHeadphonesApi hpApi, ISettingsService <PlexRequestSettings> pr, ISecurityExtensions security, IWatcherApi watcherApi, IRadarrApi radarrApi, IEmbyApi emby) : base("test", pr, security) { this.RequiresAuthentication(); CpApi = cpApi; SonarrApi = sonarrApi; PlexApi = plexApi; SickRageApi = srApi; HeadphonesApi = hpApi; WatcherApi = watcherApi; RadarrApi = radarrApi; Emby = emby; Post["/cp"] = _ => CouchPotatoTest(); Post["/sonarr"] = _ => SonarrTest(); Post["/radarr"] = _ => RadarrTest(); Post["/plex"] = _ => PlexTest(); Post["/sickrage"] = _ => SickRageTest(); Post["/headphones"] = _ => HeadphonesTest(); Post["/plexdb"] = _ => TestPlexDb(); Post["/watcher"] = _ => WatcherTest(); Post["/emby"] = _ => EmbyTest(); }
public EmbyContentSync(ISettingsService <EmbySettings> settings, IEmbyApi api, ILogger <EmbyContentSync> logger, IEmbyContentRepository repo) { _logger = logger; _settings = settings; _api = api; _repo = repo; }
public LandingPageController(ISettingsService <PlexSettings> plex, ISettingsService <EmbySettings> emby, IPlexApi plexApi, IEmbyApi embyApi) { _plexSettings = plex; _embySettings = emby; _plexApi = plexApi; _embyApi = embyApi; }
public EmbyNotificationEngine(IEmbyApi p, IRepository <UsersToNotify> repo, ISettingsService <EmbySettings> embySettings, INotificationService service, IUserHelper userHelper, IExternalUserRepository <EmbyUsers> embyUsers) { EmbyApi = p; UserNotifyRepo = repo; Notification = service; UserHelper = userHelper; EmbySettings = embySettings; EmbyUserRepo = embyUsers; }
public EmbyEpisodeSync(ISettingsService <EmbySettings> s, IEmbyApi api, ILogger <EmbyEpisodeSync> l, IEmbyContentRepository repo, IEmbyAvaliabilityChecker checker) { _api = api; _logger = l; _settings = s; _repo = repo; _avaliabilityChecker = checker; }
public EmbyUserImporter(IEmbyApi api, UserManager <OmbiUser> um, ILogger <EmbyUserImporter> log, ISettingsService <EmbySettings> embySettings, ISettingsService <UserManagementSettings> ums) { _api = api; _userManager = um; _log = log; _embySettings = embySettings; _userManagementSettings = ums; }
public EmbyContentSync(ISettingsService <EmbySettings> settings, IEmbyApi api, ILogger <EmbyContentSync> logger, IEmbyContentRepository repo, IEmbyEpisodeSync epSync) { _logger = logger; _settings = settings; _api = api; _repo = repo; _episodeSync = epSync; _settings.ClearCache(); }
public EmbyContentSync(ISettingsService <EmbySettings> settings, IEmbyApi api, ILogger <EmbyContentSync> logger, IEmbyContentRepository repo, IEmbyEpisodeSync epSync, IRefreshMetadata metadata) { _logger = logger; _settings = settings; _api = api; _repo = repo; _episodeSync = epSync; _metadata = metadata; }
public EmbyEpisodeCacher(ISettingsService <EmbySettings> embySettings, IEmbyApi emby, ICacheProvider cache, IJobRecord rec, IRepository <EmbyEpisodes> repo, ISettingsService <ScheduledJobsSettings> jobs) { Emby = embySettings; EmbyApi = emby; Cache = cache; Job = rec; Repo = repo; Jobs = jobs; }
public EmbyContentCacher(ISettingsService <EmbySettings> embySettings, IRequestService request, IEmbyApi emby, ICacheProvider cache, IJobRecord rec, IRepository <EmbyEpisodes> repo, IRepository <EmbyContent> content) { Emby = embySettings; RequestService = request; EmbyApi = emby; Cache = cache; Job = rec; EpisodeRepo = repo; EmbyContent = content; }
public EmbyUserChecker(IExternalUserRepository <EmbyUsers> plexUsers, IEmbyApi embyApi, IJobRecord rec, ISettingsService <EmbySettings> embyS, ISettingsService <PlexRequestSettings> prSettings, ISettingsService <UserManagementSettings> umSettings, IRequestService requestService, IUserRepository localUser) { Repo = plexUsers; JobRecord = rec; EmbyApi = embyApi; EmbySettings = embyS; PlexRequestSettings = prSettings; UserManagementSettings = umSettings; RequestService = requestService; LocalUserRepository = localUser; }
public OmbiUserManager(IUserStore <OmbiUser> store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <OmbiUser> passwordHasher, IEnumerable <IUserValidator <OmbiUser> > userValidators, IEnumerable <IPasswordValidator <OmbiUser> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <OmbiUser> > logger, IPlexApi plexApi, IEmbyApi embyApi, ISettingsService <EmbySettings> embySettings, ISettingsService <AuthenticationSettings> auth) : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger) { _plexApi = plexApi; _embyApi = embyApi; _embySettings = embySettings; _authSettings = auth; }
public RefreshMetadata(IPlexContentRepository plexRepo, IEmbyContentRepository embyRepo, ILogger <RefreshMetadata> log, ITvMazeApi tvApi, ISettingsService <PlexSettings> plexSettings, IMovieDbApi movieApi, ISettingsService <EmbySettings> embySettings, IEmbyApi embyApi) { _plexRepo = plexRepo; _embyRepo = embyRepo; _log = log; _movieApi = movieApi; _tvApi = tvApi; _plexSettings = plexSettings; _embySettings = embySettings; _embyApi = embyApi; }
public EmbyAvailabilityChecker(ISettingsService <EmbySettings> embySettings, IRequestService request, IEmbyApi emby, ICacheProvider cache, INotificationService notify, IJobRecord rec, IRepository <UsersToNotify> users, IRepository <EmbyEpisodes> repo, IEmbyNotificationEngine e, IRepository <EmbyContent> content) { Emby = embySettings; RequestService = request; EmbyApi = emby; Cache = cache; Notification = notify; Job = rec; UserNotifyRepo = users; EpisodeRepo = repo; NotificationEngine = e; EmbyContent = content; }
public EmbyAddedNewsletter(IEmbyApi api, ISettingsService <EmbySettings> embySettings, ISettingsService <EmailNotificationSettings> email, ISettingsService <NewletterSettings> newsletter, IRepository <RecentlyAddedLog> log, IRepository <EmbyContent> embyContent, IRepository <EmbyEpisodes> episodes) { Api = api; EmbySettings = embySettings; EmailSettings = email; NewsletterSettings = newsletter; Content = embyContent; MovieApi = new TheMovieDbApi(); TvApi = new TvMazeApi(); Episodes = episodes; RecentlyAddedLog = log; }
public SettingsController(ISettingsResolver resolver, IMapper mapper, INotificationTemplatesRepository templateRepo, IEmbyApi embyApi, ICacheService memCache, IGithubApi githubApi, IRecentlyAddedEngine engine) { SettingsResolver = resolver; Mapper = mapper; TemplateRepository = templateRepo; _embyApi = embyApi; _cache = memCache; _githubApi = githubApi; _recentlyAdded = engine; }
/// <summary> /// Initializes a new instance of the <see cref="SettingsController" /> class. /// </summary> /// <param name="resolver">The resolver.</param> /// <param name="mapper">The mapper.</param> /// <param name="templateRepo">The templateRepo.</param> /// <param name="embyApi">The embyApi.</param> /// <param name="radarrSync">The radarrCacher.</param> /// <param name="memCache">The memory cache.</param> /// <param name="githubApi">The memory cache.</param> public SettingsController(ISettingsResolver resolver, IMapper mapper, INotificationTemplatesRepository templateRepo, IEmbyApi embyApi, IRadarrSync radarrSync, ICacheService memCache, IGithubApi githubApi) { SettingsResolver = resolver; Mapper = mapper; TemplateRepository = templateRepo; _embyApi = embyApi; _radarrSync = radarrSync; _cache = memCache; _githubApi = githubApi; }
public async Task Execute(IJobExecutionContext context) { JobDataMap dataMap = context.JobDetail.JobDataMap; var recentlyAddedSearch = false; if (dataMap.TryGetValue(JobDataKeys.EmbyRecentlyAddedSearch, out var recentlyAddedObj)) { recentlyAddedSearch = Convert.ToBoolean(recentlyAddedObj); } var embySettings = await _settings.GetSettingsAsync(); if (!embySettings.Enable) { return; } Api = _apiFactory.CreateClient(embySettings); await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, recentlyAddedSearch ? "Emby Recently Added Started" : "Emby Content Sync Started"); foreach (var server in embySettings.Servers) { try { await StartServerCache(server, recentlyAddedSearch); } catch (Exception e) { await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Emby Content Sync Failed"); _logger.LogError(e, "Exception when caching Emby for server {0}", server.Name); } } await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Emby Content Sync Finished"); // Episodes await OmbiQuartz.Scheduler.TriggerJob(new JobKey(nameof(IEmbyEpisodeSync), "Emby"), new JobDataMap(new Dictionary <string, string> { { JobDataKeys.EmbyRecentlyAddedSearch, recentlyAddedSearch.ToString() } })); }
public async Task <Either <BaseError, List <EmbyLibrary> > > GetLibraries(string address, string apiKey) { try { IEmbyApi service = RestService.For <IEmbyApi>(address); List <EmbyLibraryResponse> libraries = await service.GetLibraries(apiKey); return(libraries .Map(Project) .Somes() .ToList()); } catch (Exception ex) { _logger.LogError(ex, "Error getting emby libraries"); return(BaseError.New(ex.Message)); } }
public async Task Execute(IJobExecutionContext job) { var settings = await _settings.GetSettingsAsync(); Api = _apiFactory.CreateClient(settings); await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Emby Episode Sync Started"); foreach (var server in settings.Servers) { await CacheEpisodes(server); } await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Emby Episode Sync Finished"); _logger.LogInformation("Emby Episode Sync Finished - Triggering Metadata refresh"); await OmbiQuartz.TriggerJob(nameof(IRefreshMetadata), "System"); }
public async Task <Either <BaseError, List <MediaItem> > > GetCollectionItems( string address, string apiKey, string collectionId) { try { IEmbyApi service = RestService.For <IEmbyApi>(address); EmbyLibraryItemsResponse items = await service.GetCollectionItems(apiKey, collectionId); return(items.Items .Map(ProjectToCollectionMediaItem) .Somes() .ToList()); } catch (Exception ex) { _logger.LogError(ex, "Error getting Emby collection items"); return(BaseError.New(ex.Message)); } }
public async Task <Either <BaseError, List <EmbyShow> > > GetShowLibraryItems( string address, string apiKey, string libraryId) { try { IEmbyApi service = RestService.For <IEmbyApi>(address); EmbyLibraryItemsResponse items = await service.GetShowLibraryItems(apiKey, libraryId); return(items.Items .Map(ProjectToShow) .Somes() .ToList()); } catch (Exception ex) { _logger.LogError(ex, "Error getting emby show library items"); return(BaseError.New(ex.Message)); } }
public UserWizardModule(ISettingsService <PlexRequestSettings> pr, ISettingsService <PlexSettings> plex, IPlexApi plexApi, ISettingsService <AuthenticationSettings> auth, ICustomUserMapper m, IAnalytics a, ISecurityExtensions security, IEmbyApi embyApi, ISettingsService <EmbySettings> embySettings) : base("wizard", pr, security) { PlexSettings = plex; PlexApi = plexApi; PlexRequestSettings = pr; Auth = auth; Mapper = m; Analytics = a; EmbySettings = embySettings; EmbyApi = embyApi; Get["/", true] = async(x, ct) => { a.TrackEventAsync(Category.Wizard, Action.Start, "Started the wizard", Username, CookieHelper.GetAnalyticClientId(Cookies)); var settings = await PlexRequestSettings.GetSettingsAsync(); if (settings.Wizard) { return(Context.GetRedirect("~/search")); } return(View["Index"]); }; Post["/plexAuth"] = x => PlexAuth(); Post["/plex", true] = async(x, ct) => await Plex(); Post["/plexrequest", true] = async(x, ct) => await PlexRequest(); Post["/auth", true] = async(x, ct) => await Authentication(); Post["/createuser", true] = async(x, ct) => await CreateUser(); Post["/embyauth", true] = async(x, ct) => await EmbyAuth(); }
public async Task Execute(IJobExecutionContext context) { JobDataMap dataMap = context.MergedJobDataMap; var recentlyAddedSearch = false; if (dataMap.TryGetValue(JobDataKeys.EmbyRecentlyAddedSearch, out var recentlyAddedObj)) { recentlyAddedSearch = Convert.ToBoolean(recentlyAddedObj); } var settings = await _settings.GetSettingsAsync(); Api = _apiFactory.CreateClient(settings); await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Emby Episode Sync Started"); foreach (var server in settings.Servers) { if (server.EmbySelectedLibraries.Any() && server.EmbySelectedLibraries.Any(x => x.Enabled)) { var tvLibsToFilter = server.EmbySelectedLibraries.Where(x => x.Enabled && x.CollectionType == "tvshows"); foreach (var tvParentIdFilter in tvLibsToFilter) { _logger.LogInformation($"Scanning Lib for episodes '{tvParentIdFilter.Title}'"); await CacheEpisodes(server, recentlyAddedSearch, tvParentIdFilter.Key); } } else { await CacheEpisodes(server, recentlyAddedSearch, string.Empty); } } await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Emby Episode Sync Finished"); _logger.LogInformation("Emby Episode Sync Finished - Triggering Metadata refresh"); await OmbiQuartz.TriggerJob(nameof(IRefreshMetadata), "System"); }
public async Task <Either <BaseError, EmbyServerInformation> > GetServerInformation( string address, string apiKey) { try { IEmbyApi service = RestService.For <IEmbyApi>(address); var cts = new CancellationTokenSource(); cts.CancelAfter(TimeSpan.FromSeconds(5)); return(await service.GetSystemInformation(apiKey, cts.Token) .Map(response => new EmbyServerInformation(response.ServerName, response.OperatingSystem))); } catch (OperationCanceledException ex) { _logger.LogError(ex, "Timeout getting emby server name"); return(BaseError.New("Emby did not respond in time")); } catch (Exception ex) { _logger.LogError(ex, "Error getting emby server name"); return(BaseError.New(ex.Message)); } }