Skip to content

Commit 0790c71

Browse files
committed
Version [0.2.0]
1 parent 661448d commit 0790c71

File tree

7 files changed

+54
-30
lines changed

7 files changed

+54
-30
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88

99

10+
## Version [0.2.0] - 2024-22-06
11+
12+
### Added
13+
14+
- Zurg: GITHUB_TOKEN environment variable to use for access to the private sponsored zurg repository
15+
16+
### Removed
17+
18+
- Zurg: PLEX_REFRESH environment variable
19+
- Zurg: PLEX_MOUNT environment variable
20+
21+
1022
## Version [0.1.0] - 2024-22-06
1123

1224
### Added

README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ services:
7474
- RD_API_KEY=
7575
## Zurg Optional Settings
7676
# - ZURG_LOG_LEVEL=DEBUG
77+
# - GITHUB_TOKEN= #Use with private Zurg repo
7778
# - ZURG_VERSION=v0.9.2-hotfix.4
7879
# - ZURG_UPDATE=true
7980
# - ZURG_USER=
@@ -180,14 +181,14 @@ To customize some properties of the container, the following environment
180181
variables can be passed via the `-e` parameter (one for each variable), or via the docker-compose file within the ```environment:``` section, or with a .env file saved to the config directory -- See the wiki for more info on using the [.env](https://github.com/I-am-PUID-0/DMB/wiki/Settings#use-of-env-file-for-setting-environment-variables). Value
181182
of this parameter has the format `<VARIABLE_NAME>=<VALUE>`.
182183

183-
| Variable | Description | Default | Required for rclone| Required for Riven| Required for zurg|
184+
| Variable | Description | Default | Used w/ rclone| Used w/ Riven| Used w/ zurg|
184185
|----------------|----------------------------------------------|---------|:-:|:-:|:-:|
185186
|`TZ`| [TimeZone](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones) used by the container | |
186187
|`RD_API_KEY`| [RealDebrid API key](https://real-debrid.com/apitoken) | | | :heavy_check_mark:| :heavy_check_mark:|
187188
|`AD_API_KEY`| [AllDebrid API key](https://alldebrid.com/apikeys/) | | | :heavy_check_mark:| :heavy_check_mark:|
188189
|`RCLONE_MOUNT_NAME`| A name for the rclone mount | | :heavy_check_mark:|
189-
|`RCLONE_LOG_LEVEL`| [Log level](https://rclone.org/docs/#log-level-level) for rclone | `NOTICE` |
190-
|`RCLONE_LOG_FILE`| [Log file](https://rclone.org/docs/#log-file-file) for rclone | |
190+
|`RCLONE_LOG_LEVEL`| [Log level](https://rclone.org/docs/#log-level-level) for rclone | `NOTICE` | :heavy_check_mark:|
191+
|`RCLONE_LOG_FILE`| [Log file](https://rclone.org/docs/#log-file-file) for rclone | | :heavy_check_mark: |
191192
|`RCLONE_DIR_CACHE_TIME`| [How long a directory should be considered up to date and not refreshed from the backend](https://rclone.org/commands/rclone_mount/#vfs-directory-cache) #optional, but recommended is 10s. | `5m` |
192193
|`RCLONE_CACHE_DIR`| [Directory used for caching](https://rclone.org/docs/#cache-dir-dir). | |
193194
|`RCLONE_VFS_CACHE_MODE`| [Cache mode for VFS](https://rclone.org/commands/rclone_mount/#vfs-file-caching) | |
@@ -196,8 +197,8 @@ of this parameter has the format `<VARIABLE_NAME>=<VALUE>`.
196197
|`PLEX_USER`| The [Plex Username](https://app.plex.tv/desktop/#!/settings/account) for your account | || :heavy_check_mark:|
197198
|`PLEX_TOKEN`| The [Plex Token](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/) associated with PLEX_USER | || :heavy_check_mark:|
198199
|`PLEX_ADDRESS`| The URL of your Plex server. Example: http://192.168.0.100:32400 or http://plex:32400 - format must include ```http://``` or ```https://``` and have no trailing characters after the port number (32400). E.g., ```/``` ||| :heavy_check_mark:|
199-
|`SHOW_MENU`| Enable the Riven menu to show upon startup, requiring user interaction before the program runs. Conversely, if the Riven menu is disabled, the program will automatically run upon successful startup. If used, the value must be ```true``` or ```false``` | `true` |
200200
|`RIVEN_ENABLED`| Set the value "true" to enable the Riven process | `false ` | | :heavy_check_mark: | |
201+
|`RIVEN_BRANCH`| Set the value to the appropriate branch | `main` | | :heavy_check_mark: | |
201202
|`RIVEN_LOGFILE`| Log file for Riven. The log file will appear in the ```/config``` as ```Riven.log```. If used, the value must be ```true``` or ```false``` | `false` |
202203
|`RIVEN_UPDATE`| Enable automatic updates of Riven. Adding this variable will enable automatic updates to the latest version of Riven locally within the container.| `false` |
203204
|`AUTO_UPDATE_INTERVAL`| Interval between automatic update checks in hours. Vaules can be any positive [whole](https://www.oxfordlearnersdictionaries.com/us/definition/english/whole-number) or [decimal](https://www.oxfordreference.com/display/10.1093/oi/authority.20110803095705740;jsessionid=3FDC96CC0D79CCE69702661D025B9E9B#:~:text=The%20separator%20used%20between%20the,number%20expressed%20in%20decimal%20representation.) point based number. Ex. a value of .5 would yield thirty minutes, and 1.5 would yield one and a half hours | `24` |
@@ -206,7 +207,8 @@ of this parameter has the format `<VARIABLE_NAME>=<VALUE>`.
206207
|`PDZURG_LOG_LEVEL`| The level at which logs should be captured. See the python [Logging Levels](https://docs.python.org/3/library/logging.html#logging-levels) documentation for more details | `INFO` |
207208
|`PDZURG_LOG_COUNT`| The number logs to retain. Result will be value + current log | `2` |
208209
|`ZURG_ENABLED`| Set the value "true" to enable the Zurg process | `false ` | | | :heavy_check_mark:|
209-
|`ZURG_VERSION`| The version of Zurg to use. If enabled, the value should contain v0.9.x or v0.9.x-hotfix.x format | `latest` | | | |
210+
|`GITHUB_TOKEN`| GitHub Personal Token for use with Zurg private repo | `false ` | | | :heavy_check_mark:|
211+
|`ZURG_VERSION`| The version of Zurg to use. If enabled, the value should contain v0.9.x or v0.9.x-hotfix.x format | `latest` | | | :heavy_check_mark: |
210212
|`ZURG_UPDATE`| Enable automatic updates of Zurg. Adding this variable will enable automatic updates to the latest version of Zurg locally within the container. | `false` | | | |
211213
|`ZURG_LOG_LEVEL`| Set the log level for Zurg | `INFO` | | | |
212214
|`JF_API_KEY`| The Jellyfin/Emby API Key ||| ||
@@ -238,8 +240,9 @@ format: `<HOST_DIR>:<CONTAINER_DIR>[:PERMISSIONS]`.
238240

239241
DMB supports the use of docker secrets for the following environment variables:
240242

241-
| Variable | Description | Default | Required for rclone| Required for Riven| Required for zurg|
243+
| Variable | Description | Default | Used w/ rclone| Used w/ Riven| Used w/ zurg|
242244
|----------------|----------------------------------------------|---------|:-:|:-:|:-:|
245+
|`GITHUB_TOKEN_`| [GitHub Personal Token](https://github.com/settings/tokens) | ` ` | | | :heavy_check_mark:|
243246
|`RD_API_KEY`| [RealDebrid API key](https://real-debrid.com/apitoken) | ` ` | | :heavy_check_mark:| :heavy_check_mark:|
244247
|`AD_API_KEY`| [AllDebrid API key](https://alldebrid.com/apikeys/) | ` ` | | :heavy_check_mark:| :heavy_check_mark:|
245248
|`PLEX_USER`| The [Plex USERNAME](https://app.plex.tv/desktop/#!/settings/account) for your account | ` ` || :heavy_check_mark:|
@@ -258,6 +261,7 @@ services:
258261
DMB:
259262
image: iampuid0/DMB:latest
260263
secrets:
264+
- github_token
261265
- rd_api_key
262266
- ad_api_key
263267
- plex_user
@@ -269,6 +273,8 @@ services:
269273
- seerr_address
270274

271275
secrets:
276+
github_token:
277+
file: ./path/to/github_token.txt
272278
rd_api_key:
273279
file: ./path/to/rd_api_key.txt
274280
ad_api_key:

base/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ def load_secret_or_env(secret_name, default=None):
257257
PLEXADD = load_secret_or_env('plex_address')
258258
ZURGUSER = load_secret_or_env('zurg_user')
259259
ZURGPASS = load_secret_or_env('zurg_pass')
260+
GHTOKEN = load_secret_or_env('GITHUB_TOKEN')
260261
SHOWMENU = os.getenv('SHOW_MENU')
261262
LOGFILE = os.getenv('PD_LOGFILE')
262263
DUPECLEAN = os.getenv('DUPLICATE_CLEANUP')
@@ -266,8 +267,6 @@ def load_secret_or_env(secret_name, default=None):
266267
ZURGVERSION = os.getenv("ZURG_VERSION")
267268
ZURGLOGLEVEL = os.getenv("ZURG_LOG_LEVEL")
268269
ZURGUPDATE = os.getenv('ZURG_UPDATE')
269-
PLEXREFRESH = os.getenv('PLEX_REFRESH')
270-
PLEXMOUNT = os.getenv('PLEX_MOUNT_DIR')
271270
NFSMOUNT = os.getenv('NFS_ENABLED')
272271
NFSPORT = os.getenv('NFS_PORT')
273272
ZURGPORT = os.getenv('ZURG_PORT')

main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
def main():
1010
logger = get_logger()
1111

12-
version = '0.1.0'
12+
version = '0.2.0'
1313

1414
ascii_art = f'''
1515

zurg/download.py

+22-6
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ def parse_custom_version(version_str):
5050
def get_latest_release(repo_owner, repo_name):
5151
try:
5252
logger.info("Fetching latest Zurg release.")
53+
headers = {}
54+
if GHTOKEN:
55+
headers['Authorization'] = f'token {GHTOKEN}'
5356
api_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/releases/latest"
54-
response = requests.get(api_url, timeout=10)
57+
response = requests.get(api_url, headers=headers, timeout=10)
5558
if response.status_code != 200:
5659
logger.error("Unable to access the repository API. Status code: %s", response.status_code)
5760
return None, "Error: Unable to access the repository API."
@@ -90,21 +93,28 @@ def get_architecture():
9093

9194
def download_and_unzip_release(repo_owner, repo_name, release_version, architecture):
9295
try:
96+
headers = {}
97+
if GHTOKEN:
98+
headers['Authorization'] = f'token {GHTOKEN}'
9399
api_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/releases/tags/{release_version}"
94-
response = requests.get(api_url, timeout=10)
100+
response = requests.get(api_url, headers=headers, timeout=10)
95101
if response.status_code != 200:
96102
logger.error("Failed to get release assets. Status code: %s", response.status_code)
97103
return False
98104
assets = response.json().get('assets', [])
99105
download_url = ""
106+
asset_id = None
100107
for asset in assets:
101108
if architecture in asset['name']:
102109
download_url = asset['browser_download_url']
110+
asset_id = asset['id']
103111
break
104-
if not download_url:
112+
if not asset_id:
105113
logger.error("No matching asset found for architecture: %s", architecture)
106114
return False
107-
response = requests.get(download_url, timeout=10)
115+
download_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/releases/assets/{asset_id}"
116+
headers['Accept'] = 'application/octet-stream'
117+
response = requests.get(download_url, headers=headers, timeout=10)
108118
logger.debug("Downloading from URL: %s", download_url)
109119
if response.status_code == 200:
110120
zip_file = zipfile.ZipFile(io.BytesIO(response.content))
@@ -124,12 +134,18 @@ def download_and_unzip_release(repo_owner, repo_name, release_version, architect
124134
logger.error(f"Error in download and extraction: {e}")
125135
return False
126136

137+
138+
127139
def version_check():
128140
try:
129141
architecture = get_architecture()
130142
os.environ['CURRENT_ARCHITECTURE'] = architecture
131-
repo_owner = 'debridmediamanager'
132-
repo_name = 'zurg-testing'
143+
if GHTOKEN:
144+
repo_owner = 'debridmediamanager'
145+
repo_name = 'zurg'
146+
else:
147+
repo_owner = 'debridmediamanager'
148+
repo_name = 'zurg-testing'
133149

134150
if ZURGVERSION:
135151
release_version = ZURGVERSION if ZURGVERSION.startswith('v') else 'v' + ZURGVERSION

zurg/setup.py

-13
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,6 @@ def setup_zurg_instance(config_dir, token, key_type):
143143
update_creds(config_file_path, ZURGUSER, ZURGPASS)
144144
os.environ[f'ZURG_PORT_{key_type}'] = str(port)
145145
logger.debug(f"Zurg w/ {key_type} instance configured to port: {port}")
146-
if PLEXREFRESH is not None and PLEXREFRESH.lower() == "true":
147-
if PLEXADD and PLEXTOKEN and PLEXMOUNT:
148-
plex_refresh(config_file_path)
149-
if not os.path.exists(refresh_file_path):
150-
logger.debug(f"Copying Plex Refresh script from base: /zurg/plex_refresh.py to {refresh_file_path}")
151-
shutil.copy('/zurg/plex_refresh.py', refresh_file_path)
152-
else:
153-
if not PLEXTOKEN:
154-
raise Exception("PLEX_TOKEN is required for Plex Refresh")
155-
if not PLEXADD:
156-
raise Exception("PLEX_ADDRESS is required for Plex Refresh")
157-
if not PLEXMOUNT:
158-
raise Exception("PLEX_MOUNT_DIR is required for Plex Refresh")
159146
except Exception as e:
160147
raise Exception(f"Error setting up Zurg instance for {key_type}: {e}")
161148

zurg/update.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ def start_process(self, process_name, config_dir=None):
3737

3838
def update_check(self):
3939
try:
40-
repo_owner = 'debridmediamanager'
41-
repo_name = 'zurg-testing'
40+
if GHTOKEN:
41+
repo_owner = 'debridmediamanager'
42+
repo_name = 'zurg'
43+
else:
44+
repo_owner = 'debridmediamanager'
45+
repo_name = 'zurg-testing'
4246

4347
if ZURGVERSION:
4448
self.logger.info(f"ZURG_VERSION is set to: {ZURGVERSION}. Automatic updates will not be applied!")

0 commit comments

Comments
 (0)