Esempio n. 1
0
        /// <summary>
        /// Gets missing episode (episodes without files)
        /// </summary>
        /// <param name="sortKey">Series title or airDateUtc</param>
        /// <param name="page">Page</param>
        /// <param name="pageSize">Page size</param>
        /// <param name="sortDirection">Sort direction, asc or desc</param>
        /// <returns></returns>
        public async Task <Models.Wanted> GetMissing([Optional] string sortKey, [Optional] int page, [Optional] int pageSize, [Optional] string sortDirection)
        {
            var param = new Dictionary <string, object>();

            if (sortKey != null)
            {
                param.Add("sortKey", sortKey);
            }

            if (page != 0)
            {
                param.Add("page", page);
            }

            if (pageSize != 0)
            {
                param.Add("pageSize", pageSize);
            }

            if (sortDirection != null)
            {
                param.Add("sortDir", sortDirection);
            }

            var json = await _sonarrClient.GetJson($"/wanted/missing{ParameterHelper.BuildParameterString(param)}");

            return(await Task.Run(() => JsonSerializer.Deserialize <Models.Wanted>(json, Converter.Settings)));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets history (grabs/failures/completed)
        /// </summary>
        /// <param name="sortKey">Series title or Date - Default date</param>
        /// <param name="page">Page - Default 1</param>
        /// <param name="pageSize">Page size - Default 10</param>
        /// <param name="sortDir">Sort direction, asc or desc - Default desc</param>
        /// <returns></returns>
        public async Task <Models.History> GetHistory(string sortKey, int page = 1, int pageSize = 10, string sortDir = "default")
        {
            var sb = new StringBuilder();

            sb.Append($"?sortKey={sortKey}");
            sb.Append($"&page={page}");
            sb.Append($"&pageSize={pageSize}");
            sb.Append($"&sortDir={sortDir}");

            var json = await _sonarrClient.GetJson($"/history{sb.ToString()}");

            return(await Task.Run(() => JsonSerializer.Deserialize <Models.History>(json, Converter.Settings)));
        }
Esempio n. 3
0
        /// <summary>
        /// Returns system status
        /// </summary>
        /// <returns></returns>
        public async Task <Models.SystemStatus> GetSystemStatus()
        {
            var json = await _sonarrClient.GetJson("/system/status");

            return(await Task.Run(() => JsonSerializer.Deserialize <Models.SystemStatus>(json, Converter.Settings)));
        }
Esempio n. 4
0
        /// <summary>
        /// Queries the status of all currently started commands.
        /// </summary>
        /// <returns></returns>
        public async Task <List <Models.Command> > GetCommands()
        {
            var json = await _sonarrClient.GetJson($"/command");

            return(await Task.Run(() => JsonConvert.DeserializeObject <List <Models.Command> >(json, Converter.Settings)));
        }
Esempio n. 5
0
        /// <summary>
        /// Gets all quality profiles
        /// </summary>
        /// <returns></returns>
        public async Task <List <Models.Profile> > GetProfiles()
        {
            var json = await _sonarrClient.GetJson($"/profile");

            return(await Task.Run(() => JsonConvert.DeserializeObject <List <Models.Profile> >(json, Converter.Settings)));
        }
Esempio n. 6
0
        /// <summary>
        /// Returns all episode files for the given series
        /// </summary>
        /// <param name="seriesId">Series ID</param>
        /// <returns></returns>
        public async Task <List <Models.EpisodeFile> > GetEpisodeFiles(int seriesId)
        {
            var json = await _sonarrClient.GetJson($"/episodeFile?seriesId={seriesId}");

            return(await Task.Run(() => JsonConvert.DeserializeObject <List <Models.EpisodeFile> >(json, Converter.Settings)));
        }
Esempio n. 7
0
        /// <summary>
        /// Returns all series in your collection
        /// </summary>
        /// <param name="includeSeasonImages">if set to <c>true</c> [include season images].</param>
        /// <returns></returns>
        public async Task <List <Models.Series> > GetSeries([Optional] bool includeSeasonImages)
        {
            var json = await _sonarrClient.GetJson($"/series{(includeSeasonImages ? $"?includeSeasonImages={includeSeasonImages}" : "")}");

            return(await Task.Run(() => JsonSerializer.Deserialize <List <Models.Series> >(json, Converter.Settings)));
        }
Esempio n. 8
0
        /// <summary>
        /// Gets upcoming episodes, if start/end are not supplied episodes airing today and tomorrow will be returned
        /// </summary>
        /// <returns></returns>
        public async Task <List <Models.Calendar> > GetCalendar()
        {
            var json = await _sonarrClient.GetJson($"/calendar");

            return(await Task.Run(() => JsonSerializer.Deserialize <List <Models.Calendar> >(json, Converter.Settings)));
        }
Esempio n. 9
0
        /// <summary>
        /// Returns the result of parsing a title
        /// </summary>
        /// <param name="title">Title</param>
        /// <returns></returns>
        public async Task <Models.Parse> ParseTitle(string title)
        {
            var json = await _sonarrClient.GetJson($"/parse?title={title}");

            return(await Task.Run(() => JsonSerializer.Deserialize <Models.Parse>(json, Converter.Settings)));
        }
Esempio n. 10
0
        /// <summary>
        /// Gets information about Diskspace
        /// </summary>
        /// <returns></returns>
        public async Task <List <Models.Diskspace> > GetDiskspace()
        {
            var json = await _sonarrClient.GetJson("/diskspace");

            return(await Task.Run(() => JsonSerializer.Deserialize <List <Models.Diskspace> >(json, Converter.Settings)));
        }
Esempio n. 11
0
        /// <summary>
        /// Gets the log files.
        /// </summary>
        /// <returns></returns>
        public async Task <List <Models.LogFile> > GetLogFiles()
        {
            var json = await _sonarrClient.GetJson("/log/file");

            return(await Task.Run(() => JsonSerializer.Deserialize <List <Models.LogFile> >(json, Converter.Settings)));
        }
Esempio n. 12
0
        /// <summary>
        /// Gets root folders
        /// </summary>
        /// <returns></returns>
        public async Task <List <Models.Rootfolder> > GetRootFolders()
        {
            var json = await _sonarrClient.GetJson($"/rootfolder");

            return(await Task.Run(() => JsonSerializer.Deserialize <List <Models.Rootfolder> >(json, Converter.Settings)));
        }
Esempio n. 13
0
        /// <summary>
        /// Returns all quality definitions
        /// </summary>
        /// <returns></returns>
        public async Task <List <Models.QualityDefinition> > GetQualityDefinitions()
        {
            var json = await _sonarrClient.GetJson("/qualityDefinition");

            return(await Task.Run(() => JsonSerializer.Deserialize <List <Models.QualityDefinition> >(json, Converter.Settings)));
        }
Esempio n. 14
0
        /// <summary>
        /// Searches for new shows on trakt
        /// </summary>
        /// <param name="title">Series title</param>
        /// <returns></returns>
        public async Task <List <Models.SeriesLookup> > SearchForSeries(string title)
        {
            var json = await _sonarrClient.GetJson($"/series/lookup?term={title.Replace(" ", "%20")}");

            return(await Task.Run(() => JsonConvert.DeserializeObject <List <Models.SeriesLookup> >(json, Converter.Settings)));
        }
Esempio n. 15
0
        /// <summary>
        /// Gets releases by episode ID from Sonarr's search cache (30 minute cache)
        /// </summary>
        /// <param name="episodeId">Episode ID</param>
        /// <returns></returns>
        public async Task <List <Models.Release> > GetReleases(int episodeId)
        {
            var json = await _sonarrClient.GetJson($"/release");

            return(await Task.Run(() => JsonSerializer.Deserialize <List <Models.Release> >(json, Converter.Settings)));
        }
Esempio n. 16
0
        /// <summary>
        /// Gets currently downloading info
        /// </summary>
        /// <returns></returns>
        public async Task <List <Models.Queue> > GetQueue()
        {
            var json = await _sonarrClient.GetJson($"/queue");

            return(await Task.Run(() => JsonSerializer.Deserialize <List <Models.Queue> >(json, Converter.Settings)));
        }
Esempio n. 17
0
        /// <summary>
        /// Returns the list of available backups
        /// </summary>
        /// <returns></returns>
        public async Task <List <Models.SystemBackup> > GetSystemBackups()
        {
            var json = await _sonarrClient.GetJson($"/system/backup");

            return(await Task.Run(() => JsonConvert.DeserializeObject <List <Models.SystemBackup> >(json, Converter.Settings)));
        }