mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
updated readme
This commit is contained in:
parent
c1b0f177bf
commit
dbf8a348df
25
README.md
25
README.md
@ -10,24 +10,13 @@ Following are the features that currently spotube offers:
|
||||
- Open Source
|
||||
- No telementry, diagnostics or user data collection
|
||||
- Lightweight & resource friendly
|
||||
- Near native performance (Thanks to Flutter+Skia)
|
||||
- Native performance (Thanks to Flutter+Skia)
|
||||
- Playback control is on user's machine instead of server based
|
||||
- Small size & less data hungry
|
||||
- No spotify or youtube ads since it uses all public & free APIs (But it's recommended to support the creators by watching/liking/subscribing to the artists youtube channel or add as favourite track in spotify. Mostly buying spotify premium is the best way to support their valuable creations)
|
||||
- Lyrics
|
||||
- Downloadable track (WIP)
|
||||
|
||||
## Requirements (Linux🐧 only)
|
||||
|
||||
Don't worry **spotify premium isn't required**😱. But some extra packages are required.
|
||||
|
||||
- [MPV](https://mpv.io/installation/) player for playing the actual audio
|
||||
- [yt-dlp](https://github.com/yt-dlp/yt-dlp) for streaming the audio from youtube
|
||||
|
||||
Now, Install youtube-dl from
|
||||
|
||||
- official github repo: https://github.com/yt-dlp/yt-dlp#installation (recommended)
|
||||
|
||||
## Installation
|
||||
|
||||
I'm always releasing newer versions of binary of the software each 2-3 month with minor changes & each 6-8 month with major changes. Grab the binaries
|
||||
@ -36,18 +25,18 @@ All the binaries are located in the [releases](https://github.com/krtirtho/spotu
|
||||
|
||||
### Windows
|
||||
|
||||
Extract the **`Spotube-winx64-v<version>.zip`** & double click on **`install.bat`** & follow along the installer
|
||||
Extract the **`Spotube-windows-x86_64-setup.exe`** & double click on **`install.bat`** & follow along the installer
|
||||
|
||||
### Linux
|
||||
|
||||
- **Ubuntu/Debian**
|
||||
Make sure you've fulfilled all the requirements
|
||||
- #### Ubuntu/Debian
|
||||
```bash
|
||||
sudo apt install spotube_linux-x86_64-v<version>.deb
|
||||
sudo apt install spotube-linux-x86_64.deb
|
||||
or
|
||||
sudo dpkg -i spotube_linux-x86_64-v<version>.deb
|
||||
sudo dpkg -i spotube-linux-x86_64.deb
|
||||
```
|
||||
- **Others**: Navigate to the downloaded **`Spotube_linux-x86_64-v<version>.AppImage`**
|
||||
- #### Others:
|
||||
Navigate to the downloaded **`Spotube_linux-x86_64.AppImage`**
|
||||
file & double click to run it
|
||||
|
||||
**I'll/try to upload the package binaries to linux debian/arch/ubuntu/snap/flatpack/redhat/chocolatey stores or software centers or repositories**
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 732 KiB After Width: | Height: | Size: 759 KiB |
@ -1 +0,0 @@
|
||||
{"appName":"spotube"}
|
Binary file not shown.
Before Width: | Height: | Size: 75 KiB |
@ -1,6 +0,0 @@
|
||||
const path = require("path");
|
||||
// Fix so that linux resources are found correctly
|
||||
// since webpack will bundle them such that the expected path is /dist from cwd
|
||||
process.chdir(path.resolve(path.dirname(process.execPath)));
|
||||
// Now start loading the actual bundle
|
||||
require("./dist");
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"distPath": "./index.js"
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Spotube
|
||||
Exec=/usr/bin/spotube
|
||||
Icon=icon
|
||||
Comment=A music streaming app combining the power of Spotify & Youtube
|
||||
Terminal=false
|
||||
Categories=Music;
|
@ -1,77 +0,0 @@
|
||||
# Don't edit this file without understanding, this can lead to major damage to the system
|
||||
# Use uninstall.bat to remove Spotube
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
|
||||
if(Test-Path "$ScriptDir\qode.exe"){
|
||||
$WannaRemove = Read-Host -Prompt "Are you sure to uninstall?[y]Yes/[n]No"
|
||||
$WannaRemove = $WannaRemove.Trim().ToLower()
|
||||
if($WannaRemove -eq "y"){
|
||||
Write-Output "Removing all the contents"
|
||||
Get-ChildItem $ScriptDir -Recurse | Remove-Item
|
||||
|
||||
# now deleting mpv player
|
||||
$DeleteMpv = Read-Host -Prompt "Do you want to delete mpv player?[y]Yes/[n]No"
|
||||
if ($DeleteMpv -eq "y") {
|
||||
$Mpv_Dir = "$Env:ProgramData\Spotube"
|
||||
Write-Output "Deleting Mpv player"
|
||||
Remove-Item -Path $Mpv_Dir -Recurse
|
||||
Write-Output "Deleted Mpv player"
|
||||
Write-Output "Removing environment variables"
|
||||
# Get it
|
||||
$pathMachine = [System.Environment]::GetEnvironmentVariable('PATH','Machine')
|
||||
$pathUser = [System.Environment]::GetEnvironmentVariable('PATH','User')
|
||||
# Remove unwanted elements
|
||||
$pathMachine = ($pathMachine.Split(';') | Where-Object { $_ -ne "$Mpv_Dir\mpv" }) -join ';'
|
||||
$pathUser = ($pathUser.Split(';') | Where-Object { $_ -ne "$Mpv_Dir\mpv" }) -join ';'
|
||||
# Set it
|
||||
[System.Environment]::SetEnvironmentVariable('PATH', $pathMachine, 'Machine')
|
||||
[System.Environment]::SetEnvironmentVariable('PATH', $pathUser, 'User')
|
||||
}
|
||||
elseif($DeleteMpv -eq "n") {
|
||||
Write-Output "Ok, keeping mpv player"
|
||||
}
|
||||
else{
|
||||
throw "Wrong Option, use either 'y' or 'n', aborting..."
|
||||
}
|
||||
|
||||
$DeleteData = Read-Host -Prompt "Do you want to delete all data & caches?[y]Yes/[n]No"
|
||||
$DeleteData = $DeleteData.Trim().ToLower()
|
||||
if ($DeleteData -eq "y") {
|
||||
Write-Output "Deleting data & caches"
|
||||
Remove-Item -Path "$Home\.config\spotube" -Recurse
|
||||
Remove-Item -Path "$Home\.cache\spotube" -Recurse
|
||||
Write-Output "Deleted caches & data"
|
||||
}
|
||||
elseif($DeleteData -eq "n") {
|
||||
Write-Output "Ok, keeping those"
|
||||
}
|
||||
else{
|
||||
throw "Wrong Option, use either 'y' or 'n', aborting..."
|
||||
}
|
||||
# removing all the shortcuts
|
||||
$shortcut_paths = @(
|
||||
"$HOME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Spotube.lnk",
|
||||
"$HOME\Desktop\Spotube.lnk"
|
||||
)
|
||||
|
||||
foreach($shortcut in $shortcut_paths){
|
||||
if(Test-Path $shortcut){
|
||||
Write-Output "Deleting Shortcut: $shortcut"
|
||||
Remove-Item -Path $shortcut
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Write-Output "Uninstall complete, just delete the Spotube folder now"
|
||||
Write-Output "Will miss you💕!"
|
||||
}
|
||||
elseif($WannaRemove -eq "n"){
|
||||
Write-Output "Thank god you didn't, quitting..."
|
||||
}
|
||||
else{
|
||||
throw "Wrong Option, use either 'y' or 'n', aborting..."
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw "Script isn't being executed desired location, aborting for abuse"
|
||||
}
|
@ -1,299 +0,0 @@
|
||||
param (
|
||||
[String]$CWD = (Get-Location).Path
|
||||
)
|
||||
echo "Script Location: " + (Get-Location).Path
|
||||
echo "Install PATH: $CWD"
|
||||
Set-Location -Path $CWD
|
||||
echo "Script new Location: " + (Get-Location).Path
|
||||
function Check-7z {
|
||||
$7zdir = $CWD + "\7z"
|
||||
if (-not (Test-Path ($7zdir + "\7za.exe")))
|
||||
{
|
||||
$download_file = $CWD + "\7z.zip"
|
||||
Write-Host "Downloading 7z" -ForegroundColor Green
|
||||
Invoke-WebRequest -Uri "https://download.sourceforge.net/sevenzip/7za920.zip" -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox -OutFile $download_file
|
||||
Write-Host "Extracting 7z" -ForegroundColor Green
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($download_file, $7zdir)
|
||||
Remove-Item -Force $download_file
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "7z already exist. Skipped download" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
function Check-PowershellVersion {
|
||||
$version = $PSVersionTable.PSVersion.Major
|
||||
Write-Host "Checking Windows PowerShell version -- $version" -ForegroundColor Green
|
||||
if ($version -le 2)
|
||||
{
|
||||
Write-Host "Using Windows PowerShell $version is unsupported. Upgrade your Windows PowerShell." -ForegroundColor Red
|
||||
throw
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Youtubedl {
|
||||
$youtubedl = $CWD + "\youtube-dl.exe"
|
||||
$is_exist = Test-Path $youtubedl
|
||||
return $is_exist
|
||||
}
|
||||
|
||||
function Check-Mpv {
|
||||
$mpv = $CWD + "\mpv.exe"
|
||||
$is_exist = Test-Path $mpv
|
||||
return $is_exist
|
||||
}
|
||||
|
||||
function Download-Mpv ($filename) {
|
||||
echo "MPV Filename: $filename"
|
||||
Write-Host "Downloading" $filename -ForegroundColor Green
|
||||
$global:progressPreference = 'Continue'
|
||||
$link = "https://download.sourceforge.net/mpv-player-windows/" + $filename
|
||||
Invoke-WebRequest -Uri $link -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox -OutFile $filename
|
||||
}
|
||||
|
||||
function Download-Youtubedl ($version) {
|
||||
Write-Host "Downloading youtube-dl ($version)" -ForegroundColor Green
|
||||
$global:progressPreference = 'Continue'
|
||||
$link = "https://yt-dl.org/downloads/" + $version + "/youtube-dl.exe"
|
||||
Invoke-WebRequest -Uri $link -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox -OutFile "youtube-dl.exe"
|
||||
}
|
||||
|
||||
function Extract-Mpv ($file) {
|
||||
$7za = $CWD + "\7z\7za.exe"
|
||||
Write-Host "Extracting" $file -ForegroundColor Green
|
||||
echo "MPV Extract Path: $file"
|
||||
& $7za x -y $file
|
||||
}
|
||||
|
||||
function Get-Latest-Mpv($Arch) {
|
||||
$i686_link = "https://sourceforge.net/projects/mpv-player-windows/rss?path=/32bit"
|
||||
$x86_64_link = "https://sourceforge.net/projects/mpv-player-windows/rss?path=/64bit"
|
||||
$link = ''
|
||||
switch ($Arch)
|
||||
{
|
||||
i686 { $link = $i686_link}
|
||||
x86_64 { $link = $x86_64_link }
|
||||
}
|
||||
Write-Host "Fetching RSS feed for mpv" -ForegroundColor Green
|
||||
$result = [xml](New-Object System.Net.WebClient).DownloadString($link)
|
||||
$latest = $result.rss.channel.item.link[0]
|
||||
$filename = $latest.split("/")[-2]
|
||||
return [System.Uri]::UnescapeDataString($filename)
|
||||
}
|
||||
|
||||
function Get-Latest-Youtubedl {
|
||||
$link = "https://yt-dl.org/downloads/latest/youtube-dl.exe"
|
||||
Write-Host "Fetching RSS feed for youtube-dl" -ForegroundColor Green
|
||||
$global:progressPreference = 'silentlyContinue'
|
||||
$resp = Invoke-WebRequest $link -MaximumRedirection 0 -ErrorAction Ignore -UseBasicParsing
|
||||
$redirect_link = $resp.Headers.Location
|
||||
$version = $redirect_link.split("/")[4]
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-Arch {
|
||||
# Reference: http://superuser.com/a/891443
|
||||
$FilePath = [System.IO.Path]::Combine($CWD, 'mpv.exe')
|
||||
[int32]$MACHINE_OFFSET = 4
|
||||
[int32]$PE_POINTER_OFFSET = 60
|
||||
|
||||
[byte[]]$data = New-Object -TypeName System.Byte[] -ArgumentList 4096
|
||||
$stream = New-Object -TypeName System.IO.FileStream -ArgumentList ($FilePath, 'Open', 'Read')
|
||||
$stream.Read($data, 0, 4096) | Out-Null
|
||||
|
||||
# DOS header is 64 bytes, last element, long (4 bytes) is the address of the PE header
|
||||
[int32]$PE_HEADER_ADDR = [System.BitConverter]::ToInt32($data, $PE_POINTER_OFFSET)
|
||||
[int32]$machineUint = [System.BitConverter]::ToUInt16($data, $PE_HEADER_ADDR + $MACHINE_OFFSET)
|
||||
|
||||
$result = "" | select FilePath, FileType
|
||||
$result.FilePath = $FilePath
|
||||
|
||||
switch ($machineUint)
|
||||
{
|
||||
0 { $result.FileType = 'Native' }
|
||||
0x014c { $result.FileType = 'i686' } # 32bit
|
||||
0x0200 { $result.FileType = 'Itanium' }
|
||||
0x8664 { $result.FileType = 'x86_64' } # 64bit
|
||||
}
|
||||
|
||||
$result
|
||||
}
|
||||
|
||||
function ExtractGitFromFile {
|
||||
$stripped = .\mpv --no-config | select-string "mpv" | select-object -First 1
|
||||
$pattern = "-g([a-z0-9-]{7})"
|
||||
$bool = $stripped -match $pattern
|
||||
return $matches[1]
|
||||
}
|
||||
|
||||
function ExtractGitFromURL($filename) {
|
||||
$pattern = "-git-([a-z0-9-]{7})"
|
||||
$bool = $filename -match $pattern
|
||||
return $matches[1]
|
||||
}
|
||||
|
||||
function ExtractDateFromFile {
|
||||
$date = (Get-Item ./mpv.exe).LastWriteTimeUtc
|
||||
$day = $date.Day.ToString("00")
|
||||
$month = $date.Month.ToString("00")
|
||||
$year = $date.Year.ToString("0000")
|
||||
return "$year$month$day"
|
||||
}
|
||||
|
||||
function ExtractDateFromURL($filename) {
|
||||
$pattern = "mpv-[xi864_]*-([0-9]{8})-git-([a-z0-9-]{7})"
|
||||
$bool = $filename -match $pattern
|
||||
return $matches[1]
|
||||
}
|
||||
|
||||
function Test-Admin
|
||||
{
|
||||
$user = [Security.Principal.WindowsIdentity]::GetCurrent();
|
||||
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
|
||||
}
|
||||
|
||||
function Upgrade-Mpv {
|
||||
$need_download = $false
|
||||
$remoteName = ""
|
||||
$arch = ""
|
||||
|
||||
if (Check-Mpv) {
|
||||
$arch = (Get-Arch).FileType
|
||||
$remoteName = Get-Latest-Mpv $arch
|
||||
$localgit = ExtractGitFromFile
|
||||
$localdate = ExtractDateFromFile
|
||||
$remotegit = ExtractGitFromURL $remoteName
|
||||
$remotedate = ExtractDateFromURL $remoteName
|
||||
if ($localgit -match $remotegit)
|
||||
{
|
||||
if ($localdate -match $remotedate)
|
||||
{
|
||||
Write-Host "You are already using latest mpv build -- $remoteName" -ForegroundColor Green
|
||||
$need_download = $false
|
||||
}
|
||||
else {
|
||||
Write-Host "Newer mpv build available" -ForegroundColor Green
|
||||
$need_download = $true
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "Newer mpv build available" -ForegroundColor Green
|
||||
$need_download = $true
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "mpv doesn't exist. " -ForegroundColor Green -NoNewline
|
||||
$result = Read-KeyOrTimeout "Proceed with downloading? [Y/n] (default=y)" "Y"
|
||||
Write-Host ""
|
||||
|
||||
if ($result -eq "Y") {
|
||||
$need_download = $true
|
||||
if (Test-Path (Join-Path $env:windir "SysWow64")) {
|
||||
Write-Host "Detecting System Type is 64-bit" -ForegroundColor Green
|
||||
$arch = "x86_64"
|
||||
}
|
||||
else {
|
||||
Write-Host "Detecting System Type is 32-bit" -ForegroundColor Green
|
||||
$arch = "i686"
|
||||
}
|
||||
$remoteName = Get-Latest-Mpv $arch
|
||||
}
|
||||
else {
|
||||
$need_download = $false
|
||||
}
|
||||
}
|
||||
|
||||
if ($need_download) {
|
||||
Download-Mpv $remoteName
|
||||
Check-7z
|
||||
Extract-Mpv $remoteName
|
||||
}
|
||||
}
|
||||
|
||||
function Upgrade-Youtubedl {
|
||||
$need_download = $false
|
||||
$latest_release = Get-Latest-Youtubedl
|
||||
|
||||
if (Check-Youtubedl) {
|
||||
if ((.\youtube-dl --version) -match ($latest_release)) {
|
||||
Write-Host "You are already using latest youtube-dl -- $latest_release" -ForegroundColor Green
|
||||
$need_download = $false
|
||||
}
|
||||
else {
|
||||
Write-Host "Newer youtube-dl build available" -ForegroundColor Green
|
||||
$need_download = $true
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "youtube-dl doesn't exist. " -ForegroundColor Green -NoNewline
|
||||
$result = Read-KeyOrTimeout "Proceed with downloading? [Y/n] (default=y)" "Y"
|
||||
Write-Host ""
|
||||
|
||||
if ($result -eq 'Y') {
|
||||
$need_download = $true
|
||||
}
|
||||
else {
|
||||
$need_download = $false
|
||||
}
|
||||
}
|
||||
|
||||
if ($need_download) {
|
||||
Download-Youtubedl $latest_release
|
||||
}
|
||||
}
|
||||
|
||||
function Read-KeyOrTimeout ($prompt, $key){
|
||||
$seconds = 20
|
||||
$startTime = Get-Date
|
||||
$timeOut = New-TimeSpan -Seconds $seconds
|
||||
|
||||
Write-Host "$prompt " -ForegroundColor Green
|
||||
|
||||
# Basic progress bar
|
||||
[Console]::CursorLeft = 0
|
||||
[Console]::Write("[")
|
||||
[Console]::CursorLeft = $seconds + 2
|
||||
[Console]::Write("]")
|
||||
[Console]::CursorLeft = 1
|
||||
|
||||
while (-not [System.Console]::KeyAvailable) {
|
||||
$currentTime = Get-Date
|
||||
Start-Sleep -s 1
|
||||
Write-Host "#" -ForegroundColor Green -NoNewline
|
||||
if ($currentTime -gt $startTime + $timeOut) {
|
||||
Break
|
||||
}
|
||||
}
|
||||
if ([System.Console]::KeyAvailable) {
|
||||
$response = [System.Console]::ReadKey($true).Key
|
||||
}
|
||||
else {
|
||||
$response = $key
|
||||
}
|
||||
return $response.ToString()
|
||||
}
|
||||
|
||||
#
|
||||
# Main script entry point
|
||||
#
|
||||
if (Test-Admin) {
|
||||
Write-Host "Running script with administrator privileges" -ForegroundColor Yellow
|
||||
}
|
||||
else {
|
||||
Write-Host "Running script without administrator privileges" -ForegroundColor Red
|
||||
}
|
||||
|
||||
try {
|
||||
Check-PowershellVersion
|
||||
# Sourceforge only support TLS 1.2
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
Upgrade-Mpv
|
||||
Upgrade-Youtubedl
|
||||
Write-Host "Operation completed" -ForegroundColor Magenta
|
||||
}
|
||||
catch [System.Exception] {
|
||||
Write-Host $_.Exception.Message -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 107 KiB |
@ -1,3 +0,0 @@
|
||||
@echo off
|
||||
|
||||
Powershell.exe -Command "& {Start-Process Powershell.exe -ArgumentList '-ExecutionPolicy Bypass -File %~dp0make-install.ps1' -Verb RunAs}"
|
@ -1,107 +0,0 @@
|
||||
# Don't edit this file, this can cause serious damage
|
||||
# Use install.bat to install Spotube
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
|
||||
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
|
||||
$shortcut_paths = @(
|
||||
"$HOME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Spotube.lnk",
|
||||
"$HOME\Desktop\Spotube.lnk"
|
||||
)
|
||||
# for creating shortcuts
|
||||
function CreateShortcut([String]$InstallLocation) {
|
||||
$Target = "$InstallLocation\qode.exe"
|
||||
$WshShell = New-Object -comObject WScript.Shell
|
||||
|
||||
Write-Output "Creating shortcuts"
|
||||
foreach($shortcut in $shortcut_paths){
|
||||
Write-Output $shortcut
|
||||
$StartShortcut = $WshShell.CreateShortcut($shortcut)
|
||||
$StartShortcut.TargetPath = $Target
|
||||
$StartShortcut.WorkingDirectory = $InstallLocation
|
||||
$StartShortcut.IconLocation = "$InstallLocation\icon.ico"
|
||||
$StartShortcut.Save()
|
||||
}
|
||||
}
|
||||
|
||||
$Spotube_Dir = "$Env:Programfiles\Spotube"
|
||||
# extracts & installs spotube
|
||||
function InstallSpotube {
|
||||
param([bool]$PromptLocation)
|
||||
$Spotube_Location=""
|
||||
# checking if reinstalling
|
||||
if($PromptLocation){
|
||||
$Spotube_Location = Read-Host -Prompt "Give an absolute path (e.g C:\My Folder\) to install Spotube or leave it empty to install in {$Spotube_Dir}: "
|
||||
}
|
||||
# now creating/installing spotube
|
||||
if(!$Spotube_Location.Trim()){
|
||||
New-Item -Path $Env:Programfiles -Name "Spotube" -ItemType "directory"
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$ScriptDir\spotube.data", $Spotube_Dir)
|
||||
Install-Mpv -SpotubeLocation $Spotube_Dir
|
||||
}
|
||||
else{
|
||||
New-Item -Path Spotube_Location -Name "Spotube" -ItemType "directory"
|
||||
$Spotube_Location = "$Spotube_Location\Spotube"
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$ScriptDir\spotube.data", $Spotube_Location)
|
||||
Install-Mpv -SpotubeLocation $Spotube_Location
|
||||
}
|
||||
$WannaCreateShortcut = Read-Host -Prompt "Do you want to create shortcuts?[y]Yes/[n]No"
|
||||
$WannaCreateShortcut = $WannaCreateShortcut.Trim().ToLower()
|
||||
if($WannaCreateShortcut -eq "y"){
|
||||
if(!$Spotube_Location.Trim()){
|
||||
$Spotube_Location= $Spotube_Dir
|
||||
}
|
||||
CreateShortcut -InstallLocation $Spotube_Location
|
||||
}
|
||||
elseif($WannaCreateShortcut -eq "n"){
|
||||
Write-Output "Ok, skipping this part"
|
||||
}
|
||||
else{
|
||||
throw "Wrong Option, use either 'y' or 'n', aborting..."
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function Install-Mpv{
|
||||
param([String]$SpotubeLocation)
|
||||
$Mpv_Dir = "$Env:ProgramData"
|
||||
if(!(Test-Path "$Mpv_Dir\Spotube")){
|
||||
New-Item -Path $Mpv_Dir -Name "Spotube" -ItemType "directory"
|
||||
}
|
||||
$Mpv_Dir = "$Env:ProgramData\Spotube"
|
||||
if(!(Test-Path "$Mpv_Dir\mpv")){
|
||||
New-Item -Path $Mpv_Dir -Name "mpv" -ItemType "directory"
|
||||
}
|
||||
$Mpv_Dir = "$Mpv_Dir\mpv"
|
||||
# invoking the scripts for downloading mpv player
|
||||
Write-Output "Downloading mpv player"
|
||||
Invoke-Expression "& '$SpotubeLocation\deps\bootstrap-mpv.ps1' -CWD '$Mpv_Dir'"
|
||||
# setting the env vars
|
||||
if (!($ENV:Path.Contains($Mpv_Dir))) {
|
||||
Write-Output "Setting environment vars"
|
||||
[System.Environment]::SetEnvironmentVariable("Path", "$ENV:Path;$Mpv_Dir", [System.EnvironmentVariableTarget]::Machine)
|
||||
[System.Environment]::SetEnvironmentVariable("Path", "$ENV:Path;$Mpv_Dir", [System.EnvironmentVariableTarget]::User)
|
||||
}
|
||||
}
|
||||
|
||||
if(!(Test-Path $Spotube_Dir)){
|
||||
InstallSpotube -PromptLocation $True
|
||||
}
|
||||
# reinstallation procedure
|
||||
else{
|
||||
Write-Output "Spotube already exists in $Env:Programfiles\Spotube"
|
||||
$WannaReplace = Read-Host -Prompt "Do you want to reinstall?[y]Yes/[n]No"
|
||||
$WannaReplace = $WannaReplace.Trim().ToLower()
|
||||
if($WannaReplace -eq "y"){
|
||||
Write-Output "Removing Old Spotube"
|
||||
Remove-Item -Path "$Spotube_Dir" -Recurse -Exclude "$Spotube_Dir\mpv"
|
||||
Write-Output "Installing New Spotube"
|
||||
InstallSpotube
|
||||
}
|
||||
elseif($WannaReplace -eq "n"){
|
||||
Write-Output "Keeping the older installation, quitting..."
|
||||
}
|
||||
else{
|
||||
throw "Wrong Option, use either 'y' or 'n', aborting..."
|
||||
}
|
||||
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"distPath": ".\\dist"
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
@echo off
|
||||
|
||||
powershell.exe -ExecutionPolicy Unrestricted -Command ". '%~dp0clear-installation.ps1'"
|
@ -1,86 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const process = require("child_process");
|
||||
// Get the foldername
|
||||
const deployDir = path.join("deploy"); // ./deploy relative to where command is executed
|
||||
const debStructDir = path.join(__dirname, "..", "deb-struct"); // ./deb-struct relative to where command is executed
|
||||
const configFile = path.join(deployDir, "config.json");
|
||||
const appName = JSON.parse(fs.readFileSync(configFile, { encoding: 'utf8' })).appName;
|
||||
const appNameSanitized = appName.replace(' ', '').toLowerCase();
|
||||
const buildFolder = path.join(deployDir, "linux", "build", appName);
|
||||
function cleanDirectories() {
|
||||
console.log("Cleaning DEBIAN:");
|
||||
console.log(process.execSync('rm -rf ' + debStructDir + '/DEBIAN/*'));
|
||||
console.log("Cleaning bin:");
|
||||
console.log(process.execSync('rm -rf ' + debStructDir + '/usr/bin/*'));
|
||||
console.log("Cleaning lib:");
|
||||
console.log(process.execSync('rm -rf ' + debStructDir + '/usr/lib/*'));
|
||||
console.log("Cleaning applications:");
|
||||
console.log(process.execSync('rm -rf ' + debStructDir + '/usr/share/applications/*'));
|
||||
}
|
||||
function copyControlFile() {
|
||||
console.log("Copying control:");
|
||||
console.log(process.execSync('cp ./control ' + debStructDir + '/DEBIAN/control'));
|
||||
}
|
||||
function copyBuildFolderToLib() {
|
||||
const folderPath = path.join(debStructDir, "usr", "lib");
|
||||
console.log("Copying Build Folder:");
|
||||
console.log(process.execSync('cp -R "' + buildFolder + '" "' + folderPath + '"'));
|
||||
console.log(process.execSync('cp -R ./assets "' + path.join(folderPath, appName) + '"'));
|
||||
if (appName !== appNameSanitized) {
|
||||
console.log(process.execSync('mv "' + path.join(folderPath, appName) + '" "' + path.join(folderPath, appNameSanitized) + '"'));
|
||||
}
|
||||
}
|
||||
function createSymlinkToBin() {
|
||||
const folderPath = '"' + path.join(debStructDir, "usr", "bin", appName) + '"';
|
||||
console.log("Generating Symlink:");
|
||||
console.log(process.execSync('ln -s /usr/lib/' + appNameSanitized + '/qode ' + folderPath));
|
||||
}
|
||||
function copyDesktopFileToApplications() {
|
||||
console.log("Copying Desktop File:");
|
||||
const desktopSrc = path.join(buildFolder, getFilesFromPath(buildFolder, '.desktop')[0]);
|
||||
const desktopDest = path.join(debStructDir, 'usr', 'share', 'applications', appName.replace(' ', '').toLowerCase() + '.desktop');
|
||||
console.log(process.execSync('cp "' + desktopSrc + '" "' + desktopDest + '"'));
|
||||
// Copy icon and change relative Icon path to absolute path
|
||||
const desktopContents = fs.readFileSync(desktopDest).toString();
|
||||
let m;
|
||||
const regex = /^Icon=(.*)$/m;
|
||||
const matches = regex.exec(desktopContents);
|
||||
if (matches && matches.length > 1) {
|
||||
const iconFileName = matches[1];
|
||||
if (!path.isAbsolute(iconFileName)) {
|
||||
// check if file exists, look for extensions {.png,.svg,.svgz,.xpm} as @nodegui/packer does
|
||||
let iconFileExt = '';
|
||||
for (const fileExt of ['png', 'svg', 'svgz', 'xpm']) {
|
||||
if (fs.existsSync(path.join(path.dirname(desktopSrc), iconFileName + '.' + fileExt))) {
|
||||
iconFileExt = fileExt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!iconFileExt) {
|
||||
throw new Error(iconFileName + '{.png,.svg,.svgz,.xpm} defined in desktop file but not found in ' + path.dirname(desktopSrc));
|
||||
}
|
||||
const absIconPath = '/' + path.join('usr', 'lib', appNameSanitized, iconFileName + '.' + iconFileExt);
|
||||
fs.writeFileSync(desktopDest, desktopContents.replace(regex, 'Icon=' + absIconPath));
|
||||
console.log('Adjusted relative icon path: ' + iconFileName + ' => ' + absIconPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createDeb() {
|
||||
// Create DEBIAN File
|
||||
console.log("Generating Debian:");
|
||||
console.log(process.execSync('dpkg-deb --build "' + debStructDir + '" "' + appNameSanitized + '.deb"'));
|
||||
}
|
||||
function getFilesFromPath(path, extension) {
|
||||
let files = fs.readdirSync(path);
|
||||
return files.filter(file => file.match(new RegExp(`.*\.(${extension})`, 'ig')));
|
||||
}
|
||||
cleanDirectories();
|
||||
copyControlFile();
|
||||
copyBuildFolderToLib();
|
||||
createSymlinkToBin();
|
||||
copyDesktopFileToApplications();
|
||||
createDeb();
|
||||
//# sourceMappingURL=build-deb.js.map
|
@ -1,20 +0,0 @@
|
||||
$CWD = Split-Path $script:MyInvocation.MyCommand.Path
|
||||
$CWD = "$CWD\..\"
|
||||
$Build_Dir = "$CWD\deploy\win32\build\spotube\"
|
||||
$files = Get-ChildItem -Path $Build_Dir -Exclude @("make-install.ps1", "install.bat")
|
||||
|
||||
echo "Archiving the code...."
|
||||
Compress-Archive -Path $files -DestinationPath "$Build_Dir\spotube.zip" -CompressionLevel Fastest -Force
|
||||
Rename-Item "$Build_Dir\spotube.zip" "spotube.data"
|
||||
|
||||
$packageJson = Get-Content "$CWD\package.json" | Out-String | ConvertFrom-Json
|
||||
$Version = $packageJson.version
|
||||
|
||||
echo "Now compressing the portable binary..."
|
||||
Compress-Archive -Path @("$Build_Dir\spotube.data", "$Build_Dir\install.bat", "$Build_Dir\make-install.ps1") -DestinationPath "$Build_Dir\Spotube-winx64-v$Version.zip" -Force
|
||||
|
||||
echo "Removing temp build files..."
|
||||
Remove-Item -Path "$Build_Dir\spotube.data"
|
||||
|
||||
echo "Done building"
|
||||
echo "Zip located at $Build_Dir\Spotube-winx64-v$Version.zip"
|
58
scripts/windows-setup-creator.iss
Normal file
58
scripts/windows-setup-creator.iss
Normal file
@ -0,0 +1,58 @@
|
||||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
#define MyAppName "Spotube"
|
||||
#define MyAppVersion "1.0.0"
|
||||
#define MyAppPublisher "KRTirtho, OSS"
|
||||
#define MyAppURL "https://github.com/KRTirtho/spotube"
|
||||
#define MyAppExeName "spotube.exe"
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
|
||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||
AppId={{80B901C8-D6FE-494E-8AF7-A2BD440E8644}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
;AppVerName={#MyAppName} {#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={autopf}\{#MyAppName}
|
||||
DisableProgramGroupPage=yes
|
||||
; Remove the following line to run in administrative install mode (install for all users.)
|
||||
PrivilegesRequired=lowest
|
||||
PrivilegesRequiredOverridesAllowed=dialog
|
||||
OutputDir=..\build\installer
|
||||
OutputBaseFilename=Spotube-windows-x86_64-setup
|
||||
SetupIconFile=..\windows\runner\resources\icon.ico
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: "..\build\windows\runner\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\build\windows\runner\Release\bitsdojo_window_windows_plugin.lib"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\build\windows\runner\Release\flutter_windows.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\build\windows\runner\Release\hotkey_manager_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\build\windows\runner\Release\libwinmedia.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\build\windows\runner\Release\libwinmedia_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\build\windows\runner\Release\spotube.exp"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\build\windows\runner\Release\spotube.lib"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\build\windows\runner\Release\url_launcher_windows_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\build\windows\runner\Release\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
|
Loading…
Reference in New Issue
Block a user