Update update_link_lite_json.ps1
This commit is contained in:
1 parent
c879eedbe0
commit
05ba086e76
1 file changed
+11
-2
@@ -48,6 +48,7 @@ foreach ($line in $content) {
|
||||
name = $matches[1].Trim()
|
||||
url = ""
|
||||
image = ""
|
||||
rss = ""
|
||||
}
|
||||
}
|
||||
# Match properties
|
||||
@@ -62,6 +63,9 @@ foreach ($line in $content) {
|
||||
# Handle 'avatar' key just in case
|
||||
$currentFriend.image = $matches[1].Trim()
|
||||
}
|
||||
elseif ($line -match "^\s*(rss|feed):\s*(.+)") {
|
||||
$currentFriend.rss = $matches[2].Trim()
|
||||
}
|
||||
}
|
||||
}
|
||||
# Add the last one
|
||||
@@ -71,12 +75,17 @@ if ($currentFriend -and $currentFriend.name -and $currentFriend.url) {
|
||||
|
||||
Write-Host "Found $($friends.Count) friends."
|
||||
|
||||
# Convert to requested format: ["name", "url", "image"]
|
||||
# Convert to requested format: ["name", "url", "image", "rss"(optional)]
|
||||
$outputList = @()
|
||||
foreach ($f in $friends) {
|
||||
# Use image if available, otherwise empty string or default
|
||||
$img = if ($f.image) { $f.image } else { "" }
|
||||
$outputList += ,@($f.name, $f.url, $img)
|
||||
|
||||
if ($f.rss) {
|
||||
$outputList += ,@($f.name, $f.url, $img, $f.rss)
|
||||
} else {
|
||||
$outputList += ,@($f.name, $f.url, $img)
|
||||
}
|
||||
}
|
||||
|
||||
$outputData = @{
|
||||
|
||||
Reference in new issue
Block a user