Skip to content

Commit e50f9d2

Browse files
committed
Added a contradiction reporting setting and a setting to ask before adding new videos
1 parent efdf088 commit e50f9d2

File tree

2 files changed

+37
-11
lines changed

2 files changed

+37
-11
lines changed

.env.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,18 @@ ERROR_DELAY=1000
2424
# the playlist
2525
CHECK_BLACKLISTED=false
2626

27-
# If the playlist is missing a url from the pony archive and this setting is true
28-
# then the missing url will be automatically added
27+
# If the playlist is missing a url from the pony archive, this setting
28+
# will tell the program what to do
29+
# This setting can be set to:
30+
# true : The missing url will be automatically added
31+
# ask : You will be asked whether or not the video should be added
32+
# each time a missing video is found
33+
# any other input : No videos will be added to the playlist
2934
ADD_IF_MISSING=true
3035

36+
# If this is set to true, then any video found in the cytube playlist that
37+
# has a bad status label in the archive will be reported at the end of the
38+
# program. E.g. supposedly unavailable or private videos found in the playlist
39+
REPORT_CONTRADICTORY_VIDEOS=false
40+
3141
# This file also has to be renamed to .env to work (without the .txt)

index.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function int(v) {
2020
const ret = parseInt(v)
2121

2222
if (isNaN(ret))
23-
throw new Error(`\"${v}\" used for integer variable. Expected a number`)
23+
throw new Error(`\"${v}\" given instead of an integer. Expected a number`)
2424

2525
return parseInt(v)
2626
}
@@ -39,18 +39,34 @@ async function main() {
3939
error_delay = int(process.env.ERROR_DELAY)
4040

4141
const
42-
show = get(process.env.SHOW),
43-
blacklist_check = get(process.env.CHECK_BLACKLISTED),
44-
use_auth_cookie = get(process.env.USE_AUTH_COOKIE)
42+
show = get(process.env.SHOW),
43+
blacklist_check = get(process.env.CHECK_BLACKLISTED),
44+
use_auth_cookie = get(process.env.USE_AUTH_COOKIE),
45+
report_contradictions = get(process.env.REPORT_CONTRADICTORY_VIDEOS)
46+
47+
let add_if_missing_setting
48+
49+
switch (process.env.ADD_IF_MISSING.toLowerCase()) {
50+
case "true":
51+
add_if_missing_setting = 2
52+
break
53+
case "ask":
54+
add_if_missing_setting = 1
55+
break
56+
default:
57+
add_if_missing_setting = 0
58+
}
4559

4660
setErrDelay(error_delay)
4761

4862
update_playlist(
49-
use_cookie = use_auth_cookie,
50-
headless = !show && !use_auth_cookie,
51-
queue_delay = q_delay,
52-
url = channel_url,
53-
check_blacklisted = blacklist_check
63+
use_cookie = use_auth_cookie,
64+
headless = !show && !use_auth_cookie,
65+
queue_delay = q_delay,
66+
url = channel_url,
67+
check_blacklisted = blacklist_check,
68+
add_if_missing = add_if_missing_setting,
69+
report_contradictory = report_contradictions
5470
)
5571
}
5672

0 commit comments

Comments
 (0)