-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwelcome.ps1
94 lines (87 loc) · 3.09 KB
/
welcome.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
function recurse {
sleep 180
$elapsedTime = $(get-date) - $StartTime
$totalTime = $elapsedTime.Days.ToString() +' Days '+ $elapsedTime.Hours.ToString() +' Hours '+ $elapsedTime.Minutes.ToString() +' Min ' + $elapsedTime.Seconds.ToString() +' Sec'
write-host ""
write-host "Container is running since: " -NoNewline
write-host "$totalTime" -ForegroundColor Cyan
recurse
}
$json = @"
{
"Plex": {
"Url": "https://plex.domain.com",
"token": "<redacted>"
},
"Tautulli": {
"Url": "https://tautulli.domain.com",
"APIKey": "<redacted>"
},
"SABnzbd": {
"Url": "https://sabnzbd.domain.com",
"APIKey": "<redacted>"
},
"TMDB": {
"APIKey": "<redacted>"
},
"ScriptSettings": {
"CurrentStreams": {
"Webhook": "https://discord.com/api/webhooks/<redacted>/<redacted>"
},
"PlexLibraryStats": {
"Webhook": "https://discord.com/api/webhooks/<redacted>/<redacted>",
"ExcludedLibraries": [
"Photos",
"Live TV",
"Fitness",
"YouTube"
],
"IncludedLibraries": []
},
"PlexPlayStats": {
"Webhook": "https://discord.com/api/webhooks/<redacted>/<redacted>",
"RemoveMonthsWithZeroPlays": true
},
"PopularOnPlex": {
"Webhook": "https://discord.com/api/webhooks/<redacted>/<redacted>",
"Count": 5,
"Days": 30
},
"SABnzbdStatus": {
"Webhook": "https://discord.com/api/webhooks/<redacted>/<redacted>"
},
"TopPlexStats": {
"Webhook": "https://discord.com/api/webhooks/<redacted>/<redacted>",
"Count": 5,
"Days": 30
}
}
}
"@
$json | Out-File "$PSScriptRoot\config\config.json.template"
if(-not (test-path "$PSScriptRoot\config\log")){
$null = New-Item -Path "$PSScriptRoot\config\log" -ItemType Directory -ErrorAction SilentlyContinue
}
# Install
cls
# Show integraded Scripts
$starttime = Get-Date
$scripts = (get-childitem -Filter *.ps1 | where name -ne 'welcome.ps1').Name.replace('.ps1','')
Write-Host "##############################################################################" -ForegroundColor Green
Write-Host "Currently '$($scripts.count)' scripts integrated" -ForegroundColor Yellow
Write-Host ''
Write-Host "Please create 'config.json' based on template, located here: " -ForegroundColor Yellow
Write-Host " /opt/appdata/tautulli2discord/config/config.json.template" -ForegroundColor Cyan
Write-Host "Please fill out all required informations in 'config.json'" -ForegroundColor Yellow
Write-Host ''
Write-Host " - Example on how to run the script manually: " -ForegroundColor Yellow
Write-Host " docker exec -it tautulli2discord pwsh PlexLibraryStats.ps1" -ForegroundColor Cyan
Write-Host " - Example on how to run the script via cron: " -ForegroundColor Yellow
Write-Host " * * * * * docker exec tautulli2discord pwsh CurrentStreams.ps1 >/dev/null 2>&1" -ForegroundColor Cyan
Write-Host "##############################################################################" -ForegroundColor Green
Write-Host ''
foreach ($script in $scripts){
write-host $script -ForegroundColor Cyan
}
# Call Recursive Function.
recurse