remove unused code [no ci]
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using MediatR;
|
|
||||||
|
|
||||||
namespace ErsatzTV.Application.MediaItems.Queries
|
|
||||||
{
|
|
||||||
public record SearchAllMediaItems(string SearchString) : IRequest<List<MediaItemSearchResultViewModel>>;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ErsatzTV.Core.Interfaces.Repositories;
|
|
||||||
using LanguageExt;
|
|
||||||
using MediatR;
|
|
||||||
using static ErsatzTV.Application.MediaItems.Mapper;
|
|
||||||
|
|
||||||
namespace ErsatzTV.Application.MediaItems.Queries
|
|
||||||
{
|
|
||||||
public class SearchAllMediaItemsHandler : IRequestHandler<SearchAllMediaItems, List<MediaItemSearchResultViewModel>>
|
|
||||||
{
|
|
||||||
private readonly IMediaItemRepository _mediaItemRepository;
|
|
||||||
|
|
||||||
public SearchAllMediaItemsHandler(IMediaItemRepository mediaItemRepository) =>
|
|
||||||
_mediaItemRepository = mediaItemRepository;
|
|
||||||
|
|
||||||
public Task<List<MediaItemSearchResultViewModel>>
|
|
||||||
Handle(SearchAllMediaItems request, CancellationToken cancellationToken) =>
|
|
||||||
_mediaItemRepository.Search(request.SearchString).Map(list => list.Map(ProjectToSearchViewModel).ToList());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,6 @@ namespace ErsatzTV.Core.Interfaces.Repositories
|
|||||||
{
|
{
|
||||||
Task<Option<MediaItem>> Get(int id);
|
Task<Option<MediaItem>> Get(int id);
|
||||||
Task<List<MediaItem>> GetAll();
|
Task<List<MediaItem>> GetAll();
|
||||||
Task<List<MediaItem>> Search(string searchString);
|
|
||||||
Task<bool> Update(MediaItem mediaItem);
|
Task<bool> Update(MediaItem mediaItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ErsatzTV.Core.Domain;
|
using ErsatzTV.Core.Domain;
|
||||||
using ErsatzTV.Core.Interfaces.Images;
|
using ErsatzTV.Core.Interfaces.Images;
|
||||||
@@ -15,8 +14,6 @@ namespace ErsatzTV.Core.Metadata
|
|||||||
{
|
{
|
||||||
public abstract class LocalFolderScanner
|
public abstract class LocalFolderScanner
|
||||||
{
|
{
|
||||||
private static readonly SHA1CryptoServiceProvider Crypto;
|
|
||||||
|
|
||||||
public static readonly List<string> VideoFileExtensions = new()
|
public static readonly List<string> VideoFileExtensions = new()
|
||||||
{
|
{
|
||||||
".mpg", ".mp2", ".mpeg", ".mpe", ".mpv", ".ogg", ".mp4",
|
".mpg", ".mp2", ".mpeg", ".mpe", ".mpv", ".ogg", ".mp4",
|
||||||
@@ -50,8 +47,6 @@ namespace ErsatzTV.Core.Metadata
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IMetadataRepository _metadataRepository;
|
private readonly IMetadataRepository _metadataRepository;
|
||||||
|
|
||||||
static LocalFolderScanner() => Crypto = new SHA1CryptoServiceProvider();
|
|
||||||
|
|
||||||
protected LocalFolderScanner(
|
protected LocalFolderScanner(
|
||||||
ILocalFileSystem localFileSystem,
|
ILocalFileSystem localFileSystem,
|
||||||
ILocalStatisticsProvider localStatisticsProvider,
|
ILocalStatisticsProvider localStatisticsProvider,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ErsatzTV.Core.Domain;
|
using ErsatzTV.Core.Domain;
|
||||||
@@ -12,14 +11,10 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
{
|
{
|
||||||
public class MediaItemRepository : IMediaItemRepository
|
public class MediaItemRepository : IMediaItemRepository
|
||||||
{
|
{
|
||||||
private readonly IDbConnection _dbConnection;
|
|
||||||
private readonly IDbContextFactory<TvContext> _dbContextFactory;
|
private readonly IDbContextFactory<TvContext> _dbContextFactory;
|
||||||
|
|
||||||
public MediaItemRepository(IDbContextFactory<TvContext> dbContextFactory, IDbConnection dbConnection)
|
public MediaItemRepository(IDbContextFactory<TvContext> dbContextFactory) =>
|
||||||
{
|
|
||||||
_dbContextFactory = dbContextFactory;
|
_dbContextFactory = dbContextFactory;
|
||||||
_dbConnection = dbConnection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Option<MediaItem>> Get(int id)
|
public async Task<Option<MediaItem>> Get(int id)
|
||||||
{
|
{
|
||||||
@@ -37,27 +32,6 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
|||||||
return await context.MediaItems.ToListAsync();
|
return await context.MediaItems.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<MediaItem>> Search(string searchString) =>
|
|
||||||
// TODO: fix this when we need to search
|
|
||||||
// IQueryable<TelevisionEpisodeMediaItem> episodeData =
|
|
||||||
// from c in _dbContext.TelevisionEpisodeMediaItems.Include(c => c.LibraryPath) select c;
|
|
||||||
//
|
|
||||||
// if (!string.IsNullOrEmpty(searchString))
|
|
||||||
// {
|
|
||||||
// episodeData = episodeData.Where(c => EF.Functions.Like(c.Metadata.Title, $"%{searchString}%"));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// IQueryable<Movie> movieData =
|
|
||||||
// from c in _dbContext.Movies.Include(c => c.LibraryPath) select c;
|
|
||||||
//
|
|
||||||
// // if (!string.IsNullOrEmpty(searchString))
|
|
||||||
// // {
|
|
||||||
// // movieData = movieData.Where(c => EF.Functions.Like(c.Metadata.Title, $"%{searchString}%"));
|
|
||||||
// // }
|
|
||||||
//
|
|
||||||
// return episodeData.OfType<MediaItem>().Concat(movieData.OfType<MediaItem>()).ToListAsync();
|
|
||||||
new List<MediaItem>().AsTask();
|
|
||||||
|
|
||||||
public async Task<bool> Update(MediaItem mediaItem)
|
public async Task<bool> Update(MediaItem mediaItem)
|
||||||
{
|
{
|
||||||
await using TvContext context = _dbContextFactory.CreateDbContext();
|
await using TvContext context = _dbContextFactory.CreateDbContext();
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ErsatzTV
|
|
||||||
{
|
|
||||||
namespace wms_xamarin
|
|
||||||
{
|
|
||||||
public class HttpLoggingHandler : DelegatingHandler
|
|
||||||
{
|
|
||||||
private readonly string[] types = { "html", "text", "xml", "json", "txt", "x-www-form-urlencoded" };
|
|
||||||
|
|
||||||
public HttpLoggingHandler(HttpMessageHandler innerHandler = null) : base(
|
|
||||||
innerHandler ?? new HttpClientHandler())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task<HttpResponseMessage> SendAsync(
|
|
||||||
HttpRequestMessage request,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await Task.Delay(1, cancellationToken).ConfigureAwait(false);
|
|
||||||
DateTime start = DateTime.Now;
|
|
||||||
HttpRequestMessage req = request;
|
|
||||||
var msg = $"[{req.RequestUri.PathAndQuery} - Request]";
|
|
||||||
|
|
||||||
Debug.WriteLine($"{msg}========Request Start==========");
|
|
||||||
Debug.WriteLine(
|
|
||||||
$"{msg} {req.Method} {req.RequestUri.PathAndQuery} {req.RequestUri.Scheme}/{req.Version}");
|
|
||||||
Debug.WriteLine($"{msg} Host: {req.RequestUri.Scheme}://{req.RequestUri.Host}");
|
|
||||||
|
|
||||||
foreach (KeyValuePair<string, IEnumerable<string>> header in req.Headers)
|
|
||||||
{
|
|
||||||
Debug.WriteLine($"{msg} {header.Key}: {string.Join(", ", header.Value)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req.Content != null)
|
|
||||||
{
|
|
||||||
foreach (KeyValuePair<string, IEnumerable<string>> header in req.Content.Headers)
|
|
||||||
{
|
|
||||||
Debug.WriteLine($"{msg} {header.Key}: {string.Join(", ", header.Value)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.WriteLine($"{msg} Content:");
|
|
||||||
|
|
||||||
if (req.Content is StringContent || IsTextBasedContentType(req.Headers) ||
|
|
||||||
IsTextBasedContentType(req.Content.Headers))
|
|
||||||
{
|
|
||||||
string result = await req.Content.ReadAsStringAsync();
|
|
||||||
|
|
||||||
Debug.WriteLine($"{msg} {string.Join("", result.Take(256))}...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpResponseMessage response = await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
|
|
||||||
|
|
||||||
Debug.WriteLine($"{msg}==========Request End==========");
|
|
||||||
|
|
||||||
msg = $"[{req.RequestUri.PathAndQuery} - Response]";
|
|
||||||
|
|
||||||
Debug.WriteLine($"{msg}=========Response Start=========");
|
|
||||||
|
|
||||||
HttpResponseMessage resp = response;
|
|
||||||
|
|
||||||
Debug.WriteLine(
|
|
||||||
$"{msg} {req.RequestUri.Scheme.ToUpper()}/{resp.Version} {(int) resp.StatusCode} {resp.ReasonPhrase}");
|
|
||||||
|
|
||||||
foreach (KeyValuePair<string, IEnumerable<string>> header in resp.Headers)
|
|
||||||
{
|
|
||||||
Debug.WriteLine($"{msg} {header.Key}: {string.Join(", ", header.Value)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resp.Content != null)
|
|
||||||
{
|
|
||||||
foreach (KeyValuePair<string, IEnumerable<string>> header in resp.Content.Headers)
|
|
||||||
{
|
|
||||||
Debug.WriteLine($"{msg} {header.Key}: {string.Join(", ", header.Value)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.WriteLine($"{msg} Content:");
|
|
||||||
|
|
||||||
if (resp.Content is StringContent || IsTextBasedContentType(resp.Headers) ||
|
|
||||||
IsTextBasedContentType(resp.Content.Headers))
|
|
||||||
{
|
|
||||||
string result = await resp.Content.ReadAsStringAsync();
|
|
||||||
|
|
||||||
Debug.WriteLine($"{msg} {string.Join("", result.Take(256))}...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.WriteLine($"{msg} Duration: {DateTime.Now - start}");
|
|
||||||
Debug.WriteLine($"{msg}==========Response End==========");
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsTextBasedContentType(HttpHeaders headers)
|
|
||||||
{
|
|
||||||
IEnumerable<string> values;
|
|
||||||
if (!headers.TryGetValues("Content-Type", out values))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
string header = string.Join(" ", values).ToLowerInvariant();
|
|
||||||
|
|
||||||
return types.Any(t => header.Contains(t));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user