Announcement

Collapse
No announcement yet.

[PowerShell] Elder Scrolls Online - Addon Downloader

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [PowerShell] Elder Scrolls Online - Addon Downloader

    So, you're an ESO player and you want your AddOns to be always up-to-date. Or you want to download your favorite AddOns on another computer? Maybe you just want to share your AddOns with another player?
    Now, that's super easy with new all-new Download script, written by me

    Code:
    $esoAddonsFolder = "$([Environment]::GetFolderPath("MyDocuments"))\Elder Scrolls Online\live\AddOns"
    $localDownloadFolder = "$([Environment]::GetFolderPath("MyDocuments"))\Elder Scrolls Online\live\AddOnsDownload"
    $addonIDs = @(3367,7,2161,2932)
    
    
    function Get-DownloadLink([int]$FileID) {
        $d = "https://www.esoui.com/downloads/getfile.php?id=$FileID"
        return $d
    }
    
    
    Write-Host "Thank you for using the ESOUI download script."
    Write-Host "Make sure, you've entered add your desired AddOn IDs within this script in line 3."
    Read-Host "Press ENTER to start downloading the most recent versions of your ESO Add-Ons"
    
    
    Write-Host "Checking if the download folder '$localDownloadFolder' exists..."
    if ((Test-Path $localDownloadFolder) -ne $True) {
        Write-Host "Creating the download folder '$localDownloadFolder'..."
        New-Item -ItemType Directory -Force -Path $localDownloadFolder
    }
    
    Write-Host "Searching and deleting old ZIP files in the download folder..."
    Get-ChildItem -Path $localDownloadFolder -Filter *.zip | ForEach-Object {
       Remove-Item $_.FullName -Force
    }
    
    Write-Host "Downloading the files..."
    foreach ($id in $addonIDs) {
        $download = Invoke-WebRequest -Uri (Get-DownloadLink -FileID $id) -UseBasicParsing
        $fileName = ([System.Net.Mime.ContentDisposition]::new($download.Headers["Content-Disposition"])).FileName
        $file = [System.IO.FileStream]::new((Join-Path -Path $localDownloadFolder -ChildPath $fileName), [System.IO.FileMode]::Create)
        $file.Write($download.Content, 0, $download.RawContentLength)
        $file.Close()
        Write-Host "`tSaved $fileName ($($download.RawContentLength) bytes) to disk."
    }
    Write-host
    Write-Host "Extracting ZIP files to $esoAddonsFolder..."
    Get-ChildItem -Path $localDownloadFolder -Filter *.zip | ForEach-Object {
        Write-Host "`t$($_.Name) extracted."
        Expand-Archive $_.FullName -DestinationPath $esoAddonsFolder -Force
    }
    How to use
    • Create a new file somewhere on your computer. Make sure the file extension is "ps1" - For example "ESO_Download_Addons.ps1"
    • Copy & Paste the above script into the new file
    • In line 3, you have a bunch of numbers. These are the AddOn IDs you can find on ESOUI.com. Replace them with your favorite AddOn IDs
    • Save end exit the file. Right click on it and select "Open with PowerShell".
    • That's it!
    The script will automatically download all your AddOns into your \MyDocuments\Elder Scrolls Online\live\AddOnsDownload\ directory. After that it extracts the ZIP files into MyDocuments\Elder Scrolls Online\live\AddOns and overwrites the old files (if any).
    The script always downloads the latest version. So you can simply execute the script again to update your favorite AddOns. No additional tools required. (The Minion program from ESOUI never worked for me anyway).

    How do I find the AddOn IDs?
    That is very simple as well. Let's say, you want to add "AutoInvite - Updated" to your list. You go to the official ESOUI website for this particular AddOn (https://www.esoui.com/downloads/info...e-Updated.html)
    And here in this URL you can already find the ID. Where it says "info2633", the 2633 is the ID you want to add to the script in line 3. And that's already it. No magic, no super complex technical knowledge required.

    The example IDs in the script are downloading "Much Smarter AutoLoot" + it dependencies.

    Have fun!

  • #2
    First update already here

    Code:
    $esoAddonsFolder = "$([Environment]::GetFolderPath("MyDocuments"))\Elder Scrolls Online\live\AddOns"
    $localDownloadFolder = "$([Environment]::GetFolderPath("MyDocuments"))\Elder Scrolls Online\live\AddOnsDownload"
    $addonIDs = @(3367,7,2161,2932)
    
    
    function Get-DownloadLink([int]$FileID) {
        $d = "https://www.esoui.com/downloads/getfile.php?id=$FileID"
        return $d
    }
    
    function Retreive-AddOnVersion([int]$FileID) {
        $d = "https://www.esoui.com/downloads/info$FileID"
        $html = Invoke-WebRequest -Uri ($d) -UseBasicParsing
    
        if ($html.Content -match "Sorry, this is not a valid link any more.") {
            $obj = [PSCustomObject]@{
                ID = $FileID
                Name = "N/A"
                Version = "N/A"
                LastUpdate = "Addon does not exist."
            }
            return $obj
        }
    
        $html.Content -match '<div id="version">Version: (.+)</div>' | Out-Null
        $version = $matches[1]
    
        $html.Content -match '<title>(.+)</title>' | Out-Null
        $name = $matches[1].Split(":")[0]
    
        $html.Content -match '<div id="safe">(.+)</div>' | Out-Null
        $updated = $matches[1]
    
        $obj = [PSCustomObject]@{
            ID = $FileID
            Name = $name
            Version = $version
            LastUpdate = $updated
        }
        return $obj
    }
    
    
    
    
    
    Write-Host "Thank you for using the ESOUI download script." -ForegroundColor Green
    Write-Host "Make sure, you've added your desired AddOn IDs within this script in line 3." -ForegroundColor Green
    Write-Host
    Write-Host "You have currently $($addonIDs.Count) AddOn selected." -ForegroundColor Green
    Write-Host "---MENU---"
    Write-Host "`t1)`tRetreive a detailed list of the addons"
    Write-Host "`t2)`tDownload and extract all addons"
    $input = Read-Host ">"
    
    if($input -eq "1"){
        Write-Host "Parsing ESOUI.com - Please wait..." -ForegroundColor Yellow
        $addons = @()
        ForEach ($id in $addonIDs) {
            $v = Retreive-AddOnVersion -FileID $id
            $addons += $v
        }
        $addons | Out-Default
        Read-Host "Press any key to exit..."
    } elseif ($input -eq "2") {
        Write-Host "Checking if the download folder '$localDownloadFolder' exists..."
        if ((Test-Path $localDownloadFolder) -ne $True) {
            Write-Host "Creating the download folder '$localDownloadFolder'..."
            New-Item -ItemType Directory -Force -Path $localDownloadFolder
        }
    
        Write-Host "Searching and deleting old ZIP files in the download folder..."
        Get-ChildItem -Path $localDownloadFolder -Filter *.zip | ForEach-Object {
        Remove-Item $_.FullName -Force
        }
    
        Write-Host "Downloading the files..."
        foreach ($id in $addonIDs) {
            $download = Invoke-WebRequest -Uri (Get-DownloadLink -FileID $id) -UseBasicParsing
            if ($download.Content -match "The specified file was not found." -or
                $download.Content -match "`Cannot download file - No ID was specified!")
                {
                    Write-Host "`tError downloading Addon ID $id" -ForegroundColor Red
                    continue
                }
    
            $fileName = ([System.Net.Mime.ContentDisposition]::new($download.Headers["Content-Disposition"])).FileName
            $file = [System.IO.FileStream]::new((Join-Path -Path $localDownloadFolder -ChildPath $fileName), [System.IO.FileMode]::Create)
            $file.Write($download.Content, 0, $download.RawContentLength)
            $file.Close()
            Write-Host "`tSaved $fileName ($($download.RawContentLength) bytes) to disk."
        }
    
        Write-host
        Write-Host "Extracting ZIP files to $esoAddonsFolder..."
        Get-ChildItem -Path $localDownloadFolder -Filter *.zip | ForEach-Object {
            Write-Host "`t$($_.Name) extracted."
            Expand-Archive $_.FullName -DestinationPath $esoAddonsFolder -Force
        }
    } else {
        Write-Host "Invalid input. Exiting." -ForegroundColor Red
    }
    What's new?
    With the very early and first update, you can now parse the names, current version and last update of each addon directly from ESOUI.com. Also, the script will now tell you, if there is an error with an addon ID (such us the Addon ID does not exist).

    Click image for larger version

Name:	ESOUI addon downlaoder.png
Views:	535
Size:	34.5 KB
ID:	90

    Comment

    Working...
    X