From e57d316969649c6188585774553ac1ee2c475c1d Mon Sep 17 00:00:00 2001
From: SinTan1729 <sayantan.santra689@gmail.com>
Date: Thu, 10 Aug 2023 18:46:12 -0500
Subject: [PATCH] new: Added example config files

---
 build_settings                         | 45 -----------------------
 chosen_patches.txt                     |  3 --
 example_configs/build_config           | 51 ++++++++++++++++++++++++++
 example_configs/chosen_patches         |  4 ++
 example_configs/notification_config    | 25 +++++++++++++
 src/ReVancedBuilder/APKPure_dl.py      |  2 +-
 src/ReVancedBuilder/JAVABuilder.py     |  4 +-
 src/ReVancedBuilder/ReVancedBuilder.py |  4 +-
 8 files changed, 85 insertions(+), 53 deletions(-)
 delete mode 100644 build_settings
 delete mode 100644 chosen_patches.txt
 create mode 100644 example_configs/build_config
 create mode 100644 example_configs/chosen_patches
 create mode 100644 example_configs/notification_config

diff --git a/build_settings b/build_settings
deleted file mode 100644
index bb8edb9..0000000
--- a/build_settings
+++ /dev/null
@@ -1,45 +0,0 @@
-# These are the currently supported apps that can be built
-# Make a copy of this to your working directory
-# Then change the default values to enable/disable building them
-YT_NONROOT=true
-YTM_NONROOT=true
-YT_ROOT=false
-YTM_ROOT=false
-
-# You can provide versions of apk for the builds
-# If anything nonempty is given, automatic version resolution
-# will be disabled
-# It's your job to make sure that the version is available
-# in APKPure
-YT_VERSION=
-YTM_VERSION=
-
-# Settings for sending Telegram notification using telegram.sh
-# In case you decide to use it, please put valid config in the
-# TOKEN and CHAT fields
-# Check out README for instructions
-TG_NOTIFICATIONS=false
-TELEGRAM_TOKEN=""
-TELEGRAM_CHAT=""
-
-# Settings for uploading the files through telegram-upload
-# In case you decide to use it, please put valid config in the
-# CHANNEL_ADDRESS field
-# Check out README for instructions
-TG_UPLOAD=false
-CHANNEL_ADDRESS=""
-
-# Settings for sending Gotify notifications
-# In case you decide to use it, please put valid config in the
-# URL and TOKEN fields
-# Check out README for instructions
-GOTIFY_NOTIFICATIONS=false
-GOTIFY_URL="https://push.example.com"
-GOTIFY_TOKEN=""
-
-# Settings for sending ntfy.sh notifications
-# In case you decide to use it, please put valid config in the
-# URL and TOPIC fields
-NTFY_NOTIFICATIONS=false
-NTFY_URL="https://ntfy.sh"
-NTFY_TOPIC=""
diff --git a/chosen_patches.txt b/chosen_patches.txt
deleted file mode 100644
index e7103e5..0000000
--- a/chosen_patches.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-# EXCLUDE PATCHES FROM BELOW. DO NOT REMOVE THIS LINE
-
-# INCLUDE PATCHES FROM BELOW. DO NOT REMOVE THIS LINE
diff --git a/example_configs/build_config b/example_configs/build_config
new file mode 100644
index 0000000..9e75d10
--- /dev/null
+++ b/example_configs/build_config
@@ -0,0 +1,51 @@
+# List all the applications to be built in their separate sections.
+# The version part is optional. If provided, automatic version determination
+# will be turned off. In that case, you're responsible for ensuring that the
+# version is present in APKPure.com
+
+[youtube_nonroot]
+build = true
+pretty_name = YouTube
+apk = com.google.android.youtube
+apkpure_appname = youtube
+root = false
+# Timestamp and extension will be added automatically
+output_name = YouTube_ReVanced_nonroot
+keystore = revanced-yt-nonroot.keystore
+# version = version
+
+[youtube_root]
+build = false
+pretty_name = YouTube (root)
+apk = com.google.android.youtube
+apkpure_appname = youtube
+root = true
+# Timestamp and extension will be added automatically
+output_name = YouTube_ReVanced_root
+keystore = revanced-yt-root.keystore
+# version = "version"
+
+[youtube_music]
+build = true
+pretty_name = YouTube Music
+apk = com.google.android.apps.youtube.music
+apkpure_appname = youtube-music
+root = false
+# Timestamp and extension will be added automatically
+output_name = YouTube_Music_ReVanced_nonroot
+keystore = revanced-ytm-nonroot.keystore
+version = 6.10.52
+
+[youtube_music_root]
+build = false
+pretty_name = YouTube Music (root)
+apk = com.google.android.apps.youtube.music
+apkpure_appname = youtube-music
+root = true
+# Timestamp and extension will be added automatically
+output_name = YouTube_Music_ReVanced_root
+keystore = revanced-ytm-root.keystore
+version = 6.10.52
+
+[post_script]
+# file = post_script.sh
diff --git a/example_configs/chosen_patches b/example_configs/chosen_patches
new file mode 100644
index 0000000..c247462
--- /dev/null
+++ b/example_configs/chosen_patches
@@ -0,0 +1,4 @@
+[patches]
+# Both have to be comma separated lists of patches
+included = []
+excluded = []
diff --git a/example_configs/notification_config b/example_configs/notification_config
new file mode 100644
index 0000000..3770d4a
--- /dev/null
+++ b/example_configs/notification_config
@@ -0,0 +1,25 @@
+[telegram]
+# Settings for sending Telegram notification using telegram.sh
+# In case you decide to use it, please put valid config in the
+# TOKEN and CHAT fields
+# Check out README for instructions
+# enabled = true
+# chat = url
+# token = token
+
+[gotify]
+# Settings for sending Gotify notifications
+# In case you decide to use it, please put valid config in the
+# URL and TOKEN fields
+# Check out README for instructions
+# enabled = true
+# URL = url
+# token = token
+
+[ntfy]
+# Settings for sending ntfy.sh notifications
+# In case you decide to use it, please put valid config in the
+# URL and TOPIC fields
+enabled = false
+url = url
+topic = topic
diff --git a/src/ReVancedBuilder/APKPure_dl.py b/src/ReVancedBuilder/APKPure_dl.py
index 598ed45..9be5545 100644
--- a/src/ReVancedBuilder/APKPure_dl.py
+++ b/src/ReVancedBuilder/APKPure_dl.py
@@ -88,7 +88,7 @@ def get_apks(appstate):
             pretty_name = build_config[app]['pretty_name']
             apkpure_appname = build_config[app]['apkpure_appname']
         except:
-            clean_exit(f"Invalid config for {app} in build_config.toml!", appstate)
+            clean_exit(f"Invalid config for {app} in build_config!", appstate)
 
         print(f"Checking {pretty_name}...")
         try:
diff --git a/src/ReVancedBuilder/JAVABuilder.py b/src/ReVancedBuilder/JAVABuilder.py
index f9a18bc..fd7531f 100644
--- a/src/ReVancedBuilder/JAVABuilder.py
+++ b/src/ReVancedBuilder/JAVABuilder.py
@@ -18,7 +18,7 @@ def build_apps(appstate):
     print = appstate['logger'].info
 
     chosen_patches = cp.ConfigParser()
-    chosen_patches.read('chosen_patches.toml')
+    chosen_patches.read('chosen_patches')
 
     try:
         included_patches = json.loads(chosen_patches['patches']['included'])
@@ -66,7 +66,7 @@ def build_apps(appstate):
             apkpure_appname = build_config[app]['apkpure_appname']
             output_name = build_config[app]['output_name']
         except:
-            clean_exit(f"Invalid config for {app} in build_config.toml!", appstate)
+            clean_exit(f"Invalid config for {app} in build_config!", appstate)
         
         cmd += f" -a {apk}.apk -o {output_name}.apk"
 
diff --git a/src/ReVancedBuilder/ReVancedBuilder.py b/src/ReVancedBuilder/ReVancedBuilder.py
index 868f1c2..6a90b71 100755
--- a/src/ReVancedBuilder/ReVancedBuilder.py
+++ b/src/ReVancedBuilder/ReVancedBuilder.py
@@ -135,12 +135,12 @@ print('----------------------------------------------------------------------')
 # Read configs
 try:
     appstate['build_config']=cp.ConfigParser()
-    appstate['build_config'].read_file(open('build_config.toml', 'r'))
+    appstate['build_config'].read_file(open('build_config', 'r'))
 except FileNotFoundError:
     clean_exit('No build config provided, exiting. Please look at the GitHub page for more information:\n  https://github.com/SinTan1729/ReVancedBuilder', appstate)
 
 appstate['notification_config'] = cp.ConfigParser()
-appstate['notification_config'].read('notification_config.toml')
+appstate['notification_config'].read('notification_config')
 
 # Pull the latest information using the ReVanced API
 try: