private string BuildPlayPacket(PodcastEpisodeView episode)
        {
            string playPacket = "";

            if (episode != null)
            {
                TimeSpan originalDuration            = Utilities.GetTimeSpanFromDuration(episode.OriginalDuration);
                string   formattedDurationForDisplay = $"{originalDuration.Minutes}:{originalDuration.Seconds}";
                string   totalSeconds = ((int)Math.Round(originalDuration.TotalSeconds)).ToString();

                playPacket = $"{episode.Id}|{episode.Title}|{totalSeconds}|{formattedDurationForDisplay}|{episode.MediaUrl}";
            }

            return(playPacket);
        }
예제 #2
0
        public static async Task PlayFile(PodcastEpisodeView ep, bool fromStart = false)
        {
            var podcast = Config.Instance.ConfigObject.PodcastMap.Podcasts.FirstOrDefault(x => x.Value.PrimaryName == ep.PrimaryName).Value;

            if (podcast == null)
            {
                return;
            }
            var path    = System.IO.Path.Combine(Config.Instance.ConfigObject.RootPath, podcast.FolderPath, ep.Episode.PublishDateUtc.Year.ToString(), ep.Episode.FileName);
            var seconds = 0;

            if (!fromStart)
            {
                seconds = Convert.ToInt32(ep.Episode.Progress.ProgressTime.TotalSeconds);
            }

            await VlcApi.PlayFile(path, seconds);

            podcast.LastPlayed = ep.Episode.EpisodeNumber;
            await UpdateLatestPlayedList().ConfigureAwait(false);
        }