You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Rewrite nearly the whole thing for better parsing, support, readability, etc. (OOP forever!)
- Consolidate Plex API config with schedules, now in config.yaml
- Changes to schema for schedules
- No more priority of, e.g. date_range over monthly
- No more default
- `misc` reworked to `always`
- Update Docker files
- Update README
- Delete old files, linting stuff (screw mypy)
RUN pip3 install --no-cache-dir -r requirements.txt
14
14
15
-
# Make Docker /config volume for optional config file
16
-
VOLUME /config
17
-
18
-
# Copy logging.conf file from build machine to Docker /config folder
19
-
COPY logging.conf /config/
20
-
21
-
# Copy example config file from build machine to Docker /config folder
22
-
# Also copies any existing config.ini file from build machine to Docker /config folder, (will cause the bot to use the existing config file if it exists)
23
-
COPY config.ini* /config/
24
-
25
-
# Copy example schedule file from build machine to Docker /config folder
26
-
# Also copies any existing schedules.yaml file from build machine to Docker /config folder, (will cause the bot to use the existing schedule file if it exists)
27
-
COPY schedules.yaml* /config/
15
+
# Copy config file from build machine to Docker /config folder
1.**misc**: Items listed in `always_use` will always be included (appended) to the preroll list
123
-
- If you have a large set of prerolls, you can provide all paths and use `random_count` to randomly select a smaller subset of the list to use on each run.
113
+
Any entry whose schedule falls within the current date/time at the time of execution will be added to the preroll.
124
114
125
-
2.**date_range**: Schedule based on a specific date/time range
115
+
You can define as many schedules as you want, in the following categories (order does not matter):
126
116
127
-
3.**weekly**: Schedule based on a specific week of the year
117
+
1.**always**: Items listed here will always be included (appended) to the preroll list
118
+
- If you have a large set of prerolls, you can provide all paths and use `random_count` to randomly select a smaller
119
+
subset of the list to use on each run.
128
120
129
-
4.**monthly**: Schedule based on a specific month of the year
121
+
2.**date_range**: Schedule based on a specific date/time range (including [wildcards](#date-range-section-scheduling))
130
122
131
-
5.**default**: Default item to use if none of the above apply
123
+
3.**weekly**: Schedule based on a specific week of the year
132
124
133
-
For any conflicting schedules, the script tries to find the closest matching range and highest priority.
125
+
4.**monthly**: Schedule based on a specific month of the year
134
126
135
127
### Advanced Scheduling
136
128
137
129
#### Date Range Section Scheduling
138
130
139
131
`date_range` entries can accept both dates (`yyyy-mm-dd`) and datetimes (`yyyy-mm-dd hh:mm:ss`, 24-hour time).
140
132
141
-
`date_range` entries can also accept wildcards for any of the date/time fields. This can be useful for scheduling recurring events, such as annual events, "first-of-the-month" events, or even hourly events.
133
+
`date_range` entries can also accept wildcards for any of the date/time fields. This can be useful for scheduling
134
+
recurring events, such as annual events, "first-of-the-month" events, or even hourly events.
142
135
143
136
```yaml
144
137
date_range:
@@ -147,31 +140,46 @@ date_range:
147
140
# Each entry requires start_date, end_date, path values
148
141
- start_date: 2020-01-01# Jan 1st, 2020
149
142
end_date: 2020-01-02# Jan 2nd, 2020
150
-
path: /path/to/video.mp4
143
+
paths:
144
+
- /path/to/video.mp4
145
+
- /path/to/another/video.mp4
151
146
weight: 2# Add these paths to the list twice (make up greater percentage of prerolls - more likely to be selected)
152
147
- start_date: xxxx-07-04 # Every year on July 4th
153
148
end_date: xxxx-07-04 # Every year on July 4th
154
-
path: /path/to/video.mp4
149
+
paths:
150
+
- /path/to/video.mp4
151
+
- /path/to/another/video.mp4
155
152
weight: 1
156
-
- start_date: xxxx-xx-02 # Every year on the 2nd of every month
153
+
- name: "My Schedule"# Optional name for logging purposes
154
+
start_date: xxxx-xx-02 # Every year on the 2nd of every month
157
155
end_date: xxxx-xx-03 # Every year on the 3rd of every month
158
-
path: /path/to/video.mp4
156
+
paths:
157
+
- /path/to/video.mp4
158
+
- /path/to/another/video.mp4
159
159
weight: 1
160
160
- start_date: xxxx-xx-xx 08:00:00 # Every day at 8am
161
161
end_date: xxxx-xx-xx 09:30:00 # Every day at 9:30am
162
-
path: /path/to/holiday_video.mp4
162
+
paths:
163
+
- /path/to/video.mp4
164
+
- /path/to/another/video.mp4
163
165
weight: 1
164
166
```
165
167
166
168
You should [adjust your cron schedule](#scheduling-script) to run the script more frequently if you use this feature.
167
169
168
-
`date_range` entries also accept an optional `weight` value that can be used to adjust the emphasis of this entry over others by adding the listed paths multiple times. Since Plex selects a random preroll from the list of paths, having the same path listed multiple times increases its chances of being selected over paths that only appear once. This allows you to combine, e.g. a `date_range` entry with a `misc` entry, but place more weight/emphasis on the `date_range` entry.
170
+
`date_range` entries also accept an optional `weight` value that can be used to adjust the emphasis of this entry over
171
+
others by adding the listed paths multiple times. Since Plex selects a random preroll from the list of paths, having the
172
+
same path listed multiple times increases its chances of being selected over paths that only appear once. This allows
173
+
you to combine, e.g. a `date_range` entry with a `misc` entry, but place more weight/emphasis on the `date_range` entry.
174
+
175
+
`date_range`entries also accept an optional `name` value that can be used to identify the schedule in the logs.
169
176
170
177
---
171
178
172
179
## Scheduling Script
173
180
174
-
**NOTE:** Scheduling is handled automatically in the Docker version of this script via the `CRON_SCHEDULE` environment variable.
181
+
**NOTE:** Scheduling is handled automatically in the Docker version of this script via the `CRON_SCHEDULE` environment
182
+
variable.
175
183
176
184
### Linux
177
185
@@ -184,13 +192,14 @@ crontab -e
184
192
Place desired schedule (example below for every day at midnight)
0 commit comments