mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-22 10:51:02 +01:00
Bugfix/Normalise URL (#72)
- Added normalise URL function - removes trailing backslashes. - Added warning for JSON Decode Error in Readme
This commit is contained in:
@@ -294,6 +294,7 @@ Deleting Quality Profile (2160p Optimal (Single Grab)) : SUCCESS
|
||||
PS Z:\Profilarr>
|
||||
```
|
||||
|
||||
|
||||
### Radarr and Sonarr Compatibility
|
||||
|
||||
- You are only able to import / sync files to the app that is included in the file name (e.g. `Radarr` or `Sonarr`).
|
||||
@@ -308,6 +309,9 @@ PS Z:\Profilarr>
|
||||
- **User Interface (UI):** Development of a graphical user interface (GUI) for easier and more intuitive interaction with Profilarr. This UI will cater to users who prefer graphical over command-line interactions.
|
||||
- **Automatic Updates:** Implement an auto-update mechanism for Profilarr, ensuring users always have access to the latest features, improvements, and bug fixes without manual intervention.
|
||||
|
||||
## Known Issues
|
||||
- You may encounter a `JSON Encode Error`. This occurs when the base_url is entered incorrectly. Measures have been taken to prevent this, but if you encounter this error, please check your base_url in the config.yml file.
|
||||
|
||||
## Contributing
|
||||
|
||||
- I've added a docker compose file for testing custom formats / quality profiles. Run `docker-compose up -d` to start the Radarr/ Sonarr test containers. Add your API keys to the `config.yml` file and begin testing!
|
||||
|
||||
@@ -56,7 +56,7 @@ def delete_custom_formats_or_profiles(app, instance, item_type, config):
|
||||
Deletes either custom formats or quality profiles based on the item_type.
|
||||
"""
|
||||
api_key = instance['api_key']
|
||||
base_url = instance['base_url']
|
||||
base_url = get_url(instance)
|
||||
resource_type = item_type # 'customformat' or 'qualityprofile'
|
||||
|
||||
if item_type == 'customformat':
|
||||
|
||||
@@ -34,7 +34,7 @@ def export_custom_formats(app, instances, config):
|
||||
for instance in instances:
|
||||
print_message(f"Exporting Custom Formats for {app.capitalize()} : {instance['name']}", 'blue')
|
||||
|
||||
url = instance['base_url']
|
||||
url = get_url(instance)
|
||||
api_key = instance['api_key']
|
||||
|
||||
# Get the export path from the config
|
||||
@@ -87,7 +87,7 @@ def create_quality_profiles_export_path(app, config):
|
||||
def export_quality_profiles(app, instances, config):
|
||||
for instance in instances:
|
||||
print_message(f"Exporting Quality Profiles for {app.capitalize()} : {instance['name']}", 'blue')
|
||||
url = instance['base_url']
|
||||
url = get_url(instance)
|
||||
api_key = instance['api_key']
|
||||
|
||||
# Create the export directory
|
||||
|
||||
@@ -4,6 +4,7 @@ import requests
|
||||
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
|
||||
import json
|
||||
import sys
|
||||
import re
|
||||
|
||||
class Colors:
|
||||
GREEN = '\033[92m'
|
||||
@@ -20,6 +21,11 @@ class Apps:
|
||||
# Add more apps here as needed
|
||||
}
|
||||
|
||||
def get_url(instance):
|
||||
url = instance['base_url']
|
||||
normalized_url = re.sub(r'/$', '', url)
|
||||
return normalized_url
|
||||
|
||||
def print_message(message, message_type='', newline=True):
|
||||
config = load_config()
|
||||
ansi_colors = config['settings']['ansi_colors']
|
||||
|
||||
@@ -41,7 +41,7 @@ def import_custom_formats(app, instances):
|
||||
|
||||
for instance in instances:
|
||||
api_key = instance['api_key']
|
||||
base_url = instance['base_url']
|
||||
base_url = get_url(instance)
|
||||
|
||||
existing_formats = make_request('get', base_url, api_key, 'customformat')
|
||||
existing_names_to_id = {format['name']: format['id'] for format in existing_formats}
|
||||
@@ -90,7 +90,7 @@ def get_existing_profiles(base_url, api_key):
|
||||
def cf_import_sync(instances):
|
||||
for instance in instances:
|
||||
api_key = instance['api_key']
|
||||
base_url = instance['base_url']
|
||||
base_url = get_url(instance)
|
||||
resource_type = 'customformat'
|
||||
response = make_request('get', base_url, api_key, resource_type)
|
||||
|
||||
@@ -179,7 +179,7 @@ def import_quality_profiles(app, instances):
|
||||
selected_profiles_names = user_select_profiles(all_profiles)
|
||||
|
||||
for instance in instances:
|
||||
base_url = instance['base_url']
|
||||
base_url = get_url(instance)
|
||||
api_key = instance['api_key']
|
||||
custom_formats = instance.get('custom_formats', {})
|
||||
existing_profiles = get_existing_profiles(base_url, api_key) # Retrieve existing profiles
|
||||
|
||||
Reference in New Issue
Block a user