Skip to content

Instantly share code, notes, and snippets.

@Nixellion
Created October 22, 2024 07:33
Show Gist options
  • Save Nixellion/aaefc45f6f3c3bdc3a306d7f673af6cb to your computer and use it in GitHub Desktop.
Save Nixellion/aaefc45f6f3c3bdc3a306d7f673af6cb to your computer and use it in GitHub Desktop.
Script to migrate from Dashy (https://dashy.to/) to Homepage (https://gethomepage.dev/)
"""
Script to migrate from Dashy (https://dashy.to/) to Homepage (https://gethomepage.dev/)
Get your config.yml from Dashy and place it in the same folder as this script.
Run the script with Python.
The script takes a list of known services that have Widgets in Dashy and tries to automatically match your existing entries to this list, to decide whether an entry should be a bookmark or a service entry.
Adjust MATCH_THRESHOLD as needed depending on how much your titles match service names.
"""
import yaml
import difflib
# Threshold for fuzzy matching (0.0 to 1.0)
MATCH_THRESHOLD = 0.85
with open("dashy_config.yml", "r", encoding="utf-8") as f:
dashy_config = yaml.safe_load(f.read())
homepage_bookmarks = []
homepage_services = []
KNOWN_SERVICES = """Adguard Home
Atsumeru
Audiobookshelf
Authentik
Autobrr
Azure DevOps
Bazarr
Caddy
Calendar
Calibre-web
Changedetection.io
Channels DVR Server
Cloudflare Tunnels
Coin Market Cap
Crowdsec
Custom API
Deluge
DeveLanCacheUI
Synology Disk Station
Synology Download Station
Emby
ESPHome
EVCC
Fileflows
Flood
FreshRSS
Frigate
FRITZ!Box
GameDig
Gatus
Ghostfolio
Gitea
Glances
Gluetun
Gotify
Grafana
HDHomerun
Health checks
Home Assistant
Homebox
Homebridge
iFrame
Immich
Jackett
JDownloader
Jellyfin
Jellyseerr
Kavita
Komga
Kopia
Lidarr
Linkwarden
LubeLogger
Mastodon
Mailcow
Mealie
Medusa
Mikrotik
Minecraft
Miniflux
MJPEG
Moonraker (Klipper)
Mylar3
MySpeed
Navidrome
Netdata
NetAlertX
Nextcloud
NextDNS
Nginx Proxy Manager
NZBget
OctoPrint
Omada
Ombi
OpenDTU
OpenMediaVault
OPNSense
OpenWRT
Overseerr
Paperless-ngx
PeaNUT
pfSense
PhotoPrism
PiHole
Plant-it
Tautulli (Plex)
Plex
Portainer
Prometheus
Prowlarr
Proxmox
Proxmox Backup Server
Pterodactyl
Pyload
qBittorrent
QNAP
Radarr
Readarr
Romm
ruTorrent
SABnzbd
Scrutiny
Sonarr
Speedtest Tracker
Stash
Stocks
SWAG Dashboard
Syncthing Relay Server
Tailscale
Tandoor
Technitium DNS Server
Tdarr
Traefik
Transmission
TrueNas
Tube Archivist
Unifi Controller
Unmanic
Uptime Kuma
UptimeRobot
UrBackup
Vikunja
Watchtower
Wg-Easy
What's Up Docker
Xteve
Zabbix
Date & Time
Glances
Greeting
Kubernetes
Logo
Longhorn
Open-Meteo
OpenWeatherMap
Resources
Search
Stocks
Unifi Controller
Weather API"""
# Convert known services to a list and normalize
known_services_list = [service.strip().lower().replace(" ", "") for service in KNOWN_SERVICES.split("\n")]
def is_known_service(title):
"""
Check if a title matches any known service using fuzzy matching
"""
# Normalize the title
normalized_title = title.strip().lower().replace(" ", "")
# Use difflib to find the closest match
matches = difflib.get_close_matches(normalized_title, known_services_list, n=1, cutoff=MATCH_THRESHOLD)
return len(matches) > 0
for dashy_section in dashy_config['sections']:
services_entries = []
bookmarks_entries = []
for dashy_entry in dashy_section['items']:
entry = {
dashy_entry['title']: {
"href": dashy_entry["url"],
"description": dashy_entry.get("description", "")
}
}
entry_bookmark = {
dashy_entry['title']: [{
"href": dashy_entry["url"],
"abbr": dashy_entry['title'][0:2].upper()
}]
}
# Check if the entry is a known service
if is_known_service(dashy_entry['title']):
services_entries.append(entry)
else:
bookmarks_entries.append(entry_bookmark)
# Only add sections that have entries
if services_entries:
homepage_services.append({
dashy_section['name']: services_entries
})
if bookmarks_entries:
homepage_bookmarks.append({
dashy_section['name']: bookmarks_entries
})
homepage_bookmarks = yaml.dump(homepage_bookmarks)
homepage_services = yaml.dump(homepage_services)
with open("services.yaml", "w+", encoding="utf-8") as f:
f.write(f"""---
# For configuration options and examples, please see:
# https://gethomepage.dev/latest/configs/services
# Converted from Dashy
{homepage_services}""")
with open("bookmarks.yaml", "w+", encoding="utf-8") as f:
f.write(f"""---
# For configuration options and examples, please see:
# https://gethomepage.dev/latest/configs/bookmarks
# Converted from Dashy
{homepage_bookmarks}""")
@bonelifer
Copy link

Thanks for posting, I used DeepSeek to add icon conversion, and more apps.

https://gist.github.com/bonelifer/8b07d5bde9e703c2b903aa2fc87dd09d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment