diff --git a/.github/workflows/BuildDockerPush.yml b/.github/workflows/BuildDockerPush.yml index 375b6009..9407aa54 100644 --- a/.github/workflows/BuildDockerPush.yml +++ b/.github/workflows/BuildDockerPush.yml @@ -100,14 +100,13 @@ jobs: tags: | docker.io/ptr727/plexcleaner:${{ endsWith(github.ref, 'refs/heads/main') && 'debian-testing' || 'debian-testing-develop' }} - # TODO: No Alpine stable until 3.20 is released # Alpine Stable: - # - file: ./Docker/Alpine.Stable.Dockerfile - # platforms: linux/amd64,linux/arm64 - # cache-scope: alpine - # secrets: SAVOURY_PPA_AUTH - # tags: | - # docker.io/ptr727/plexcleaner:${{ endsWith(github.ref, 'refs/heads/main') && 'alpine' || 'alpine-develop' }} + - file: ./Docker/Alpine.Stable.Dockerfile + platforms: linux/amd64,linux/arm64 + cache-scope: alpine + secrets: SAVOURY_PPA_AUTH + tags: | + docker.io/ptr727/plexcleaner:${{ endsWith(github.ref, 'refs/heads/main') && 'alpine' || 'alpine-develop' }} # Alpine Edge: - file: ./Docker/Alpine.Edge.Dockerfile @@ -222,9 +221,8 @@ jobs: file: debian.ver - tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'debian-testing' || 'debian-testing-develop' }} file: debian-testing.ver - # TODO: No Alpine stable until 3.20 is released - # - tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'alpine' || 'alpine-develop' }} - # file: alpine.ver + - tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'alpine' || 'alpine-develop' }} + file: alpine.ver - tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'alpine-edge' || 'alpine-edge-develop' }} file: alpine-edge.ver - tag: ${{ endsWith(github.ref, 'refs/heads/main') && 'ubuntu' || 'ubuntu-develop' }} diff --git a/.vscode/launch.json b/.vscode/launch.json index 771447de..f4f96487 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,32 +2,15 @@ "version": "0.2.0", "configurations": [ { - // Use IntelliSense to find out which attributes exist for C# debugging - // Use hover for the description of the existing attributes - // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md - "name": ".NET Core Launch (console)", + "name": "Process Snippets Test", "type": "coreclr", "request": "launch", "preLaunchTask": "build", - // If you have changed target frameworks, make sure to update the program path. "program": "${workspaceFolder}/PlexCleaner/bin/Debug/net8.0/PlexCleaner.dll", - "args": [], - "cwd": "${workspaceFolder}/PlexCleaner", - // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "args": ["process", "--logfile", "PlexCleaner.log", "--settingsfile", "PlexCleaner.json", "--testsnippets", "--mediafiles", "D:\\Test"], + "cwd": "${workspaceFolder}/PlexCleaner/bin/Debug/net8.0", "console": "internalConsole", "stopAtEntry": false - }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach" - }, - { - "name": "Docker .NET Core Attach", - "type": "docker", - "request": "attach", - "platform": "netCore", - "processId": "${command:pickRemoteProcess}" - } + } ] } \ No newline at end of file diff --git a/Docker/Alpine.Edge.Dockerfile b/Docker/Alpine.Edge.Dockerfile index 5d8276c8..ee549fe0 100644 --- a/Docker/Alpine.Edge.Dockerfile +++ b/Docker/Alpine.Edge.Dockerfile @@ -4,6 +4,10 @@ # Platforms: linux/amd64, linux/arm64 # Tag: ptr727/plexcleaner:alpine-edge +# Docker build debugging: +# --progress=plain +# --no-cache + # Test image in shell: # docker run -it --rm --pull always --name Testing alpine:edge /bin/sh # docker run -it --rm --pull always --name Testing ptr727/plexcleaner:alpine-edge /bin/sh @@ -94,12 +98,6 @@ RUN apk add \ # https://pkgs.alpinelinux.org/package/edge/community/x86_64/dotnet8-runtime RUN apk add dotnet8-runtime -# Install VS debug tools -# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes -RUN wget https://aka.ms/getvsdbgsh \ - && sh getvsdbgsh -v latest -l /vsdbg \ - && rm getvsdbgsh - # Install media tools # https://pkgs.alpinelinux.org/package/edge/community/x86_64/ffmpeg # https://pkgs.alpinelinux.org/package/edge/community/x86_64/mediainfo @@ -118,6 +116,10 @@ COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test +# Copy debug tools installer script +COPY ./Docker/DebugTools.sh ./ +RUN chmod ugo+rwx ./DebugTools.sh + # Copy version script COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh diff --git a/Docker/Alpine.Stable.Dockerfile b/Docker/Alpine.Stable.Dockerfile index 21bd0c12..80763562 100644 --- a/Docker/Alpine.Stable.Dockerfile +++ b/Docker/Alpine.Stable.Dockerfile @@ -1,10 +1,12 @@ -# Description: Alpine Stable (3.19) +# Description: Alpine Stable (3.20) # Based on: alpine:latest # .NET: Alpine repository # Platforms: linux/amd64, linux/arm64 # Tag: ptr727/plexcleaner:alpine -# TODO: 3.19 does not support Handbrake or .NET 8, wait for 3.20 to be released +# Docker build debugging: +# --progress=plain +# --no-cache # Test image in shell: # docker run -it --rm --pull always --name Testing alpine:latest /bin/sh @@ -96,17 +98,11 @@ RUN apk add \ # https://pkgs.alpinelinux.org/package/edge/community/x86_64/dotnet8-runtime RUN apk add dotnet8-runtime -# Install VS debug tools -# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes -RUN wget https://aka.ms/getvsdbgsh \ - && sh getvsdbgsh -v latest -l /vsdbg \ - && rm getvsdbgsh - # Install media tools -# https://pkgs.alpinelinux.org/package/edge/community/x86_64/ffmpeg -# https://pkgs.alpinelinux.org/package/edge/community/x86_64/mediainfo -# https://pkgs.alpinelinux.org/package/edge/community/x86_64/mkvtoolnix -# https://pkgs.alpinelinux.org/package/edge/community/x86_64/handbrake +# https://pkgs.alpinelinux.org/package/v3.20/community/x86_64/ffmpeg +# https://pkgs.alpinelinux.org/package/v3.20/community/x86_64/mediainfo +# https://pkgs.alpinelinux.org/package/v3.20/community/x86_64/mkvtoolnix +# https://pkgs.alpinelinux.org/package/v3.20/community/x86_64/handbrake RUN apk add \ ffmpeg\ handbrake \ @@ -120,6 +116,10 @@ COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test +# Copy debug tools installer script +COPY ./Docker/DebugTools.sh ./ +RUN chmod ugo+rwx ./DebugTools.sh + # Copy version script COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh diff --git a/Docker/Debian.Stable.Dockerfile b/Docker/Debian.Stable.Dockerfile index fdce19ef..ee06dd40 100644 --- a/Docker/Debian.Stable.Dockerfile +++ b/Docker/Debian.Stable.Dockerfile @@ -4,7 +4,9 @@ # Platforms: linux/amd64, linux/arm64, linux/arm/v7 # Tag: ptr727/plexcleaner:debian -# TODO: Update Msft repository when Trixie is released +# Docker build debugging: +# --progress=plain +# --no-cache # Test image in shell: # docker run -it --rm --pull always --name Testing debian:stable-slim /bin/bash @@ -46,10 +48,11 @@ RUN apt-get update \ # Install dependencies RUN apt-get install -y --no-install-recommends \ ca-certificates \ + lsb-release \ wget # Install .NET SDK -RUN wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ +RUN wget https://packages.microsoft.com/config/debian/$(lsb_release -sr)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ && dpkg -i packages-microsoft-prod.deb \ && rm packages-microsoft-prod.deb \ && apt-get update \ @@ -94,6 +97,7 @@ RUN apt-get install -y --no-install-recommends \ ca-certificates \ locales \ locales-all \ + lsb-release \ p7zip-full \ tzdata \ wget \ @@ -107,19 +111,13 @@ ENV TZ=Etc/UTC \ LC_ALL=en_US.UTF-8 # Install .NET Runtime -RUN wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ +RUN wget https://packages.microsoft.com/config/debian/$(lsb_release -sr)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ && dpkg -i packages-microsoft-prod.deb \ && rm packages-microsoft-prod.deb \ && apt-get update \ && apt-get install -y --no-install-recommends \ dotnet-runtime-8.0 -# Install VS debug tools -# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes -RUN wget https://aka.ms/getvsdbgsh \ - && sh getvsdbgsh -v latest -l /vsdbg \ - && rm getvsdbgsh - # Install media tools # https://tracker.debian.org/pkg/ffmpeg # https://tracker.debian.org/pkg/handbrake @@ -143,6 +141,10 @@ COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test +# Copy debug tools installer script +COPY ./Docker/DebugTools.sh ./ +RUN chmod ugo+rwx ./DebugTools.sh + # Copy version script COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh diff --git a/Docker/Debian.Testing.Dockerfile b/Docker/Debian.Testing.Dockerfile index ad04f94b..85c68a9b 100644 --- a/Docker/Debian.Testing.Dockerfile +++ b/Docker/Debian.Testing.Dockerfile @@ -4,7 +4,9 @@ # Platforms: linux/amd64, linux/arm64, linux/arm/v7 # Tag: ptr727/plexcleaner:debian-testing -# TODO: Trixie is not supported in the Msft repository, using 12/Bookworm. +# Docker build debugging: +# --progress=plain +# --no-cache # Test image in shell: # docker run -it --rm --pull always --name Testing debian:testing-slim /bin/bash @@ -46,9 +48,11 @@ RUN apt-get update \ # Install dependencies RUN apt-get install -y --no-install-recommends \ ca-certificates \ + lsb-release \ wget # Install .NET SDK +# TODO: Keep version number in sync with release, or use latest version published by Msft RUN wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ && dpkg -i packages-microsoft-prod.deb \ && rm packages-microsoft-prod.deb \ @@ -94,6 +98,7 @@ RUN apt-get install -y --no-install-recommends \ ca-certificates \ locales \ locales-all \ + lsb-release \ p7zip-full \ tzdata \ wget \ @@ -107,6 +112,7 @@ ENV TZ=Etc/UTC \ LC_ALL=en_US.UTF-8 # Install .NET Runtime +# TODO: Keep version number in sync with release, or use latest version published by Msft RUN wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ && dpkg -i packages-microsoft-prod.deb \ && rm packages-microsoft-prod.deb \ @@ -114,12 +120,6 @@ RUN wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod && apt-get install -y --no-install-recommends \ dotnet-runtime-8.0 -# Install VS debug tools -# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes -RUN wget https://aka.ms/getvsdbgsh \ - && sh getvsdbgsh -v latest -l /vsdbg \ - && rm getvsdbgsh - # Install media tools # https://tracker.debian.org/pkg/ffmpeg # https://tracker.debian.org/pkg/handbrake @@ -143,6 +143,10 @@ COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test +# Copy debug tools installer script +COPY ./Docker/DebugTools.sh ./ +RUN chmod ugo+rwx ./DebugTools.sh + # Copy version script COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh diff --git a/Docker/DebugTools.sh b/Docker/DebugTools.sh new file mode 100644 index 00000000..b3d4ad8e --- /dev/null +++ b/Docker/DebugTools.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# Echo commands +set -x + +# Exit on error +set -e + +# Install VS debug tools to /vsdbg +# https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-dotnet-core-linux-with-ssh +# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes +echo "Installing VS debug tools to /vsdbg" +wget -O ./getvsdbg.sh https://aka.ms/getvsdbgsh +chmod ugo+rwx getvsdbg.sh +./getvsdbg.sh -v latest -l /vsdbg +rm getvsdbg.sh + +# Install .NET diagnostic tools /dotnet-tools +# https://learn.microsoft.com/en-us/dotnet/core/diagnostics/tools-overview +# https://github.com/dotnet/diagnostics/blob/main/documentation/single-file-tools.md +RID=$(dotnet --info | grep "RID" | awk '{print $2}') +echo "Installing .NET diagnostic tools for $RID to /dotnet-tools" +mkdir -p /dotnet-tools +wget -O /dotnet-tools/dotnet-counters https://aka.ms/dotnet-counters/$RID +chmod ugo+rwx /dotnet-tools/dotnet-counters +wget -O /dotnet-tools/dotnet-dump https://aka.ms/dotnet-dump/$RID +chmod ugo+rwx /dotnet-tools/dotnet-dump diff --git a/Docker/README.m4 b/Docker/README.m4 index 4944f568..b673e0fc 100644 --- a/Docker/README.m4 +++ b/Docker/README.m4 @@ -90,7 +90,9 @@ include({{debian-testing.ver}}) ### `ptr727/plexcleaner:alpine` -*Alpine is [not](https://github.com/ptr727/PlexCleaner/issues/344) currently being built.* +```text +include({{alpine.ver}}) +``` ### `ptr727/plexcleaner:alpine-edge` diff --git a/Docker/Ubuntu.Devel.Dockerfile b/Docker/Ubuntu.Devel.Dockerfile index 04654485..69a88ffc 100644 --- a/Docker/Ubuntu.Devel.Dockerfile +++ b/Docker/Ubuntu.Devel.Dockerfile @@ -4,6 +4,10 @@ # Platforms: linux/amd64, linux/arm64, linux/arm/v7 # Tag: ptr727/plexcleaner:ubuntu-devel +# Docker build debugging: +# --progress=plain +# --no-cache + # Test image in shell: # docker run -it --rm --pull always --name Testing ubuntu:devel /bin/bash # docker run -it --rm --pull always --name Testing ptr727/plexcleaner:ubuntu-devel /bin/bash @@ -99,12 +103,6 @@ ENV TZ=Etc/UTC \ RUN apt-get install -y --no-install-recommends \ dotnet-runtime-8.0 -# Install VS debug tools -# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes -RUN wget https://aka.ms/getvsdbgsh \ - && sh getvsdbgsh -v latest -l /vsdbg \ - && rm getvsdbgsh - # Install media tools # https://packages.ubuntu.com/noble/ffmpeg # https://packages.ubuntu.com/noble/handbrake-cli @@ -128,6 +126,10 @@ COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test +# Copy debug tools installer script +COPY ./Docker/DebugTools.sh ./ +RUN chmod ugo+rwx ./DebugTools.sh + # Copy version script COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh diff --git a/Docker/Ubuntu.Rolling.Dockerfile b/Docker/Ubuntu.Rolling.Dockerfile index 4ee9a47c..2fdf9fe6 100644 --- a/Docker/Ubuntu.Rolling.Dockerfile +++ b/Docker/Ubuntu.Rolling.Dockerfile @@ -4,6 +4,10 @@ # Platforms: linux/amd64, linux/arm64, linux/arm/v7 # Tag: ptr727/plexcleaner:ubuntu +# Docker build debugging: +# --progress=plain +# --no-cache + # Test image in shell: # docker run -it --rm --pull always --name Testing ubuntu:rolling /bin/bash # docker run -it --rm --pull always --name Testing ptr727/plexcleaner:ubuntu /bin/bash @@ -99,12 +103,6 @@ ENV TZ=Etc/UTC \ RUN apt-get install -y --no-install-recommends \ dotnet-runtime-8.0 -# Install VS debug tools -# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes -RUN wget https://aka.ms/getvsdbgsh \ - && sh getvsdbgsh -v latest -l /vsdbg \ - && rm getvsdbgsh - # Install media tools # https://packages.ubuntu.com/noble/ffmpeg # https://packages.ubuntu.com/noble/handbrake-cli @@ -128,6 +126,10 @@ COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test +# Copy debug tools installer script +COPY ./Docker/DebugTools.sh ./ +RUN chmod ugo+rwx ./DebugTools.sh + # Copy version script COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh diff --git a/Docker/Ubuntu.Savoury.Dockerfile b/Docker/Ubuntu.Savoury.Dockerfile index ed25cc43..8dcb6fbf 100644 --- a/Docker/Ubuntu.Savoury.Dockerfile +++ b/Docker/Ubuntu.Savoury.Dockerfile @@ -4,6 +4,10 @@ # Platforms: linux/amd64 # Tag: ptr727/plexcleaner:savoury +# Docker build debugging: +# --progress=plain +# --no-cache + # Test image in shell: # docker run -it --rm --pull always --name Testing ubuntu:jammy /bin/bash # docker run -it --rm --pull always --name Testing ptr727/plexcleaner:savoury /bin/bash @@ -102,12 +106,6 @@ ENV TZ=Etc/UTC \ RUN apt-get install -y --no-install-recommends \ dotnet-runtime-8.0 -# Install VS debug tools -# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes -RUN wget https://aka.ms/getvsdbgsh \ - && sh getvsdbgsh -v latest -l /vsdbg \ - && rm getvsdbgsh - # Install MediaInfo # https://mediaarea.net/en/MediaInfo/Download/Ubuntu # https://mediaarea.net/en/Repos @@ -165,6 +163,10 @@ COPY --from=builder /Builder/Publish/PlexCleaner/. /PlexCleaner COPY /Docker/Test.sh /Test/ RUN chmod -R ugo+rwx /Test +# Copy debug tools installer script +COPY ./Docker/DebugTools.sh ./ +RUN chmod ugo+rwx ./DebugTools.sh + # Copy version script COPY /Docker/Version.sh /PlexCleaner/ RUN chmod ugo+rwx /PlexCleaner/Version.sh diff --git a/PlexCleaner.code-workspace b/PlexCleaner.code-workspace index b258c7ca..79107079 100644 --- a/PlexCleaner.code-workspace +++ b/PlexCleaner.code-workspace @@ -126,6 +126,19 @@ "yaml.schemas": { "https://json.schemastore.org/github-issue-config.json": "file:/.github/ISSUE_TEMPLATE/config.yml" }, - "dotnet.defaultSolution": "PlexCleaner.sln" + "dotnet.defaultSolution": "PlexCleaner.sln", + "files.trimTrailingWhitespace": true, + "[markdown]": { + "files.trimTrailingWhitespace": false + } + }, + "extensions": { + "recommendations": [ + "davidanson.vscode-markdownlint", + "gruntfuggly.todo-tree", + "ms-dotnettools.csharp", + "ms-dotnettools.csdevkit", + "streetsidesoftware.code-spell-checker" + ] } } \ No newline at end of file diff --git a/PlexCleaner/FfMpegTool.cs b/PlexCleaner/FfMpegTool.cs index 4ab0f58c..647e197d 100644 --- a/PlexCleaner/FfMpegTool.cs +++ b/PlexCleaner/FfMpegTool.cs @@ -118,7 +118,7 @@ protected override bool GetLatestVersionLinux(out MediaToolInfo mediaToolInfo) // Initialize mediaToolInfo = new MediaToolInfo(this); - // TODO: + // TODO: Linux implementation return false; } diff --git a/PlexCleaner/HandBrakeTool.cs b/PlexCleaner/HandBrakeTool.cs index 4310219a..4e7f4dcb 100644 --- a/PlexCleaner/HandBrakeTool.cs +++ b/PlexCleaner/HandBrakeTool.cs @@ -101,7 +101,7 @@ protected override bool GetLatestVersionLinux(out MediaToolInfo mediaToolInfo) // Initialize mediaToolInfo = new MediaToolInfo(this); - // TODO: + // TODO: Linux implementation return false; } diff --git a/PlexCleaner/MediaInfoTool.cs b/PlexCleaner/MediaInfoTool.cs index f96daac9..b3da4aba 100644 --- a/PlexCleaner/MediaInfoTool.cs +++ b/PlexCleaner/MediaInfoTool.cs @@ -104,7 +104,7 @@ protected override bool GetLatestVersionLinux(out MediaToolInfo mediaToolInfo) // Initialize mediaToolInfo = new MediaToolInfo(this); - // TODO + // TODO: Linux implementation return false; } diff --git a/PlexCleaner/MkvMergeTool.cs b/PlexCleaner/MkvMergeTool.cs index 152b078f..551e1d35 100644 --- a/PlexCleaner/MkvMergeTool.cs +++ b/PlexCleaner/MkvMergeTool.cs @@ -112,7 +112,7 @@ protected override bool GetLatestVersionLinux(out MediaToolInfo mediaToolInfo) // Initialize mediaToolInfo = new MediaToolInfo(this); - // TODO + // TODO: Linux implementation return false; } diff --git a/PlexCleaner/PlexCleaner.csproj b/PlexCleaner/PlexCleaner.csproj index 5d7560f0..541114fe 100644 --- a/PlexCleaner/PlexCleaner.csproj +++ b/PlexCleaner/PlexCleaner.csproj @@ -39,7 +39,7 @@ - + diff --git a/PlexCleaner/SevenZipTool.cs b/PlexCleaner/SevenZipTool.cs index 4b9c677a..7ea4854b 100644 --- a/PlexCleaner/SevenZipTool.cs +++ b/PlexCleaner/SevenZipTool.cs @@ -97,10 +97,10 @@ protected override bool GetLatestVersionWindows(out MediaToolInfo mediaToolInfo) protected override bool GetLatestVersionLinux(out MediaToolInfo mediaToolInfo) { - // Initialize + // Initialize mediaToolInfo = new MediaToolInfo(this); - // TODO + // TODO: Linux implementation return false; } diff --git a/PlexCleaner/SidecarFile.cs b/PlexCleaner/SidecarFile.cs index 149ac30d..ed22ac18 100644 --- a/PlexCleaner/SidecarFile.cs +++ b/PlexCleaner/SidecarFile.cs @@ -472,18 +472,19 @@ private string ComputeHash() { try { - // Create a buffer to hold the file data being hashed - byte[] buffer = new byte[2 * HashWindowLength]; + // TODO: Reuse this object to get value out of reusing the 128KB buffer + // Allocate buffer to hold data to be hashed + byte[] hashBuffer = new byte[2 * HashWindowLength]; // Open file using FileStream fileStream = MediaFileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.Read); // Small files read entire file, big files read front and back - if (MediaFileInfo.Length <= buffer.Length) + if (MediaFileInfo.Length <= hashBuffer.Length) { - // Read the entire file + // Read the entire file, buffer is already zeroed fileStream.Seek(0, SeekOrigin.Begin); - if (fileStream.Read(buffer, 0, (int)MediaFileInfo.Length) != MediaFileInfo.Length) + if (fileStream.Read(hashBuffer, 0, (int)MediaFileInfo.Length) != MediaFileInfo.Length) { Log.Logger.Error("Error reading from media file : {FileName}", MediaFileInfo.Name); return null; @@ -493,7 +494,7 @@ private string ComputeHash() { // Read the beginning of the file fileStream.Seek(0, SeekOrigin.Begin); - if (fileStream.Read(buffer, 0, HashWindowLength) != HashWindowLength) + if (fileStream.Read(hashBuffer, 0, HashWindowLength) != HashWindowLength) { Log.Logger.Error("Error reading from media file : {FileName}", MediaFileInfo.Name); return null; @@ -501,7 +502,7 @@ private string ComputeHash() // Read the end of the file fileStream.Seek(-HashWindowLength, SeekOrigin.End); - if (fileStream.Read(buffer, HashWindowLength, HashWindowLength) != HashWindowLength) + if (fileStream.Read(hashBuffer, HashWindowLength, HashWindowLength) != HashWindowLength) { Log.Logger.Error("Error reading from media file : {FileName}", MediaFileInfo.Name); return null; @@ -511,11 +512,8 @@ private string ComputeHash() // Close stream fileStream.Close(); - // Calculate the hash - byte[] hash = SHA256.HashData(buffer); - - // Convert to string - return System.Convert.ToBase64String(hash); + // Calculate the hash and convert to string + return System.Convert.ToBase64String(SHA256.HashData(hashBuffer)); } catch (Exception e) when (Log.Logger.LogAndHandle(e, MethodBase.GetCurrentMethod()?.Name)) { @@ -602,7 +600,7 @@ public static bool Update(string fileName) // Must be a MKV file Debug.Assert(MkvMergeTool.IsMkvFile(fileName)); - // Create new or udate existing sidecar file + // Create new or update existing sidecar file SidecarFile sidecarFile = new(fileName); return sidecarFile.Open(true); } diff --git a/PlexCleanerTests/PlexCleanerTests.csproj b/PlexCleanerTests/PlexCleanerTests.csproj index 6aaf9702..c7ff2d4c 100644 --- a/PlexCleanerTests/PlexCleanerTests.csproj +++ b/PlexCleanerTests/PlexCleanerTests.csproj @@ -8,9 +8,9 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/README.md b/README.md index 74229ba6..4ce69fd0 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,9 @@ Docker images are published on [Docker Hub][docker-link]. ## Release Notes +- Version 3.9: + - Re-enabling Alpine Stable builds now that Alpine 3.20 has been [released](https://alpinelinux.org/posts/Alpine-3.20.0-released.html). + - No longer pre-installing VS Debug Tools in docker builds, replaced with [`DebugTools.sh`](./Docker//DebugTools.sh) script that can be used to install [VS Debug Tools](https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-dotnet-core-linux-with-ssh) and [.NET Diagnostic Tools](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/tools-overview) if required. - Version 3.8: - Added Alpine Stable and Edge, Debian Stable and Testing, and Ubuntu Rolling and Devel docker builds. - Removed ArchLinux docker build, only supported x64 and media tool versions were often lagging. diff --git a/version.json b/version.json index 8aecdfbe..aa136665 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "3.8", + "version": "3.9", "publicReleaseRefSpec": [ "^refs/heads/main$" ],