Skip to content

Commit

Permalink
Release 076 (#487)
Browse files Browse the repository at this point in the history
* allow PUID/GUID other than 1000:1000 (#486)

* allow PUID/GUID other than 1000:1000

* retarget chown for faster startup

* chore: updated deps for parsett and rtn

* fix: update default rank model

* chore: update version

---------

Co-authored-by: Zombie <[email protected]>
Co-authored-by: Spoked <Spoked@localhost>
  • Loading branch information
3 people authored Jul 2, 2024
1 parent d09f512 commit 12f5c67
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 149 deletions.
15 changes: 4 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ RUN mkdir -p /usr/share/fonts/nerd-fonts && \
# Install Poetry
RUN pip install poetry==1.8.3

# Create user and group
RUN addgroup -g 1000 riven && \
adduser -u 1000 -G riven -h /home/riven -s /usr/bin/fish -D riven

# Create fish config directory
RUN mkdir -p /home/riven/.config/fish

Expand All @@ -81,9 +77,9 @@ ENV TERM=xterm-256color
WORKDIR /riven

# Copy frontend build from the previous stage
COPY --from=frontend --chown=riven:riven /app/build /riven/frontend/build
COPY --from=frontend --chown=riven:riven /app/node_modules /riven/frontend/node_modules
COPY --from=frontend --chown=riven:riven /app/package.json /riven/frontend/package.json
COPY --from=frontend /app/build /riven/frontend/build
COPY --from=frontend /app/node_modules /riven/frontend/node_modules
COPY --from=frontend /app/package.json /riven/frontend/package.json

# Copy the virtual environment from the builder stage
COPY --from=builder /app/.venv /app/.venv
Expand All @@ -98,10 +94,7 @@ COPY VERSION entrypoint.sh /riven/
# Ensure entrypoint script is executable
RUN chmod +x /riven/entrypoint.sh

# Set correct permissions for the riven user
RUN chown -R riven:riven /home/riven/.config /riven

# Switch to fish shell
SHELL ["fish", "--login"]

ENTRYPOINT ["fish", "/riven/entrypoint.sh"]
ENTRYPOINT ["fish", "/riven/entrypoint.sh"]
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.5
0.7.6
4 changes: 2 additions & 2 deletions backend/program/media/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def _determine_state(self):
return States.Downloaded
if self.is_scraped():
return States.Scraped
if all(episode.state == States.Indexed for episode in self.episodes):
if any(episode.state == States.Indexed for episode in self.episodes):
return States.Indexed
if any(episode.state == States.Requested for episode in self.episodes):
return States.Requested
Expand Down Expand Up @@ -409,7 +409,7 @@ def __init__(self, item):
self.item_id = ItemId(self.number, parent_id=item.get("parent_id"))
super().__init__(item)
if self.parent and isinstance(self.parent, Season):
self.is_anime = self.parent.is_anime
self.is_anime = self.parent.parent.is_anime

def __eq__(self, other):
if (
Expand Down
8 changes: 6 additions & 2 deletions backend/program/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,12 @@ def _process_future_item(self, future: Future, service: Service, orig_item: Medi
self._remove_from_running_items(orig_item, service.__name__)

def _submit_job(self, service: Service, item: MediaItem | None) -> None:
logger.log("PROGRAM", f"Submitting service {service.__name__} to the pool" + (f" with {getattr(item, 'log_string', None) or item.item_id}" if item else ""))

if item and service:
if service.__name__ == "TraktIndexer":
logger.log("NEW", f"Submitting service {service.__name__} to the pool with {getattr(item, 'log_string', None) or item.item_id}")
else:
logger.log("PROGRAM", f"Submitting service {service.__name__} to the pool with {getattr(item, 'log_string', None) or item.item_id}")

# Check if the executor has been shut down
if not self.running:
logger.error("Cannot submit job, executor is shut down.")
Expand Down
8 changes: 4 additions & 4 deletions backend/program/settings/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,17 @@ class RTNSettingsModel(SettingsModel, Observable):
"webdl": CustomRank(fetch=True, rank=90),
"repack": CustomRank(fetch=True, rank=5),
"proper": CustomRank(fetch=True, rank=4),
"dubbed": CustomRank(fetch=True, rank=1),
"subbed": CustomRank(fetch=True, rank=4),
"dubbed": CustomRank(fetch=True, rank=3),
"subbed": CustomRank(fetch=True, rank=3),
"av1": CustomRank(fetch=False, rank=0),
"h264": CustomRank(fetch=True, rank=0),
"h265": CustomRank(fetch=True, rank=0),
"hevc": CustomRank(fetch=True, rank=0),
"avc": CustomRank(fetch=True, rank=0),
"dvdrip": CustomRank(fetch=True, rank=5),
"dvdrip": CustomRank(fetch=True, rank=-100),
"bdrip": CustomRank(fetch=True, rank=5),
"brrip": CustomRank(fetch=True, rank=0),
"hdtv": CustomRank(fetch=True, rank=0),
"hdtv": CustomRank(fetch=True, rank=-100),
}


Expand Down
2 changes: 2 additions & 0 deletions backend/program/settings/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class DefaultRanking(BaseRankingModel):
remux: int = -1000
webdl: int = 90
bluray: int = 80
dvdrip: int = -100
hdtv: int = -100


class BestRemuxRanking(BaseRankingModel):
Expand Down
80 changes: 43 additions & 37 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,58 @@ set PGID (set -q PGID; and echo $PGID; or echo 1000)

echo "Starting Container with $PUID:$PGID permissions..."

if not echo $PUID | grep -qE '^[0-9]+$'
echo "PUID is not a valid integer. Exiting..."
exit 1
end

if not echo $PGID | grep -qE '^[0-9]+$'
echo "PGID is not a valid integer. Exiting..."
exit 1
end

set -q USERNAME; or set USERNAME riven
set -q GROUPNAME; or set GROUPNAME riven

if not getent group $PGID > /dev/null
addgroup -g $PGID $GROUPNAME
if test $status -ne 0
echo "Failed to create group. Exiting..."
if [ "$PUID" = "0" ]
echo running as root user
set USER_HOME "/home/$USERNAME"
mkdir -p $USER_HOME
else
if not echo $PUID | grep -qE '^[0-9]+$'
echo "PUID is not a valid integer. Exiting..."
exit 1
end
else
set GROUPNAME (getent group $PGID | cut -d: -f1)
end

if not getent passwd $USERNAME > /dev/null
adduser -D -u $PUID -G $GROUPNAME $USERNAME
if test $status -ne 0
echo "Failed to create user. Exiting..."

if not echo $PGID | grep -qE '^[0-9]+$'
echo "PGID is not a valid integer. Exiting..."
exit 1
end
else
if test $PUID -ne 0
usermod -u $PUID -g $PGID $USERNAME

set -q USERNAME; or set USERNAME riven
set -q GROUPNAME; or set GROUPNAME riven

if not getent group $PGID > /dev/null
addgroup -g $PGID $GROUPNAME
if test $status -ne 0
echo "Failed to create group. Exiting..."
exit 1
end
else
set GROUPNAME (getent group $PGID | cut -d: -f1)
end

if not getent passwd $USERNAME > /dev/null
adduser -D -u $PUID -G $GROUPNAME $USERNAME
if test $status -ne 0
echo "Failed to modify user UID/GID. Exiting..."
exit 1
echo "Failed to create user. Exiting..."
exit 1
end
else
echo "Skipping usermod for root user."
if test $PUID -ne 0
usermod -u $PUID -g $PGID $USERNAME
if test $status -ne 0
echo "Failed to modify user UID/GID. Exiting..."
exit 1
end
else
echo "Skipping usermod for root user."
end
end

set USER_HOME "/home/$USERNAME"
mkdir -p $USER_HOME
chown -R $PUID:$PGID $USER_HOME
chown -R $PUID:$PGID /riven/data
end

set USER_HOME "/home/$USERNAME"
mkdir -p $USER_HOME
chown -R $PUID:$PGID $USER_HOME
chown -R $PUID:$PGID /riven

umask 002

set -x XDG_CONFIG_HOME "$USER_HOME/.config"
Expand Down Expand Up @@ -77,4 +83,4 @@ set backend_pid (jobs -p %1)

# Start the frontend
echo "Starting frontend..."
exec su -m $USERNAME -c "fish -c 'ORIGIN=$ORIGIN node /riven/frontend/build'"
exec su -m $USERNAME -c "fish -c 'ORIGIN=$ORIGIN node /riven/frontend/build'"
Loading

0 comments on commit 12f5c67

Please sign in to comment.