ankenyr / jellyfin-youtube-metadata-plugin

Youtube Metadata Plugin for Jellyfin
GNU Affero General Public License v3.0
481 stars 31 forks source link

Won't build in Docker #56

Closed mohkale closed 2 years ago

mohkale commented 2 years ago

Hi, how're we supposed to build this project?

In a sandboxed Docker environment it's failing.

FROM mcr.microsoft.com/dotnet/sdk:6.0

ARG VERSION=1.0.3.7
RUN curl -L --output YoutubeMetadta.tar.gz https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/archive/refs/tags/$VERSION.tar.gz \
 && tar xzvf YoutubeMetadta.tar.gz \
 && cd jellyfin-youtube-metadata-plugin-$VERSION \
 && dotnet publish --configuration Release --output bin

When I run docker build . it eventually fails with:

Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /jellyfin-youtube-metadata-plugin-1.0.3.7/Jellyfin.Plugin.YoutubeMetadata/Jellyfin.Plugin.YoutubeMetadata.csproj (in 37.57 sec).
  Restored /jellyfin-youtube-metadata-plugin-1.0.3.7/Jellyfin.Plugin.YoutubeMetadata.Providers.Tests/Jellyfin.Plugin.YoutubeMetadata.Tests.csproj (in 42.07 sec).
/usr/share/dotnet/sdk/6.0.301/Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "NYoutubeDL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/jellyfin-youtube-metadata-plugin-1.0.3.7/Jellyfin.Plugin.YoutubeMetadata/Jellyfin.Plugin.YoutubeMetadata.csproj]
/jellyfin-youtube-metadata-plugin-1.0.3.7/Jellyfin.Plugin.YoutubeMetadata/Utils.cs(7,7): error CS0246: The type or namespace name 'NYoutubeDL' could not be found (are you missing a using directive or an assembly reference?) [/jellyfin-youtube-metadata-plugin-1.0.3.7/Jellyfin.Plugin.YoutubeMetadata/Jellyfin.Plugin.YoutubeMetadata.csproj]
The command '/bin/sh -c curl -L --output YoutubeMetadta.tar.gz https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/archive/refs/tags/$VERSION.tar.gz  && tar xzvf YoutubeMetadta.tar.gz  && cd jellyfin-youtube-metadata-plugin-$VERSION  && dotnet publish --configuration Release --output bin' returned a non-zero code: 1
ankenyr commented 2 years ago

It looks to me like you are missing NYoutubeDLP, this is my fork of NYoutubeDL. https://github.com/ankenyr/NYoutubeDLP

I don't think I have ever tried building my plugin from inside of a docker container like this before.

mohkale commented 2 years ago

@ankenyr

I'm surprised since dotnet should auto fetch dependencies when doing a build. Looking at Jellyfin.Plugin.YoutubeMetadata/Jellyfin.Plugin.YoutubeMetadata.csproj it seems as if you added it as a local reference dependency which probably explains why I couldn't resolve it. And it looks like someone else has already published it as a NuGeT package so trying to add it as a conventional external dependency will fail because it'll be fetching the wrong package.

          <Reference Include="NYoutubeDL">
            <HintPath>..\..\NYoutubeDLP\src\NYoutubeDL\bin\Debug\netstandard2.0\NYoutubeDL.dll</HintPath>
          </Reference>
mohkale commented 2 years ago

Update: Finally managed to get a build my Jellyfin instance can actually load. For reference here's the section from my Dockerfile:

ARG DOTNET_VERSION=6.0
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} as plugin-builder

RUN mkdir /plugins

ARG YT_METADATA_VERSION=1.0.3.7
ARG NYTDLP_VERSION=12dcfe3
RUN cd $(mktemp -d)                                                                     \
 && curl                                                                                \
      -L                                                                                \
      --output YoutubeMetadata.tar.gz                                                   \
      https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/archive/refs/tags/$YT_METADATA_VERSION.tar.gz \
 && tar xvzf YoutubeMetadata.tar.gz                                                     \
 && cd jellyfin-youtube-metadata-plugin-$YT_METADATA_VERSION                            \
 && git clone https://github.com/ankenyr/NYoutubeDLP                                    \
 && git --work-tree NYoutubeDLP --git-dir NYoutubeDLP/.git checkout $NYTDLP_VERSION     \
 && dotnet add Jellyfin.Plugin.YoutubeMetadata reference NYoutubeDLP/src/NYoutubeDL     \
 && dotnet publish --configuration Release --output bin Jellyfin.Plugin.YoutubeMetadata \
 && mv bin /plugins/Jellyfin.Plugin.YoutubeMetadata

I'm happy to close this issue now, hopefully anyone trying to do the same in the future will stumble upon it as well.

ankenyr commented 2 years ago

Yea forked theirs since it needed to be changed to work for yt-dlp. I could rename it and upload it to nugget which would then work but I have not had the need to so I have not learned how to. If you have references I could do that if it simplifies things.for others.

On Sat, Jul 2, 2022, 2:11 PM Mohsin Kaleem @.***> wrote:

Closed #56 https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/56 as completed.

— Reply to this email directly, view it on GitHub https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/56#event-6922559414, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYWLRCM2ZLS3OEEX2CY4TVSCV6ZANCNFSM52DUJZZQ . You are receiving this because you were mentioned.Message ID: <ankenyr/jellyfin-youtube-metadata-plugin/issue/56/issue_event/6922559414@ github.com>

mohkale commented 2 years ago

If you have references I could do that if it simplifies things.for others.

I agree this should be done (it'll make building as easy as git clone remote . && dotnet build). But I'm a complete newb at C# so I have no idea how to either :sweat_smile:. A quick documentation search however does make it seem pretty easy. First produce a nupkg file from your code (looks like dotnet pack can do this) and then you can upload straight to the site.

ankenyr commented 2 years ago

Ahh same, this and the other half baked plugin are my only C# code I have written. Only the phone and not signed in but let's reopen this and track this as an issue.

On Sat, Jul 2, 2022, 3:17 PM Mohsin Kaleem @.***> wrote:

If you have references I could do that if it simplifies things.for others.

I agree this should be done (it'll make building as easy as git clone remote . && dotnet build). But I'm a complete newb at C# so I have no idea how to either 😅. A quick documentation search however does make it seem pretty easy. First produce a nupkg file from your code (looks like dotnet pack https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package-using-the-dotnet-cli#run-the-pack-command can do this) and then you can upload straight to the site https://docs.microsoft.com/en-us/nuget/nuget-org/publish-a-package.

— Reply to this email directly, view it on GitHub https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/56#issuecomment-1172971445, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYWLWM3TWIWLSOHVRWJ6LVSC5Y5ANCNFSM52DUJZZQ . You are receiving this because you were mentioned.Message ID: @.***>

ankenyr commented 2 years ago

Looks like someone had the same idea as me and already packaged this. https://www.nuget.org/packages/NYoutubeDLP/

mohkale commented 2 years ago

@ankenyr

I don't think that's the same. I tried building against it and it failed. The github repo it links to is https://github.com/Antfere/NYoutubeDLP and that doesn't look to be the same as your fork (at least to me).

ankenyr commented 2 years ago

It is forked from the same project. It looks to be more up to date with the latest yt-dlp stuff than mine. So if it isn't strictly compatible I will move to it so there is one less thing for me to support.

mohkale commented 2 years ago

Makes sense. Could you keep this issue open until you get a chance to migrate onto it (or create a new issue) so that I can subscribe to updates regarding this change?

ankenyr commented 2 years ago

I already moved to it.

On Fri, Jul 8, 2022, 5:58 AM Mohsin Kaleem @.***> wrote:

Makes sense. Could you keep this issue open until you get a chance to migrate onto it (or create a new issue) so that I can subscribe to updates regarding this change?

— Reply to this email directly, view it on GitHub https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/56#issuecomment-1178960562, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYWLVL7RGCPWAR2KHMKALVTAQW7ANCNFSM52DUJZZQ . You are receiving this because you were mentioned.Message ID: @.***>