Skip to content

Commit

Permalink
push 2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
FozerG committed Nov 19, 2024
1 parent 028dac6 commit 02f3eab
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 16 deletions.
52 changes: 39 additions & 13 deletions InnoScript.iss
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#define ScriptVersion "2.4"
#define ScriptVersion "2.4.1"
[Setup]
AppName=WinYandexMusicRPC
AppPublisher=FozerG
AppVersion={#ScriptVersion}
DefaultDirName={localappdata}\WinYandexMusicRPC
DefaultDirName={pf}\WinYandexMusicRPC
DefaultGroupName=WinYandexMusicRPC
OutputDir=dist
AppId={{9b1a69af-4040-4080-8afd-97131cba7e21}}
AppId=WinYandexMusicRPC
OutputBaseFilename=WinYandexMusicRPC_Installer_{#ScriptVersion}
Compression=lzma
SolidCompression=yes
Expand All @@ -17,7 +17,7 @@ SetupIconFile=assets\YMRPC_ico.ico
WizardImageFile=assets\YMRPC_large_bmp.bmp
WizardSmallImageFile=assets\YMRPC_bmp.bmp
WizardImageAlphaFormat=defined
PrivilegesRequired=lowest
PrivilegesRequired=admin
UninstallDisplayIcon={app}\WinYandexMusicRPC.exe
Uninstallable=yes
AllowRootDirectory=no
Expand All @@ -37,14 +37,35 @@ russian.CreateDesktop=Создать значок на рабочем столе
russian.AdditionalTasks=Дополнительные задачи

[Files]
Source: "dist\WinYandexMusicRPC-cli\WinYandexMusicRPC.exe"; DestDir: "{localappdata}\WinYandexMusicRPC"; Flags: ignoreversion
Source: "dist\WinYandexMusicRPC-cli\_internal\*"; DestDir: "{localappdata}\WinYandexMusicRPC\_internal"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "dist\WinYandexMusicRPC-cli\WinYandexMusicRPC.exe"; DestDir: "{pf}\WinYandexMusicRPC"; Flags: ignoreversion
Source: "dist\WinYandexMusicRPC-cli\_internal\*"; DestDir: "{pf}\WinYandexMusicRPC\_internal"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\WinYandexMusicRPC"; Filename: "{localappdata}\WinYandexMusicRPC\WinYandexMusicRPC.exe"
Name: "{autodesktop}\WinYandexMusicRPC"; Filename: "{localappdata}\WinYandexMusicRPC\WinYandexMusicRPC.exe"; Tasks: desktopicon
Name: "{group}\WinYandexMusicRPC"; Filename: "{pf}\WinYandexMusicRPC\WinYandexMusicRPC.exe"
Name: "{autodesktop}\WinYandexMusicRPC"; Filename: "{pf}\WinYandexMusicRPC\WinYandexMusicRPC.exe"; Tasks: desktopicon

[Code]
procedure UninstallPreviousVersion; //Удаление версии 2.4, так как установка в AppData оказалась неудачным решением.
var
OldUninstallString: string;
ResultCode: Integer;
begin
if RegQueryStringValue(HKEY_CURRENT_USER, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{9b1a69af-4040-4080-8afd-97131cba7e21}}_is1', 'UninstallString', OldUninstallString) then
begin
Log('Обнаружена предыдущая версия. Запуск деинсталляции...');
if (Pos('"', OldUninstallString) = 1) and (Copy(OldUninstallString, Length(OldUninstallString), 1) = '"') then
OldUninstallString := Copy(OldUninstallString, 2, Length(OldUninstallString) - 2);
if Exec(OldUninstallString, '/VERYSILENT /SUPPRESSMSGBOXES', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
Log('Деинсталляция предыдущей версии завершена успешно.')
else
Log('Ошибка при деинсталляции предыдущей версии. Код результата: ' + IntToStr(ResultCode));
end
else
begin
Log('Предыдущая версия не обнаружена.');
end;
end;
procedure DeleteStartupShortcut;
var
StartupShortcut: string;
Expand Down Expand Up @@ -83,14 +104,19 @@ begin
end;
end;
procedure InitializeWizard;
begin
UninstallPreviousVersion;
end;
[Run]
Filename: "{localappdata}\WinYandexMusicRPC\WinYandexMusicRPC.exe"; Description: "{cm:RunDescription}"; Flags: nowait postinstall skipifsilent
Filename: "{pf}\WinYandexMusicRPC\WinYandexMusicRPC.exe"; Description: "{cm:RunDescription}"; Flags: nowait postinstall skipifsilent

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktop}"; GroupDescription: "{cm:AdditionalTasks}"

[UninstallDelete]
Type: files; Name: "{localappdata}\WinYandexMusicRPC\_internal\*"
Type: dirifempty; Name: "{localappdata}\WinYandexMusicRPC\_internal"
Type: files; Name: "{localappdata}\WinYandexMusicRPC\WinYandexMusicRPC.exe"
Type: dirifempty; Name: "{localappdata}\WinYandexMusicRPC"
Type: files; Name: "{pf}\WinYandexMusicRPC\_internal\*"
Type: dirifempty; Name: "{pf}\WinYandexMusicRPC\_internal"
Type: files; Name: "{pf}\WinYandexMusicRPC\WinYandexMusicRPC.exe"
Type: dirifempty; Name: "{pf}\WinYandexMusicRPC"
10 changes: 7 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
CLIENT_ID_RU_DECLINED = '1269826362399522849' #Яндекс Музыку (склонение для активности "Слушает")

# Версия (tag) скрипта для проверки на актуальность через Github Releases
CURRENT_VERSION = "v2.4"
CURRENT_VERSION = "v2.4.1"

# Ссылка на репозиторий
REPO_URL = "https://github.com/FozerG/WinYandexMusicRPC"
Expand Down Expand Up @@ -113,11 +113,15 @@ async def get_media_info():
position = current_session.get_timeline_properties().position
playback_info = current_session.get_playback_info()
playback_status = PlaybackStatus(playback_info.playback_status).name
session_title = info.title or "Unknown Title"
app_name = current_session.source_app_user_model_id or "Unknown App"
return {
'artist': artist,
'title': title,
'playback_status': playback_status,
'position': position
'position': position,
'session_title': session_title,
'app_name': app_name
}

raise Exception('The music is not playing right now.')
Expand Down Expand Up @@ -313,7 +317,7 @@ def getTrack() -> dict:
title = current_media_info.get("title", "").strip()
position = current_media_info['position']
if not artist or not title:
log("Winsdk returned empty string for artist or title", LogType.Error)
log(f"MediaManager returned empty string for artist or title. Active app - {current_media_info['app_name']}. Title - {current_media_info['session_title']}", LogType.Error)
return {'success': False}
name_current = artist + " - " + title
global name_prev
Expand Down

0 comments on commit 02f3eab

Please sign in to comment.