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

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


Check-in [de4013065e]

Overview
Comment:Unified the definitions for Make-Shortcut in @tasks. Moved the Python 2.7.13 GUID to $Python GUID, since it is used in regkey and Check-Pythoninstall. For the uninstall dismissed the batch variable %UsrFolder%, since it was used only once and can be derived from %installFolder%. This had also to be corrected in the uninstall script generation in install_python_gtk.ps1. In Resetprefs.cmd I changed the text to reflect that also the downloaded Gtk themes would be deleted. In uninstall.cmd I changed the rd command for the themes folder to use the correct rd syntax.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: de4013065e46f7da4c0dd187d7b513c1dff230c4
User & Date: Oliver on 2016-12-23 21:37:56
Other Links: manifest | tags
Context
2016-12-23
21:39
Temporary workaround for file browser plugin to avoid reloading. check-in: 147d87c1e1 user: Oliver tags: trunk
21:37
Unified the definitions for Make-Shortcut in @tasks. Moved the Python 2.7.13 GUID to $Python GUID, since it is used in regkey and Check-Pythoninstall. For the uninstall dismissed the batch variable %UsrFolder%, since it was used only once and can be derived from %installFolder%. This had also to be corrected in the uninstall script generation in install_python_gtk.ps1. In Resetprefs.cmd I changed the text to reflect that also the downloaded Gtk themes would be deleted. In uninstall.cmd I changed the rd command for the themes folder to use the correct rd syntax. check-in: de4013065e user: Oliver tags: trunk
21:36
Guard non-writeable gtk_dir / extra statusbar info. check-in: fdad9d9430 user: Oliver tags: trunk
Changes

Modified dev/install_python_gtk.ps1 from [864d0e4d45] to [6af7be9ecb].

13
14
15
16
17
18
19

20
21
22
23
24
25
26
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27







+








#-- defaults / parameters
[CmdletBinding()]            
Param(
  [string]$reinstall = "ask",
  [string]$TEMP = $env:TEMP,
  [string]$PYTHON = "C:\Python27",
  [string]$PythonGUID = "{4A656C6C-D24A-473F-9747-3A8D00907A03}", #Python 2.7.13
  [string]$StartMenu = "$env:USERPROFILE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs",
 #[string]$UsrFolder = $MyInvocation.MyCommand.Path -replace ("([\\/][^\\/]+){4}$",""),
  [string]$ProgramFiles = "%ProgramFiles(x86)%",
  [string]$AboutLink = "http://freshcode.club/projects/streamtuner2",
  [string]$VERSION = "2.2.0"
)

41
42
43
44
45
46
47
48
49


50
51
52

53
54
55
56
57
58
59
42
43
44
45
46
47
48


49
50
51
52

53
54
55
56
57
58
59
60







-
-
+
+


-
+







    $ProgramFiles = "%ProgramFiles%"
}
New-Variable -Name STREAMRIPPER -Option AllScope -Value "$ProgramFiles\Streamripper" #can be changed in Check-Prerequisites

#-- 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"
    title  = "Python 2.7.13"
    url    = "https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi"
    cmd    = ""
    iargs   = 'TARGETDIR="{PYTHON}" /qb-!'
    regkey = "$regPathLM\{9DA28CE5-0AA5-429E-86D8-686ED898C665}"
    regkey = "$regPathLM\$PythonGUID"
    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"
91
92
93
94
95
96
97
98










99
100
101
102
103
104
105
106





107
108
109
110





111
112
113



114

115
116
117
118




119
120
121
122




123
124
125
126




127
128
129
130






131
132
133
134





135
136
137
138
139
140
141
92
93
94
95
96
97
98

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

116
117
118
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
147
148
149
150
151
152

153
154
155
156
157
158
159

160
161
162
163
164
165
166
167
168

169
170
171
172
173
174
175
176
177
178
179
180







-
+
+
+
+
+
+
+
+
+
+







-
+
+
+
+
+



-
+
+
+
+
+



+
+
+
-
+



-
+
+
+
+



-
+
+
+
+



-
+
+
+
+



-
+
+
+
+
+
+



-
+
+
+
+
+







    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 ($t.found = (Get-ITPV "Streamripper")) {$STREAMRIPPER = $_found}} else {$STREAMRIPPER=""; continue;}'
    prescn = 'if ($optionalInstall) {if ($t.found = (Get-ITPV "Streamripper")) {$STREAMRIPPER = $t.found}} else {$STREAMRIPPER=""; continue;}'
  },
  @{
    title  = "Mutagen (ID3-Support)"
    url    = "mutagen" # no download url
    cmd    = "pip"
    iargs   = "--disable-pip-version-check"
    testpth= "{PYTHON}\Lib\site-packages\mutagen-1*py2.7.egg-info"
    is_opt = '($optionalInstall)'     
    prescn = 'if ($optionalInstall) {if ($t.found = (test-path -path $t.testpth)) {$t.found = $t.testpth}} else {continue}'
  },
  @{
    title  = "Uninstall script"
    cmd    = 'Create-Uninstallscript'
  },
  @{
    title  = "Desktop shortcut"
    cmd    = 'Make-Shortcut -dir $Home\Desktop -name Streamtuner2.lnk -target $PYTHON\pythonw.exe -arg $UsrFolder\bin\streamtuner2'
    cmd    = 'Make-Shortcut @task'
       dir = "$Home\Desktop"
      name = "Streamtuner2.lnk"
    target = "$PYTHON\pythonw.exe"
       arg = "$UsrFolder\bin\streamtuner2"
  },
  @{
    title  = "Startmenu shortcut"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2" -name Streamtuner2.lnk -target $PYTHON\pythonw.exe -arg $UsrFolder\bin\streamtuner2'
    cmd    = 'Make-Shortcut @task'
       dir = "$StartMenu\Streamtuner2"
      name = "Streamtuner2.lnk"
    target = "$PYTHON\pythonw.exe"
       arg = "$UsrFolder\bin\streamtuner2"
  },
  @{
    title  = "Startmenu help.chm"
    cmd    = 'Make-Shortcut @task'
       dir = "$StartMenu\Streamtuner2"
      name = "Help.lnk"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2" -name Help.lnk -target $UsrFolder\share\streamtuner2\help\help.chm'
    target = "$UsrFolder\share\streamtuner2\help\help.chm"
  },
  @{
    title  = "Startmenu uninstall"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2" -name Uninstall.lnk -target $UninstallPath'
    cmd    = 'Make-Shortcut @task'
       dir = "$StartMenu\Streamtuner2"
      name = "Uninstall.lnk"
    target = "$UninstallPath"
  },
  @{
    title  = "Startmenu Internet"
    cmd    = 'Make-Shortcut -dir "$StartMenu\Streamtuner2" -name "Streamtuner2 on the Web.lnk" -target "$AboutLink"'
    cmd    = 'Make-Shortcut @task'
       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'
    cmd    = 'Make-Shortcut @task'
       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"'
    cmd    = 'Make-Shortcut @task'
       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"'
    cmd    = 'Make-Shortcut @task'
       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"
161
162
163
164
165
166
167
168

169
170
171
172
173
174
175
200
201
202
203
204
205
206

207
208
209
210
211
212
213
214







-
+







|             __/\\\______\//\\\________\/\\\_________/\\\/___________        |
|              _\///\\\\\\\\\\\/_________\/\\\________/\\\\\\\\\\\\\\\_       |
|               ___\///////////___________\///________\///////////////__      |
|                                                                             |
|                                                                             |
|    Streamtuner2 for Windows                               Version $VERSION     |
|                                                                             |
|    Installer for Python 2.7.12 & Gtk 2.24.2                                 |
|    Installer for Python 2.7.13 & Gtk 2.24.2                                 |
 โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“ 
"@
}
function Ask-First {
    Write-Host ""
    if ((Ask "Do you want to install Streamtuner2 and its Python dependencies now? [Y/n] ") -notmatch "^[yY]|^$") {
        #$tasks = $tasks[7..($tasks.length-1)]; return 0,0
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
259
260
261
262
263
264
265

266
267
268
269
270
271
272







-







    [CmdletBinding()]
    param()
    # update uninstall.cmd with current values
    $installFolder = $usrFolder.substring(0,$usrFolder.LastIndexOf('\'))
    $UninstallScript = Get-Content -Path $UninstallPath
    Out-File -FilePath $UninstallPath -Encoding ascii -InputObject @"
@set installFolder=$installFolder
@set usrFolder=$usrFolder
@set Python=$PYTHON
@set StreamripperFolder=$STREAMRIPPER
"@
    $UninstallScript | %{if ($_ -notmatch "@set") {Out-File -FilePath $UninstallPath -Encoding ascii -Append -InputObject $_}} 
    # registry entry for ST2
    Remove-Item -Path $regPathCU\Streamtuner2 2> $null        
    New-Item $regPathCU -Name "Streamtuner2" > $null
285
286
287
288
289
290
291
292
293


294
295
296
297
298
299
300
323
324
325
326
327
328
329


330
331
332
333
334
335
336
337
338







-
-
+
+







    }
}

#-- Check if previous Python 2.7 installation exists
function Check-PythonInstall {
    $PythonInstalledPath = Get-ITPV('Python\PythonCore\2.7\InstallPath\')
    
    #-- if Python 2.7.12 installed, reuse installation folder
    if (Get-Item -path "$regPathLM\{9DA28CE5-0AA5-429E-86D8-686ED898C665}" 2> $null ) {
    #-- if Python 2.7.13 installed, reuse installation folder
    if (Get-Item -path "$regPathLM\$PythonGUID" 2> $null ) {
        $PYTHON = $pythonInstalledPath -replace "\\$", ""
    }

    #-- older 2.7 version found
    else {
        if ($PythonInstalledPath) {
            Write-Host ""
373
374
375
376
377
378
379


380
381
382
383
384
385
386
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426







+
+







#  ยท $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) })) }

#    $iargs = $iargs -replace "{PYTHON}","$PYTHON"

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

    # print step
    if ($title -match "\d+\.\d+") { $title = "Installing $title" }
    Write-Host -b DarkBlue "`n $title `n"
    chdir($TEMP);
407
408
409
410
411
412
413

414





415
416
417
418

419
420
421

422
423
424
425
426
427
428
447
448
449
450
451
452
453
454

455
456
457
458
459
460
461
462

463
464
465

466
467
468
469
470
471
472
473







+
-
+
+
+
+
+



-
+


-
+







        $wget.DownloadFile($url, "$TEMP\$file");
    }

    # run shorthand or custom command
    if ($cmd) {
        if (Test-Path $PYTHON) { chdir($PYTHON) }
        if ($cmd -eq "pip") {
            if (!($file)) {
            $cmd = "& `"$PYTHON\Scripts\pip.exe`" install $TEMP\$file", $iargs #"
                $cmd = "& `"$PYTHON\Scripts\pip.exe`" install $url", $iargs
            }
            else {
                $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" #"
                $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $url", $iargs 
            }
            else {
                $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $TEMP\$file" #"
                $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $TEMP\$file", $iargs  
            }
        }
        Write-Host -f DarkGray " โ†’ $cmd"
        Invoke-Expression "$cmd"
    }
    # msi
    elseif ($file -match ".+.msi$") {

Modified dev/resetprefs.cmd from [1b49b46f8b] to [5ddc3b8698].

55
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70
71
72
73
74
75
55
56
57
58
59
60
61

62
63
64
65
66
67
68
69
70
71
72
73
74
75







-
+













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 ...the downloaded plug-ins and Gtk themes. 
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

Modified dev/uninstall.cmd from [a1f67aab14] to [5e61c36351].

1
2
3
4
5
6
7
8
9
1

2
3
4
5
6
7
8

-







@set installFolder=Do_not_Change
@set usrFolder=Do_not_Change
@set Python=Do_not_Change
@set StreamripperFolder=Do_not_Change
@echo off
set ST2=Streamtuner2

>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55







-
+







echo.
echo.

setlocal enableextensions
cd /d "%~dp0"

if NOT "%cd%" == "%TEMP%" (
	copy "%UsrFolder%\share\streamtuner2\dev\uninstall.cmd" "%temp%\STuninst.cmd" 
	copy "%installFolder%\usr\share\streamtuner2\dev\uninstall.cmd" "%temp%\STuninst.cmd" 
	"%temp%\STuninst.cmd"
)

tasklist /fi "Imagename eq python.exe" /fi "Windowtitle eq %ST2%*" /v | find "%ST2%" >nul
if %errorlevel% EQU 0 goto ST2isRunning
tasklist /fi "Imagename eq pythonw.exe" /fi "Windowtitle eq %ST2%*" /v | find "%ST2%" >nul
if %errorlevel% EQU 0 goto ST2isRunning
106
107
108
109
110
111
112
113

114
115
116
117
118




119
120
121
122
123
124
125
126
127
128
129
130

131

132
133

134


135
136
137
138
139
140
141
105
106
107
108
109
110
111

112
113
114
115
116
117
118
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







-
+





+
+
+
+










-

+
-
+

-
+

+
+







set INPUT=

:uninstallPython
if '%Pythonrun%' EQU 'Y' (
	echo Skipping uninstall of Python
	goto uninstallST2
)
echo | set /p=Do you want to keep your Python 2.7.12 installation? [Y/n]
echo | set /p=Do you want to keep your Python 2.7.13 installation? [Y/n]
set /P INPUT=%=%
If /I '%INPUT%' == 'N' (
	echo Uninstalling Python...
	echo Removing PIL 1.1.7
	"%Python%\RemovePIL.exe" -u "%Python%\PIL-wininst.log"
	if exist "%Python%\Lib\site-packages\mutagen-1*py2.7.egg-info" (
		echo Removing Mutagen
		"%Python%\scripts\pip.exe" uninstall mutagen -y -q
	)
	echo Removing pyquery 1.2.17
	"%Python%\scripts\pip.exe" uninstall pyquery -y -q
	echo Removing LXML 2.3
	"%Python%\scripts\pip.exe" uninstall lxml -y -q
	echo Removing requests
	"%Python%\scripts\pip.exe" uninstall requests -y -q
	echo Removing cssselect
	"%Python%\scripts\pip.exe" uninstall cssselect -y -q
	echo Removing PyGtk 2.24.2
	MsiExec.exe /x{09F82967-D26B-48AC-830E-33191EC177C8} /qb-!
	echo Removing Python 2.7.12
	reg delete %RegUninstallBase%\{09F82967-D26B-48AC-830E-33191EC177C8} /f 1>nul 2>&1
	echo Removing Python 2.7.13
	MsiExec.exe /x{9DA28CE5-0AA5-429E-86D8-686ED898C665} /qb-!
	MsiExec.exe /x{4A656C6C-D24A-473F-9747-3A8D00907A03} /qb-!
	reg delete HKCU\SOFTWARE\Python\PythonCore\2.7 /f 1>nul 2>&1
	reg delete %RegUninstallBase%\{9DA28CE5-0AA5-429E-86D8-686ED898C665} /f 1>nul 2>&1
	reg delete %RegUninstallBase%\{4A656C6C-D24A-473F-9747-3A8D00907A03} /f 1>nul 2>&1
	rd "%Python%"  /S /Q
	echo Removing installed Gtk2-Themes
	rd "%APPDATA%\streamtuner2\themes" /S /Q
)

:uninstallST2 
echo Removing %ST2%...
rd "%installFolder%" /S /Q

echo Removing shortcuts...