[17] add global timeout

This commit is contained in:
meisnate12 2022-08-01 16:26:10 -04:00
parent 1f4c1f8e35
commit c10460f757
4 changed files with 54 additions and 1 deletions

View file

@ -1 +1 @@
1.17.2-develop16
1.17.2-develop17

View file

@ -12,6 +12,7 @@ These docs are assuming you have a basic understanding of Docker concepts. One
| [Time to Run](#time-to-run) | `-t` or `--time` | `PMM_TIME` |
| [Run](#run) | `-r` or `--run` | `PMM_RUN` |
| [Run Tests](#run-tests) | `-rt`, `--tests`, or `--run-tests` | `PMM_TEST` |
| [Timeout](#timeout) | `-ti` or `--timeout` | `PMM_TIMEOUT` |
| [Collections Only](#collections-only) | `-co` or `--collections-only` | `PMM_COLLECTIONS_ONLY` |
| [Playlists Only](#playlists-only) | `-po` or `--playlists-only` | `PMM_PLAYLISTS_ONLY` |
| [Operations](#operations) | `-op` or `--operations` | `PMM_OPERATIONS` |
@ -211,6 +212,45 @@ docker run -it -v "X:\Media\Plex Meta Manager\config:/config:rw" meisnate12/plex
</details>
### Timeout
Change the main Plex Meta Manager timeout.
<table class="dualTable colwidths-auto align-default table">
<tr>
<th style="background-color: #222;"></th>
<th>Shell</th>
<th>Environment</th>
</tr>
<tr>
<th>Flags</th>
<td><code>-ti</code> or <code>--timeout</code></td>
<td><code>PMM_TIMEOUT</code></td>
</tr>
<tr>
<th>Example</th>
<td><code>--timeout 360</code></td>
<td><code>PMM_TIMEOUT=360</code></td>
</tr>
</table>
<details>
<summary>Local Environment</summary>
```shell
python plex_meta_manager.py ---timeout 360
```
</details>
<details>
<summary>Docker Environment</summary>
```shell
docker run -it -v "X:\Media\Plex Meta Manager\config:/config:rw" meisnate12/plex-meta-manager ---timeout 360
```
</details>
### Collections Only
Only run collection metadata/YAML files, skip library operations, overlays, and collections/metadata.
@ -221,6 +261,7 @@ Only run collection metadata/YAML files, skip library operations, overlays, and
<th>Shell</th>
<th>Environment</th>
</tr>
<tr>
<th>Flags</th>
<td><code>-co</code> or <code>--collections-only</code></td>

View file

@ -36,6 +36,7 @@ class MDbObj:
self.tomatoesaudience_rating = None
self.tmdb_rating = None
self.letterboxd_rating = None
self.myanimelist_rating = None
for rating in data["ratings"]:
if rating["source"] == "imdb":
self.imdb_rating = util.check_num(rating["value"], is_int=False)

View file

@ -22,6 +22,7 @@ parser.add_argument("-db", "--debug", dest="debug", help=argparse.SUPPRESS, acti
parser.add_argument("-tr", "--trace", dest="trace", help=argparse.SUPPRESS, action="store_true", default=False)
parser.add_argument("-c", "--config", dest="config", help="Run with desired *.yml file", type=str)
parser.add_argument("-t", "--time", "--times", dest="times", help="Times to update each day use format HH:MM (Default: 05:00) (comma-separated list)", default="05:00", type=str)
parser.add_argument("-ti", "--timeout", dest="timeout", help="PMM Global Timeout (Default: 180)", default=180, type=int)
parser.add_argument("-re", "--resume", dest="resume", help="Resume collection run from a specific collection", type=str)
parser.add_argument("-r", "--run", dest="run", help="Run without the scheduler", action="store_true", default=False)
parser.add_argument("-is", "--ignore-schedules", dest="ignore_schedules", help="Run ignoring collection schedules", action="store_true", default=False)
@ -89,6 +90,7 @@ no_missing = get_arg("PMM_NO_MISSING", args.no_missing, arg_bool=True)
read_only_config = get_arg("PMM_READ_ONLY_CONFIG", args.read_only_config, arg_bool=True)
divider = get_arg("PMM_DIVIDER", args.divider)
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)
@ -125,6 +127,15 @@ def my_except_hook(exctype, value, tb):
sys.excepthook = my_except_hook
old_send = requests.Session.send
def new_send(*send_args, **kwargs):
if kwargs.get("timeout", None) is None:
kwargs["timeout"] = timeout
return old_send(*send_args, **kwargs)
requests.Session.send = new_send
version = ("Unknown", "Unknown", 0)
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "VERSION")) as handle:
for line in handle.readlines():