2
0
Luke Pulverenti 11 жил өмнө
parent
commit
1e88b1ef9f

+ 6 - 0
MediaBrowser.Model/LiveTv/ChannelInfoDto.cs

@@ -70,6 +70,12 @@ namespace MediaBrowser.Model.LiveTv
         /// <value>The user data.</value>
         public UserItemDataDto UserData { get; set; }
 
+        /// <summary>
+        /// Gets or sets the now playing program.
+        /// </summary>
+        /// <value>The now playing program.</value>
+        public ProgramInfoDto CurrentProgram { get; set; }
+
         public ChannelInfoDto()
         {
             ImageTags = new Dictionary<ImageType, Guid>();

+ 8 - 8
MediaBrowser.Providers/Movies/MovieDbProvider.cs

@@ -822,14 +822,14 @@ namespace MediaBrowser.Providers.Movies
                 }
             }
 
-            if (movieData.keywords != null && movieData.keywords.keywords != null && !movie.LockedFields.Contains(MetadataFields.Tags))
-            {
-                var hasTags = movie as IHasTags;
-                if (hasTags != null)
-                {
-                    hasTags.Tags = movieData.keywords.keywords.Select(i => i.name).ToList();
-                }
-            }
+            //if (movieData.keywords != null && movieData.keywords.keywords != null && !movie.LockedFields.Contains(MetadataFields.Tags))
+            //{
+            //    var hasTags = movie as IHasTags;
+            //    if (hasTags != null)
+            //    {
+            //        hasTags.Tags = movieData.keywords.keywords.Select(i => i.name).ToList();
+            //    }
+            //}
 
             if (movieData.trailers != null && movieData.trailers.youtube != null &&
                 movieData.trailers.youtube.Count > 0)

+ 7 - 1
MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs

@@ -259,9 +259,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
         /// Gets the channel info dto.
         /// </summary>
         /// <param name="info">The info.</param>
+        /// <param name="currentProgram">The current program.</param>
         /// <param name="user">The user.</param>
         /// <returns>ChannelInfoDto.</returns>
-        public ChannelInfoDto GetChannelInfoDto(LiveTvChannel info, User user = null)
+        public ChannelInfoDto GetChannelInfoDto(LiveTvChannel info, LiveTvProgram currentProgram, User user = null)
         {
             var channelInfo = info.ChannelInfo;
 
@@ -289,6 +290,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
                 dto.ImageTags[ImageType.Primary] = imageTag.Value;
             }
 
+            if (currentProgram != null)
+            {
+                dto.CurrentProgram = GetProgramInfoDto(currentProgram, channelInfo.Name, user);
+            }
+
             return dto;
         }
 

+ 13 - 2
MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -107,7 +107,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
                 return number;
 
             }).ThenBy(i => i.Name)
-            .Select(i => _tvDtoService.GetChannelInfoDto(i, user))
+            .Select(i => _tvDtoService.GetChannelInfoDto(i, GetCurrentProgram(i.ChannelInfo.Id), user))
             .ToArray();
 
             var result = new QueryResult<ChannelInfoDto>
@@ -705,11 +705,22 @@ namespace MediaBrowser.Server.Implementations.LiveTv
         {
             var channel = GetInternalChannel(id);
 
-            var dto = _tvDtoService.GetChannelInfoDto(channel, user);
+            var dto = _tvDtoService.GetChannelInfoDto(channel, GetCurrentProgram(channel.ChannelInfo.Id), user);
 
             return Task.FromResult(dto);
         }
 
+        private LiveTvProgram GetCurrentProgram(string externalChannelId)
+        {
+            var now = DateTime.UtcNow;
+
+            return _programs.Values
+                .Where(i => string.Equals(externalChannelId, i.ProgramInfo.ChannelId, StringComparison.OrdinalIgnoreCase))
+                .OrderBy(i => i.ProgramInfo.StartDate)
+                .SkipWhile(i => now >= i.ProgramInfo.EndDate)
+                .FirstOrDefault();
+        }
+
         public async Task<SeriesTimerInfoDto> GetNewTimerDefaults(CancellationToken cancellationToken)
         {
             var service = ActiveService;

+ 16 - 2
MediaBrowser.ServerApplication/ApplicationHost.cs

@@ -1,4 +1,5 @@
-using MediaBrowser.Api;
+using System.Globalization;
+using MediaBrowser.Api;
 using MediaBrowser.Common;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Constants;
@@ -627,10 +628,23 @@ namespace MediaBrowser.ServerApplication
                 OperatingSystem = Environment.OSVersion.ToString(),
                 CanSelfRestart = CanSelfRestart,
                 CanSelfUpdate = CanSelfUpdate,
-                WanAddress = WanAddressEntryPoint.WanAddress
+                WanAddress = GetWanAddress()
             };
         }
 
+        private readonly CultureInfo _usCulture = new CultureInfo("en-US");
+        private string GetWanAddress()
+        {
+            var ip = WanAddressEntryPoint.WanAddress;
+
+            if (!string.IsNullOrEmpty(ip))
+            {
+                return "http://" + ip + ":" + ServerConfigurationManager.Configuration.HttpServerPortNumber.ToString(_usCulture);
+            }
+
+            return null;
+        }
+
         /// <summary>
         /// Gets the mac address.
         /// </summary>

+ 0 - 48
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -244,42 +244,18 @@
     <Content Include="dashboard-ui\css\images\media\audioflyout.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\css\images\media\audiotrack.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\css\images\media\chapterflyout.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\css\images\media\chapters.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="dashboard-ui\css\images\media\mute.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="dashboard-ui\css\images\media\quality.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\css\images\media\qualityflyout.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\css\images\media\remove.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\css\images\media\selected.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\css\images\media\settings.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\css\images\media\subtitleflyout.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\css\images\media\subtitles.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="dashboard-ui\css\images\media\volume.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\css\images\rotten.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -313,12 +289,6 @@
     <Content Include="dashboard-ui\css\images\items\list\video.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\css\images\media\playlist.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="dashboard-ui\css\images\media\fullscreen.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\css\images\supporter\nonsupporterbadge.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -1778,24 +1748,6 @@
     <Content Include="dashboard-ui\scripts\wizardfinishpage.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\css\images\media\playcircle.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="dashboard-ui\css\images\media\nexttrack.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="dashboard-ui\css\images\media\pause.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="dashboard-ui\css\images\media\play.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="dashboard-ui\css\images\media\previoustrack.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="dashboard-ui\css\images\media\stop.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\css\images\items\detail\video.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>