Skip to content

Commit

Permalink
Merge branch 'main' into feature_autodrive
Browse files Browse the repository at this point in the history
  • Loading branch information
microtechno9000 authored Nov 20, 2024
2 parents 534e2e8 + 4d8cf1f commit 4b0898f
Show file tree
Hide file tree
Showing 18 changed files with 400 additions and 44 deletions.
5 changes: 5 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Title (remove section)
_Add either feature or bugfix to the title inline with the software version increment_
New Feature - [FEATURE]
Patch or Bugfix - [BUGFIX]

# Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.
Expand Down
88 changes: 65 additions & 23 deletions .github/workflows/version_bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: "Version Increment"
on:
# Run this action on any Pull Request raised against ARM
pull_request:
# Ensure changes re-run the version script (i.e. title change)
types: [opened, edited, synchronize]
# Don't run on changes to the below paths
paths-ignore:
- 'arm_wiki/**'
Expand Down Expand Up @@ -46,73 +48,113 @@ jobs:
- name: Determine new version
if: env.VERSION_UPDATED == 'false'
id: determine-version
env:
# Safely get title (avoid injection attacks)
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
PR_TITLE=$(jq -r '.pull_request.title' "$GITHUB_EVENT_PATH")
# Set Title environment flag to false
TITLE_FLAG="false"
echo "PR Title: $PR_TITLE"
if [[ "$PR_TITLE" == *"[FEATURE]"* ]]; then
VERSION_TYPE="minor"
echo "VERSION_TYPE=$VERSION_TYPE" >> $GITHUB_ENV
echo "PR set to FEATURE updating minor version"
TITLE_FLAG="true"
elif [[ "$PR_TITLE" == *"[BUGFIX]"* ]]; then
VERSION_TYPE="patch"
echo "VERSION_TYPE=$VERSION_TYPE" >> $GITHUB_ENV
echo "PR set to BUGFIX updating patch version"
TITLE_FLAG="true"
else
echo "No version bump flag found in PR title. Exiting."
echo "Edit your PR title to include either FEATURE or BUGFIX"
exit 1
fi
CURRENT_VERSION=$(cat VERSION)
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
if [ "$VERSION_TYPE" == "minor" ]; then
VERSION_PARTS[1]=$((VERSION_PARTS[1]+1))
VERSION_PARTS[2]=0
elif [ "$VERSION_TYPE" == "patch" ]; then
VERSION_PARTS[2]=$((VERSION_PARTS[2]+1))
# If Feature or Bugfix update the version
if [[ "$TITLE_FLAG" == "true" ]]; then
CURRENT_VERSION=$(cat VERSION)
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
if [[ "$VERSION_TYPE" == "minor" ]]; then
VERSION_PARTS[1]=$((VERSION_PARTS[1]+1))
VERSION_PARTS[2]=0
elif [[ "$VERSION_TYPE" == "patch" ]]; then
VERSION_PARTS[2]=$((VERSION_PARTS[2]+1))
fi
NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}"
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "New Version: " $NEW_VERSION
fi
NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}"
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "New Version: " $NEW_VERSION
# Set variables to global environment variables for later
echo "TITLE_FLAG=$TITLE_FLAG" >> $GITHUB_ENV
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
echo "VERSION_TYPE=$VERSION_TYPE" >> $GITHUB_ENV
- name: Configure Git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Pull latest changes from remote
if: env.VERSION_UPDATED == 'false'
if: env.VERSION_UPDATED == 'false' && env.TITLE_FLAG == 'true'
run: |
git pull --rebase origin ${{ github.head_ref }}
- name: Update VERSION file
if: env.VERSION_UPDATED == 'false'
- name: Update VERSION file and Push Changes
if: env.VERSION_UPDATED == 'false' && env.TITLE_FLAG == 'true'
run: |
echo "$NEW_VERSION" > VERSION
git add VERSION
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "[Automated] Release: ${VERSION_TYPE} - Version from $CURRENT_VERSION to $NEW_VERSION"
# Use the pull request's branch name to push changes
BRANCH="${{ github.head_ref }}"
echo "Pushing changes to branch: $BRANCH"
# Push changes to the PR branch
git push origin HEAD:$BRANCH
- name: Push changes
if: env.VERSION_UPDATED == 'false'
- name: Debug Environment Variables
run: |
git push origin ${{ github.head_ref }}
echo "PR_TITLE=${{ env.PR_TITLE }}"
echo "NEW_VERSION=${{ env.NEW_VERSION }}"
echo "CURRENT_VERSION=${{ env.CURRENT_VERSION }}"
echo "VERSION_TYPE=${{ env.VERSION_TYPE }}"
- name: Comment on PR
if: env.VERSION_UPDATED == 'false'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Retrieve variables from the environment
const titleFlag = process.env.TITLE_FLAG;
const prNumber = context.issue.number;
const prTitle = process.env.PR_TITLE;
const newVersion = process.env.NEW_VERSION;
const currentVersion = process.env.CURRENT_VERSION;
const versionType = process.env.VERSION_TYPE;
// Prepare the message based on the title flag
let prBody;
if (titleFlag === "false") {
prBody = `Version Bot\n **PR title:** ${prTitle}\n **No valid version flag found**. PR title must include either [FEATURE] or [BUGFIX] to auto-increment the version.\n **Please update the PR title** and re-run the workflow.`;
} else {
prBody = `Version Bot:\n **PR title:** ${prTitle}\n Updated version: **${currentVersion}** to **${newVersion}**\n Release version: **${versionType}**`;
}
// Generate PR comment
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `Release type: ${versionType}. The version has been incremented from ${currentVersion} to ${newVersion} based on the PR title flag.`
body: prBody
})
- name: Set tag for non-default branch
if: steps.branch-name.outputs.is_default == 'false' && steps.branch-name.outputs.default_branch != ''
if: steps.branch-name.outputs.is_default == 'false' && steps.branch-name.outputs.default_branch != '' && env.TITLE_FLAG == 'true'
run: |
echo "Branch name is ${{ steps.branch-name.outputs.ref_branch }}"
echo "Main name is ${{ steps.branch-name.outputs.default_branch }}"
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.10.0
2.10.0
13 changes: 10 additions & 3 deletions arm/ripper/arm_ripper.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def rip_visual_media(have_dupes, job, logfile, protection):
makemkv_out_path = None
hb_in_path = str(job.devpath)
# Do we need to use MakeMKV - Blu-rays, protected dvd's, and dvd with mainfeature off
if rip_with_mkv(job, protection):
use_make_mkv = rip_with_mkv(job, protection)
logging.debug(f"Using MakeMKV: [{use_make_mkv}]")
if use_make_mkv:
logging.info("************* Ripping disc with MakeMKV *************")
# Run MakeMKV and get path to output
job.status = "ripping"
Expand All @@ -68,19 +70,24 @@ def rip_visual_media(have_dupes, job, logfile, protection):
hb_in_path = makemkv_out_path
# Begin transcoding section - only transcode if skip_transcode is false
start_transcode(job, logfile, hb_in_path, hb_out_path, protection)

# --------------- POST PROCESSING ---------------
if job.config.SKIP_TRANSCODE:
# Delete the transcode path and update the out path to RAW path
# If ripped with MakeMKV remove the 'out' folder and set the raw as the output
logging.debug(f"Transcode status: [{job.config.SKIP_TRANSCODE}] and MakeMKV Status: [{use_make_mkv}]")
if job.config.SKIP_TRANSCODE and use_make_mkv:
utils.delete_raw_files([hb_out_path])
hb_out_path = hb_in_path

# Update final path if user has set a custom/manual title
logging.debug(f"Job title status: [{job.title_manual}]")
if job.title_manual:
# Remove the old final dir
utils.delete_raw_files([final_directory])
job_title = utils.fix_job_title(job)
final_directory = os.path.join(job.config.COMPLETED_PATH, type_sub_folder, job_title)
# Update the job.path with the final directory
utils.database_updater({'path': final_directory}, job)

# Move to final folder
move_files_post(hb_out_path, job)
# Movie the movie poster if we have one - no longer needed, now handled by save_movie_poster
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# IMPORTANT: This installation method is no longer supported. Please install ARM as a [Docker Container](https://github.com/automatic-ripping-machine/automatic-ripping-machine/wiki/docker) instead
# IMPORTANT

***
This installation method is not supported or maintained by the ARM Developers.
For full support and continued maintenance,
recommend installing ARM via the supported [Docker Container](https://github.com/automatic-ripping-machine/automatic-ripping-machine/wiki/docker).
This installation guide has been left within the Wiki, as some users do not install via docker.

**Use at your own risk**

***

## Manual Installation Guide

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# IMPORTANT: This installation method is no longer supported. Please install ARM as a [Docker Container](https://github.com/automatic-ripping-machine/automatic-ripping-machine/wiki/docker) instead
# IMPORTANT

***
This installation method is not supported or maintained by the ARM Developers.
For full support and continued maintenance,
recommend installing ARM via the supported [Docker Container](https://github.com/automatic-ripping-machine/automatic-ripping-machine/wiki/docker).
This installation guide has been left within the Wiki, as some users do not install via docker.

**Use at your own risk**

***

# Auto Install Script For OpenMediaVault/Debian

Expand Down
140 changes: 140 additions & 0 deletions arm_wiki/Alternate-Install-TrueNAS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# TrueNAS Installation Guide

> [!Important]
>
> This installation method is not supported, maintained or tested by the ARM Developers during upgrades.
This is a step-by-step walkthrough adding ARM (Automatic Ripping Machine) to a
TrueNAS Scale system as a custom app.

**Note**: The following guide was performed on TrueNAS Scale Cobie (24.04).
Prior versions of TrueNAS Scale have an issue with GPU Allocation, which Cobia fixes.


1. **Create App**

Create a custom app via Apps → Discover Apps → Custom App

> [!TIP]
>
> Refer to the TrueNAS Documentation for additional information:
> [Documentation Hub](https://www.truenas.com/docs/scale/24.04/scaletutorials/apps/usingcustomapp/)

2. **Set the App Name**

Name the Application, e.g. `arm`, `autorip`, or any other arbitrary name.


3. **Set the Repository**

Set the *Image Repository* to `automaticrippingmachine/automatic-ripping-machine`
and leave the _Image Tage_ on `latest`.


4. **Managing Permissions**

The ARM container's internal user has User ID (`uid`) `1000` and Group ID (`gid`) `1000`.
In most TrueNAS Scale installations, no user or group with this ID exists, and directory/file permissions
are likely not these ids. Therefore, you will need to make sure the container user has read and write permissions
in the paths you will be setting in Step 6.

You have 2 choices for this:
- **Preferred**:
In the **Container Environment Variables** section add the variables `ARM_UID` and `ARM_GID` and set both
to `568`. This is TrueNAS' default `apps` user/group, which will most likely already have access to your
directories and files.
- **Alternate**:
Adjust the directory and file permissions to allow read/write access for user and group ID `1000`,
either by `chown`ing the directories/files, or adding corresponding ACLs.


5. **Port Forwarding**

Enable port forwarding to allow access to ARM outside the docker container.
ARM uses a default internal port of `8080`, configure the 'Node Port' to any unused port.

| Container Port | Node Port | Protocol |
|----------------|---------------|------------------|
| `8080` | `<your port>` | `TCP Protocol` |

Where `your-port` is the port the WebUI will be reachable at later.
Make sure it does not conflict with a port of your other Apps.

<img title="TrueNAS Port Forward Config" src="images/setup_truenas_portforwarding.png" width="30%" height="">

6. **Storage**

Under **Storage** you need to map the 5 directories listed below.
Note the *Host Paths* need to be created ahead of time to show up in the *Host Path* selector.
Where you put these is your choice, but specifically for the `media` and `music` volumes,
a path on your storage pools is highly recommended. For a reference what each of these directories are used for,
read our guide on [Understanding Docker Volumes for A.R.M.](https://github.com/automatic-ripping-machine/automatic-ripping-machine/wiki/docker#understanding-docker-volumes-for-arm).

Next to *Host Path Volumes* click *Add* and configure the following directories:

| Local Path | ARM Docker Directory |
|--------------------------------|----------------------|
| `<path_to_arm_user_home_folder>` | `/home/arm` |
| `<path_to_music_folder>` | `/home/arm/music` |
| `<path_to_logs_folder>` | `/home/arm/logs` |
| `<path_to_media_folder>` | `/home/arm/media` |
| `<path_to_config_folder>` | `/etc/arm/config` |

> [!IMPORTANT]
> Please make sure to ***not*** check any of the *Read Only* boxes.
7. **Media Drives**

Assign the required CD, DVD or Blu-ray drives in the system to ARM.

_needs verification, see PR comments_

In the **Workload Details** section under *Security Context*, enable the *Privileged Mode* checkbox.

> [!WARNING]
> As of the current TrueNAS Scale Cobia release, there seems to be no way to pass only a single drive to a Docker container.
> This may change in Electric Eel with the replacement of the Kubernetes Engine in favor of Docker Compose.
>
> That being said, running containers in
> [Privileged Mode comes with inherent security risks](https://docs.docker.com/security/faqs/containers/).
> If you are not comfortable with this, you may want to hold off for now and check back later after Electric Eel is released.

8. **GPU Configuration** (Optional)

If you don’t have a compatible GPU or wish to keep your video files raw,
you can skip this step as this is only required for transcoding.
Continue down to the **Resource Reservation** section and into the *GPU Configuration*
If you do, continue down to the **Resource Reservation** section. Under *GPU Configuration* allocate at least a
single one of the compatible GPUs to enable the NVENC.
It will show you multiple GPUs that you can allocate, choose at least one.

> [!IMPORTANT]
>
> For NVIDIA GPUs, not only do you need to allocate your GPU, but you must also add a pair of variables in the **Container Environment Variables** section:
> - Name: `NVIDIA_VISIBLE_DEVICES` Value: `all`
> - Name: `NVIDIA_DRIVER_CAPABILITIES` Value: `all`

9. **Enable Web Portal** (Optional)

Not a necessary step, but this will create a button on the ARM app in TrueNAS Scale
to allow quick access to the ARM Web GUI.
_Note:_ Port forwarding is required to enable the Web Portal

<img title="TrueNAS WebUI Portal Config" src="images/setup_truenas_webui.png" width="30%" height="">


10. **Install**

Click the *Install* button at the bottom and wait for it to complete.


If everything was done properly, ARM should now work.
Head into the WebGUI either using the web portal button on the ARM app if you made one
or using the `ip:port` in the browser to check if ARM is working.

### Contributors:
* provscan (via discord)
* [mihawk90](https://github.com/mihawk90)
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# IMPORTANT: This installation method is no longer supported. Please install ARM as a [Docker Container](https://github.com/automatic-ripping-machine/automatic-ripping-machine/wiki/docker) instead
# IMPORTANT

***
This installation method is not supported or maintained by the ARM Developers.
For full support and continued maintenance,
recommend installing ARM via the supported [Docker Container](https://github.com/automatic-ripping-machine/automatic-ripping-machine/wiki/docker).
This installation guide has been left within the Wiki, as some users do not install via docker.

**Use at your own risk**

***

## Manual Install Guide

Expand Down
2 changes: 1 addition & 1 deletion arm_wiki/Configuring-ARM.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- For ARM to identify movie/tv titles register for an API key at OMDb API: http://www.omdbapi.com/apikey.aspx and set the OMDB_API_KEY parameter in the config file.


**Email notifcations**
**Email Notifications**

A lot of random problems are found in the sysmail, email alerting is a most effective method for debugging and monitoring.

Expand Down
Loading

0 comments on commit 4b0898f

Please sign in to comment.