mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-25 05:50:21 +00:00
[90] schedule multiple alls
This commit is contained in:
parent
9013d8143a
commit
0eaba3dd2c
4 changed files with 36 additions and 21 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.16.5-develop89
|
||||
1.16.5-develop90
|
||||
|
|
|
@ -30,6 +30,7 @@ settings:
|
|||
asset_folders: true
|
||||
asset_depth: 0
|
||||
create_asset_folders: false
|
||||
prioritize_assets: false
|
||||
dimensional_asset_rename: false
|
||||
download_url_assets: false
|
||||
show_missing_season_assets: false
|
||||
|
@ -48,14 +49,16 @@ settings:
|
|||
show_options: false
|
||||
show_missing: true
|
||||
show_missing_assets: true
|
||||
save_missing: true
|
||||
save_report: false
|
||||
tvdb_language: eng
|
||||
ignore_ids:
|
||||
ignore_imdb_ids:
|
||||
item_refresh_delay: 0
|
||||
playlist_sync_to_user: all
|
||||
playlist_report: false
|
||||
verify_ssl: true
|
||||
custom_repo:
|
||||
check_nightly: false
|
||||
webhooks: # Can be individually specified per library as well
|
||||
error:
|
||||
version:
|
||||
|
|
|
@ -52,7 +52,9 @@ collections:
|
|||
TMDb Top Rated:
|
||||
tmdb_top_rated: 30
|
||||
sync_mode: sync
|
||||
schedule: monthly(1), monthly(15)
|
||||
schedule:
|
||||
- monthly(1)
|
||||
- monthly(15)
|
||||
```
|
||||
|
||||
Below is an example of a scheduled pinning collection:
|
||||
|
@ -67,7 +69,7 @@ collections:
|
|||
The scheduling options are:
|
||||
|
||||
| Name | Description | Format | Example |
|
||||
|:--------|:-----------------------------------------------------------------------------------------------------|:----------------------|:---------------------|
|
||||
|:--------|:-------------------------------------------------------------------------------------------------|:----------------------|:----------------------------------|
|
||||
| Hourly | Update only when the script is run in that hour | hourly(Hour of Day) | `hourly(17)` |
|
||||
| Daily | Update once a day | daily | `daily` |
|
||||
| Weekly | Update once a week on the specified day | weekly(Day of Week) | `weekly(sunday)` |
|
||||
|
@ -75,9 +77,9 @@ The scheduling options are:
|
|||
| Yearly | Update once a year on the specified day | yearly(MM/DD) | `yearly(01/30)` |
|
||||
| Range | Updates whenever the date is within the range | range(MM/DD-MM/DD) | `range(12/01-12/31)` |
|
||||
| Never | Never updates | never | `never` |
|
||||
| All | Requires that all scheduling option be meet in order to run<br>ex. `all, weekly(sunday), hourly(17)` | all | `all` |
|
||||
| All | Requires that all comma separated scheduling options inside its brackets be meet in order to run | all[Options] | `all[weekly(sunday), hourly(17)]` |
|
||||
|
||||
* `daily` is the default when `schedule` isn't specified.
|
||||
* You can run the script multiple times per day but using the `--time` command line argument detailed on the [Run Commands & Environmental Variables Page](../../home/environmental.md#time-to-run).
|
||||
* You can have multiple scheduling options just make them a list or comma-separated values.
|
||||
* You can have multiple scheduling options as a list.
|
||||
* You can use the `delete_not_scheduled` setting to delete Collections that are skipped due to not being scheduled.
|
|
@ -513,21 +513,31 @@ def check_day(_m, _d):
|
|||
else:
|
||||
return _m, _d
|
||||
|
||||
def schedule_check(attribute, data, current_time, run_hour):
|
||||
def schedule_check(attribute, data, current_time, run_hour, is_all=False):
|
||||
range_collection = False
|
||||
all_check = 0
|
||||
schedules_run = 0
|
||||
is_all = False
|
||||
next_month = current_time.replace(day=28) + timedelta(days=4)
|
||||
last_day = next_month - timedelta(days=next_month.day)
|
||||
schedule_str = ""
|
||||
if isinstance(data, str) and (("all" in data and not data.endswith("]")) or data.count("all") > 1):
|
||||
raise Failed("Schedule Error: each all schedule must be on its own line")
|
||||
elif isinstance(data, str) and "all" in data:
|
||||
data = [data]
|
||||
for schedule in get_list(data):
|
||||
run_time = str(schedule).lower()
|
||||
display = f"{attribute} attribute {schedule} invalid"
|
||||
schedules_run += 1
|
||||
if run_time == "all":
|
||||
is_all = True
|
||||
if run_time.startswith("all"):
|
||||
match = re.search("\\[([^\\]]+)\\]", run_time)
|
||||
if not match:
|
||||
logger.error(f"Schedule Error: failed to parse {attribute}: {schedule}")
|
||||
continue
|
||||
try:
|
||||
schedule_check(attribute, match.group(1), current_time, run_hour, is_all=True)
|
||||
all_check += 1
|
||||
except NotScheduled:
|
||||
continue
|
||||
elif run_time.startswith(("day", "daily")):
|
||||
all_check += 1
|
||||
elif run_time == "never":
|
||||
|
@ -598,7 +608,7 @@ def schedule_check(attribute, data, current_time, run_hour):
|
|||
all_check += 1
|
||||
else:
|
||||
logger.error(f"Schedule Error: {display}")
|
||||
if all_check == 0 or (is_all and schedules_run != all_check):
|
||||
if (all_check == 0 and not is_all) or (is_all and schedules_run != all_check):
|
||||
if range_collection:
|
||||
raise NotScheduledRange(schedule_str)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue