mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-19 08:36:37 +00:00
update search hints
This commit is contained in:
@@ -110,11 +110,11 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
||||
{
|
||||
var attributes = child.Attributes;
|
||||
|
||||
if ((attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
|
||||
{
|
||||
//logger.Debug("Igoring series file or folder marked hidden: {0}", child.FullName);
|
||||
continue;
|
||||
}
|
||||
//if ((attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
|
||||
//{
|
||||
// //logger.Debug("Igoring series file or folder marked hidden: {0}", child.FullName);
|
||||
// continue;
|
||||
//}
|
||||
|
||||
// Can't enforce this because files saved by Bitcasa are always marked System
|
||||
//if ((attributes & FileAttributes.System) == FileAttributes.System)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.Listings.Emby
|
||||
{
|
||||
public class EmbyGuide : IListingsProvider
|
||||
{
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
||||
public EmbyGuide(IHttpClient httpClient, IJsonSerializer jsonSerializer)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Emby Guide"; }
|
||||
}
|
||||
|
||||
public string Type
|
||||
{
|
||||
get { return "emby"; }
|
||||
}
|
||||
|
||||
public Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
|
||||
{
|
||||
return GetListingsProvider(info.Country).GetProgramsAsync(info, channelNumber, startDateUtc, endDateUtc, cancellationToken);
|
||||
}
|
||||
|
||||
public Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken)
|
||||
{
|
||||
return GetListingsProvider(info.Country).AddMetadata(info, channels, cancellationToken);
|
||||
}
|
||||
|
||||
public Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings)
|
||||
{
|
||||
return GetListingsProvider(info.Country).Validate(info, validateLogin, validateListings);
|
||||
}
|
||||
|
||||
public Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location)
|
||||
{
|
||||
return GetListingsProvider(country).GetLineups(info, country, location);
|
||||
}
|
||||
|
||||
private IEmbyListingProvider GetListingsProvider(string country)
|
||||
{
|
||||
return new EmbyListingsNorthAmerica(_httpClient, _jsonSerializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.Listings.Emby
|
||||
{
|
||||
public class EmbyListingsNorthAmerica : IEmbyListingProvider
|
||||
{
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
||||
public EmbyListingsNorthAmerica(IHttpClient httpClient, IJsonSerializer jsonSerializer)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
|
||||
{
|
||||
return new List<ProgramInfo>();
|
||||
}
|
||||
|
||||
public async Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken)
|
||||
{
|
||||
var response = await GetResponse<LineupDetailResponse>("https://data.emby.media/service/lineups?id=" + info.ListingsId).ConfigureAwait(false);
|
||||
|
||||
foreach (var channel in channels)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings)
|
||||
{
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public async Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location)
|
||||
{
|
||||
var response = await GetResponse<LineupInfo[]>("https://data.emby.media/service/lineups?id=" + location).ConfigureAwait(false);
|
||||
|
||||
return response.Select(i => new NameIdPair
|
||||
{
|
||||
|
||||
Name = GetName(i),
|
||||
Id = i.lineupID
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private string GetName(LineupInfo info)
|
||||
{
|
||||
var name = info.lineupName;
|
||||
|
||||
if (string.Equals(info.lineupType, "cab", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
name += " - Cable";
|
||||
}
|
||||
else if (string.Equals(info.lineupType, "sat", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
name += " - SAT";
|
||||
}
|
||||
else if (string.Equals(info.lineupType, "ota", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
name += " - OTA";
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
private async Task<T> GetResponse<T>(string url)
|
||||
where T : class
|
||||
{
|
||||
using (var stream = await _httpClient.Get(new HttpRequestOptions
|
||||
{
|
||||
Url = url
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
var path = await reader.ReadToEndAsync().ConfigureAwait(false);
|
||||
|
||||
// location = zip code
|
||||
using (var secondStream = await _httpClient.Get(new HttpRequestOptions
|
||||
{
|
||||
Url = "https://data.emby.media" + path
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
return _jsonSerializer.DeserializeFromStream<T>(secondStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class LineupInfo
|
||||
{
|
||||
public string lineupID { get; set; }
|
||||
public string lineupName { get; set; }
|
||||
public string lineupType { get; set; }
|
||||
public string providerID { get; set; }
|
||||
public string providerName { get; set; }
|
||||
public string serviceArea { get; set; }
|
||||
public string country { get; set; }
|
||||
}
|
||||
|
||||
private class Station
|
||||
{
|
||||
public string number { get; set; }
|
||||
public int channelNumber { get; set; }
|
||||
public int subChannelNumber { get; set; }
|
||||
public int stationID { get; set; }
|
||||
public string name { get; set; }
|
||||
public string callsign { get; set; }
|
||||
public string network { get; set; }
|
||||
public string stationType { get; set; }
|
||||
public int NTSC_TSID { get; set; }
|
||||
public int DTV_TSID { get; set; }
|
||||
public string webLink { get; set; }
|
||||
public string logoFilename { get; set; }
|
||||
}
|
||||
|
||||
private class LineupDetailResponse
|
||||
{
|
||||
public string lineupID { get; set; }
|
||||
public string lineupName { get; set; }
|
||||
public string lineupType { get; set; }
|
||||
public string providerID { get; set; }
|
||||
public string providerName { get; set; }
|
||||
public string serviceArea { get; set; }
|
||||
public string country { get; set; }
|
||||
public List<Station> stations { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv.Listings.Emby
|
||||
{
|
||||
public interface IEmbyListingProvider
|
||||
{
|
||||
Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken);
|
||||
Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken);
|
||||
Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings);
|
||||
Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location);
|
||||
}
|
||||
}
|
||||
@@ -222,6 +222,9 @@
|
||||
<Compile Include="LiveTv\EmbyTV\RecordingHelper.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\SeriesTimerManager.cs" />
|
||||
<Compile Include="LiveTv\EmbyTV\TimerManager.cs" />
|
||||
<Compile Include="LiveTv\Listings\Emby\EmbyListings.cs" />
|
||||
<Compile Include="LiveTv\Listings\Emby\EmbyListingsNorthAmerica.cs" />
|
||||
<Compile Include="LiveTv\Listings\Emby\IEmbyListingProvider.cs" />
|
||||
<Compile Include="LiveTv\Listings\SchedulesDirect.cs" />
|
||||
<Compile Include="LiveTv\Listings\XmlTv.cs" />
|
||||
<Compile Include="LiveTv\LiveTvConfigurationFactory.cs" />
|
||||
|
||||
Reference in New Issue
Block a user