allow per-episode folders in local show libraries (#462)
* allow per-episode folders in local show libraries * fix subfolder etag generation
This commit is contained in:
+5
-1
@@ -13,7 +13,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- When streaming is attempted during an unscheduled gap, the resulting video will be determined using the following priority:
|
||||
- Channel fallback filler
|
||||
- Global fallback filler
|
||||
- Generated `Channel Is Offline` error message video
|
||||
- Generated `Channel Is Offline` error message video
|
||||
|
||||
### Changed
|
||||
- Allow per-episode folders for local show libraries
|
||||
- e.g. `Show Name\Season #\Episode #\Show Name - s#e#.mkv`
|
||||
|
||||
## [0.2.1-alpha] - 2021-10-24
|
||||
### Fixed
|
||||
|
||||
@@ -31,5 +31,32 @@ namespace ErsatzTV.Core.Metadata
|
||||
|
||||
return hash.ToString();
|
||||
}
|
||||
|
||||
public static string CalculateWithSubfolders(string folder, ILocalFileSystem localFileSystem)
|
||||
{
|
||||
IEnumerable<string> allFiles = localFileSystem.ListFiles(folder);
|
||||
|
||||
var sb = new StringBuilder();
|
||||
foreach (string file in allFiles.OrderBy(identity))
|
||||
{
|
||||
sb.Append(file);
|
||||
sb.Append(localFileSystem.GetLastWriteTime(file).Ticks);
|
||||
}
|
||||
|
||||
foreach (string subfolder in localFileSystem.ListSubdirectories(folder).OrderBy(identity))
|
||||
{
|
||||
sb.Append(subfolder);
|
||||
sb.Append(Calculate(subfolder, localFileSystem));
|
||||
}
|
||||
|
||||
var hash = new StringBuilder();
|
||||
byte[] bytes = Crypto.ComputeHash(Encoding.UTF8.GetBytes(sb.ToString()));
|
||||
foreach (byte t in bytes)
|
||||
{
|
||||
hash.Append(t.ToString("x2"));
|
||||
}
|
||||
|
||||
return hash.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace ErsatzTV.Core.Metadata
|
||||
foreach (string seasonFolder in _localFileSystem.ListSubdirectories(showFolder).Filter(ShouldIncludeFolder)
|
||||
.OrderBy(identity))
|
||||
{
|
||||
string etag = FolderEtag.Calculate(seasonFolder, _localFileSystem);
|
||||
string etag = FolderEtag.CalculateWithSubfolders(seasonFolder, _localFileSystem);
|
||||
Option<LibraryFolder> knownFolder = libraryPath.LibraryFolders
|
||||
.Filter(f => f.Path == seasonFolder)
|
||||
.HeadOrNone();
|
||||
@@ -208,10 +208,16 @@ namespace ErsatzTV.Core.Metadata
|
||||
Season season,
|
||||
string seasonPath)
|
||||
{
|
||||
foreach (string file in _localFileSystem.ListFiles(seasonPath)
|
||||
var allSeasonFiles = _localFileSystem.ListSubdirectories(seasonPath)
|
||||
.Map(_localFileSystem.ListFiles)
|
||||
.Flatten()
|
||||
.Append(_localFileSystem.ListFiles(seasonPath))
|
||||
.Filter(f => VideoFileExtensions.Contains(Path.GetExtension(f)))
|
||||
.Filter(f => !Path.GetFileName(f).StartsWith("._"))
|
||||
.OrderBy(identity))
|
||||
.OrderBy(identity)
|
||||
.ToList();
|
||||
|
||||
foreach (string file in allSeasonFiles)
|
||||
{
|
||||
// TODO: figure out how to rebuild playlists
|
||||
Either<BaseError, Episode> maybeEpisode = await _televisionRepository
|
||||
|
||||
@@ -34,6 +34,7 @@ The `Shows` library requires show and season subfolders. The following is a (non
|
||||
|
||||
- `Show (1999)\Season 01\Show - S01E01.mp4`
|
||||
- `Show\Season 1\Show - s1e1.mp4`
|
||||
- `Show\Season 1\Episode 1\Show - s1e1.mp4`
|
||||
|
||||
### Show NFO Metadata
|
||||
|
||||
|
||||
Reference in New Issue
Block a user