Skip to content

Commit

Permalink
Update MovieHub.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorbobaylor committed May 1, 2023
1 parent 8b33de5 commit 8195581
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion TrailerDownloader/SignalRHubs/MovieHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,21 @@ private void GetMovieDirectories(string directoryPath)
var subDirectories = Directory.EnumerateDirectories(directoryPath, "*", SearchOption.AllDirectories);

// Add the movie directories to the collection
bool hasSubdirectories = false;
foreach (var subDirectory in subDirectories)
{
if (Directory.GetFiles(subDirectory).Length > 0)
if (Directory.GetDirectories(subDirectory).Length > 0)
{
_movieDirectories.Add(subDirectory);
hasSubdirectories = true;
}
}

// If no subdirectories were added, add the main directoryPath
if (!hasSubdirectories)
{
_movieDirectories.Add(directoryPath);
}
}
catch (Exception ex)
{
Expand Down

0 comments on commit 8195581

Please sign in to comment.