Thursday, September 3, 2015

The Ultimate Script to download Microsoft Ignite New Zealand 2015 Videos AND slides!

download Microsoft Ignite New Zealand

New Zealand’s largest, annual tech event returns in its 20th year to SKYCITY and Vector Arena from September 1 – 4. Previously known as TechEd NZ, this gathering of the brightest Kiwi techies has become Ignite NZ. If you couldn’t attend the event, and even if you could, you probably couldn’t attend all the great sessions available. That is why I created this PowerShell Script so everyone can easily download them whether they were present at Ignite or not! Here are the features:

  • Downloads all the Microsoft Ignite New Zealand 2015 Sessions and Slides
  • Groups them by folders
  • Makes sure no errors come up due to Illegal File names.
  • If you stop the script and restart in the middle, it will start where it left off and not from beginning
  • Filter by keywords in the session title!

*Total size of videos will be updated when conference finishes & all sessions will be posted online!

 

 

Download the script from here!  Do not copy paste from source code below!

How to use: 

  • To download all sessions just run the script! EX:

.\IgniteNZ2015VidandSlides.ps1

  • To download sessions based on a keyword use the keyword parameters, and divide keywords by a comma. Make sure to use quotes around the keywords! EX:

.\IgniteNZ2015VidandSlides.ps1 -keyword “SharePoint,Azure,System Center”

  • To download sessions based on the session code, use the session parameter and divide sessions by a comma. Make sure to use quotes around the session codes!

.\IgniteNZ2015VidandSlides.ps1 -session “M216,M258″

Here is the source code:


#Script written by Vlad Catrinescu
#Visit my site http://ift.tt/1eCEHiK
#Twitter: @vladcatrinescu
#Originally Posted here: http://ift.tt/1DSpDD0
#Contributors: Dan Holme, Jeff Collins, Steve Beaugé 

Param(
  [string]$keyword,[string]$session
)

######    Variables  #####

#Location - Preferably enter something not too long to not have filename problems! cut and paste them afterwards
$downloadlocation = "C:\IgniteNZ2015"
#Ignite 2015 Videos RSS Feed
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
$video1 = (1$rss.downloadstring("http://ift.tt/1JS5ZPo;))
$slide1 = (1$rss.downloadstring("http://ift.tt/1UwaUqw;))

#other qualities for the videos only. Choose the one you want!
# $a = (1$rss.downloadstring("http://ift.tt/1KMczVE;))
# $a = (1$rss.downloadstring("http://ift.tt/1RdgMq0;)) 

#SCRIPT/ Functions  Do not touch below this line :)#
if (-not (Test-Path $downloadlocation)) {
                Write-Host "Folder $fpath dosen't exist. Creating it..."
                New-Item $downloadlocation -type directory | Out-Null
        }
set-location $downloadlocation

function CleanFilename($filename)
{
    return $filename.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
}

function DownloadSlides($filter,$videourl)
{
    try
    {
        $videourl.rss.channel.item | Where{($_.title -like “*$filter*”) -or ($_.link -like "*/$filter")} |
        foreach {
                $code = $_.comments.split("/") | select -last 1          

                # Grab the URL for the PPTX file
                $urlpptx = New-Object System.Uri($_.enclosure.url)
            $filepptx = $code + "-" + $_.creator + "-" + (CleanFileName($_.title))
                $filepptx = $filepptx.substring(0, [System.Math]::Min(120, $filepptx.Length))
                $filepptx = $filepptx.trim()
                $filepptx = $filepptx + ".pptx"
                if ($code -ne "")
                {
                         $folder = $code + " - " + (CleanFileName($_.title))
                         $folder = $folder.substring(0, [System.Math]::Min(100, $folder.Length))
                         $folder = $folder.trim()
                }
                else
                {
                        $folder = "NoCodeSessions"
                }

                if (-not (Test-Path $folder)) {
                        Write-Host "Folder $folder dosen't exist. Creating it..."
                        New-Item $folder -type directory | Out-Null
                }

                # Make sure the PowerPoint file doesn't already exist
                if (!(test-path "$downloadlocation\$folder\$filepptx"))
                {
                        # Echo out the  file that's being downloaded
                        write-host "Downloading slides: $filepptx"
                        #$wc = (New-Object System.Net.WebClient)  

                        # Download the MP4 file
                        #$wc.DownloadFile($urlpptx, "$downloadlocation\$filepptx")
                Start-BitsTransfer $urlpptx "$downloadlocation\$filepptx" -DisplayName $filepptx
                        mv $filepptx $folder 

                }
            else
            {
                        write-host "Slides exist: $filepptx"
            }
            }

     }

    catch
    {
        $ErrorMessage = $_.Exception.Message
        Write-host "$ErrorMessage"
    }
}

function DownloadVideos($filter,$slideurl)
{
#download all the mp4
# Walk through each item in the feed
$slideurl.rss.channel.item | Where{($_.title -like “*$filter*”) -or ($_.link -like "*/$filter*")} | foreach{
        $code = $_.comments.split("/") | select -last 1          

        # Grab the URL for the MP4 file
        $url = New-Object System.Uri($_.enclosure.url)  

        # Create the local file name for the MP4 download
        $file = $code + "-" + $_.creator + "-" + (CleanFileName($_.title))
        $file = $file.substring(0, [System.Math]::Min(120, $file.Length))
        $file = $file.trim()
        $file = $file + ".mp4"  

        if ($code -ne "")
        {
                 $folder = $code + " - " + (CleanFileName($_.title))
                 $folder = $folder.substring(0, [System.Math]::Min(100, $folder.Length))
                 $folder = $folder.trim()
        }
        else
        {
                $folder = "NoCodeSessions"
        }

        if (-not (Test-Path $folder)) {
                Write-Host "Folder $folder) dosen't exist. Creating it..."
                New-Item $folder -type directory | Out-Null
        }

        # Make sure the MP4 file doesn't already exist

        if (!(test-path "$folder\$file"))
        {
                # Echo out the  file that's being downloaded
                write-host "Downloading video: $file"
                #$wc = (New-Object System.Net.WebClient)  

                # Download the MP4 file
                Start-BitsTransfer $url "$downloadlocation\$file" -DisplayName $file
                mv $file $folder
        }
    else
    {
                write-host "Video exists: $file"
    }

#text description from session
        $OutFile = New-Item -type file "$($downloadlocation)\$($Folder)\$($Code.trim()).txt" -Force
    $Category = "" ; $Content = ""
    $_.category | foreach {$Category += $_ + ","}
    $Content = $_.title.trim() + &quot;<code>r</code>n&quot; + $_.creator + &quot;<code>r</code>n&quot; + $_.summary.trim() + &quot;<code>r</code>n&quot; + &quot;<code>r</code>n&quot; + $Category.Substring(0,$Category.Length -1)
   add-content $OutFile $Content

        }
}

if ($keyword)
{
    $keywords = $keyword.split(&quot;,&quot;)

    foreach ($k in $keywords)
    {
        $k.trim()
        Write-Host &quot;You are now downloading the sessions with the keyword $k&quot;
        DownloadSlides $k $slide1
        DownloadVideos $k $video1
    }
}
elseif ($session)
{
    $sessions = $session.Split(&quot;,&quot;)

    foreach ($s in $sessions)
    {
        $s.trim()
        Write-Host &quot;You are now downloading the session $s&quot;
        DownloadSlides $s $slide1
        DownloadVideos $s $video1
    }

}
else
{
    DownloadSlides &quot; &quot; $slide1
    DownloadVideos &quot; &quot; $video1
}

The post The Ultimate Script to download Microsoft Ignite New Zealand 2015 Videos AND slides! appeared first on Absolute SharePoint Blog by Vlad Catrinescu.


by Vlad Catrinescu via Absolute SharePoint Blog by Vlad Catrinescu

No comments:

Post a Comment