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