Beispiel #1
0
        protected virtual void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/v1/");
            RestClient.AddDefaultHeader("Authentication", ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", ApiKey);

            Blacklist         = new ClientBase <BlacklistResource>(RestClient, ApiKey);
            Commands          = new CommandClient(RestClient, ApiKey);
            DownloadClients   = new DownloadClientClient(RestClient, ApiKey);
            Albums            = new AlbumClient(RestClient, ApiKey);
            Tracks            = new TrackClient(RestClient, ApiKey);
            History           = new ClientBase <HistoryResource>(RestClient, ApiKey);
            HostConfig        = new ClientBase <HostConfigResource>(RestClient, ApiKey, "config/host");
            Indexers          = new IndexerClient(RestClient, ApiKey);
            Logs              = new LogsClient(RestClient, ApiKey);
            NamingConfig      = new ClientBase <NamingConfigResource>(RestClient, ApiKey, "config/naming");
            Notifications     = new NotificationClient(RestClient, ApiKey);
            Profiles          = new ClientBase <QualityProfileResource>(RestClient, ApiKey);
            Releases          = new ReleaseClient(RestClient, ApiKey);
            ReleasePush       = new ReleasePushClient(RestClient, ApiKey);
            RootFolders       = new ClientBase <RootFolderResource>(RestClient, ApiKey);
            Artist            = new ArtistClient(RestClient, ApiKey);
            Tags              = new ClientBase <TagResource>(RestClient, ApiKey);
            WantedMissing     = new ClientBase <AlbumResource>(RestClient, ApiKey, "wanted/missing");
            WantedCutoffUnmet = new ClientBase <AlbumResource>(RestClient, ApiKey, "wanted/cutoff");
        }
Beispiel #2
0
        protected virtual void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/");
            RestClient.AddDefaultHeader("Authentication", ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", ApiKey);

            RestClientv3 = new RestClient(RootUrl + "api/v3/");
            RestClientv3.AddDefaultHeader("Authentication", ApiKey);
            RestClientv3.AddDefaultHeader("X-Api-Key", ApiKey);

            Blocklist         = new ClientBase <BlocklistResource>(RestClient, ApiKey);
            Commands          = new CommandClient(RestClient, ApiKey);
            DownloadClients   = new DownloadClientClient(RestClient, ApiKey);
            Episodes          = new EpisodeClient(RestClient, ApiKey);
            History           = new ClientBase <HistoryResource>(RestClient, ApiKey);
            HostConfig        = new ClientBase <HostConfigResource>(RestClient, ApiKey, "config/host");
            Indexers          = new IndexerClient(RestClient, ApiKey);
            Indexersv3        = new IndexerClient(RestClientv3, ApiKey);
            Logs              = new LogsClient(RestClient, ApiKey);
            NamingConfig      = new ClientBase <NamingConfigResource>(RestClient, ApiKey, "config/naming");
            Notifications     = new NotificationClient(RestClient, ApiKey);
            Profiles          = new ClientBase <ProfileResource>(RestClient, ApiKey);
            Releases          = new ReleaseClient(RestClient, ApiKey);
            ReleasePush       = new ReleasePushClient(RestClient, ApiKey);
            RootFolders       = new ClientBase <RootFolderResource>(RestClient, ApiKey);
            Series            = new SeriesClient(RestClient, ApiKey);
            Tags              = new ClientBase <TagResource>(RestClient, ApiKey);
            WantedMissing     = new ClientBase <EpisodeResource>(RestClient, ApiKey, "wanted/missing");
            WantedCutoffUnmet = new ClientBase <EpisodeResource>(RestClient, ApiKey, "wanted/cutoff");
        }
Beispiel #3
0
 private void InitRestClients()
 {
     RestClient   = new RestClient("http://localhost:8989/api");
     Series       = new SeriesClient(RestClient);
     Releases     = new ReleaseClient(RestClient);
     RootFolders  = new ClientBase <RootFolderResource>(RestClient);
     Commands     = new ClientBase <CommandResource>(RestClient);
     History      = new ClientBase <HistoryResource>(RestClient);
     Indexers     = new IndexerClient(RestClient);
     Episodes     = new EpisodeClient(RestClient);
     NamingConfig = new ClientBase <NamingConfigResource>(RestClient, "config/naming");
 }
 private void InitRestClients()
 {
     RestClient = new RestClient("http://localhost:8989/api");
     Series = new SeriesClient(RestClient, _runner.ApiKey);
     Releases = new ReleaseClient(RestClient, _runner.ApiKey);
     RootFolders = new ClientBase<RootFolderResource>(RestClient, _runner.ApiKey);
     Commands = new ClientBase<CommandResource>(RestClient, _runner.ApiKey);
     History = new ClientBase<HistoryResource>(RestClient, _runner.ApiKey);
     Indexers = new IndexerClient(RestClient, _runner.ApiKey);
     Episodes = new EpisodeClient(RestClient, _runner.ApiKey);
     NamingConfig = new ClientBase<NamingConfigResource>(RestClient, _runner.ApiKey, "config/naming");
 }
Beispiel #5
0
 private void InitRestClients()
 {
     RestClient    = new RestClient(RootUrl + "api/");
     Series        = new SeriesClient(RestClient, _runner.ApiKey);
     Releases      = new ReleaseClient(RestClient, _runner.ApiKey);
     RootFolders   = new ClientBase <RootFolderResource>(RestClient, _runner.ApiKey);
     Commands      = new ClientBase <CommandResource>(RestClient, _runner.ApiKey);
     History       = new ClientBase <HistoryResource>(RestClient, _runner.ApiKey);
     Indexers      = new IndexerClient(RestClient, _runner.ApiKey);
     Episodes      = new EpisodeClient(RestClient, _runner.ApiKey);
     NamingConfig  = new ClientBase <NamingConfigResource>(RestClient, _runner.ApiKey, "config/naming");
     Notifications = new NotificationClient(RestClient, _runner.ApiKey);
 }
Beispiel #6
0
        private static void CheckForUpdate()
        {
            var client  = new ReleaseClient();
            var release = client.GetLatestVersion().GetAwaiter().GetResult();

            if (release == UserSettings.APPLICATIONVERSION)
            {
                return;
            }

            new NewVersionPopup().Show();
            _logger.Info($"New version available upgrade from {UserSettings.APPLICATIONVERSION} to {release}");

            // Check release with current version.
        }
Beispiel #7
0
        protected virtual void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/");
            RestClient.AddDefaultHeader("Authentication", ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", ApiKey);

            Blacklist       = new ClientBase <BlacklistResource>(RestClient, ApiKey);
            Commands        = new CommandClient(RestClient, ApiKey);
            DownloadClients = new DownloadClientClient(RestClient, ApiKey);
            Episodes        = new EpisodeClient(RestClient, ApiKey);
            History         = new ClientBase <HistoryResource>(RestClient, ApiKey);
            Indexers        = new IndexerClient(RestClient, ApiKey);
            NamingConfig    = new ClientBase <NamingConfigResource>(RestClient, ApiKey, "config/naming");
            Notifications   = new NotificationClient(RestClient, ApiKey);
            Releases        = new ReleaseClient(RestClient, ApiKey);
            RootFolders     = new ClientBase <RootFolderResource>(RestClient, ApiKey);
            Series          = new SeriesClient(RestClient, ApiKey);
            Tags            = new ClientBase <TagResource>(RestClient, ApiKey);
        }
Beispiel #8
0
        private static void CheckForUpdate()
        {
            try
            {
                var client  = new ReleaseClient();
                var release = client.GetLatestVersion().GetAwaiter().GetResult();

                if (release == UserSettings.APPLICATIONVERSION)
                {
                    return;
                }

                new NewVersionPopup().Show();
                _logger.Info($"New version available upgrade from {UserSettings.APPLICATIONVERSION} to {release}");
            }
            catch (Octokit.RateLimitExceededException)
            {
                //Do nothing
            }
        }
Beispiel #9
0
        private static void CheckForUpdate()
        {
            try
            {
                var client  = new ReleaseClient();
                var release = client.GetLatestVersion().GetAwaiter().GetResult();

                if (release == UserSettings.APPLICATIONVERSION)
                {
                    return;
                }

                new NewVersionPopup().Show();
                _logger.Info($"New version available upgrade from {UserSettings.APPLICATIONVERSION} to {release}");
            }
            catch
            {
                //Do nothing, does not matter if the user is offline or github is unreachable
            }
        }
        protected virtual void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/");
            RestClient.AddDefaultHeader("Authentication", ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", ApiKey);

            Blacklist = new ClientBase<BlacklistResource>(RestClient, ApiKey);
            Commands = new CommandClient(RestClient, ApiKey);
            DownloadClients = new DownloadClientClient(RestClient, ApiKey);
            Episodes = new EpisodeClient(RestClient, ApiKey);
            History = new ClientBase<HistoryResource>(RestClient, ApiKey);
            HostConfig = new ClientBase<HostConfigResource>(RestClient, ApiKey, "config/host");
            Indexers = new IndexerClient(RestClient, ApiKey);
            NamingConfig = new ClientBase<NamingConfigResource>(RestClient, ApiKey, "config/naming");
            Notifications = new NotificationClient(RestClient, ApiKey);
            Profiles = new ClientBase<ProfileResource>(RestClient, ApiKey);
            Releases = new ReleaseClient(RestClient, ApiKey);
            RootFolders = new ClientBase<RootFolderResource>(RestClient, ApiKey);
            Series = new SeriesClient(RestClient, ApiKey);
            Tags = new ClientBase<TagResource>(RestClient, ApiKey);
            WantedMissing = new ClientBase<EpisodeResource>(RestClient, ApiKey, "wanted/missing");
            WantedCutoffUnmet = new ClientBase<EpisodeResource>(RestClient, ApiKey, "wanted/cutoff");
        }
Beispiel #11
0
        private void InitRestClients()
        {
            RestClient = new RestClient(RootUrl + "api/");
            RestClient.AddDefaultHeader("Authentication", _runner.ApiKey);
            RestClient.AddDefaultHeader("X-Api-Key", _runner.ApiKey);

            Series = new SeriesClient(RestClient, _runner.ApiKey);
            Releases = new ReleaseClient(RestClient, _runner.ApiKey);
            RootFolders = new ClientBase<RootFolderResource>(RestClient, _runner.ApiKey);
            Commands = new ClientBase<CommandResource>(RestClient, _runner.ApiKey);
            History = new ClientBase<HistoryResource>(RestClient, _runner.ApiKey);
            Indexers = new IndexerClient(RestClient, _runner.ApiKey);
            Episodes = new EpisodeClient(RestClient, _runner.ApiKey);
            NamingConfig = new ClientBase<NamingConfigResource>(RestClient, _runner.ApiKey, "config/naming");
            Notifications = new NotificationClient(RestClient, _runner.ApiKey);
        }
        private static void UpdateExpiryDatePack(EverestPortalContext context, ReleasePack pack, ReleaseClient client)
        {
            var updateClientException = context.ClientPackException.FirstOrDefault(x => x.PackExceptionId == pack.Id && x.ClientId == client.clientId);

            if (updateClientException != null)
            {
                var eDate = Convert.ToDateTime(pack.ExpiryDate);
                updateClientException.ExpiryDate = eDate;
            }
        }
        public HttpResponseMessage GetClientReleaseDetails(string id, string isAllClients)
        {
            var identity = (ClaimsIdentity)User.Identity;
            //force to use login id, can not pass other value for security reasons.
            var tid = identity.Claims.FirstOrDefault(c => c.Type == "userid").Value.ToString();

            var getAllClients = false;

            if (!string.IsNullOrWhiteSpace(isAllClients))
            {
                getAllClients = Convert.ToBoolean(isAllClients);
            }
            HttpResponseMessage message;

            using (EverestPortalContext context = new EverestPortalContext())
            {
                var clientReleaseDetails = (from client in context.Clients
                                            join
                                            clRelease in context.ClientRelease on client.Id equals clRelease.ClientId into rClients
                                            from r in rClients.DefaultIfEmpty()

                                            join cMfr in context.ClientMFR on client.Id equals cMfr.ClientId into mCLients
                                            from m in mCLients.DefaultIfEmpty()

                                            join pException in context.ClientPackException on client.Id equals pException.ClientId into pClients
                                            from p in pClients.DefaultIfEmpty()

                                            select new
                {
                    clientId = client.Id,
                    clientName = client.Name,
                    CapitalChemist = r.CapitalChemist == null ? false : r.CapitalChemist,
                    Census = r.Census == null ? false : r.Census,
                    OneKey = r.OneKey == null ? false : r.OneKey,
                    MfrId = m.MFRId,
                    packExceptionId = p.PackExceptionId
                }).GroupBy(x => x.clientId).Select(x => new
                {
                    clientId       = x.Key,
                    clientName     = x.FirstOrDefault().clientName,
                    OneKey         = x.FirstOrDefault().OneKey,
                    CapitalChemist = x.FirstOrDefault().CapitalChemist,
                    Census         = x.FirstOrDefault().Census,
                    MfrCount       = x.Select(m => m.MfrId).Distinct().Where(w => w != null).Count(),
                    packCount      = x.Select(p => p.packExceptionId).Distinct().Where(w => w != null).Count()
                }).
                                           ToList();

                var uId         = Convert.ToInt32(tid); //force to use login id, not querystring
                var userClients = context.userClient.Where(u => u.UserID == uId).Select(x => x.ClientID).ToList();


                var responseReleaseClients = new List <ReleaseClient>();

                foreach (var cr in clientReleaseDetails)
                {
                    var aClientRelease = new ReleaseClient()
                    {
                        clientId       = cr.clientId,
                        clientName     = cr.clientName,
                        CapitalChemist = cr.CapitalChemist == null ? false : Convert.ToBoolean(cr.CapitalChemist),
                        Census         = cr.Census == null ? false : Convert.ToBoolean(cr.Census),
                        OneKey         = cr.OneKey == null ? false : Convert.ToBoolean(cr.OneKey),
                        MfrCount       = cr.MfrCount,
                        packCount      = cr.packCount,
                        isMyClient     = userClients.Contains(cr.clientId)
                    };
                    if (getAllClients || aClientRelease.isMyClient)
                    {
                        responseReleaseClients.Add(aClientRelease);
                    }
                }


                var response = new
                {
                    //data = clientReleaseDetails.Where(cr => userClients.Contains(cr.clientId)).ToList()
                    data = responseReleaseClients.OrderBy(r => r.clientName).ToList()
                };

                message = Request.CreateResponse(HttpStatusCode.OK, response);
                return(message);
            }
        }