Ejemplo n.º 1
0
        public IEnumerable <ProgramInfo> GetPrograms(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
        {
            var pluginPath = Plugin.Instance.ConfigurationFilePath.Remove(Plugin.Instance.ConfigurationFilePath.Length - 4);
            var response   = GetFromService <List <Program> >(
                cancellationToken,
                "GetProgramsDetailedForChannel?channelId={0}&startTime={1}&endTime={2}",
                channelId,
                startDateUtc.ToLocalTime().ToUrlDate(),
                endDateUtc.ToLocalTime().ToUrlDate());

            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);

            Plugin.Logger.Info("Found programs: {0}  for channel id: {1}", response.Count(), channelId);
            return(response.Select(p =>
            {
                var program = new ProgramInfo()
                {
                    Name = p.Title,
                    EpisodeNumber = p.EpisodeNumber,
                    SeasonNumber = p.SeasonNumber,
                    ProductionYear = p.ProductionYear,
                    Id = p.Id.ToString(CultureInfo.InvariantCulture),
                    SeriesId = p.Title,
                    ChannelId = channelId,
                    StartDate = p.StartTime,
                    EndDate = p.EndTime,
                    Overview = p.Description,
                    Genres = new List <String>(),
                };

                //program.IsSeries = true; //is set by genreMapper
                if (!String.IsNullOrEmpty(p.Genre))
                {
                    program.Genres.Add(p.Genre);
                    genreMapper.PopulateProgramGenres(program);
                }

                if (program.IsSeries && p.Title != p.EpisodeName)
                {
                    program.EpisodeTitle = p.EpisodeName;
                }

                if (Configuration.ProgramImages)
                {
                    if (File.Exists(Path.Combine(pluginPath, "channellogos", channelId + ".png")))
                    {
                        program.ImageUrl = Path.Combine(pluginPath, "channellogos", channelId + ".png");

                        if (Configuration.EnableImageProcessing)
                        {
                            program.ImageUrl = Path.Combine(pluginPath, "channellogos", channelId + "-poster.png");;
                            program.ThumbImageUrl = Path.Combine(pluginPath, "channellogos", channelId + "-landscape.png");
                        }
                    }
                }

                return program;
            }));
        }
Ejemplo n.º 2
0
        public IEnumerable <ProgramInfo> GetPrograms(CancellationToken cancellationToken, string channelId, DateTime startDateUtc, DateTime endDateUtc)
        {
            var pluginPath = Plugin.Instance.ConfigurationFilePath.Remove(Plugin.Instance.ConfigurationFilePath.Length - 4);
            var channel    = GetChannelList(cancellationToken).Root.ChannelGroup.SelectMany(c => c.Channel).Where(c => c.Id == channelId).FirstOrDefault();
            var response   = GetFromService <Guide>(cancellationToken, typeof(Guide),
                                                    "api/epg.html?lvl=2&channel={0}&start={1}&end={2}",
                                                    channel.EPGID,
                                                    GeneralExtensions.FloatDateTime(startDateUtc),
                                                    GeneralExtensions.FloatDateTime(endDateUtc));

            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);

            Plugin.Logger.Info("Found Programs: {0}  for ChannelId: {1}", response.Program.Count(), channelId);
            return(response.Program.Select(p =>
            {
                var program = new ProgramInfo()
                {
                    Name = p.Name,
                    EpisodeNumber = p.EpisodeNumber,
                    SeasonNumber = p.SeasonNumber,
                    ProductionYear = p.ProductionYear,
                    Id = GeneralExtensions.SetEventId(channelId, p.Start, p.Stop),
                    SeriesId = p.Name,
                    ChannelId = p.ChannelId,
                    StartDate = GeneralExtensions.GetProgramTime(p.Start),
                    EndDate = GeneralExtensions.GetProgramTime(p.Stop),
                    Overview = p.Overview,
                    Etag = p.EitContent,
                };

                if (!String.IsNullOrEmpty(p.EitContent) || !String.IsNullOrEmpty(p.Overview))
                {
                    genreMapper.PopulateProgramGenres(program);
                }

                if (program.IsSeries && p.Name != p.EpisodeTitle)
                {
                    program.EpisodeTitle = p.EpisodeTitle;
                }

                if (Configuration.ProgramImages)
                {
                    if (File.Exists(Path.Combine(pluginPath, "channellogos", String.Join("", channel.Name.Split(Path.GetInvalidFileNameChars())) + ".png")))
                    {
                        program.ImageUrl = Path.Combine(pluginPath, "channellogos", String.Join("", channel.Name.Split(Path.GetInvalidFileNameChars())) + ".png");

                        if (Configuration.EnableImageProcessing)
                        {
                            program.ImageUrl = Path.Combine(pluginPath, "channellogos", String.Join("", channel.Name.Split(Path.GetInvalidFileNameChars())) + "-poster.png");;
                            program.ThumbImageUrl = Path.Combine(pluginPath, "channellogos", String.Join("", channel.Name.Split(Path.GetInvalidFileNameChars())) + "-landscape.png");
                        }
                    }
                }

                Plugin.Logger.Info("Found Program: {0}, SubTitle: {1}, SeasonNr: {2}, EpisodeNr: {3}, ChannelId: {4}", program.Name, program.EpisodeTitle, program.SeasonNumber, program.EpisodeNumber, program.ChannelId);
                return program;
            }));
        }
Ejemplo n.º 3
0
        public IEnumerable <ProgramInfo> GetPrograms(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
        {
            var response = GetFromService <List <Program> >(
                cancellationToken,
                "GetProgramsDetailedForChannel?channelId={0}&startTime={1}&endTime={2}",
                channelId,
                startDateUtc.ToLocalTime().ToUrlDate(),
                endDateUtc.ToLocalTime().ToUrlDate());

            // Create this once per channel - if created at the class level, then changes to configuration would never be caught
            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);

            Plugin.Logger.Info("Found programs: {0}  for channel id: {1}", response.Count(), channelId);
            return(response.Select(p =>
            {
                var program = new ProgramInfo()
                {
                    Name = p.Title,
                    EpisodeTitle = p.EpisodeName,
                    Id = p.Id.ToString(CultureInfo.InvariantCulture),
                    SeriesId = p.Title,
                    ChannelId = channelId,
                    StartDate = p.StartTime,
                    EndDate = p.EndTime,
                    Overview = p.Description,
                    Genres = new List <String>(),
                };

                if (!String.IsNullOrEmpty(p.EpisodeNum))
                {
                    int enumber;
                    Int32.TryParse((Regex.Match(p.EpisodeNum, @"\d+").Value), out enumber);
                    program.EpisodeNumber = enumber;
                }

                if (!String.IsNullOrEmpty(p.SeriesNum))
                {
                    int snumber;
                    Int32.TryParse((Regex.Match(p.SeriesNum, @"\d+").Value), out snumber);
                    program.SeasonNumber = snumber;
                }

                //program.IsSeries = true; //is set by genreMapper
                if (!String.IsNullOrEmpty(p.Genre))
                {
                    program.Genres.Add(p.Genre);
                    genreMapper.PopulateProgramGenres(program);
                }

                if (Plugin.Instance.Configuration.ProgramImages && File.Exists(String.Format(@"{0}\logos\{1}.jpg", Plugin.Instance.DataFolderPath, channelId)))
                {
                    program.ImagePath = String.Format(@"{0}\logos\{1}.jpg", Plugin.Instance.DataFolderPath, channelId);;
                }

                return program;
            }));
        }
Ejemplo n.º 4
0
        public IObservable <IEnumerable <Genre> > GetMovieGenres()
        {
            var genreMapper = new GenreMapper();

            return(GetAndFetchGenres()
                   .Select(genreInfo => genreInfo == null
                    ? Enumerable.Empty <Genre>()
                    : genreInfo.Genres.Select(result => genreMapper.ToGenre(result))));
        }
        /*поменяла в int? на int в параметрах*/
        public async Task <ActionResult> Index(int id)
        {
            var genre = GenreMapper.Map(await genresClient.GetGenre(id).ConfigureAwait(false));
            var books = BookMapper.Map(await booksClient.GetWithGenre(id).ConfigureAwait(false));

            var model = new GenrePage(genre, books);

            return(View(model));
        }
        public IEnumerable <ProgramInfo> GetPrograms(string channelId, DateTime startDateUtc, DateTime endDateUtc,
                                                     CancellationToken cancellationToken)
        {
            int x        = 0;
            var response = GetFromService <List <Program> >(
                cancellationToken,
                "GetProgramsDetailedForChannel?channelId={0}&starttime={1}&endtime={2}",
                channelId,
                startDateUtc.ToLocalTime().ToUrlDate(),
                endDateUtc.ToLocalTime().ToUrlDate());

            // Create this once per channel - if created at the class level, then changes to configuration would never be caught
            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);

            var programs = response.Select(p =>
            {
                var program = new ProgramInfo()
                {
                    ChannelId    = channelId,
                    StartDate    = p.StartTime,
                    EndDate      = p.EndTime,
                    EpisodeTitle = p.EpisodeName,
                    Genres       = new List <String>(),
                    Id           = p.Id.ToString(CultureInfo.InvariantCulture),
                    Name         = p.Title,
                    Overview     = p.Description,
                    // IsSeries = true,
                    // IsPremiere = false,
                    // IsRepeat = true,
                    // OriginalAirDate = p.OriginalAirDate
                };

                if (!String.IsNullOrEmpty(p.EpisodeNum))
                {
                    program.EpisodeNumber = Int32.Parse(p.EpisodeNum);
                }

                if (!String.IsNullOrEmpty(p.SeriesNum))
                {
                    program.SeasonNumber = Int32.Parse(p.SeriesNum);
                }

                if (!String.IsNullOrEmpty(p.Genre))
                {
                    program.Genres.Add(p.Genre);
                    // Call Genre Mapper
                    genreMapper.PopulateProgramGenres(program);
                }

                return(program);
            });

            return(programs);
        }
Ejemplo n.º 7
0
        public void ToGenre_HasGenreResult_ReturnsGenre()
        {
            var source = new GenreResult()
            {
                Id   = 10,
                Name = "Any genre"
            };
            var target = new GenreMapper();
            var actual = target.ToGenre(source);

            Assert.AreEqual(source.Id, actual.Id);
            Assert.AreEqual(source.Name, actual.Name);
        }
Ejemplo n.º 8
0
        public void GetGenreById_WhenCalledCorrectly_Succeeds()
        {
            // Assemble
            var genreRepository = new Mock <IGenreRepository>();

            genreRepository.Setup(a => a.FindById(It.IsAny <long>()))
            .Returns(GenreMapper.ToEntity(SampleData.SampleGenreData.ValidSampleGenre1()));

            // Act
            var genre = genreRepository.Object.FindById(1);

            // Assert
            Assert.NotNull(genre);
        }
Ejemplo n.º 9
0
        private TimerInfo GetTimerInfo(Recording i)
        {
            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);
            var info        = new TimerInfo();

            try
            {
                if (i.recurring)
                {
                    info.SeriesTimerId = i.recurringParent.ToString(_usCulture);
                    info.IsSeries      = true; //!string.IsNullOrEmpty(epg.Subtitle); http://emby.media/community/index.php?/topic/21264-series-record-ability-missing-in-emby-epg/#entry239633
                }
                info.ChannelId          = i.channelId.ToString(_usCulture);
                info.Id                 = i.id.ToString(_usCulture);
                info.Status             = ParseStatus(i.status);
                info.StartDate          = DateTimeOffset.FromUnixTimeSeconds(i.startTime).DateTime;
                info.EndDate            = DateTimeOffset.FromUnixTimeSeconds(i.startTime + i.duration).DateTime;
                info.PrePaddingSeconds  = i.prePadding * 60;
                info.PostPaddingSeconds = i.postPadding * 60;
                info.ProgramId          = i.epgEventId.ToString(_usCulture);
                info.Name               = i.name;
                info.Overview           = i.desc;
                info.EpisodeTitle       = i.subtitle;
                info.SeasonNumber       = i.season;
                info.EpisodeNumber      = i.episode;
                info.OfficialRating     = i.rating;
                if (i.original != null)
                {
                    info.OriginalAirDate = i.original;
                }
                info.ProductionYear = i.year;

                if (i.genres != null)
                {
                    info.Genres = i.genres.ToArray();
                    genreMapper.PopulateTimerGenres(info);
                }

                info.IsRepeat = !i.firstrun;

                //info.CommunityRating = ListingsResponse.ParseCommunityRating(epg.StarRating);
                return(info);
            }
            catch (Exception err)
            {
                throw (err);
            }
        }
Ejemplo n.º 10
0
        public void FindAll_WhenCalledCorrectly_Succeeds()
        {
            // Assemble
            var genreRepository = new Mock <IGenreRepository>();

            genreRepository.Setup(a => a.FindAll())
            .Returns(new List <GenreEntity> {
                GenreMapper.ToEntity(SampleData.SampleGenreData.ValidSampleGenre1())
            });

            // Act
            var genres = genreRepository.Object.FindAll();

            // Assert
            Assert.NotNull(genres);
        }
Ejemplo n.º 11
0
    private ProgramInfo GetProgram(Listing epg)
    {
        var genreMapper = new GenreMapper(Plugin.Instance.Configuration);
        var info        = new ProgramInfo
        {
            ChannelId       = _channelId,
            Id              = epg.Id.ToString(CultureInfo.InvariantCulture),
            Overview        = epg.Description,
            EpisodeTitle    = epg.Subtitle,
            SeasonNumber    = epg.Season,
            EpisodeNumber   = epg.Episode,
            StartDate       = DateTimeOffset.FromUnixTimeSeconds(epg.Start).DateTime,
            EndDate         = DateTimeOffset.FromUnixTimeSeconds(epg.End).DateTime,
            Genres          = new List <string>(), // epg.genres.Where(g => !string.IsNullOrWhiteSpace(g)).ToList(),
            OriginalAirDate = epg.Original == null ? epg.Original : DateTime.SpecifyKind((DateTime)epg.Original, DateTimeKind.Local),
            ProductionYear  = epg.Year,
            Name            = epg.Name,
            OfficialRating  = epg.Rating,
            IsPremiere      = epg.Significance != null && epg.Significance.Contains("Premiere", StringComparison.OrdinalIgnoreCase),
            // CommunityRating = ParseCommunityRating(epg.StarRating),
            // Audio = ParseAudio(epg.Audio),
            // IsHD = string.Equals(epg.Quality, "hdtv", StringComparison.OrdinalIgnoreCase),
            IsLive           = epg.Significance != null && epg.Significance.Contains("Live", StringComparison.OrdinalIgnoreCase),
            IsRepeat         = !Plugin.Instance.Configuration.ShowRepeat || !epg.Firstrun,
            IsSeries         = true, // !string.IsNullOrEmpty(epg.Subtitle),  http://emby.media/community/index.php?/topic/21264-series-record-ability-missing-in-emby-epg/#entry239633
            HasImage         = Plugin.Instance.Configuration.GetEpisodeImage,
            ImageUrl         = Plugin.Instance.Configuration.GetEpisodeImage ? $"{_baseUrl}/service?method=channel.show.artwork&name={Uri.EscapeDataString(epg.Name)}" : null,
            BackdropImageUrl = Plugin.Instance.Configuration.GetEpisodeImage ? $"{_baseUrl}/service?method=channel.show.artwork&prefer=landscape&name={Uri.EscapeDataString(epg.Name)}" : null,
        };

        if (epg.Genres != null)
        {
            info.Genres     = epg.Genres;
            info.Genres[0] += " Movie";
            genreMapper.PopulateProgramGenres(info);
            if (info.IsMovie)
            {
                info.IsRepeat = false;
                info.IsSeries = false;
            }
        }

        return(info);
    }
Ejemplo n.º 12
0
        public void MappingTest()
        {
            var pluginConfiguration = new PluginConfiguration()
            {
                GenreMappings = new SerializableDictionary <String, List <String> >()
                {
                    { GenreMapper.GENRE_MOVIE, new List <string>()
                      {
                          "Movie", "Film"
                      } },
                    { GenreMapper.GENRE_SPORT, new List <string>()
                      {
                          "Sport", "Football"
                      } },
                }
            };

            var target = new GenreMapper(pluginConfiguration);

            // Test movie
            var movie = new ProgramInfo()
            {
                Genres = new List <String>()
                {
                    "Movie", "Drama"
                }
            };

            target.PopulateProgramGenres(movie);
            Assert.IsTrue(movie.IsMovie);
            Assert.IsFalse(movie.IsSports);

            var match = new ProgramInfo()
            {
                Genres = new List <String>()
                {
                    "Sport", "Football"
                }
            };

            target.PopulateProgramGenres(match);
            Assert.IsFalse(match.IsMovie);
            Assert.IsTrue(match.IsSports);
        }
Ejemplo n.º 13
0
    private TimerInfo GetTimerInfo(Recording i)
    {
        var genreMapper = new GenreMapper(Plugin.Instance.Configuration);
        var info        = new TimerInfo();

        if (i.Recurring)
        {
            info.SeriesTimerId = i.RecurringParent.ToString(CultureInfo.InvariantCulture);
            info.IsSeries      = true;
        }

        info.ChannelId          = i.ChannelId.ToString(CultureInfo.InvariantCulture);
        info.Id                 = i.Id.ToString(CultureInfo.InvariantCulture);
        info.Status             = ParseStatus(i.Status);
        info.StartDate          = DateTimeOffset.FromUnixTimeSeconds(i.StartTime).DateTime;
        info.EndDate            = DateTimeOffset.FromUnixTimeSeconds(i.StartTime + i.Duration).DateTime;
        info.PrePaddingSeconds  = i.PrePadding * 60;
        info.PostPaddingSeconds = i.PostPadding * 60;
        info.ProgramId          = i.EpgEventId.ToString(CultureInfo.InvariantCulture);
        info.Name               = i.Name;
        info.Overview           = i.Desc;
        info.EpisodeTitle       = i.Subtitle;
        info.SeasonNumber       = i.Season;
        info.EpisodeNumber      = i.Episode;
        info.OfficialRating     = i.Rating;
        if (i.Original != null)
        {
            info.OriginalAirDate = i.Original;
        }

        info.ProductionYear = i.Year;

        if (i.Genres != null)
        {
            info.Genres = i.Genres.ToArray();
            genreMapper.PopulateTimerGenres(info);
        }

        info.IsRepeat = !i.Firstrun;
        return(info);
    }
Ejemplo n.º 14
0
        public IEnumerable <ProgramInfo> GetPrograms(CancellationToken cancellationToken, string channelId, DateTime startDateUtc, DateTime endDateUtc)
        {
            var channels = GetChannelList(cancellationToken).Scanroot.Channelgroup.SelectMany(c => c.Channel);
            var response = GetFromService <Guide>(cancellationToken, typeof(Guide),
                                                  "api/epg.html?lvl=2&channel={0}&start={1}&end={2}",
                                                  channels.Where(c => c.Nr == channelId).Select(c => c.EPGID).FirstOrDefault(),
                                                  GeneralExtensions.FloatDateTime(startDateUtc),
                                                  GeneralExtensions.FloatDateTime(endDateUtc));

            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);

            Plugin.Logger.Info("Found programs: {0}  for channel nr: {1}", response.Programs.Count(), channelId);
            return(response.Programs.Select(p =>
            {
                var program = new ProgramInfo()
                {
                    Name = p.GetTitle(),
                    EpisodeTitle = p.GetSubTitle(),
                    Overview = p.GetDescription(),
                    Id = GeneralExtensions.SetEventId(p.Channel, p.Start, p.Stop),
                    SeriesId = p.GetTitle(),
                    ChannelId = channels.Where(c => c.EPGID == p.Channel).Select(c => c.Nr).FirstOrDefault(),
                    StartDate = GeneralExtensions.GetProgramTime(p.Start),
                    EndDate = GeneralExtensions.GetProgramTime(p.Stop),
                };

                var channel = channels.Where(c => c.EPGID == p.Channel).FirstOrDefault();
                if (!String.IsNullOrEmpty(channel.Logo))
                {
                    program.ImageUrl = GeneralExtensions.ChannelImageUrl(channel.Logo);
                }

                if (!String.IsNullOrEmpty(p.GetDescription()))
                {
                    genreMapper.PopulateProgramGenres(program);
                }

                //Plugin.Logger.Info("Found program: {0}, subtitle: {1}, description: {2}", p.GetTitle(), p.GetSubTitle(), p.GetDescription());
                return program;
            }));
        }
Ejemplo n.º 15
0
        public IEnumerable <TimerInfo> GetSchedules(CancellationToken cancellationToken)
        {
            List <TimerInfo> schedules = new List <TimerInfo>();

            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);

            var schedulesResponse = GetFromService <List <Schedule> >(cancellationToken, "GetSchedules");

            Plugin.Logger.Info("Found one time schedules: {0}", schedulesResponse.Where(c => c.ScheduleType == 0).Count());
            Plugin.Logger.Info("Found series schedules: {0}", schedulesResponse.Where(c => c.ScheduleType > 0).Count());

            foreach (var schedule in schedulesResponse.Where(s => s.ScheduleType == 0))
            {
                var timerInfo = new TimerInfo();
                timerInfo.Name                  = schedule.Title;
                timerInfo.Id                    = schedule.Id.ToString(CultureInfo.InvariantCulture);
                timerInfo.SeriesTimerId         = (schedule.ParentScheduleId > 0) ? schedule.ParentScheduleId.ToString(CultureInfo.InvariantCulture) : null;
                timerInfo.ProgramId             = schedule.Id.ToString(CultureInfo.InvariantCulture);
                timerInfo.ChannelId             = schedule.ChannelId.ToString(CultureInfo.InvariantCulture);
                timerInfo.StartDate             = schedule.StartTime;
                timerInfo.EndDate               = schedule.EndTime;
                timerInfo.IsPrePaddingRequired  = (schedule.PreRecordInterval > 0);
                timerInfo.IsPostPaddingRequired = (schedule.PostRecordInterval > 0);
                timerInfo.PrePaddingSeconds     = schedule.PreRecordInterval * 60;
                timerInfo.PostPaddingSeconds    = schedule.PostRecordInterval * 60;
                timerInfo.Status                = (((schedule.StartTime - TimeSpan.FromMinutes(schedule.PreRecordInterval) < DateTime.UtcNow))) &&
                                                  (DateTime.UtcNow < (schedule.EndTime + TimeSpan.FromMinutes(schedule.PostRecordInterval)))
                                   ? RecordingStatus.InProgress : RecordingStatus.New;

                var programResponse = GetFromService <List <Program> >(cancellationToken, "SearchProgramsDetailed?searchTerm={0}", schedule.Title);
                var program         = programResponse.Where(p => (p.StartTime == schedule.StartTime && p.ChannelId == schedule.ChannelId)).FirstOrDefault();
                if (program != null)
                {
                    timerInfo.Name = (!String.IsNullOrEmpty(program.EpisodeNum)) ? program.Title + " - " + program.EpisodeName :
                                     (program.HasConflict && !String.IsNullOrEmpty(program.EpisodeNum)) ? program.Title + " - " + program.EpisodeName + " [Conflict]" :
                                     (program.HasConflict && String.IsNullOrEmpty(program.EpisodeNum)) ? program.Title + " [Conflict]" :
                                     program.Title;
                    timerInfo.ProgramId    = program.Id.ToString(CultureInfo.InvariantCulture);
                    timerInfo.EpisodeTitle = program.EpisodeName;
                    timerInfo.Overview     = program.Description;
                    timerInfo.Genres       = new List <String>();
                    timerInfo.Status       = (program.HasConflict) ? RecordingStatus.ConflictedNotOk : timerInfo.Status;

                    if (!String.IsNullOrEmpty(program.EpisodeNum))
                    {
                        int enumber;
                        Int32.TryParse((Regex.Match(program.EpisodeNum, @"\d+").Value), out enumber);
                        timerInfo.EpisodeNumber = enumber;
                    }

                    if (!String.IsNullOrEmpty(program.SeriesNum))
                    {
                        int snumber;
                        Int32.TryParse((Regex.Match(program.SeriesNum, @"\d+").Value), out snumber);
                        timerInfo.SeasonNumber = snumber;
                    }

                    //timerInfo.IsProgramSeries = true; //is set by genreMapper
                    if (!String.IsNullOrEmpty(program.Genre))
                    {
                        timerInfo.Genres.Add(program.Genre);
                        genreMapper.PopulateTimerGenres(timerInfo);
                    }

                    Plugin.Logger.Info("One time schedule: \"{0}\"; Channel: {1}; Start Time: {2}; End Time: {3}; Status: {4}", schedule.Title, schedule.ChannelId, schedule.StartTime, schedule.EndTime, timerInfo.Status.ToString());
                }
                else
                {
                    Plugin.Logger.Info("The one time schedule: \"{0}\" does not match any program with start time: {1} on channel: {2}", schedule.Title, schedule.StartTime, schedule.ChannelId);
                }
                schedules.Add(timerInfo);
            }

            foreach (var schedule in schedulesResponse.Where(s => s.ScheduleType > 0).DistinctBy(s => s.Title))
            {
                var programResponse = GetFromService <List <Program> >(cancellationToken, "SearchProgramsDetailed?searchTerm={0}", schedule.Title);
                Plugin.Logger.Info("Found pending timers: {0}  for series schedule: \"{1}\"", programResponse.Where(c => (c.IsRecordingSeriesPending || c.IsPartialRecordingSeriesPending || c.IsRecordingSeriesCanceled)).Count(), schedule.Title);

                foreach (var program in programResponse.Where(p => (p.IsRecordingSeriesPending || p.IsPartialRecordingSeriesPending || p.IsRecordingSeriesCanceled)))
                {
                    var timerInfo = new TimerInfo();
                    timerInfo.Name = (program.IsRecordingSeriesCanceled && !String.IsNullOrEmpty(program.EpisodeNum)) ? program.Title + " - " + program.EpisodeName + " [Cancelled]" :
                                     (program.HasConflict && !String.IsNullOrEmpty(program.EpisodeNum)) ? program.Title + " - " + program.EpisodeName + " [Conflict]" :
                                     (!String.IsNullOrEmpty(program.EpisodeNum)) ? program.Title + " - " + program.EpisodeName :
                                     program.Title;
                    timerInfo.Id                    = program.Id.ToString(CultureInfo.InvariantCulture);
                    timerInfo.SeriesTimerId         = schedule.Id.ToString(CultureInfo.InvariantCulture);
                    timerInfo.ProgramId             = program.Id.ToString(CultureInfo.InvariantCulture);
                    timerInfo.ChannelId             = program.ChannelId.ToString(CultureInfo.InvariantCulture);
                    timerInfo.EpisodeTitle          = program.EpisodeName;
                    timerInfo.Overview              = program.Description;
                    timerInfo.StartDate             = program.StartTime;
                    timerInfo.EndDate               = program.EndTime;
                    timerInfo.IsPrePaddingRequired  = (schedule.PreRecordInterval > 0);
                    timerInfo.IsPostPaddingRequired = (schedule.PostRecordInterval > 0);
                    timerInfo.PrePaddingSeconds     = schedule.PreRecordInterval * 60;
                    timerInfo.PostPaddingSeconds    = schedule.PostRecordInterval * 60;
                    timerInfo.Status                = (program.IsRecordingSeriesCanceled) ? RecordingStatus.Cancelled :
                                                      (program.HasConflict) ? RecordingStatus.ConflictedNotOk :
                                                      RecordingStatus.New;

                    if (!String.IsNullOrEmpty(program.EpisodeNum))
                    {
                        int enumber;
                        Int32.TryParse((Regex.Match(program.EpisodeNum, @"\d+").Value), out enumber);
                        timerInfo.EpisodeNumber = enumber;
                    }

                    if (!String.IsNullOrEmpty(program.SeriesNum))
                    {
                        int snumber;
                        Int32.TryParse((Regex.Match(program.SeriesNum, @"\d+").Value), out snumber);
                        timerInfo.SeasonNumber = snumber;
                    }

                    Plugin.Logger.Info("Seriespart schedule: \"{0}\"; Channel: {1}; Start Time: {2}; End Time: {3}; Status: {4}", program.Title, program.ChannelId, program.StartTime, program.EndTime, timerInfo.Status.ToString());

                    schedules.Add(timerInfo);
                }
                ;
            }

            return(schedules);
        }
Ejemplo n.º 16
0
        public IEnumerable <TimerInfo> GetSchedules(CancellationToken cancellationToken)
        {
            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);

            var channels = GetChannelList(cancellationToken).Root.ChannelGroup.SelectMany(c => c.Channel);
            var response = GetFromService <Timers>(cancellationToken, typeof(Timers), "api/timerlist.html?utf8=2");

            Plugin.Logger.Info("Found overall one time schedules: {0} ", response.Timer.Where(t => String.IsNullOrEmpty(t.Days)).Count());
            return(response.Timer.Where(t => String.IsNullOrEmpty(t.Days)).Select(t =>
            {
                var timerInfo = new TimerInfo()
                {
                    Name = t.Description,
                    Id = t.Id,
                    ChannelId = t.ChannelId,
                    StartDate = GeneralExtensions.GetScheduleTime(t.Date, t.Start).AddMinutes(t.PreEPG),
                    EndDate = GeneralExtensions.GetScheduleTime(t.Date, t.Start).AddMinutes(t.Duration).AddMinutes(-t.PostEPG),
                    IsPrePaddingRequired = (t.PreEPG > 0),
                    IsPostPaddingRequired = (t.PostEPG > 0),
                    PrePaddingSeconds = t.PreEPG * 60,
                    PostPaddingSeconds = t.PostEPG * 60,
                    Status = (t.Enabled == "0") ? RecordingStatus.Cancelled :
                             (t.Executeable == "0") ? RecordingStatus.ConflictedNotOk :
                             (t.Recording == "-1") ? RecordingStatus.InProgress :
                             RecordingStatus.New,
                };

                var seriesTimer = GetFromService <Searches>(cancellationToken, typeof(Searches), "api/searchlist.html").Search.OrderBy(s => s.Name).ToList();

                if (seriesTimer.Any(x => x.Series.Equals(t.Series)))
                {
                    timerInfo.SeriesTimerId = t.Series;
                }

                var guide = GetFromService <Guide>(cancellationToken, typeof(Guide),
                                                   "api/epg.html?lvl=2&channel={0}&start={1}&end={2}",
                                                   channels.Where(c => c.Id == timerInfo.ChannelId).Select(c => c.EPGID).FirstOrDefault(),
                                                   GeneralExtensions.FloatDateTime(timerInfo.StartDate),
                                                   GeneralExtensions.FloatDateTime(timerInfo.EndDate));

                var program = guide.Program.Where(p => GeneralExtensions.GetProgramTime(p.Start) == timerInfo.StartDate).FirstOrDefault();

                if (program != null)
                {
                    timerInfo.ProgramId = GeneralExtensions.SetEventId(program.ChannelId, program.Start, program.Stop);
                    timerInfo.Name = (program.EpisodeNumber.HasValue) ? program.Name + " - " + program.EpisodeTitle : program.Name;
                    timerInfo.EpisodeTitle = program.EpisodeTitle;
                    timerInfo.EpisodeNumber = program.EpisodeNumber;
                    timerInfo.SeasonNumber = program.SeasonNumber;
                    timerInfo.Overview = program.Overview;

                    if (!String.IsNullOrEmpty(program.Overview))
                    {
                        genreMapper.PopulateTimerGenres(timerInfo);
                    }
                }

                Plugin.Logger.Info("Found Schedule: {0}, Series: {1}, ChannelNr: {2}, StartDate: {3}, EndDate: {4}, IsEnabled: {5}", t.Description, t.Series, timerInfo.ChannelId, timerInfo.StartDate.ToLocalTime(), timerInfo.EndDate.ToLocalTime(), t.Enabled);
                return timerInfo;
            }));
        }
Ejemplo n.º 17
0
        public IEnumerable <MyRecordingInfo> GetRecordings(CancellationToken cancellationToken)
        {
            var pluginPath  = Plugin.Instance.ConfigurationFilePath.Remove(Plugin.Instance.ConfigurationFilePath.Length - 4);
            var localPath   = String.Format("{0}", Configuration.LocalFilePath);
            var remotePath  = String.Format("{0}", Configuration.RemoteFilePath);
            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);
            var lastName    = string.Empty;

            var schedules = GetFromService <Timers>(cancellationToken, typeof(Timers), "api/timerlist.html?utf8=2");
            var response  = GetFromService <Recordings>(cancellationToken, typeof(Recordings), "api/recordings.html?utf8=1&images=1");

            Plugin.Logger.Info("Found overall Recordings: {0} ", response.Recording.Count());
            return(response.Recording.Select(r =>
            {
                var recording = new MyRecordingInfo()
                {
                    Id = r.Id,
                    Name = r.Name,
                    EpisodeTitle = r.EpisodeTitle,
                    EpisodeNumber = r.EpisodeNumber,
                    SeasonNumber = r.SeasonNumber,
                    Year = r.Year,
                    Overview = r.Overview,
                    EitContent = r.EitContent,
                    SeriesTimerId = r.Series,
                    ChannelId = r.ChannelId,
                    ChannelName = r.ChannelName,
                    ChannelType = ChannelType.TV,
                    StartDate = DateTime.ParseExact(r.Start, "yyyyMMddHHmmss", CultureInfo.InvariantCulture).ToUniversalTime(),
                    EndDate = DateTime.ParseExact(r.Start, "yyyyMMddHHmmss", CultureInfo.InvariantCulture).Add(TimeSpan.ParseExact(r.Duration, "hhmmss", CultureInfo.InvariantCulture)).ToUniversalTime(),
                    Path = r.File,
                };

                if (!String.IsNullOrEmpty(r.EitContent) || !String.IsNullOrEmpty(r.Overview))
                {
                    genreMapper.PopulateRecordingGenres(recording);
                }

                if (recording.IsMovie)
                {
                    recording.Name = r.MovieName;
                }

                if ((recording.StartDate <= DateTime.Now.ToUniversalTime()) && (recording.EndDate >= DateTime.Now.ToUniversalTime()))
                {
                    var timers = schedules.Timer.Where(t => GeneralExtensions.GetScheduleTime(t.Date, t.Start).AddMinutes(t.PreEPG) == recording.StartDate && t.Recording == "-1").FirstOrDefault();

                    if (timers != null)
                    {
                        recording.Status = RecordingStatus.InProgress;
                    }
                }
                else
                {
                    recording.Status = RecordingStatus.Completed;

                    if (!String.IsNullOrEmpty(r.Image))
                    {
                        recording.ImageUrl = _wssProxy.GetRecordingImage(r.Image);
                    }
                }

                if (Configuration.RequiresPathSubstitution)
                {
                    recording.Path = r.File.Replace(localPath, remotePath);
                }

                if (Configuration.EnableTmdbLookup)
                {
                    if (recording.Name != lastName)
                    {
                        _tmdbLookup.GetTmdbPoster(cancellationToken, recording);
                    }
                    lastName = recording.Name;
                }

                if (File.Exists(Path.Combine(pluginPath, "recordingposters", String.Join("", recording.Name.Split(Path.GetInvalidFileNameChars())) + ".jpg")))
                {
                    recording.TmdbPoster = Path.Combine(pluginPath, "recordingposters", String.Join("", recording.Name.Split(Path.GetInvalidFileNameChars())) + ".jpg");
                }

                Plugin.Logger.Info("Found Recording: {0} - {1}, Series: {2}, Id: {3}, status: {4}", r.Name, r.EpisodeTitle, r.Series, r.Id, recording.Status);
                return recording;
            }));
        }
Ejemplo n.º 18
0
        public IEnumerable <MyRecordingInfo> GetRecordings(CancellationToken cancellationToken)
        {
            var pluginPath  = Plugin.Instance.ConfigurationFilePath.Remove(Plugin.Instance.ConfigurationFilePath.Length - 4);
            var localPath   = String.Format("{0}", Configuration.LocalFilePath);
            var remotePath  = String.Format("{0}", Configuration.RemoteFilePath);
            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);
            var lastName    = string.Empty;

            var recordings = GetFromService <List <Recording> >(cancellationToken, "GetRecordings").Select(r =>
            {
                var recording = new MyRecordingInfo()
                {
                    Id            = r.Id,
                    Name          = r.Title,
                    EpisodeTitle  = r.EpisodeName,
                    EpisodeNumber = r.EpisodeNumber,
                    SeasonNumber  = r.SeasonNumber,
                    Overview      = r.Description,
                    Year          = r.Year,
                    Genres        = new List <String>(),
                    TimerId       = r.ScheduleId.ToString(CultureInfo.InvariantCulture),
                    ChannelId     = r.ChannelId.ToString(CultureInfo.InvariantCulture),
                    ChannelName   = r.ChannelName,
                    ChannelType   = ChannelType.TV,
                    StartDate     = r.StartTime,
                    EndDate       = r.EndTime,
                    Status        = (r.IsRecording) ? RecordingStatus.InProgress : RecordingStatus.Completed,
                    Path          = r.FileName,
                };

                //recording.IsSeries = true; //is set by genreMapper
                if (!String.IsNullOrEmpty(r.Genre))
                {
                    recording.Genres.Add(r.Genre);
                    genreMapper.PopulateRecordingGenres(recording);
                }

                if (recording.IsMovie)
                {
                    recording.Name = r.MovieName;
                }

                if (r.IsRecording)
                {
                    var schedule      = GetSchedule(cancellationToken, r.ScheduleId.ToString());
                    recording.EndDate = schedule.EndTime + TimeSpan.FromMinutes(schedule.PostRecordInterval);
                }

                if (!r.IsRecording)
                {
                    recording.ImageUrl = _wssProxy.GetRecordingImage(r.Id);
                }

                if (Configuration.RequiresPathSubstitution)
                {
                    recording.Path = r.FileName.Replace(localPath, remotePath);
                }

                if (Configuration.EnableTmdbLookup)
                {
                    if (recording.Name != lastName)
                    {
                        _tmdbLookup.GetTmdbPoster(cancellationToken, recording);
                    }
                    lastName = recording.Name;
                }

                if (File.Exists(Path.Combine(pluginPath, "recordingposters", String.Join("", recording.Name.Split(Path.GetInvalidFileNameChars())) + ".jpg")))
                {
                    recording.TmdbPoster = Path.Combine(pluginPath, "recordingposters", String.Join("", recording.Name.Split(Path.GetInvalidFileNameChars())) + ".jpg");
                }

                return(recording);
            }).ToList();

            Plugin.Logger.Info("Found recordings: {0} ", recordings.Count());
            return(recordings);
        }
Ejemplo n.º 19
0
        public void ToGenre_GenreResultIsNull_ThrowsArgumentNullException()
        {
            var target = new GenreMapper();

            Assert.Throws <ArgumentNullException>(() => target.ToGenre(null));
        }
Ejemplo n.º 20
0
 public void Update(GenreModel entity)
 {
     _genreRepository.Update(GenreMapper.ToEntity(entity));
 }
Ejemplo n.º 21
0
 public GenreModel FindById(long id)
 {
     return(GenreMapper.ToModel(_genreRepository.FindById(id)));
 }
Ejemplo n.º 22
0
 public void Delete(GenreModel entity)
 {
     _genreRepository.Delete(GenreMapper.ToEntity(entity));
 }
Ejemplo n.º 23
0
        private IRestResponse <T[]> Browse <T>(
            string seriesType,
            int?year                           = null,
            Season?season                      = null,
            MediaType?type                     = null,
            AnimeStatus?status                 = null,
            IEnumerable <Genre> genres         = null,
            IEnumerable <Genre> excludedGenres = null,
            SortingMethod?sortingMethod        = null,
            bool?airingData                    = null,
            bool?fullPage                      = null,
            int?page                           = null)
        {
            var request        = MakeRequest($"browse/{seriesType}", Method.GET);
            var genreConverter = new GenreMapper();

            if (year != null)
            {
                request.AddParameter("year", year);
            }
            if (season != null)
            {
                request.AddParameter("season", new SeasonMapper().T2ToT1((Season)season));
            }
            if (type != null)
            {
                request.AddParameter("type", type);
            }
            if (status != null)
            {
                request.AddParameter("status", status);
            }
            if (genres != null)
            {
                var genresArray = genres as Genre[] ?? genres.ToArray();
                if (genresArray.Any())
                {
                    request.AddParameter("genres", string.Join(",", genresArray.Select(genre => genreConverter.T2ToT1(genre))));
                }
            }
            if (excludedGenres != null)
            {
                var genresArray = excludedGenres as Genre[] ?? excludedGenres.ToArray();
                if (genresArray.Any())
                {
                    request.AddParameter("genres_exclude", string.Join(",", genresArray.Select(genre => genreConverter.T2ToT1(genre))));
                }
            }
            if (sortingMethod != null)
            {
                request.AddParameter("sort", new SortMapper().T2ToT1((SortingMethod)sortingMethod));
            }
            if (airingData != null)
            {
                request.AddParameter("airing_data", airingData);
            }
            if (fullPage != null)
            {
                request.AddParameter("full_page", fullPage);
            }
            if (page != null)
            {
                request.AddParameter("page", page);
            }

            return(Execute <T[]>(request));
        }
        public ActionResult Index()
        {
            var model = GenreMapper.Map(genresClient.GetGenres().Result);

            return(PartialView(model));
        }
 public OperationMaster()
 {
     mapper  = new GenreMapper();
     songmmp = new SongMapper();
     dao     = SqlDao.GetInstance();
 }
Ejemplo n.º 26
0
    private MyRecordingInfo GetRecordingInfo(Recording i)
    {
        var genreMapper = new GenreMapper(Plugin.Instance.Configuration);
        var info        = new MyRecordingInfo();

        info.Id = i.Id.ToString(CultureInfo.InvariantCulture);
        if (i.Recurring)
        {
            info.SeriesTimerId = i.RecurringParent.ToString(CultureInfo.InvariantCulture);
        }

        if (i.File != null)
        {
            if (Plugin.Instance.Configuration.RecordingTransport == 2)
            {
                info.Url = i.File;
            }
            else
            {
                info.Url = $"{_baseUrl}/live?recording={i.Id}";
            }
        }

        info.Status    = ParseStatus(i.Status);
        info.StartDate = DateTimeOffset.FromUnixTimeSeconds(i.StartTime).DateTime;
        info.EndDate   = DateTimeOffset.FromUnixTimeSeconds(i.StartTime + i.Duration).DateTime;

        info.ProgramId    = i.EpgEventId.ToString(CultureInfo.InvariantCulture);
        info.EpisodeTitle = i.Subtitle;
        info.Name         = i.Name;
        info.Overview     = i.Desc;
        info.Genres       = i.Genres;
        info.IsRepeat     = !i.Firstrun;
        info.ChannelId    = i.ChannelId.ToString(CultureInfo.InvariantCulture);
        info.ChannelType  = ChannelType.TV;
        info.ImageUrl     = _baseUrl + "/service?method=channel.show.artwork&prefer=landscape&name=" + Uri.EscapeDataString(i.Name);
        info.HasImage     = true;
        if (i.Season.HasValue)
        {
            info.SeasonNumber  = i.Season;
            info.EpisodeNumber = i.Episode;
            info.IsSeries      = true;
        }

        if (i.Original != null)
        {
            info.OriginalAirDate = i.Original;
        }

        info.ProductionYear = i.Year;
        info.OfficialRating = i.Rating;

        if (info.Genres != null)
        {
            info.Genres = i.Genres;
            genreMapper.PopulateRecordingGenres(info);
        }
        else
        {
            info.Genres = new List <string>();
        }

        return(info);
    }
Ejemplo n.º 27
0
        private MyRecordingInfo GetRecordingInfo(Recording i)
        {
            var genreMapper = new GenreMapper(Plugin.Instance.Configuration);
            var info        = new MyRecordingInfo();

            try
            {
                info.Id = i.id.ToString(_usCulture);
                if (i.recurring)
                {
                    info.SeriesTimerId = i.recurringParent.ToString(_usCulture);
                }

                if (i.file != null)
                {
                    if (Plugin.Instance.Configuration.RecordingTransport == 2)
                    {
                        info.Url = i.file;
                    }
                    else
                    {
                        info.Url = String.Format("{0}/live?recording={1}", _baseUrl, i.id);
                    }
                }

                info.Status    = ParseStatus(i.status);
                info.StartDate = DateTimeOffset.FromUnixTimeSeconds(i.startTime).DateTime;
                info.EndDate   = DateTimeOffset.FromUnixTimeSeconds(i.startTime + i.duration).DateTime;

                info.ProgramId    = i.epgEventId.ToString(_usCulture);
                info.EpisodeTitle = i.subtitle;
                info.Name         = i.name;
                info.Overview     = i.desc;
                info.Genres       = i.genres;
                info.IsRepeat     = !i.firstrun;
                info.ChannelId    = i.channelId.ToString(_usCulture);
                info.ChannelType  = ChannelType.TV;
                info.ImageUrl     = _baseUrl + "/service?method=channel.show.artwork&prefer=landscape&name=" + Uri.EscapeDataString(i.name);
                info.HasImage     = true;
                if (i.season.HasValue)
                {
                    info.SeasonNumber  = i.season;
                    info.EpisodeNumber = i.episode;
                    info.IsSeries      = true; //!string.IsNullOrEmpty(epg.Subtitle); http://emby.media/community/index.php?/topic/21264-series-record-ability-missing-in-emby-epg/#entry239633
                }
                if (i.original != null)
                {
                    info.OriginalAirDate = i.original;
                }
                info.ProductionYear = i.year;
                //info.CommunityRating = ListingsResponse.ParseCommunityRating(epg.StarRating);
                //info.IsHD = true;
                //info.Audio = ProgramAudio.Stereo;

                info.OfficialRating = i.rating;

                if (info.Genres != null)
                {
                    info.Genres = i.genres;
                    genreMapper.PopulateRecordingGenres(info);
                }
                else
                {
                    info.Genres = new List <string>();
                }
                return(info);
            }
            catch (Exception err)
            {
                throw (err);
            }
        }
Ejemplo n.º 28
0
        public IEnumerable <RecordingInfo> GetRecordings(CancellationToken cancellationToken)
        {
            var configuration = Plugin.Instance.Configuration;
            var localpath     = String.Format("{0}", configuration.LocalFilePath);
            var remotepath    = String.Format("{0}", configuration.RemoteFilePath);
            var genreMapper   = new GenreMapper(Plugin.Instance.Configuration);

            var schedules  = GetFromService <List <Schedule> >(cancellationToken, "GetSchedules");
            var recordings = GetFromService <List <Recording> >(cancellationToken, "GetRecordings").Select(r =>
            {
                var recording = new RecordingInfo()
                {
                    Name         = r.Title,
                    EpisodeTitle = r.EpisodeName,
                    Id           = r.Id,
                    ShowId       = r.Title,
                    TimerId      = r.ScheduleId.ToString(CultureInfo.InvariantCulture),
                    ChannelId    = r.ChannelId.ToString(CultureInfo.InvariantCulture),
                    StartDate    = r.StartTime,
                    EndDate      = r.EndTime,
                    Overview     = r.Description,
                    Genres       = new List <String>(),
                    Status       = (r.IsRecording) ? RecordingStatus.InProgress : RecordingStatus.Completed,
                    HasImage     = false,
                };

                if (!String.IsNullOrEmpty(r.EpisodeNum))
                {
                    int EpisodeNumber;
                    int SeasonNumber;

                    if (String.IsNullOrEmpty(r.SeriesNum))
                    {
                        Int32.TryParse((Regex.Match(r.EpisodeNum, @"\d+").Value), out EpisodeNumber);
                        recording.EpisodeTitle = String.Format("E{0} - {1}", EpisodeNumber, r.EpisodeName);
                    }

                    if (!String.IsNullOrEmpty(r.SeriesNum))
                    {
                        Int32.TryParse((Regex.Match(r.SeriesNum, @"\d+").Value), out SeasonNumber);
                        Int32.TryParse((Regex.Match(r.EpisodeNum, @"\d+").Value), out EpisodeNumber);
                        recording.EpisodeTitle = String.Format("S{0},E{1} - {2}", SeasonNumber, EpisodeNumber, r.EpisodeName);
                    }
                }

                if (r.IsRecording)
                {
                    var schedule      = GetSchedule(cancellationToken, r.ScheduleId.ToString());
                    recording.EndDate = schedule.EndTime + TimeSpan.FromMinutes(schedule.PostRecordInterval);

                    if (Plugin.Instance.Configuration.ProgramImages && File.Exists(String.Format(@"{0}\logos\{1}.jpg", Plugin.Instance.DataFolderPath, recording.ChannelId)))
                    {
                        recording.HasImage  = true;
                        recording.ImagePath = String.Format(@"{0}\logos\{1}.jpg", Plugin.Instance.DataFolderPath, recording.ChannelId);;
                    }
                }

                if (!r.IsRecording)
                {
                    recording.HasImage = true;
                    recording.ImageUrl = _wssProxy.GetRecordingImageUrl(r.Id);
                }

                if (configuration.EnableDirectAccess && !configuration.RequiresPathSubstitution && !r.IsRecording)
                {
                    recording.Path = r.FileName;
                }

                if (configuration.EnableDirectAccess && configuration.RequiresPathSubstitution && !r.IsRecording)
                {
                    recording.Path = r.FileName.Replace(localpath, remotepath);
                }

                //recording.IsSeries = true; //is set by genreMapper
                if (!String.IsNullOrEmpty(r.Genre))
                {
                    recording.Genres.Add(r.Genre);
                    genreMapper.PopulateRecordingGenres(recording);
                }

                var series = schedules.Where(s => (s.ScheduleType > 0 && s.Title == r.Title)).FirstOrDefault();
                if (series != null)
                {
                    recording.SeriesTimerId = series.Id.ToString(CultureInfo.InvariantCulture);
                    Plugin.Logger.Info("Found recording \"{0} - {1}\"; Id: {2}", r.Title, r.EpisodeName, recording.Id);
                }
                else
                {
                    Plugin.Logger.Info("Found recording \"{0} - {1}\"; Id: {2} without any matching series schedule", r.Title, r.EpisodeName, recording.Id);
                }

                return(recording);
            }).ToList();

            Plugin.Logger.Info("Found recordings: {0} ", recordings.Count());
            return(recordings);
        }