Initial no-report

pull/1130/head
James Hu 2 years ago
parent 03c4971e96
commit be62be7579

@ -28,6 +28,7 @@ These docs are assuming you have a basic understanding of Docker concepts. One
| [Resume Run](#resume-run) | `-re` or `--resume` | `PMM_RESUME` | | [Resume Run](#resume-run) | `-re` or `--resume` | `PMM_RESUME` |
| [No Countdown](#no-countdown) | `-nc` or `--no-countdown` | `PMM_NO_COUNTDOWN` | | [No Countdown](#no-countdown) | `-nc` or `--no-countdown` | `PMM_NO_COUNTDOWN` |
| [No Missing](#no-missing) | `-nm` or `--no-missing` | `PMM_NO_MISSING` | | [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` | | [Read Only Config](#read-only-config) | `-ro` or `--read-only-config` | `PMM_READ_ONLY_CONFIG` |
| [Divider Character](#divider-character--screen-width) | `-d` or `--divider` | `PMM_DIVIDER` | | [Divider Character](#divider-character--screen-width) | `-d` or `--divider` | `PMM_DIVIDER` |
| [Screen Width](#divider-character--screen-width) | `-w` or `--width` | `PMM_WIDTH` | | [Screen Width](#divider-character--screen-width) | `-w` or `--width` | `PMM_WIDTH` |
@ -854,6 +855,45 @@ docker run -it -v "X:\Media\Plex Meta Manager\config:/config:rw" meisnate12/plex
</details> </details>
### No Report
Run without saving report.
<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>-nr</code> or <code>--no-report</code></td>
<td><code>PMM_NO_REPORT</code></td>
</tr>
<tr>
<th>Example</th>
<td><code>--no-report</code></td>
<td><code>PMM_NO_REPORT=true</code></td>
</tr>
</table>
<details>
<summary>Local Environment</summary>
```shell
python plex_meta_manager.py --no-report
```
</details>
<details>
<summary>Docker Environment</summary>
```shell
docker run -it -v "X:\Media\Plex Meta Manager\config:/config:rw" meisnate12/plex-meta-manager --no-report
```
</details>
### Read Only Config ### Read Only Config
Run without writing to the configuration file Run without writing to the configuration file

@ -792,7 +792,8 @@ class CollectionBuilder:
if self.smart_url: if self.smart_url:
self.sync = False self.sync = False
self.do_missing = not self.config.no_missing and (self.details["show_missing"] or self.details["save_report"] self.do_report = not self.config.no_report and (self.details["save_report"])
self.do_missing = not self.config.no_missing and (self.details["show_missing"] or self.do_report
or (self.library.Radarr and self.radarr_details["add_missing"]) or (self.library.Radarr and self.radarr_details["add_missing"])
or (self.library.Sonarr and self.sonarr_details["add_missing"])) or (self.library.Sonarr and self.sonarr_details["add_missing"]))
if self.build_collection: if self.build_collection:
@ -1790,7 +1791,7 @@ class CollectionBuilder:
self.filtered_keys[item.ratingKey] = current_title self.filtered_keys[item.ratingKey] = current_title
if self.details["show_filtered"] is True: if self.details["show_filtered"] is True:
logger.info(f"{name} {self.Type} | X | {current_title}") logger.info(f"{name} {self.Type} | X | {current_title}")
if self.details["save_report"] is True and filtered_items: if self.do_report and filtered_items:
self.library.add_filtered(self.name, [(i.title, self.library.get_id_from_maps(i.ratingKey)) for i in filtered_items], self.library.is_movie) self.library.add_filtered(self.name, [(i.title, self.library.get_id_from_maps(i.ratingKey)) for i in filtered_items], self.library.is_movie)
def build_filter(self, method, plex_filter, display=False, default_sort=None): def build_filter(self, method, plex_filter, display=False, default_sort=None):
@ -2186,7 +2187,7 @@ class CollectionBuilder:
logger.info(f"Playlist: {self.name} created") logger.info(f"Playlist: {self.name} created")
elif self.playlist and items_added: elif self.playlist and items_added:
self.obj.addItems(items_added) self.obj.addItems(items_added)
if self.details["save_report"] is True and items_added: if self.do_report and items_added:
self.library.add_additions(self.name, [(i.title, self.library.get_id_from_maps(i.ratingKey)) for i in items_added], self.library.is_movie) self.library.add_additions(self.name, [(i.title, self.library.get_id_from_maps(i.ratingKey)) for i in items_added], self.library.is_movie)
logger.exorcise() logger.exorcise()
logger.info("") logger.info("")
@ -2216,7 +2217,7 @@ class CollectionBuilder:
if self.playlist and items_removed: if self.playlist and items_removed:
self.obj.reload() self.obj.reload()
self.obj.removeItems(items_removed) self.obj.removeItems(items_removed)
if self.details["save_report"] is True and items_removed: if self.do_report and items_removed:
self.library.add_removed(self.name, [(i.title, self.library.get_id_from_maps(i.ratingKey)) for i in items_removed], self.library.is_movie) self.library.add_removed(self.name, [(i.title, self.library.get_id_from_maps(i.ratingKey)) for i in items_removed], self.library.is_movie)
logger.info("") logger.info("")
logger.info(f"{amount_removed} {self.builder_level.capitalize()}{'s' if amount_removed == 1 else ''} Removed") logger.info(f"{amount_removed} {self.builder_level.capitalize()}{'s' if amount_removed == 1 else ''} Removed")
@ -2366,7 +2367,7 @@ class CollectionBuilder:
logger.info("") logger.info("")
logger.info(f"{len(missing_movies_with_names)} Movie{'s' if len(missing_movies_with_names) > 1 else ''} Missing") logger.info(f"{len(missing_movies_with_names)} Movie{'s' if len(missing_movies_with_names) > 1 else ''} Missing")
if len(missing_movies_with_names) > 0: if len(missing_movies_with_names) > 0:
if self.details["save_report"] is True: if self.do_report:
self.library.add_missing(self.name, missing_movies_with_names, True) self.library.add_missing(self.name, missing_movies_with_names, True)
if self.run_again or (self.library.Radarr and (self.radarr_details["add_missing"] or "item_radarr_tag" in self.item_details)): if self.run_again or (self.library.Radarr and (self.radarr_details["add_missing"] or "item_radarr_tag" in self.item_details)):
missing_tmdb_ids = [missing_id for title, missing_id in missing_movies_with_names] missing_tmdb_ids = [missing_id for title, missing_id in missing_movies_with_names]
@ -2385,7 +2386,7 @@ class CollectionBuilder:
logger.error(e) logger.error(e)
if self.run_again: if self.run_again:
self.run_again_movies.extend(missing_tmdb_ids) self.run_again_movies.extend(missing_tmdb_ids)
if len(filtered_movies_with_names) > 0 and self.details["save_report"] is True: if len(filtered_movies_with_names) > 0 and self.do_report:
self.library.add_filtered(self.name, filtered_movies_with_names, True) self.library.add_filtered(self.name, filtered_movies_with_names, True)
if len(self.missing_shows) > 0 and self.library.is_show: if len(self.missing_shows) > 0 and self.library.is_show:
if self.details["show_missing"] is True: if self.details["show_missing"] is True:
@ -2411,7 +2412,7 @@ class CollectionBuilder:
logger.info("") logger.info("")
logger.info(f"{len(missing_shows_with_names)} Show{'s' if len(missing_shows_with_names) > 1 else ''} Missing") logger.info(f"{len(missing_shows_with_names)} Show{'s' if len(missing_shows_with_names) > 1 else ''} Missing")
if len(missing_shows_with_names) > 0: if len(missing_shows_with_names) > 0:
if self.details["save_report"] is True: if self.do_report:
self.library.add_missing(self.name, missing_shows_with_names, False) self.library.add_missing(self.name, missing_shows_with_names, False)
if self.run_again or (self.library.Sonarr and (self.sonarr_details["add_missing"] or "item_sonarr_tag" in self.item_details)): if self.run_again or (self.library.Sonarr and (self.sonarr_details["add_missing"] or "item_sonarr_tag" in self.item_details)):
missing_tvdb_ids = [missing_id for title, missing_id in missing_shows_with_names] missing_tvdb_ids = [missing_id for title, missing_id in missing_shows_with_names]
@ -2430,13 +2431,13 @@ class CollectionBuilder:
logger.error(e) logger.error(e)
if self.run_again: if self.run_again:
self.run_again_shows.extend(missing_tvdb_ids) self.run_again_shows.extend(missing_tvdb_ids)
if len(filtered_shows_with_names) > 0 and self.details["save_report"] is True: if len(filtered_shows_with_names) > 0 and self.do_report:
self.library.add_filtered(self.name, filtered_shows_with_names, False) self.library.add_filtered(self.name, filtered_shows_with_names, False)
if len(self.missing_parts) > 0 and self.library.is_show: if len(self.missing_parts) > 0 and self.library.is_show:
if self.details["show_missing"] is True: if self.details["show_missing"] is True:
for missing in self.missing_parts: for missing in self.missing_parts:
logger.info(f"{self.name} {self.Type} | ? | {missing}") logger.info(f"{self.name} {self.Type} | ? | {missing}")
if self.details["save_report"] is True: if self.do_report:
self.library.add_missing(self.name, self.missing_parts, False) self.library.add_missing(self.name, self.missing_parts, False)
return added_to_radarr, added_to_sonarr return added_to_radarr, added_to_sonarr

@ -99,6 +99,7 @@ class ConfigFile:
self.read_only = attrs["read_only"] if "read_only" in attrs else False self.read_only = attrs["read_only"] if "read_only" in attrs else False
self.version = attrs["version"] if "version" in attrs else None self.version = attrs["version"] if "version" in attrs else None
self.no_missing = attrs["no_missing"] if "no_missing" in attrs else None self.no_missing = attrs["no_missing"] if "no_missing" in attrs else None
self.no_report = attrs["no_report"] if "no_report" in attrs else None
self.test_mode = attrs["test"] if "test" in attrs else False self.test_mode = attrs["test"] if "test" in attrs else False
self.trace_mode = attrs["trace"] if "trace" in attrs else False self.trace_mode = attrs["trace"] if "trace" in attrs else False
self.delete_collections = attrs["delete"] if "delete" in attrs else False self.delete_collections = attrs["delete"] if "delete" in attrs else False

@ -40,6 +40,7 @@ parser.add_argument("-ca", "--cache-library", "--cache-libraries", dest="cache_l
parser.add_argument("-dc", "--delete", "--delete-collections", dest="delete", help="Deletes all Collections in the Plex Library before running", action="store_true", default=False) parser.add_argument("-dc", "--delete", "--delete-collections", dest="delete", help="Deletes all Collections in the Plex Library before running", action="store_true", default=False)
parser.add_argument("-nc", "--no-countdown", dest="no_countdown", help="Run without displaying the countdown", action="store_true", default=False) parser.add_argument("-nc", "--no-countdown", dest="no_countdown", help="Run without displaying the countdown", action="store_true", default=False)
parser.add_argument("-nm", "--no-missing", dest="no_missing", help="Run without running the missing section", action="store_true", default=False) 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("-ro", "--read-only-config", dest="read_only_config", help="Run without writing to the config", action="store_true", default=False)
parser.add_argument("-d", "--divider", dest="divider", help="Character that divides the sections (Default: '=')", 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) parser.add_argument("-w", "--width", dest="width", help="Screen Width (Default: 100)", default=100, type=int)
@ -87,6 +88,7 @@ delete = get_arg("PMM_DELETE_COLLECTIONS", args.delete, arg_bool=True)
resume = get_arg("PMM_RESUME", args.resume) resume = get_arg("PMM_RESUME", args.resume)
no_countdown = get_arg("PMM_NO_COUNTDOWN", args.no_countdown, arg_bool=True) no_countdown = get_arg("PMM_NO_COUNTDOWN", args.no_countdown, arg_bool=True)
no_missing = get_arg("PMM_NO_MISSING", args.no_missing, arg_bool=True) no_missing = get_arg("PMM_NO_MISSING", args.no_missing, arg_bool=True)
no_report = get_arg("PMM_NO_REPORT", args.no_report, arg_bool=True)
read_only_config = get_arg("PMM_READ_ONLY_CONFIG", args.read_only_config, 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) divider = get_arg("PMM_DIVIDER", args.divider)
screen_width = get_arg("PMM_WIDTH", args.width, arg_int=True) screen_width = get_arg("PMM_WIDTH", args.width, arg_int=True)
@ -192,6 +194,7 @@ def start(attrs):
attrs["read_only"] = read_only_config attrs["read_only"] = read_only_config
attrs["version"] = version attrs["version"] = version
attrs["no_missing"] = no_missing attrs["no_missing"] = no_missing
attrs["no_report"] = no_report
attrs["collection_only"] = collection_only attrs["collection_only"] = collection_only
attrs["playlist_only"] = playlist_only attrs["playlist_only"] = playlist_only
attrs["operations_only"] = operations_only attrs["operations_only"] = operations_only
@ -216,6 +219,7 @@ def start(attrs):
logger.debug(f"--resume (PMM_RESUME): {resume}") logger.debug(f"--resume (PMM_RESUME): {resume}")
logger.debug(f"--no-countdown (PMM_NO_COUNTDOWN): {no_countdown}") logger.debug(f"--no-countdown (PMM_NO_COUNTDOWN): {no_countdown}")
logger.debug(f"--no-missing (PMM_NO_MISSING): {no_missing}") 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"--read-only-config (PMM_READ_ONLY_CONFIG): {read_only_config}")
logger.debug(f"--divider (PMM_DIVIDER): {divider}") logger.debug(f"--divider (PMM_DIVIDER): {divider}")
logger.debug(f"--width (PMM_WIDTH): {screen_width}") logger.debug(f"--width (PMM_WIDTH): {screen_width}")

Loading…
Cancel
Save