Skip to content

Commit e176d46

Browse files
committed
Merge branch 'albayan_beta'
2 parents fb92815 + 961450e commit e176d46

62 files changed

Lines changed: 6695 additions & 325 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/albayan_beta.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,15 @@ jobs:
3333
run: |
3434
python setup.py build
3535
36-
- name: Rename main.exe to albayan.exe
37-
run: |
38-
Rename-Item -Path "albayan_build\main.exe" -NewName "albayan.exe"
39-
36+
4037
- name: Download and install Inno Setup
4138
run: |
4239
Invoke-WebRequest -Uri https://jrsoftware.org/download.php/is.exe -OutFile is.exe
4340
Start-Process -Wait -FilePath .\is.exe -ArgumentList '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/SP'
4441
4542
- name: Download Arabic and Vietnamese language files
4643
run: |
47-
Invoke-WebRequest -Uri https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Arabic.isl -OutFile "C:\Program Files (x86)\Inno Setup 6\Languages\Arabic.isl"
44+
Invoke-WebRequest -Uri https://raw.githubusercontent.com/jrsoftware/issrc/refs/heads/main/Files/Languages/Arabic.isl -OutFile "C:\Program Files (x86)\Inno Setup 6\Languages\Arabic.isl"
4845
Invoke-WebRequest -Uri https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Vietnamese.isl -OutFile "C:\Program Files (x86)\Inno Setup 6\Languages\Vietnamese.isl"
4946
5047
- name: Package with Inno Setup

Albayan.ico

148 KB
Binary file not shown.

Audio/sounds/filter clos.ogg

4.72 KB
Binary file not shown.

Audio/sounds/filter open.ogg

4.75 KB
Binary file not shown.

albayan.iss

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define MyAppName "Albayan"
2-
#define MyAppVersion "2.0.0"
3-
#define AppVersion "2.0.0"
2+
#define MyAppVersion "3.0.0"
3+
#define AppVersion "3.0.0"
44
#define MyAppPublisher "Tecwindow"
55
#define MyAppURL "https://tecwindow.net/"
66
#define MyAppExeName "Albayan.exe"
@@ -22,6 +22,7 @@ AppPublisherURL={#MyAppURL}
2222
AppSupportURL={#MyAppURL}
2323
AppUpdatesURL={#MyAppURL}
2424
ArchitecturesAllowed=x64
25+
SetupIconFile=Albayan.ico
2526

2627
DefaultDirName={sd}\program files\tecwindow\{#MyAppName}
2728
DisableProgramGroupPage=yes
@@ -47,53 +48,57 @@ Name: "arabic"; MessagesFile: "compiler:Languages\Arabic.isl"
4748
arabic.AppLNGfile=Arabic
4849
english.DeleteSettingsPrompt=Do you want to delete the settings folder?
4950
arabic.DeleteSettingsPrompt=هل تريد حذف مجلد الإعدادات؟
51+
english.autorun=auto start albayan with windows?
52+
arabic.autorun=فتح برنامج البيان تلقائيا مع بدء تشغيل النظام
5053

5154
[Tasks]
5255
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
56+
Name: "autorun"; Description: "{cm:autorun}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
5357

5458
[Files]
5559
Source: "albayan_build\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
5660
Source: "albayan_build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
5761
Source: "albayan_build\Audio\athkar\*"; DestDir: "{userappdata}\tecwindow\albayan\Audio\athkar"; Flags: ignoreversion recursesubdirs createallsubdirs
5862

5963
[Icons]
60-
Name: "{autoprograms}\Albayan"; Filename: "{app}\{#MyAppExeName}"
61-
Name: "{autodesktop}\Albayan"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
64+
Name: "{autoprograms}\Albayan"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\Albayan.ico"
65+
Name: "{autodesktop}\Albayan"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\Albayan.ico"; Tasks: desktopicon
6266

6367
[INI]
64-
Filename: "{userappdata}\tecwindow\{#MyAppName}\Settingss.ini"; Section: "general"; Key: "language"; String: "{cm:AppLNGfile}"
68+
Filename: "{userappdata}\tecwindow\{#MyAppName}\config.ini"; Section: "general"; Key: "run_in_background_enabled"; String: "true"; Tasks: autorun
69+
Filename: "{userappdata}\tecwindow\{#MyAppName}\config.ini"; Section: "general"; Key: "auto_start_enabled"; String: "true"; Tasks: autorun
70+
71+
[Registry]
72+
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "albayan"; ValueData: "{app}\albayan.exe --minimized"; Flags: uninsdeletevalue; Tasks: autorun
73+
74+
[UninstallRun]
75+
Filename: "taskkill"; Parameters: "/F /IM Albayan.exe"; Flags: runhidden
6576

6677
[UninstallDelete]
6778
Type: filesandordirs; Name: "{pf}\tecwindow\Albayan"
6879

80+
[InstallDelete]
81+
Type: filesandordirs; Name: "{app}\*"
82+
6983
[Run]
7084
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall
7185

7286
[Code]
73-
procedure DeleteOldInstallation();
74-
begin
75-
if DirExists(ExpandConstant('{sd}\program files\tecwindow\{#MyAppName}\Audio\sounds')) then
76-
begin
77-
DelTree(ExpandConstant('{sd}\program files\tecwindow\{#MyAppName}\Audio\sounds'), True, True, True);
78-
end;
79-
end;
80-
8187
function InitializeSetup(): Boolean;
8288
begin
83-
DeleteOldInstallation();
8489
Result := True;
8590
end;
8691
87-
procedure DeleteAthkarFolder();
88-
begin
89-
DelTree(ExpandConstant('{app}\Audio\athkar'), True, True, True);
90-
end;
9192
9293
procedure CurStepChanged(CurStep: TSetupStep);
9394
begin
94-
if CurStep = ssPostInstall then
95+
if CurStep = ssInstall then
9596
begin
96-
DeleteAthkarFolder();
97+
if FileExists(ExpandConstant('{userappdata}\tecwindow\{#MyAppName}\Settingss.ini')) then
98+
begin
99+
RenameFile(ExpandConstant('{userappdata}\tecwindow\{#MyAppName}\Settingss.ini'), ExpandConstant('{userappdata}\tecwindow\{#MyAppName}\config.ini'));
100+
end;
101+
97102
end;
98103
end;
99104
@@ -117,3 +122,4 @@ begin
117122
end;
118123
end;
119124
end;
125+

albayan_env.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if /i !create_activate! equ C (
1010
start /wait py -3.12 -m venv albayan_env
1111
start cmd.exe /k "call albayan_env\Scripts\activate.bat && cd /d ""%~dp0"" && pip install -r requirements.txt"
1212
) else if /i !create_activate! equ A (
13-
start cmd.exe /k "call env\Scripts\activate.bat"
13+
start cmd.exe /k "call albayan_env\Scripts\activate.bat"
1414
)
1515

1616
exit

build.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@echo off
2+
title AlbayanBuild
23
set VENV_DIR=albayan_env
34

45
if not exist %VENV_DIR% (

core_functions/Reciters.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
import sqlite3
33
from typing import List, Dict, Optional
44
from functools import lru_cache
5+
from abc import ABC, abstractmethod
56
from exceptions.database import DBNotFoundError
67

78

8-
class RecitersManager:
9-
def __init__(self, db_path: str) -> None:
9+
class RecitersManager(ABC):
10+
def __init__(self, db_path: str, table_name: str) -> None:
1011
self.db_path = db_path
12+
self.table_name = table_name
1113

1214
def _connect(self) -> sqlite3.Connection:
1315

@@ -23,29 +25,55 @@ def get_reciters(self) -> List[sqlite3.Row]:
2325
"""Fetches all reciters from the database."""
2426
with self._connect() as conn:
2527
cursor = conn.cursor()
26-
cursor.execute("""
28+
cursor.execute(f"""
2729
SELECT *,
2830
CASE
2931
WHEN bitrate < 64 THEN 'Low'
3032
WHEN bitrate BETWEEN 64 AND 128 THEN 'Medium'
3133
ELSE 'High'
3234
END AS quality
33-
FROM reciters
35+
FROM {self.table_name}
3436
ORDER BY name, bitrate;
3537
""")
3638

3739
return cursor.fetchall()
3840

41+
def get_reciter(self, id: int) -> sqlite3.Row:
42+
with self._connect() as conn:
43+
cursor = conn.cursor()
44+
cursor.execute(f"SELECT * FROM {self.table_name} WHERE id = ?;", (id,))
45+
return cursor.fetchone()
46+
3947
@lru_cache(maxsize=1)
4048
def _get_base_url(self, reciter_id: int) -> Optional[str]:
4149
with self._connect() as conn:
4250
cursor = conn.cursor()
43-
cursor.execute("SELECT url FROM reciters WHERE id = ?", (reciter_id,))
51+
cursor.execute(f"SELECT url FROM {self.table_name} WHERE id = ?", (reciter_id,))
4452
result = cursor.fetchone()
4553
if result:
4654
return result["url"]
4755
return None
4856

57+
@abstractmethod
58+
def get_url(self, reciter_id: int, surah_number: int) -> Optional[str]:
59+
pass
60+
61+
62+
class SurahReciter(RecitersManager):
63+
def __init__(self, db_path: str, table_name: str ="moshaf"):
64+
super().__init__(db_path, table_name)
65+
66+
def get_url(self, reciter_id: int, surah_number: int) -> Optional[str]:
67+
base_url = self._get_base_url(reciter_id)
68+
if base_url:
69+
return f"{base_url}/{surah_number:03}.mp3"
70+
return None
71+
72+
73+
class AyahReciter(RecitersManager):
74+
def __init__(self, db_path: str, table_name: str ="reciters"):
75+
super().__init__(db_path, table_name)
76+
4977
def get_url(self, reciter_id: int, surah_number: int, aya_number: int) -> Optional[str]:
5078
base_url = self._get_base_url(reciter_id)
5179
if base_url:

core_functions/athkar/athkar_db_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def create_category(self,
3636
audio_path: Optional[str] = None,
3737
from_time: str = "00:00",
3838
to_time: str = "23:00",
39-
play_interval: int =5,
39+
play_interval: int =30,
4040
audio_athkar_enabled: int = 0,
4141
text_athkar_enabled: int = 0
4242
) -> int:

core_functions/athkar/athkar_scheduler.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from PyQt6.QtGui import QIcon
2+
from PyQt6.QtWidgets import QSystemTrayIcon
13
import os
24
import json
35
from datetime import datetime, time
@@ -10,7 +12,7 @@
1012
from .athkar_db_manager import AthkarDBManager
1113
from .athkar_refresher import AthkarRefresher
1214
from utils.audio_player import AthkarPlayer
13-
from utils.const import Globals
15+
from utils.const import Globals, program_icon
1416
from utils.logger import Logger
1517
from exceptions.base import ErrorMessage
1618

@@ -55,7 +57,10 @@ def text_athkar_job(self, category_id: int) -> None:
5557
title = "البيان"
5658
description = text
5759

58-
Globals.TRAY_ICON.showMessage(title, description, msecs=5000)
60+
61+
icon_path = "Albayan.ico"
62+
63+
Globals.TRAY_ICON.showMessage(title, description, QIcon(icon_path), 5000)
5964

6065
@staticmethod
6166
def _parse_time(time_str: str) -> time:

0 commit comments

Comments
 (0)