Merge pull request #108 from AnonymusRaccoon/fix/dotfiles

Ignoring hidden files in scan
This commit is contained in:
Zoe Roux 2022-04-17 13:35:43 +02:00 committed by GitHub
commit 425c80237b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View File

@ -142,16 +142,15 @@ namespace Kyoo.Core.Controllers
tracks = new Track[trackCount];
int j = 0;
for (int i = 0; i < arrayLength; i++)
for (int i = 0; i < arrayLength; i++, streamsPtr += size)
{
FTrack stream = Marshal.PtrToStructure<FTrack>(streamsPtr);
if (stream!.Type != FTrackType.Unknown && stream.Type != FTrackType.Attachment)
{
if (stream!.Type == FTrackType.Unknown || stream.Type == FTrackType.Attachment)
continue;
tracks[j] = stream.ToTrack();
j++;
}
streamsPtr += size;
}
Array.Resize(ref tracks, j);
}
else
tracks = Array.Empty<Track>();
@ -207,12 +206,13 @@ namespace Kyoo.Core.Controllers
{
if (fastStop && _initialized)
return;
if (TranscoderAPI.Init() == Marshal.SizeOf<FTrack>())
return;
_initialized = true;
if (TranscoderAPI.Init() != Marshal.SizeOf<FTrack>())
{
_logger.LogCritical("The transcoder library could not be initialized correctly");
throw new HealthException("The transcoder library is corrupted or invalid.");
}
_initialized = true;
}
/// <inheritdoc />
public async Task<ICollection<Track>> ExtractInfos(Episode episode, bool reExtract)

View File

@ -138,6 +138,7 @@ namespace Kyoo.Core.Tasks
// of the show has already been fetched.
List<IGrouping<string, string>> shows = files
.Where(FileExtensions.IsVideo)
.Where(x => !Path.GetFileName(x).StartsWith('.')) // ignore hidden files.
.Where(x => episodes.All(y => y.Path != x))
.GroupBy(Path.GetDirectoryName)
.ToList();