Internet radio browser GUI for music/video streams from various directory services.

βŒˆβŒ‹ βŽ‡ branch:  streamtuner2


Check-in [7e49e61eee]

Overview
Comment:Oliver: fixed the $kwargs/$args→$iargs issue and colors
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7e49e61eee5e6f8c75964c4ae52f2e8c981d880a
User & Date: mario on 2016-12-11 17:11:29
Other Links: manifest | tags
Context
2016-12-11
17:11
Colorize statusbar hint about config reset / save. check-in: c98c1aca39 user: mario tags: trunk
17:11
Oliver: fixed the $kwargs/$argsβ†’$iargs issue and colors check-in: 7e49e61eee user: mario tags: trunk
15:11
Document prefstore and cachereset plugins. check-in: de1e8b9558 user: mario tags: trunk
Changes

Modified dev/install_python_gtk.ps1 from [b28e25db0a] to [a13bf52e4a].

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

#-- what and how to install (hash list as used by Run-Task and Check-Prerequisites)
$tasks = @(
  @{
    title  = "Python 2.7.12"
    url    = "https://www.python.org/ftp/python/2.7.12/python-2.7.12.msi"
    cmd    = ""
    args   = 'TARGETDIR="{PYTHON}" /qb-!'
    regkey = "$regPathLM\{9DA28CE5-0AA5-429E-86D8-686ED898C665}"
    testpth= "{PYTHON}\pythonw.exe"
    is_opt = ''
    prescn = ''
  },
  @{
    title  = "PyGtk 2.24.2"
    url    = "http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/pygtk-all-in-one-2.24.2.win32-py2.7.msi"
    cmd    = ""
    args   = 'TARGETDIR="{PYTHON}" ADDLOCAL=ALL REMOVE=PythonExtensionModulePyGtkSourceview2,PythonExtensionModulePyGoocanvas,PythonExtensionModulePyRsvg,DevelopmentTools /qb-!'
    regkey = "$regPathLM\{09F82967-D26B-48AC-830E-33191EC177C8}"
    testpth= "{PYTHON}\Lib\site-packages\gtk-2.0\pygtk-2.24.0-py2.7.egg-info"
  },
  @{
    title  = "Python requests"
    url    = "requests" # no download url, pip handles this
    cmd    = "easy_install"
    testpth= "{PYTHON}\Lib\site-packages\requests-2*py2.7.egg"
  },
  @{
    title  = "LXML 2.3"
    url    = "https://pypi.python.org/packages/d4/fa/e4e0c7a8fe971b10e275cdc20efd16f553a225e700c400c11da25276e4f4/lxml-2.3-py2.7-win32.egg"
    cmd    = "easy_install"
    testpth= "{PYTHON}\Lib\site-packages\lxml-2.3-py2.7-win32.egg"
  },
  @{
    title  = "PyQuery 1.2.1"
    url    = "https://pypi.python.org/packages/62/71/8ac1f5c0251e51714d20e4b102710d5eee1683c916616129552b0a025ba5/pyquery-1.2.17-py2.py3-none-any.whl"
    cmd    = "pip"
    args   = "--disable-pip-version-check"
    testpth= "{PYTHON}\Lib\site-packages\pyquery-1.2.17.dist-info"
  },
  @{
    title  = "PIL 1.1.7"
    url    = "http://effbot.org/downloads/PIL-1.1.7.win32-py2.7.exe"
    regkey = "$regPathCU\PIL-py2.7"
    testpth= "{PYTHON}\Lib\site-packages\PIL"
  },
  @{
    title  = "Streamripper 1.64.6"
    url    = "https://netcologne.dl.sourceforge.net/project/streamripper/streamripper%20%28current%29/1.64.6/streamripper-windows-installer-1.64.6.exe"
    cmd    = ""
    args   = "/S  /D={STREAMRIPPER}"  #NSIS does not use double quotes in /D parm
    regkey = "$regPathLM\Streamripper"
    testpth= "{STREAMRIPPER}\streamripper.exe"
    is_opt = '($optionalInstall)'     # ← could use '((Ask "Install streamripper too [y/N]") -match N)' instead
    prescn = 'if ($optionalInstall) {if ($_found = (Get-ITPV "Streamripper")) {$STREAMRIPPER = $_found}} else {$STREAMRIPPER=""; continue;}'
  },
  @{
    title  = "Uninstall script"







|









|



















|












|







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

#-- what and how to install (hash list as used by Run-Task and Check-Prerequisites)
$tasks = @(
  @{
    title  = "Python 2.7.12"
    url    = "https://www.python.org/ftp/python/2.7.12/python-2.7.12.msi"
    cmd    = ""
    iargs   = 'TARGETDIR="{PYTHON}" /qb-!'
    regkey = "$regPathLM\{9DA28CE5-0AA5-429E-86D8-686ED898C665}"
    testpth= "{PYTHON}\pythonw.exe"
    is_opt = ''
    prescn = ''
  },
  @{
    title  = "PyGtk 2.24.2"
    url    = "http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/pygtk-all-in-one-2.24.2.win32-py2.7.msi"
    cmd    = ""
    iargs   = 'TARGETDIR="{PYTHON}" ADDLOCAL=ALL REMOVE=PythonExtensionModulePyGtkSourceview2,PythonExtensionModulePyGoocanvas,PythonExtensionModulePyRsvg,DevelopmentTools /qb-!'
    regkey = "$regPathLM\{09F82967-D26B-48AC-830E-33191EC177C8}"
    testpth= "{PYTHON}\Lib\site-packages\gtk-2.0\pygtk-2.24.0-py2.7.egg-info"
  },
  @{
    title  = "Python requests"
    url    = "requests" # no download url, pip handles this
    cmd    = "easy_install"
    testpth= "{PYTHON}\Lib\site-packages\requests-2*py2.7.egg"
  },
  @{
    title  = "LXML 2.3"
    url    = "https://pypi.python.org/packages/d4/fa/e4e0c7a8fe971b10e275cdc20efd16f553a225e700c400c11da25276e4f4/lxml-2.3-py2.7-win32.egg"
    cmd    = "easy_install"
    testpth= "{PYTHON}\Lib\site-packages\lxml-2.3-py2.7-win32.egg"
  },
  @{
    title  = "PyQuery 1.2.1"
    url    = "https://pypi.python.org/packages/62/71/8ac1f5c0251e51714d20e4b102710d5eee1683c916616129552b0a025ba5/pyquery-1.2.17-py2.py3-none-any.whl"
    cmd    = "pip"
    iargs   = "--disable-pip-version-check"
    testpth= "{PYTHON}\Lib\site-packages\pyquery-1.2.17.dist-info"
  },
  @{
    title  = "PIL 1.1.7"
    url    = "http://effbot.org/downloads/PIL-1.1.7.win32-py2.7.exe"
    regkey = "$regPathCU\PIL-py2.7"
    testpth= "{PYTHON}\Lib\site-packages\PIL"
  },
  @{
    title  = "Streamripper 1.64.6"
    url    = "https://netcologne.dl.sourceforge.net/project/streamripper/streamripper%20%28current%29/1.64.6/streamripper-windows-installer-1.64.6.exe"
    cmd    = ""
    iargs   = "/S  /D={STREAMRIPPER}"  #NSIS does not use double quotes in /D parm
    regkey = "$regPathLM\Streamripper"
    testpth= "{STREAMRIPPER}\streamripper.exe"
    is_opt = '($optionalInstall)'     # ← could use '((Ask "Install streamripper too [y/N]") -match N)' instead
    prescn = 'if ($optionalInstall) {if ($_found = (Get-ITPV "Streamripper")) {$STREAMRIPPER = $_found}} else {$STREAMRIPPER=""; continue;}'
  },
  @{
    title  = "Uninstall script"
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
  },
  @{
    title  = "Startmenu Internet"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2" -name "Streamtuner2 on the Web.lnk" -target "$AboutLink"'
  },
  @{
    title  = "Startmenu Reconfigure"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2\Advanced" -name "Reconfigure.lnk" -target $ModifyPath'
  },
  @{
    title  = "Startmenu RunDebug"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2\Advanced" -name "Run in debug mode.lnk" -target $PYTHON\python.exe -arg "$UsrFolder\bin\streamtuner2" -parm "-D"'
  },
  @{
    title  = "Startmenu RunConsole"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2\Advanced" -name "Run with console.lnk" -target $PYTHON\python.exe -arg "$UsrFolder\bin\streamtuner2"'
  },
  @{
    title  = "Startmenu ResetPrefs"
    cmd    = 'Make-Shortcut @task'
       dir = "$StartMenu\Streamtuner2\Advanced"
      name = "Reset preferences.lnk"
    target = "$ResetPrefsPath"
  },
  @{
    title  = "FINISHED"
  }
)







|



|



|




|







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
  },
  @{
    title  = "Startmenu Internet"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2" -name "Streamtuner2 on the Web.lnk" -target "$AboutLink"'
  },
  @{
    title  = "Startmenu Reconfigure"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2\Extra" -name "Reconfigure.lnk" -target $ModifyPath'
  },
  @{
    title  = "Startmenu RunDebug"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2\Extra" -name "Run in debug mode (-D).lnk" -target $PYTHON\python.exe -arg "$UsrFolder\bin\streamtuner2" -parm "-D"'
  },
  @{
    title  = "Startmenu RunConsole"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2\Extra" -name "Run with console.lnk" -target $PYTHON\python.exe -arg "$UsrFolder\bin\streamtuner2"'
  },
  @{
    title  = "Startmenu ResetPrefs"
    cmd    = 'Make-Shortcut @task'
       dir = "$StartMenu\Streamtuner2\Extra"
      name = "Reset preferences.lnk"
    target = "$ResetPrefsPath"
  },
  @{
    title  = "FINISHED"
  }
)
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
        $host.UI.RawUI.set_bufferSize($MyBuffer)
        $host.UI.RawUI.set_windowSize($MyWindow)
    }
}

#-- create Desktop/Startmenu shortcuts
function Make-Shortcut {
    param($dir, $name, $target, $arg=$false, $parm=$false, [parameter(ValueFromRemainingArguments=$true)]$kwargs=0)
    if (!(Test-Path -Path $dir)) {
        New-Item -Path $dir -ItemType directory > $null
    }
    $wsh = New-Object -ComObject WScript.Shell
    if (!$wsh) { return }
    $lnk = $wsh.CreateShortcut("$dir\$name")
    $lnk.TargetPath = $target







|







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
        $host.UI.RawUI.set_bufferSize($MyBuffer)
        $host.UI.RawUI.set_windowSize($MyWindow)
    }
}

#-- create Desktop/Startmenu shortcuts
function Make-Shortcut {
    param($dir, $name, $target, $arg=$false, $parm=$false)
    if (!(Test-Path -Path $dir)) {
        New-Item -Path $dir -ItemType directory > $null
    }
    $wsh = New-Object -ComObject WScript.Shell
    if (!$wsh) { return }
    $lnk = $wsh.CreateShortcut("$dir\$name")
    $lnk.TargetPath = $target
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
}

#-- Operates on parameters of each hash from `$tasks`
#
#  Β· $title   β†’ print current step
#  Β· $url     β†’ download from given link, keep as local `$file`
#  Β· $cmd     β†’ instead of running file, run a custom command
#  Β· $args    β†’ used for MSI installation
#  Β· $testpth β†’ check for exisiting dir/file
#  Β· $regkey  β†’ set registry key if successful
#  Β· $is_opt  β†’ run as expression
#  Β· $prescn  β†’ used in check-prereq()
#
filter Run-Task {
    # extract flags/vars from $tasks pipe
    $title=""; $cmd=""; $url=""; $args=""; $testpth=""; $regkey=""; $is_opt=""; $prescn=""; $_found=""
    ($task = $_).GetEnumerator() | % { Set-Variable -Scope Local -Name $_.key -Value ([regex]::Replace($_.value, "[#{](\w+)[}#]", { param($m) Invoke-Expression ("$"+$m.Groups[1].Value) })) }

    # skip optionals
    if ($is_opt -AND !(Invoke-Expression $is_opt)) { return }

    # print step
    if ($title -match "\d+\.\d+") { $title = "Installing $title" }







|







|







361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
}

#-- Operates on parameters of each hash from `$tasks`
#
#  Β· $title   β†’ print current step
#  Β· $url     β†’ download from given link, keep as local `$file`
#  Β· $cmd     β†’ instead of running file, run a custom command
#  Β· $iargs    β†’ used for MSI installation
#  Β· $testpth β†’ check for exisiting dir/file
#  Β· $regkey  β†’ set registry key if successful
#  Β· $is_opt  β†’ run as expression
#  Β· $prescn  β†’ used in check-prereq()
#
filter Run-Task {
    # extract flags/vars from $tasks pipe
    $title=""; $cmd=""; $url=""; $iargs=""; $testpth=""; $regkey=""; $is_opt=""; $prescn=""; $_found=""
    ($task = $_).GetEnumerator() | % { Set-Variable -Scope Local -Name $_.key -Value ([regex]::Replace($_.value, "[#{](\w+)[}#]", { param($m) Invoke-Expression ("$"+$m.Groups[1].Value) })) }

    # skip optionals
    if ($is_opt -AND !(Invoke-Expression $is_opt)) { return }

    # print step
    if ($title -match "\d+\.\d+") { $title = "Installing $title" }
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
        $wget.DownloadFile($url, "$TEMP\$file");
    }

    # run shorthand or custom command
    if ($cmd) {
        if (Test-Path $PYTHON) { chdir($PYTHON) }
        if ($cmd -eq "pip") {
            $cmd = "& `"$PYTHON\Scripts\pip.exe`" install $TEMP\$file", $args #"
        }
        elseif ($cmd -match "^(easy|easy_install|silent)$") {
            if (!($file)) {
                $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $url" #"
            }
            else {
                $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $TEMP\$file" #"
            }
        }
        Write-Host -f Yellow " β†’ $cmd"
        Invoke-Expression "$cmd"
    }
    # msi
    elseif ($file -match ".+.msi$") {
        Write-Host -f DarkGray (" β†’ msiexec /i " + "$file " + $args)
        Start-Process -Wait msiexec -ArgumentList /i,"$TEMP\$file", $args
        if ($regkey) {
            Set-ItemProperty -Path "$regkey" -Name "WindowsInstaller"  -Value "0"
        }
    }
    # exe
    elseif ($file -match ".+.exe$") {
        write-host -f DarkGray " β†’ $file $args"
        if ($args) {
            Start-Process -Wait "$TEMP\$file" -ArgumentList $args
        }
        else {
            Start-Process -Wait "$TEMP\$file"
        }
    }
    # other files
    elseif ($file) {







|









|




|
|






|
|
|







406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
        $wget.DownloadFile($url, "$TEMP\$file");
    }

    # run shorthand or custom command
    if ($cmd) {
        if (Test-Path $PYTHON) { chdir($PYTHON) }
        if ($cmd -eq "pip") {
            $cmd = "& `"$PYTHON\Scripts\pip.exe`" install $TEMP\$file", $iargs #"
        }
        elseif ($cmd -match "^(easy|easy_install|silent)$") {
            if (!($file)) {
                $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $url" #"
            }
            else {
                $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $TEMP\$file" #"
            }
        }
        Write-Host -f DarkGray " β†’ $cmd"
        Invoke-Expression "$cmd"
    }
    # msi
    elseif ($file -match ".+.msi$") {
        Write-Host -f DarkGray (" β†’ msiexec /i " + "$file " + $iargs)
        Start-Process -Wait msiexec -ArgumentList /i,"$TEMP\$file", $iargs
        if ($regkey) {
            Set-ItemProperty -Path "$regkey" -Name "WindowsInstaller"  -Value "0"
        }
    }
    # exe
    elseif ($file -match ".+.exe$") {
        Write-Host -f DarkGray " β†’ $file $iargs"
        if ($iargs) {
            Start-Process -Wait "$TEMP\$file" -ArgumentList $iargs
        }
        else {
            Start-Process -Wait "$TEMP\$file"
        }
    }
    # other files
    elseif ($file) {

Modified dev/resetprefs.cmd from [454d73f68d] to [1b49b46f8b].

54
55
56
57
58
59
60
61

62
63
64
65
66
67
68
69
70
71
72
73
74
echo.
pause
exit

:NotRunning
echo Your personal files are in %PrefsFolder%
echo.
echo This will delete all settings of %ST2% and the cached files. 

echo If you want to save your bookmarks before, then quit now and come back later...
echo.
echo.
echo | set /p=Do you want to clear all settings of %ST2% now? [y/N]
set /P INPUT=%=%
If /I NOT '%INPUT%' == 'Y' exit

del %PrefsFolder%\*.*  /F /S /Q 1>nul
rd %PrefsFolder% /S /Q 
echo.
echo.
echo Your %ST2% settings have been deleted.
pause







|
>
|












54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
echo.
pause
exit

:NotRunning
echo Your personal files are in %PrefsFolder%
echo.
echo This will delete all settings of %ST2%, all cached files...
echo ...and the downloaded plug-ins. 
echo If you want to save your bookmarks before, then quit now and come back later!
echo.
echo.
echo | set /p=Do you want to clear all settings of %ST2% now? [y/N]
set /P INPUT=%=%
If /I NOT '%INPUT%' == 'Y' exit

del %PrefsFolder%\*.*  /F /S /Q 1>nul
rd %PrefsFolder% /S /Q 
echo.
echo.
echo Your %ST2% settings have been deleted.
pause