mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-22 19:01:02 +01:00
Compare commits
50 Commits
v0.3.01
...
archive-ma
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1ae021aef | ||
|
|
8be921cab9 | ||
|
|
4364d940ec | ||
|
|
d4dc3b6c2d | ||
|
|
3c88841cb0 | ||
|
|
c081d7d7a4 | ||
|
|
48e72bd55d | ||
|
|
3acc743b98 | ||
|
|
fe49baf402 | ||
|
|
4090e5e3b9 | ||
|
|
0ec65299ef | ||
|
|
3edeb14f14 | ||
|
|
a4160941af | ||
|
|
cafc0ed796 | ||
|
|
14d2c288d4 | ||
|
|
515e52dcfa | ||
|
|
e471edd96f | ||
|
|
17f623a805 | ||
|
|
7badb36616 | ||
|
|
22602f24e9 | ||
|
|
fdc4edbf90 | ||
|
|
175459139a | ||
|
|
b4522aeefa | ||
|
|
61a363ff93 | ||
|
|
527e415d18 | ||
|
|
757a7522e3 | ||
|
|
4b67031e78 | ||
|
|
0e772ecf38 | ||
|
|
5f58fc63b0 | ||
|
|
1f0247dd78 | ||
|
|
b9079a5f3d | ||
|
|
72fb763c17 | ||
|
|
f66f2a160a | ||
|
|
ca32c2cc89 | ||
|
|
1b58c1e0aa | ||
|
|
0ad40005b4 | ||
|
|
da1be0ef36 | ||
|
|
e9d62a9b4a | ||
|
|
bd21eef647 | ||
|
|
7bb2e255dd | ||
|
|
bd89fd9126 | ||
|
|
3c110fee42 | ||
|
|
015553205a | ||
|
|
1b038711f4 | ||
|
|
e221004add | ||
|
|
1dab721756 | ||
|
|
08a95035c5 | ||
|
|
840861b24c | ||
|
|
9ff99d556b | ||
|
|
a82e8d31fe |
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* @santiagosayshey
|
||||
133
.github/workflows/add-issue-to-project.yml
vendored
Normal file
133
.github/workflows/add-issue-to-project.yml
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
name: Add Issue to Project
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
add-to-project:
|
||||
name: Add issue to project
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Add to Project
|
||||
id: add-to-project
|
||||
uses: actions/add-to-project@v0.5.0
|
||||
with:
|
||||
project-url: https://github.com/orgs/Dictionarry-Hub/projects/1
|
||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||
|
||||
- name: Get project item ID
|
||||
id: get-project-item-id
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
echo "Fetching project item ID for issue number: $ISSUE_NUMBER"
|
||||
item_id=$(gh api graphql -f query='
|
||||
query($project:ID!) {
|
||||
node(id: $project) {
|
||||
... on ProjectV2 {
|
||||
items(first: 100) {
|
||||
nodes {
|
||||
id
|
||||
content {
|
||||
... on Issue {
|
||||
number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}' -f project=$PROJECT_ID --jq ".data.node.items.nodes[] | select(.content.number == $ISSUE_NUMBER) | .id" -F number=$ISSUE_NUMBER)
|
||||
if [ -z "$item_id" ]; then
|
||||
echo "Error: Project item ID not found for issue number $ISSUE_NUMBER"
|
||||
exit 1
|
||||
else
|
||||
echo "Project item ID found: $item_id"
|
||||
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Set component, type, and status
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||
PROJECT_ITEM_ID: ${{ steps.get-project-item-id.outputs.PROJECT_ITEM_ID }}
|
||||
run: |
|
||||
echo "Setting fields for Project Item ID: ${PROJECT_ITEM_ID}"
|
||||
|
||||
# Set component to "Profilarr"
|
||||
result=$(gh api graphql -f query='
|
||||
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
|
||||
updateProjectV2ItemFieldValue(input: {
|
||||
projectId: $project
|
||||
itemId: $item
|
||||
fieldId: $fieldId
|
||||
value: {
|
||||
singleSelectOptionId: $value
|
||||
}
|
||||
}) {
|
||||
projectV2Item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCr_E" -f value="48fc49c7")
|
||||
echo "Set component result: $result"
|
||||
|
||||
# Set status to "Backlog"
|
||||
result=$(gh api graphql -f query='
|
||||
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
|
||||
updateProjectV2ItemFieldValue(input: {
|
||||
projectId: $project
|
||||
itemId: $item
|
||||
fieldId: $fieldId
|
||||
value: {
|
||||
singleSelectOptionId: $value
|
||||
}
|
||||
}) {
|
||||
projectV2Item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCn8s" -f value="f75ad846")
|
||||
echo "Set status result: $result"
|
||||
|
||||
# Get the label of the issue
|
||||
LABEL=$(gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }} --jq '.labels[0].name')
|
||||
echo "Issue label: $LABEL"
|
||||
|
||||
# Convert label to lowercase for comparison
|
||||
LABEL_LOWER=$(echo "$LABEL" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Set issue type based on label
|
||||
ISSUE_TYPE_ID=$(case $LABEL_LOWER in
|
||||
"bug") echo "b760225f" ;;
|
||||
"feature request") echo "1341bde2" ;;
|
||||
"improvement") echo "cb34d96f" ;;
|
||||
"documentation") echo "269885d0" ;;
|
||||
"refactor") echo "4996f537" ;;
|
||||
"infrastructure") echo "45a91bfe" ;;
|
||||
*) echo "" ;;
|
||||
esac)
|
||||
|
||||
if [ -z "$ISSUE_TYPE_ID" ]; then
|
||||
echo "No matching issue type for label: $LABEL"
|
||||
else
|
||||
echo "Setting issue type to ID: $ISSUE_TYPE_ID"
|
||||
result=$(gh api graphql -f query='
|
||||
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
|
||||
updateProjectV2ItemFieldValue(input: {
|
||||
projectId: $project
|
||||
itemId: $item
|
||||
fieldId: $fieldId
|
||||
value: {
|
||||
singleSelectOptionId: $value
|
||||
}
|
||||
}) {
|
||||
projectV2Item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCswQ" -f value="$ISSUE_TYPE_ID")
|
||||
echo "Set issue type result: $result"
|
||||
fi
|
||||
117
.github/workflows/add-to-testing.yml
vendored
Normal file
117
.github/workflows/add-to-testing.yml
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
name: Set Issue Status to Testing on Merge to Dev
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
update-status:
|
||||
if: ${{ github.event.pull_request.merged }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Extract Issue Number from Branch Name
|
||||
id: extract-issue-number
|
||||
run: |
|
||||
ISSUE_NUMBER=$(echo ${{ github.event.pull_request.head.ref }} | cut -d'-' -f1)
|
||||
echo "Issue Number extracted: $ISSUE_NUMBER"
|
||||
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
|
||||
|
||||
- name: Get project item ID
|
||||
id: get-project-item-id
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
|
||||
run: |
|
||||
echo "Fetching project item ID for issue number: $ISSUE_NUMBER"
|
||||
QUERY='
|
||||
query fetchProjectItem($project: ID!) {
|
||||
node(id: $project) {
|
||||
... on ProjectV2 {
|
||||
items(first: 100) {
|
||||
nodes {
|
||||
id
|
||||
content {
|
||||
... on Issue {
|
||||
number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
item_id=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.items.nodes[] | select(.content.number == '"$ISSUE_NUMBER"') | .id')
|
||||
if [ -z "$item_id" ]; then
|
||||
echo "Error: Project item ID not found for issue number $ISSUE_NUMBER"
|
||||
exit 1
|
||||
else
|
||||
echo "Project item ID found: $item_id"
|
||||
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Get single select field ID and options
|
||||
id: get-field-options
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
|
||||
run: |
|
||||
echo "Fetching field ID and options for status"
|
||||
QUERY='
|
||||
query($project:ID!) {
|
||||
node(id: $project) {
|
||||
... on ProjectV2 {
|
||||
fields(first: 100) {
|
||||
nodes {
|
||||
... on ProjectV2SingleSelectField {
|
||||
id
|
||||
name
|
||||
options {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
field_data=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.fields.nodes[] | select(.name == "Status")')
|
||||
field_id=$(echo $field_data | jq -r '.id')
|
||||
testing_option_id=$(echo $field_data | jq -r '.options[] | select(.name == "Testing") | .id')
|
||||
if [ -z "$field_id" ] || [ -z "$testing_option_id" ]; then
|
||||
echo "Error: Field ID or Testing option ID not found"
|
||||
exit 1
|
||||
else
|
||||
echo "Field ID: $field_id"
|
||||
echo "Testing option ID: $testing_option_id"
|
||||
echo "FIELD_ID=$field_id" >> $GITHUB_ENV
|
||||
echo "TESTING_OPTION_ID=$testing_option_id" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Set status to Testing
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||
PROJECT_ITEM_ID: ${{ env.PROJECT_ITEM_ID }}
|
||||
FIELD_ID: ${{ env.FIELD_ID }}
|
||||
TESTING_OPTION_ID: ${{ env.TESTING_OPTION_ID }}
|
||||
run: |
|
||||
echo "Setting status for Project Item ID: ${PROJECT_ITEM_ID}"
|
||||
result=$(gh api graphql -f query='
|
||||
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
|
||||
updateProjectV2ItemFieldValue(input: {
|
||||
projectId: $project
|
||||
itemId: $item
|
||||
fieldId: $fieldId
|
||||
value: {
|
||||
singleSelectOptionId: $value
|
||||
}
|
||||
}) {
|
||||
projectV2Item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="${FIELD_ID}" -f value="${TESTING_OPTION_ID}")
|
||||
echo "Set status result: $result"
|
||||
114
.github/workflows/new-branch-created.yml
vendored
Normal file
114
.github/workflows/new-branch-created.yml
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
name: Update Issue Status to In Development
|
||||
|
||||
on:
|
||||
create:
|
||||
branches:
|
||||
- '*-*'
|
||||
|
||||
jobs:
|
||||
update-status:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Extract Issue Number from Branch Name
|
||||
id: extract-issue-number
|
||||
run: |
|
||||
ISSUE_NUMBER=$(echo $GITHUB_REF_NAME | cut -d'-' -f1)
|
||||
echo "Issue Number extracted: $ISSUE_NUMBER"
|
||||
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
|
||||
|
||||
- name: Get project item ID
|
||||
id: get-project-item-id
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
|
||||
run: |
|
||||
echo "Fetching project item ID for issue number: $ISSUE_NUMBER"
|
||||
QUERY='
|
||||
query fetchProjectItem($project: ID!) {
|
||||
node(id: $project) {
|
||||
... on ProjectV2 {
|
||||
items(first: 100) {
|
||||
nodes {
|
||||
id
|
||||
content {
|
||||
... on Issue {
|
||||
number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
item_id=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.items.nodes[] | select(.content.number == '"$ISSUE_NUMBER"') | .id')
|
||||
if [ -z "$item_id" ]; then
|
||||
echo "Error: Project item ID not found for issue number $ISSUE_NUMBER"
|
||||
exit 1
|
||||
else
|
||||
echo "Project item ID found: $item_id"
|
||||
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Get single select field ID and options
|
||||
id: get-field-options
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
|
||||
run: |
|
||||
echo "Fetching field ID and options for status"
|
||||
QUERY='
|
||||
query($project:ID!) {
|
||||
node(id: $project) {
|
||||
... on ProjectV2 {
|
||||
fields(first: 100) {
|
||||
nodes {
|
||||
... on ProjectV2SingleSelectField {
|
||||
id
|
||||
name
|
||||
options {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
field_data=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.fields.nodes[] | select(.name == "Status")')
|
||||
field_id=$(echo $field_data | jq -r '.id')
|
||||
in_development_option_id=$(echo $field_data | jq -r '.options[] | select(.name == "In Development") | .id')
|
||||
if [ -z "$field_id" ] || [ -z "$in_development_option_id" ]; then
|
||||
echo "Error: Field ID or In Development option ID not found"
|
||||
exit 1
|
||||
else
|
||||
echo "Field ID: $field_id"
|
||||
echo "In Development option ID: $in_development_option_id"
|
||||
echo "FIELD_ID=$field_id" >> $GITHUB_ENV
|
||||
echo "IN_DEVELOPMENT_OPTION_ID=$in_development_option_id" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Set status to In Development
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||
PROJECT_ITEM_ID: ${{ env.PROJECT_ITEM_ID }}
|
||||
FIELD_ID: ${{ env.FIELD_ID }}
|
||||
IN_DEVELOPMENT_OPTION_ID: ${{ env.IN_DEVELOPMENT_OPTION_ID }}
|
||||
run: |
|
||||
echo "Setting status for Project Item ID: ${PROJECT_ITEM_ID}"
|
||||
result=$(gh api graphql -f query='
|
||||
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
|
||||
updateProjectV2ItemFieldValue(input: {
|
||||
projectId: $project
|
||||
itemId: $item
|
||||
fieldId: $fieldId
|
||||
value: {
|
||||
singleSelectOptionId: $value
|
||||
}
|
||||
}) {
|
||||
projectV2Item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="${FIELD_ID}" -f value="${IN_DEVELOPMENT_OPTION_ID}")
|
||||
echo "Set status result: $result"
|
||||
78
README.md
78
README.md
@@ -1,6 +1,14 @@
|
||||
# Profilarr
|
||||
|
||||
Profilarr is a Python-based tool designed to add import/export/sync functionality to the \*arr suite. It offers a user-friendly way to export existing custom formats / profiles, import new ones or sync a master instance of Radarr / Sonarr with extras.
|
||||
Profilarr is a Python-based tool designed to add import/export/sync/delete functionality to the \*arr suite. It offers a user-friendly way to:
|
||||
- Export existing custom formats / profiles
|
||||
- Import new custom formats / profiles
|
||||
- Sync a master instance of Radarr / Sonarr with other instances
|
||||
- Delete existing custom formats / quality profiles
|
||||
|
||||
## Discord
|
||||
|
||||
Come join us at https://discord.gg/ZxywYBGRB9 if you need any help or want to talk!
|
||||
|
||||
## ⚠️ Before Continuing
|
||||
|
||||
@@ -14,25 +22,61 @@ Profilarr is a Python-based tool designed to add import/export/sync functionalit
|
||||
- Python 3.x installed. You can download it from [python.org](https://www.python.org/downloads/).
|
||||
- Radarr / Sonarr
|
||||
|
||||
### 📦 Dependencies
|
||||
|
||||
- run `pip install -r requirements.txt` to install dependencies.
|
||||
|
||||
### Initial Setup
|
||||
|
||||
1. Download the latest Profilarr package from the release section.
|
||||
2. Extract its contents into a folder.
|
||||
3. Run `python setup.py` in your command line interface to generate a config file.
|
||||
- This will create a `config.yml` file in the same directory as `setup.py`.
|
||||
4. Open the `config.yml` file in a text editor.
|
||||
- Add the URL and API key to the master instances of Radarr / Sonarr.
|
||||
- If syncing, add the URL, API key and a name to each extra instance of Radarr / Sonarr.
|
||||
- If exporting, adjust the `export_path` to your desired export location.
|
||||
- If importing non Dictionarry files, adjust the `import_path` to your desired import location.
|
||||
5. Save the changes.
|
||||
#### Step 1: Download Profilarr
|
||||
|
||||
1. **Download Profilarr:**
|
||||
- Go to the Profilarr GitHub page and find the "Releases" [section](https://github.com/santiagosayshey/Profilarr/releases).
|
||||
- Download the latest release package.
|
||||
|
||||
2. **Extract Files:**
|
||||
- Once downloaded, extract the zip file to a folder of your choice.
|
||||
|
||||
#### Step 2: Install Profilarr
|
||||
|
||||
1. **Open Your Terminal:**
|
||||
- **Windows:** Search for `Command Prompt` or `PowerShell` in your start menu.
|
||||
- **MacOS:** Search for `Terminal`.
|
||||
- **Linux:** Use your desktop environment's application launcher to find `Terminal`, or press `Ctrl+Alt+T` if that's a shortcut in your Linux distro.
|
||||
|
||||
2. **Navigate to Profilarr Folder:**
|
||||
- Type `cd path/to/your/folder` and press Enter. Replace `path/to/your/folder` with the actual path to where you extracted Profilarr. This command works the same on Windows, MacOS, and Linux.
|
||||
|
||||
3. **Install Dependencies:**
|
||||
- Type `pip install -r requirements.txt` and press Enter. This command tells Python to install the necessary software components Profilarr needs to run. The command is the same across all platforms.
|
||||
|
||||
4. **Setup Configuration:**
|
||||
- Type `python setup.py` and press Enter. This will run a setup script that prepares Profilarr for use by generating a `config.yml` file, essentially Profilarr's settings book.
|
||||
|
||||
#### Step 3: Configure Profilarr
|
||||
|
||||
1. **Edit `config.yml`:**
|
||||
- Open the `config.yml` file in a text editor. Windows users might use Notepad, MacOS users might use TextEdit, and Linux users can use any text editor like Gedit, Nano, or Vim.
|
||||
- This file contains different settings that you can adjust to tell Profilarr how to operate.
|
||||
|
||||
2. **Add Master Instance Details:**
|
||||
- Look for the section related to Radarr/Sonarr.
|
||||
- Here, enter the URL and API key for your Radarr/Sonarr instances to link Profilarr with your movie/TV series managers.
|
||||
|
||||
3. **Configure Syncing or Exporting (if needed):**
|
||||
- **Syncing:** For syncing additional Radarr/Sonarr instances, add their URL, API key, and a name for each.
|
||||
- **Exporting:** To set where Profilarr saves files it creates, adjust the `export_path`.
|
||||
- **Importing:** If you have settings or lists from other sources, set `import_path` to their location.
|
||||
|
||||
4. **Configure ANSI Color Support (Optional):**
|
||||
- Profilarr can show colorful text in the terminal. If it's not displaying correctly (like showing `←[94m` instead of colors), you can fix this:
|
||||
- In the `settings` section, find `ansi_colors: true`.
|
||||
- Change it to `ansi_colors: false`. This disables colorful output for better compatibility with your terminal's capabilities.
|
||||
|
||||
5. **Save Your Changes:**
|
||||
- After adjusting these settings, save and close the `config.yml` file.
|
||||
|
||||
#### You're All Set!
|
||||
|
||||
## 🚀 Usage
|
||||
- If using Windows, use `python script.py` or `py script.py`. If on Linux, use `python3 script.py`.
|
||||
|
||||
- If using Windows, use `python <script>` or `py <script>`. If on Linux, use `python3 <script>`.
|
||||
|
||||
### Importing
|
||||
|
||||
@@ -277,3 +321,5 @@ PS Z:\Profilarr>
|
||||
Some custom formats found here have been interated on from the trash guides. Credit for these goes entirely to trash, and can be found on their site here. It is not my intention to steal their work, but rather to build on it and make it more accessible to the average user through my quality profiles. Please check out their site for more information on their work.
|
||||
|
||||
https://trash-guides.info/
|
||||
|
||||
test
|
||||
50
helpers.py
50
helpers.py
@@ -3,6 +3,7 @@ import json
|
||||
import requests
|
||||
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
|
||||
import json
|
||||
import sys
|
||||
|
||||
class Colors:
|
||||
GREEN = '\033[92m'
|
||||
@@ -20,24 +21,41 @@ class Apps:
|
||||
}
|
||||
|
||||
def print_message(message, message_type='', newline=True):
|
||||
color = Colors.ENDC # default color
|
||||
message_type = message_type.lower()
|
||||
config = load_config()
|
||||
ansi_colors = config['settings']['ansi_colors']
|
||||
|
||||
if ansi_colors:
|
||||
# Initialize color as default.
|
||||
color = Colors.ENDC
|
||||
message_type = message_type.lower()
|
||||
|
||||
if message_type == 'green':
|
||||
color = Colors.GREEN
|
||||
elif message_type == 'red':
|
||||
color = Colors.RED
|
||||
elif message_type == 'yellow':
|
||||
color = Colors.YELLOW
|
||||
elif message_type == 'blue':
|
||||
color = Colors.BLUE
|
||||
elif message_type == 'purple':
|
||||
color = Colors.PURPLE
|
||||
# Assign color based on message type.
|
||||
if message_type == 'green':
|
||||
color = Colors.GREEN
|
||||
elif message_type == 'red':
|
||||
color = Colors.RED
|
||||
elif message_type == 'yellow':
|
||||
color = Colors.YELLOW
|
||||
elif message_type == 'blue':
|
||||
color = Colors.BLUE
|
||||
elif message_type == 'purple':
|
||||
color = Colors.PURPLE
|
||||
|
||||
# Prepare the end color reset code.
|
||||
end_color = Colors.ENDC
|
||||
|
||||
if newline:
|
||||
print(color + message + Colors.ENDC)
|
||||
# Print the colored message.
|
||||
if newline:
|
||||
print(color + message + end_color)
|
||||
else:
|
||||
print(color + message + end_color, end='')
|
||||
else:
|
||||
print(color + message + Colors.ENDC, end='')
|
||||
# Print the message without color if ANSI colors are disabled.
|
||||
if newline:
|
||||
print(message)
|
||||
else:
|
||||
print(message, end='')
|
||||
|
||||
|
||||
|
||||
def load_config():
|
||||
@@ -119,6 +137,7 @@ def make_request(request_type, url, api_key, resource_type, json_payload=None):
|
||||
return None
|
||||
elif response.status_code == 401:
|
||||
print_message("Unauthorized. Check your API key.", "red")
|
||||
sys.exit()
|
||||
elif response.status_code == 409:
|
||||
print_message("Conflict detected. The requested action could not be completed.", "red")
|
||||
else:
|
||||
@@ -126,6 +145,7 @@ def make_request(request_type, url, api_key, resource_type, json_payload=None):
|
||||
except (ConnectionError, Timeout, TooManyRedirects) as e:
|
||||
# Update the message here to suggest checking the application's accessibility
|
||||
print_message("Network error. Make sure the application is running and accessible.", "red")
|
||||
sys.exit()
|
||||
|
||||
return None
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user