Merge pull request #2982 from MediaBrowser/dev

Dev
pull/1154/head
Luke 7 years ago committed by GitHub
commit 24ecccb7d3

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

@ -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 // Schedules direct requires that the client support compression and will return a 400 response without it
options.EnableHttpCompression = true; 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 try
{ {
return await _httpClient.Post(options).ConfigureAwait(false); 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 // Schedules direct requires that the client support compression and will return a 400 response without it
options.EnableHttpCompression = true; 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 try
{ {
return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false); return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false);

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

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

@ -117,6 +117,17 @@ namespace MediaBrowser.Providers.Music
ProductionYear = i.Year 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)) if (!string.IsNullOrWhiteSpace(i.ReleaseId))
{ {
result.SetProviderId(MetadataProviders.MusicBrainzAlbum, i.ReleaseId); result.SetProviderId(MetadataProviders.MusicBrainzAlbum, i.ReleaseId);
@ -285,6 +296,8 @@ namespace MediaBrowser.Providers.Music
public string Overview; public string Overview;
public int? Year; public int? Year;
public List<Tuple<string, string>> Artists = new List<Tuple<string, string>>();
public static List<ReleaseResult> Parse(XmlReader reader) public static List<ReleaseResult> Parse(XmlReader reader)
{ {
reader.MoveToContent(); reader.MoveToContent();
@ -417,6 +430,32 @@ namespace MediaBrowser.Providers.Music
{ {
result.ReleaseGroupId = reader.GetAttribute("id"); result.ReleaseGroupId = reader.GetAttribute("id");
reader.Skip(); 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; break;
} }
default: 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) private async Task<string> GetReleaseIdFromReleaseGroupId(string releaseGroupId, CancellationToken cancellationToken)
{ {
var url = string.Format("/ws/2/release?release-group={0}", releaseGroupId); var url = string.Format("/ws/2/release?release-group={0}", releaseGroupId);

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

Loading…
Cancel
Save