[67] add url to ENV var

pull/1237/head
meisnate12 2 years ago
parent c0e1913a88
commit aba08397f4

@ -1 +1 @@
1.18.0-develop66
1.18.0-develop67

@ -16,9 +16,9 @@ plex:
```
| Attribute | Allowed Values | Default | Required |
|:----------------|:-----------------------------------------------------------------------|:--------|:--------:|
| `url` | Plex Server URL<br><strong>Example:</strong> http://192.168.1.12:32400 | N/A | &#9989; |
| `token` | Plex Server Authentication Token | N/A | &#9989; |
|:----------------|:---------------------------------------------------------------------------------------------------------------------------------|:--------|:--------:|
| `url` | Plex Server URL or `ENV` (This will use the Environment/Runtime Plex URL)<br><strong>Example:</strong> http://192.168.1.12:32400 | N/A | &#9989; |
| `token` | Plex Server Authentication Token or `ENV` (This will use the Environment/Runtime Plex URL) | N/A | &#9989; |
| `timeout` | Plex Server Timeout | 60 | &#10060; |
| `clean_bundles` | Runs Clean Bundles on the Server after all Metadata Files are run | false | &#10060; |
| `empty_trash` | Runs Empty Trash on the Server after all Metadata Files are run | false | &#10060; |

@ -33,6 +33,8 @@ These docs are assuming you have a basic understanding of Docker concepts. One
| [No Missing](#no-missing) | `-nm` or `--no-missing` | `PMM_NO_MISSING` |
| [No Report](#no-report) | `-nr` or `--no-report` | `PMM_NO_REPORT` |
| [Read Only Config](#read-only-config) | `-ro` or `--read-only-config` | `PMM_READ_ONLY_CONFIG` |
| [ENV Plex URL](#env-plex-url--token) | `-pu` or `--plex-url` | `PMM_PLEX_URL` |
| [ENV Plex Token](#env-plex-url--token) | `-pt` or `--plex-token` | `PMM_PLEX_TOKEN` |
| [Divider Character](#divider-character--screen-width) | `-d` or `--divider` | `PMM_DIVIDER` |
| [Screen Width](#divider-character--screen-width) | `-w` or `--width` | `PMM_WIDTH` |
@ -905,6 +907,62 @@ docker run -it -v "X:\Media\Plex Meta Manager\config:/config:rw" meisnate12/plex
```
````
### ENV Plex URL & Token
Replaces `ENV` when it is used plex `url` or `token`.
#### Plex URL
<table class="dualTable colwidths-auto align-default table">
<tr>
<th style="background-color: #1d1d1d;"></th>
<th>Shell</th>
<th>Environment</th>
</tr>
<tr>
<th>Flags</th>
<td><code>-pu</code> or <code>--plex-url</code></td>
<td><code>PMM_PLEX_URL</code></td>
</tr>
<tr>
<th>Example</th>
<td><code>--plex-url 192.168.1.12:32400</code></td>
<td><code>PMM_PLEX_URL=192.168.1.12:32400</code></td>
</tr>
</table>
#### Plex Token
<table class="dualTable colwidths-auto align-default table">
<tr>
<th style="background-color: #1d1d1d;"></th>
<th>Shell</th>
<th>Environment</th>
</tr>
<tr>
<th>Flags</th>
<td><code>-pt</code> or <code>--plex-token</code></td>
<td><code>PMM_PLEX_TOKEN</code></td>
</tr>
<tr>
<th>Example</th>
<td><code>--plex-token AB23HE4588</code></td>
<td><code>PMM_PLEX_TOKEN=AB23HE4588</code></td>
</tr>
</table>
````{tab} Local Environment
```
python plex_meta_manager.py --plex-url 192.168.1.12:32400 --plex-token AB23HE4588
```
````
````{tab} Docker Environment
```
docker run -it -v "X:\Media\Plex Meta Manager\config:/config:rw" meisnate12/plex-meta-manager --plex-url 192.168.1.12:32400 --plex-token AB23HE4588
```
````
### Divider Character & Screen Width
Change the terminal output divider character or width.

@ -125,6 +125,8 @@ class ConfigFile:
self.collection_only = attrs["collection_only"] if "collection_only" in attrs else False
self.operations_only = attrs["operations_only"] if "operations_only" in attrs else False
self.overlays_only = attrs["overlays_only"] if "overlays_only" in attrs else False
self.env_plex_url = attrs["plex_url"] if "plex_url" in attrs else ""
self.env_plex_token = attrs["plex_token"] if "plex_token" in attrs else ""
current_time = datetime.now()
with open(self.config_path, encoding="utf-8") as fp:
@ -854,6 +856,10 @@ class ConfigFile:
"empty_trash": check_for_attribute(lib, "empty_trash", parent="plex", var_type="bool", default=self.general["plex"]["empty_trash"], save=False),
"optimize": check_for_attribute(lib, "optimize", parent="plex", var_type="bool", default=self.general["plex"]["optimize"], save=False)
}
if params["plex"]["url"].lower() == "env":
params["plex"]["url"] = self.env_plex_url
if params["plex"]["token"].lower() == "env":
params["plex"]["token"] = self.env_plex_token
library = Plex(self, params)
logger.info("")
logger.info(f"{display_name} Library Connection Successful")

@ -43,6 +43,8 @@ parser.add_argument("-nc", "--no-countdown", dest="no_countdown", help="Run with
parser.add_argument("-nm", "--no-missing", dest="no_missing", help="Run without running the missing section", action="store_true", default=False)
parser.add_argument("-nr", "--no-report", dest="no_report", help="Run without saving a report", action="store_true", default=False)
parser.add_argument("-ro", "--read-only-config", dest="read_only_config", help="Run without writing to the config", action="store_true", default=False)
parser.add_argument("-pu", "--plex-url", dest="plex_url", help="Plex URL for Plex ENV URLs", default="", type=str)
parser.add_argument("-pt", "--plex-token", dest="plex_token", help="Plex Token for Plex ENV Tokens", default="", type=str)
parser.add_argument("-d", "--divider", dest="divider", help="Character that divides the sections (Default: '=')", default="=", type=str)
parser.add_argument("-w", "--width", dest="width", help="Screen Width (Default: 100)", default=100, type=int)
args = parser.parse_args()
@ -100,6 +102,8 @@ screen_width = get_arg("PMM_WIDTH", args.width, arg_int=True)
timeout = get_arg("PMM_TIMEOUT", args.timeout, arg_int=True)
debug = get_arg("PMM_DEBUG", args.debug, arg_bool=True)
trace = get_arg("PMM_TRACE", args.trace, arg_bool=True)
plex_url = get_arg("PMM_PLEX_URL", args.plex_url)
plex_token = get_arg("PMM_PLEX_TOKEN", args.plex_token)
if collections:
collection_only = True
@ -207,6 +211,8 @@ def start(attrs):
attrs["playlist_only"] = playlist_only
attrs["operations_only"] = operations_only
attrs["overlays_only"] = overlays_only
attrs["plex_url"] = plex_url
attrs["plex_token"] = plex_token
logger.separator(debug=True)
logger.debug(f"Run Command: {run_arg}")
logger.debug(f"--config (PMM_CONFIG): {config_file}")
@ -231,6 +237,8 @@ def start(attrs):
logger.debug(f"--no-missing (PMM_NO_MISSING): {no_missing}")
logger.debug(f"--no-report (PMM_NO_REPORT): {no_report}")
logger.debug(f"--read-only-config (PMM_READ_ONLY_CONFIG): {read_only_config}")
logger.debug(f"--plex-url (PMM_PLEX_URL): {plex_url}")
logger.debug(f"--plex-token (PMM_PLEX_TOKEN): {plex_token}")
logger.debug(f"--divider (PMM_DIVIDER): {divider}")
logger.debug(f"--width (PMM_WIDTH): {screen_width}")
logger.debug(f"--debug (PMM_DEBUG): {debug}")

Loading…
Cancel
Save