Merge pull request #2982 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-10-28 00:21:11 -04:00 committed by GitHub
commit 24ecccb7d3
6 changed files with 199 additions and 13 deletions

View File

@ -9,7 +9,7 @@ using MediaBrowser.Model.Tasks;
namespace Emby.Server.Implementations.Channels
{
class RefreshChannelsScheduledTask : IScheduledTask
class RefreshChannelsScheduledTask : IScheduledTask, IConfigurableScheduledTask
{
private readonly IChannelManager _channelManager;
private readonly IUserManager _userManager;
@ -39,6 +39,21 @@ namespace Emby.Server.Implementations.Channels
get { return "Internet Channels"; }
}
public bool IsHidden
{
get { return ((ChannelManager)_channelManager).Channels.Length == 0; }
}
public bool IsEnabled
{
get { return true; }
}
public bool IsLogged
{
get { return true; }
}
public async Task Execute(System.Threading.CancellationToken cancellationToken, IProgress<double> progress)
{
var manager = (ChannelManager)_channelManager;
@ -65,15 +80,5 @@ namespace Emby.Server.Implementations.Channels
{
get { return "RefreshInternetChannels"; }
}
public bool IsHidden
{
get { return false; }
}
public bool IsEnabled
{
get { return true; }
}
}
}

View File

@ -653,6 +653,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings
// Schedules direct requires that the client support compression and will return a 400 response without it
options.EnableHttpCompression = true;
// On windows 7 under .net core, this header is not getting added
#if NETSTANDARD2_0
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
options.RequestHeaders["Accept-Encoding"] = "deflate";
}
#endif
try
{
return await _httpClient.Post(options).ConfigureAwait(false);
@ -684,6 +692,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings
// Schedules direct requires that the client support compression and will return a 400 response without it
options.EnableHttpCompression = true;
// On windows 7 under .net core, this header is not getting added
#if NETSTANDARD2_0
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
options.RequestHeaders["Accept-Encoding"] = "deflate";
}
#endif
try
{
return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false);

View File

@ -1266,7 +1266,7 @@ namespace MediaBrowser.Controller.Entities
var childOwner = child.IsOwnedItem ? (child.GetOwner() ?? child) : child;
if (childOwner != null)
if (childOwner != null && !(child is IItemByName))
{
var childLocationType = childOwner.LocationType;
if (childLocationType == LocationType.Remote || childLocationType == LocationType.Virtual)

View File

@ -34,6 +34,8 @@ namespace MediaBrowser.Model.Providers
public string GameSystem { get; set; }
public string Overview { get; set; }
public RemoteSearchResult AlbumArtist { get; set; }
public RemoteSearchResult()
{
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

View File

@ -117,6 +117,17 @@ namespace MediaBrowser.Providers.Music
ProductionYear = i.Year
};
if (i.Artists.Count > 0)
{
result.AlbumArtist = new RemoteSearchResult
{
SearchProviderName = Name,
Name = i.Artists[0].Item1
};
result.AlbumArtist.SetProviderId(MetadataProviders.MusicBrainzArtist, i.Artists[0].Item2);
}
if (!string.IsNullOrWhiteSpace(i.ReleaseId))
{
result.SetProviderId(MetadataProviders.MusicBrainzAlbum, i.ReleaseId);
@ -285,6 +296,8 @@ namespace MediaBrowser.Providers.Music
public string Overview;
public int? Year;
public List<Tuple<string, string>> Artists = new List<Tuple<string, string>>();
public static List<ReleaseResult> Parse(XmlReader reader)
{
reader.MoveToContent();
@ -417,6 +430,32 @@ namespace MediaBrowser.Providers.Music
{
result.ReleaseGroupId = reader.GetAttribute("id");
reader.Skip();
break;
}
case "artist-credit":
{
// TODO
/*
* <artist-credit>
<name-credit>
<artist id="e225cda5-882d-4b80-b8a3-b36d7175b1ea">
<name>SARCASTIC+ZOOKEEPER</name>
<sort-name>SARCASTIC+ZOOKEEPER</sort-name>
</artist>
</name-credit>
</artist-credit>
*/
using (var subReader = reader.ReadSubtree())
{
var artist = ParseArtistCredit(subReader);
if (artist != null)
{
result.Artists.Add(artist);
}
}
break;
}
default:
@ -436,6 +475,130 @@ namespace MediaBrowser.Providers.Music
}
}
private static Tuple<string, string> ParseArtistCredit(XmlReader reader)
{
reader.MoveToContent();
reader.Read();
// http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "name-credit":
{
using (var subReader = reader.ReadSubtree())
{
return ParseArtistNameCredit(subReader);
}
}
default:
{
reader.Skip();
break;
}
}
}
else
{
reader.Read();
}
}
return null;
}
private static Tuple<string, string> ParseArtistNameCredit(XmlReader reader)
{
reader.MoveToContent();
reader.Read();
string name = null;
// http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "artist":
{
var id = reader.GetAttribute("id");
using (var subReader = reader.ReadSubtree())
{
return ParseArtistArtistCredit(subReader, id);
}
}
default:
{
reader.Skip();
break;
}
}
}
else
{
reader.Read();
}
}
if (string.IsNullOrWhiteSpace(name))
{
return null;
}
return new Tuple<string, string>(name, null);
}
private static Tuple<string, string> ParseArtistArtistCredit(XmlReader reader, string artistId)
{
reader.MoveToContent();
reader.Read();
string name = null;
// http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "name":
{
name = reader.ReadElementContentAsString();
break;
}
default:
{
reader.Skip();
break;
}
}
}
else
{
reader.Read();
}
}
if (string.IsNullOrWhiteSpace(name))
{
return null;
}
return new Tuple<string, string>(name, artistId);
}
private async Task<string> GetReleaseIdFromReleaseGroupId(string releaseGroupId, CancellationToken cancellationToken)
{
var url = string.Format("/ws/2/release?release-group={0}", releaseGroupId);

View File

@ -1,3 +1,3 @@
using System.Reflection;
[assembly: AssemblyVersion("3.2.34.1")]
[assembly: AssemblyVersion("3.2.34.2")]