public async Task Process(Models.BeyondPod.PodCast source, IConsolidationRepository consolidationRepository, INewPodCastQueue newPodCastQueue, ILogger log) { log.LogInformation($"Processing Beyond Pod data"); var existing = await consolidationRepository.Get(source.FeedName, source.EpisodeName); var isNew = (existing == null); Models.BeyondPod.PodCastTableEntity podCast = isNew ? NewPodCast(source) : UpdatePodCast(existing, source); podCast = ApplyFixes(podCast); var shouldBeProgressed = ShouldPodCastBeProgressed(podCast); if (shouldBeProgressed) { podCast.Actioned = true; } // Make sure we can save the podcast before we progress await consolidationRepository.Save(podCast); if (shouldBeProgressed) { var activityPodcast = _podCastConverter.Convert(podCast); newPodCastQueue.Add(activityPodcast); } }
protected override void PostConvertActions(Models.BeyondPod.PodCastTableEntity source, Models.PodCast destination) { var episodeNumber = GetEpisodeNumber(source.EpisodeName); if (!string.IsNullOrEmpty(episodeNumber)) { destination.EpisodeUrl = $"https://darknetdiaries.com/episode/{episodeNumber}/"; } }
public static Models.BeyondPod.PodCastTableEntity ApplyFixes(Models.BeyondPod.PodCastTableEntity podCast) { // Apply fix for when duration is less than position if (podCast.EpisodeDuration < podCast.EpisodePosition) { podCast.EpisodeDuration = podCast.EpisodePosition; } return(podCast); }
protected override void PostConvertActions(Models.BeyondPod.PodCastTableEntity source, Models.PodCast destination) { var url = source.EpisodePostUrl; if (!string.IsNullOrEmpty(url) && url.StartsWith("http:", StringComparison.CurrentCultureIgnoreCase)) { url = $"https:{url.Substring(5)}"; } destination.EpisodeUrl = url; }
public Models.PodCast Convert(Models.BeyondPod.PodCastTableEntity source) { return(new Models.PodCast { Created = source.Created, FeedName = source.FeedName, FeedUrl = source.FeedUrl, EpisodeName = source.EpisodeName, EpisodeUrl = source.EpisodeUrl, EpisodeSummary = source.EpisodeSummary, EpisodeDuration = source.EpisodeDuration, Category = "" }); }
public Models.PodCast Convert(Models.BeyondPod.PodCastTableEntity source) { if (_inner == null) { return(null); } var podcast = _inner.Convert(source); if (string.IsNullOrEmpty(podcast.Category)) { podcast.Category = "Other"; } return(podcast); }
public static Models.BeyondPod.PodCastTableEntity UpdatePodCast(Models.BeyondPod.PodCastTableEntity podCast, Models.BeyondPod.PodCast source) { if (source.Created > podCast.Created) { podCast.Created = source.Created; podCast.Playing = source.Playing; podCast.EpisodePosition = source.EpisodePosition; // Sometimes we seem to see zero durations if (podCast.EpisodeDuration < source.EpisodeDuration) { podCast.EpisodeDuration = source.EpisodeDuration; } } return(podCast); }
public Models.PodCast Convert(Models.BeyondPod.PodCastTableEntity source) { if (_inner == null) { return(null); } var podcast = _inner.Convert(source); if (podcast.FeedName.Equals(_feedname, StringComparison.CurrentCultureIgnoreCase)) { podcast.Category = _category; PostConvertActions(source, podcast); } return(podcast); }
public static bool ShouldPodCastBeProgressed(Models.BeyondPod.PodCastTableEntity podCast) { if (podCast.Actioned) { return(false); } if (podCast.EpisodeDuration == 0) { return(false); } var percentageThrough = (float)podCast.EpisodePosition / (float)podCast.EpisodeDuration; if (percentageThrough <= 0.9) { return(false); } return(true); }
public static Models.BeyondPod.PodCastTableEntity NewPodCast(Models.BeyondPod.PodCast source) { var podCast = new Models.BeyondPod.PodCastTableEntity(source.FeedName, source.EpisodeName); podCast.Created = source.Created; podCast.Playing = source.Playing; podCast.FeedName = source.FeedName; podCast.FeedUrl = source.FeedUrl; podCast.EpisodeName = source.EpisodeName; podCast.EpisodeUrl = source.EpisodeUrl; podCast.EpisodeFile = source.EpisodeFile; podCast.EpisodePostUrl = source.EpisodePostUrl; podCast.EpisodeMime = source.EpisodeMime; podCast.EpisodeSummary = source.EpisodeSummary; podCast.EpisodeDuration = source.EpisodeDuration; podCast.EpisodePosition = source.EpisodePosition; podCast.Artist = source.Artist; podCast.Album = source.Album; podCast.Track = source.Track; return(podCast); }
public Models.PodCast Convert(Models.BeyondPod.PodCastTableEntity source) { return(_rootHandler.Convert(source)); }
protected override void PostConvertActions(Models.BeyondPod.PodCastTableEntity source, Models.PodCast destination) { destination.EpisodeUrl = "https://www.hanselminutes.com/"; }
protected override void PostConvertActions(Models.BeyondPod.PodCastTableEntity source, Models.PodCast destination) { destination.EpisodeUrl = $"https://red-folder.com/podcasts/{MakeSafe(source.EpisodeName)}"; }
protected override void PostConvertActions(Models.BeyondPod.PodCastTableEntity source, Models.PodCast destination) { destination.FeedName = "JavaScript Jabber"; destination.EpisodeUrl = source.EpisodePostUrl; }
protected override void PostConvertActions(Models.BeyondPod.PodCastTableEntity source, Models.PodCast destination) { destination.EpisodeUrl = source.EpisodePostUrl; }
protected virtual void PostConvertActions(Models.BeyondPod.PodCastTableEntity source, Models.PodCast destination) { }
protected override void PostConvertActions(Models.BeyondPod.PodCastTableEntity source, Models.PodCast destination) { destination.FeedName = "Adventures in Angular"; destination.EpisodeUrl = source.EpisodePostUrl; }