Skip to content

Commit

Permalink
v1.4.12.43 - install directory
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdelsol committed Mar 25, 2024
1 parent 1196d7a commit a6ae4cd
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[^1]: External EPG doesn't work with **local** m3u accounts.
# Downloads
[<img src="https://custom-icon-badges.demolab.com/badge/Sfvip All v1.4.12.42-informational?logo=download-cloud&logoSource=feather&logoColor=white&style=flat-square" height="35"><img src="https://img.shields.io/badge/x64-informational?logo=Windows10&logoColor=lightblue&style=flat-square" height="35"><img src="https://custom-icon-badges.demolab.com/badge/clean-brightgreen?logo=shield-check&logoColor=white&style=flat-square" height="35">](https://github.com/sebdelsol/sfvip-all/releases/download/Sfvip.All.1.4.12.42/Install.Sfvip.All.1.4.12.42.x64.exe)
<sup><sup>_by MS Defender • 1.1.24020.9 • 1.407.627.0_</sup></sup>
<sup><sup>_by MS Defender • 1.1.24020.9 • 1.407.703.0_</sup></sup>

[<img src="https://custom-icon-badges.demolab.com/badge/Sfvip All v1.4.12.42-informational?logo=download-cloud&logoSource=feather&logoColor=white&style=flat-square" height="35"><img src="https://img.shields.io/badge/x86-informational?logo=Windows10&logoColor=lightblue&style=flat-square" height="35"><img src="https://custom-icon-badges.demolab.com/badge/clean-brightgreen?logo=shield-check&logoColor=white&style=flat-square" height="35">](https://github.com/sebdelsol/sfvip-all/releases/download/Sfvip.All.1.4.12.42/Install.Sfvip.All.1.4.12.42.x86.exe)
<sup><sup>_by MS Defender • 1.1.24020.9 • 1.407.627.0_</sup></sup>
Expand Down Expand Up @@ -43,7 +43,7 @@ You'll find them in the app folder:
<kbd><img src="resources/readme/logs.png"></kbd>

# Build
[![version](https://custom-icon-badges.demolab.com/badge/Build%201.4.12.42-informational?logo=github)](/build_config.py#L27)
[![version](https://custom-icon-badges.demolab.com/badge/Build%201.4.12.43-informational?logo=github)](/build_config.py#L27)
[![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc%208.5k-informational?logo=file-code)](https://api.codetabs.com/v1/loc/?github=sebdelsol/sfvip-all)
[![Ruff](https://custom-icon-badges.demolab.com/badge/Ruff-informational?logo=ruff-color)](https://docs.astral.sh/ruff/)
[![Python](https://custom-icon-badges.demolab.com/badge/Python%203.11.8-linen?logo=python-color)](https://www.python.org/downloads/release/python-3118/)
Expand Down
5 changes: 5 additions & 0 deletions build/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.4.12.43
* Option to modify _Sfvip All_ install directory.
* When updating the Install directory won't be asked again
and _Sfvip All_ will be automatically relaunched.

## 1.4.12.42
* Fix Minor bugs.
* Better translations.
Expand Down
2 changes: 1 addition & 1 deletion build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Build:
main: ClassVar = "sfvip_all.py"
company: ClassVar = "sebdelsol"
name: ClassVar = "Sfvip All"
version: ClassVar = "1.4.12.42"
version: ClassVar = "1.4.12.43"
dir: ClassVar = "build"
enable_console: ClassVar = False
logs_dir: ClassVar = "../logs"
Expand Down
62 changes: 59 additions & 3 deletions dev/tools/nsis/template.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ VIAddVersionKey "ProductName" "{{name}}"
VIAddVersionKey "CompanyName" "{{company}}"

!include "MUI2.nsh" ; modern UI
!include "FileFunc.nsh" ; GetParameters and GetOptions
Name "{{name}} {{version}} {{bitness}}"
OutFile "{{installer}}"
RequestExecutionLevel user
Expand All @@ -18,25 +19,47 @@ ShowUninstDetails hide
!define MUI_ICON "{{dist}}\{{ico}}"
!define MUI_UNICON "{{dist}}\{{ico}}"

; -------------
; directory page
; -------------
!define MUI_PAGE_CUSTOMFUNCTION_PRE "SetInstDir"
!insertmacro MUI_PAGE_DIRECTORY

; -------------
; install pages
; -------------
!define MUI_PAGE_CUSTOMFUNCTION_PRE "UninstallOldVersionIfNeeded"
Page Custom AppRunningPage AppRunningPageFinalize
!insertmacro MUI_PAGE_INSTFILES

; -------------
; finish pages
; -------------
{% if finish_page %}
Function RunApp
SetOutPath "$InstDir\{{dist}}" ; exe working directory
Exec "$InstDir\{{dist}}\{{name}}.exe"
FunctionEnd

Function AbortFinishPage
; Abort if /AUTORUN=yes
${GetParameters} $0
${GetOptions} $0 "/AUTORUN=" $1
ClearErrors
${If} $1 == "yes"
Call RunApp
Abort
${Endif}
FunctionEnd

!define MUI_PAGE_CUSTOMFUNCTION_PRE "AbortFinishPage"
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION "RunApp"
!insertmacro MUI_PAGE_FINISH
{% endif %}

; ---------------
; uninstall pages
; uninstall page
; ---------------
UninstPage Custom un.AppRunningPage un.AppRunningPageFinalize
!insertmacro MUI_UNPAGE_INSTFILES
Expand All @@ -56,7 +79,6 @@ LangString retry ${LANG_{{lang.upper}}} "{{lang.retry}}"
{% endfor %}

; Cmd argument /LANG= to force the language (case insensitive)
!include "FileFunc.nsh" ; GetParameters and GetOptions
!include "StrFunc.nsh" ; StrCase
${Using:StrFunc} StrCase

Expand Down Expand Up @@ -194,4 +216,38 @@ Section "Uninstall"
{% endif %}
Delete "$InstDir\uninstall.exe"
Delete "$SMPROGRAMS\{{name}} {{bitness}}.lnk"
SectionEnd
SectionEnd

; --------------
; Set install directory if in the registry
; --------------
Function SetInstDir
; check in the registry for already installed version
ReadRegStr $0 HKCU "${UNINSTALL_KEY}" "InstallLocation"
${If} ${Errors}
ClearErrors
${Else}
StrCpy $InstDir $0
${Endif}
; no directory page if /AUTOINSTDIR=yes
${GetParameters} $0
${GetOptions} $0 "/AUTOINSTDIR=" $1
ClearErrors
${If} $1 == "yes"
Abort
${Endif}
FunctionEnd

; --------------
; Uninstall version stored in the registry if different from instdir
; --------------
Function UninstallOldVersionIfNeeded
ReadRegStr $0 HKCU "${UNINSTALL_KEY}" "InstallLocation"
${If} ${Errors}
ClearErrors
${ElseIf} $InstDir != $0
${If} ${FileExists} "$0\uninstall.exe"
ExecWait "$0\uninstall.exe /S"
${EndIf}
${Endif}
FunctionEnd
2 changes: 1 addition & 1 deletion src/sfvip/app_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _update_exe(self, update: AppUpdate) -> Path:
def _install(self, update_exe: Path) -> None:
# replace current process with the update exe
def launch() -> None:
update_exe_args = update_exe.name, f"/LANG={LOC.language}"
update_exe_args = update_exe.name, f"/LANG={LOC.language}", "/AUTOINSTDIR=yes", "/AUTORUN=yes"
logger.info("Launch %s %s", *update_exe_args)
os.execl(update_exe, *update_exe_args)

Expand Down
5 changes: 4 additions & 1 deletion src/sfvip/ui/infos.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,12 @@ def _app_version_tooltip(app_info: AppInfo) -> Style:
lines.extend(("", f"{prefix}{text}:"))
case "*":
lines.append(f"{tab}- {text}")
case _:
line = f"{first} {text}"
raise ValueError
except ValueError:
if line:
lines.append(f"{tab}{line}")
lines.append(f"{tab} {line}")

except (PermissionError, FileNotFoundError, OSError):
pass
Expand Down

0 comments on commit a6ae4cd

Please sign in to comment.