nicknsy / jellyscrub

Smooth mouse-over video scrubbing previews for Jellyfin.
MIT License
660 stars 25 forks source link

How to do this on unraid? #132

Open dandud100 opened 7 months ago

dandud100 commented 7 months ago

Hey, i am using the jellyfin docker image from linuxserver. I got this plugin working after i ran the following into the console, but if the container gets updated it will forget these changes. How to solve this?

chown jellyfin:jellyfin /usr/share/jellyfin/web/index.html

chmod 666 /usr/share/jellyfin/web/index.html

Lochnair commented 5 months ago

Late reply, but ran into this recently, and this is what I came up with. Note that I'm using hotio/jellyfin, not linuxserver, but the steps I took should work pretty similarly, probably just gotta adjust the naming for the jellyfin service, and of course adjust the paths to reflect how your setup looks like

echo "oneshot" > /srv/apps/jellyfin/set-perms-jellyscrub/init-jellyscrub/type

cat << 'EOF' > /srv/apps/jellyfin/set-perms-jellyscrub/init-jellyscrub/run
#!/command/with-contenv bash
echo "Setting owner/group on index.html to ${PUID}:${PGID} so Jellyscrub can inject its script"
chown -v ${PUID}:${PGID} /usr/share/jellyfin/web/index.html
EOF

chmod +x https://redirect.teleparty.com/join/ccda7b0554f357b2

echo "/etc/s6-overlay/s6-rc.d/init-jellyscrub/run" > /srv/apps/jellyfin/set-perms-jellyscrub/init-jellyscrub/up

touch /srv/apps/jellyfin/set-perms-jellyscrub/dependency

And in my docker-compose.yml I have these extra volumes:

    - /srv/apps/jellyfin/set-perms-jellyscrub/init-jellyscrub:/etc/s6-overlay/s6-rc.d/init-jellyscrub
    - /srv/apps/jellyfin/set-perms-jellyscrub/dependency:/etc/s6-overlay/s6-rc.d/service-jellyfin/dependencies.d/init-jellyscrub

This creates an extra initialization step taken by the jellyfin container during startup, that runs before jellyfin itself starts, and sets the user/group ownership for the index.html file to what the container was started with.

And since I'm using volumes to add my modifications to the container, it will keep working even if there's a new image.

nezuky commented 5 months ago

Thanks @Lochnair. Your solution worked for me. I am in the same situation as dandud100, on Unraid with a linuxserver Jellyfin image.

However I still needed to execute chmod +x on the run file, and correct it's contents since ${PUID}:${PGID} was missing. Your cat <<EOF > script didn't fully copy that over.

Linuxserver also didn't have a service-jellyfin path, I had to use svc-jellyfin instead:

Host Path:
/mnt/user/appdata/jellyfin/set-perms-jellyscrub/dependency
Container Path:
/etc/s6-overlay/s6-rc.d/svc-jellyfin/dependencies.d/init-jellyscrub
Lochnair commented 5 months ago

Thanks @nezuky, I've updated my comment.

I've changed cat <<EOF > to cat << 'EOF' >, which should stop the shell from doing variable substitution and keep the content intact.

Also added a note about the different path in the linuxserver image

Edit: Just saw someone posted a PR to update the readme with instructions to do this with the linuxserver container, which is much simpler: https://github.com/nicknsy/jellyscrub/pull/130/files

I'd personally still prefer to change the ownership, in case the Jellyscrub changes what should be injected, but both ways are viable

dimitarmanov commented 1 month ago

This can be used as well for those running linuxserver/jellyfin image: https://docs.linuxserver.io/general/container-customization/#custom-scripts

Create a script and mount it to the container and that script will be executed on startup