Skip to content

Commit

Permalink
Merge branch 'albayan_beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
QaisAlrefai committed Dec 13, 2024
2 parents c2dd091 + a6cda51 commit 32c5935
Show file tree
Hide file tree
Showing 108 changed files with 2,145 additions and 529 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/albayan_beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This workflow will install Python dependencies and build the Albayan application using cx-Freeze on Windows.

name: Albayan_beta

on:
push:
branches: [ "albayan_beta" ]
pull_request:
branches: [ "albayan_beta" ]

permissions:
contents: read

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cx-Freeze
if (Test-Path "requirements.txt") { pip install -r requirements.txt }
- name: Build with cx-Freeze
run: |
python setup.py build
- name: Rename main.exe to albayan.exe
run: |
Rename-Item -Path "albayan_build\main.exe" -NewName "albayan.exe"
- name: Download and install Inno Setup
run: |
Invoke-WebRequest -Uri https://jrsoftware.org/download.php/is.exe -OutFile is.exe
Start-Process -Wait -FilePath .\is.exe -ArgumentList '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/SP'
- name: Download Arabic and Vietnamese language files
run: |
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"
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"
- name: Package with Inno Setup
run: |
Start-Process -Wait -FilePath "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" -ArgumentList "albayan.iss"
- name: Upload compressed build output
uses: actions/upload-artifact@v4
with:
name: albayan-beta-build
path: albayan_build\AlbayanSetup.exe
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Python bytecode files
__pycache__/

# Ignore virtual environment directory
albayan_env/
Binary file modified Audio/basmala/1.OGG
Binary file not shown.
Binary file modified Audio/basmala/10.OGG
Binary file not shown.
Binary file modified Audio/basmala/11.OGG
Binary file not shown.
Binary file modified Audio/basmala/12.OGG
Binary file not shown.
Binary file modified Audio/basmala/13.OGG
Binary file not shown.
Binary file added Audio/basmala/14.OGG
Binary file not shown.
Binary file added Audio/basmala/15.OGG
Binary file not shown.
Binary file added Audio/basmala/16.OGG
Binary file not shown.
Binary file added Audio/basmala/17.OGG
Binary file not shown.
Binary file added Audio/basmala/18.OGG
Binary file not shown.
Binary file added Audio/basmala/19.OGG
Binary file not shown.
Binary file modified Audio/basmala/2.OGG
Binary file not shown.
Binary file added Audio/basmala/20.OGG
Binary file not shown.
Binary file added Audio/basmala/21.OGG
Binary file not shown.
Binary file added Audio/basmala/22.OGG
Binary file not shown.
Binary file added Audio/basmala/23.OGG
Binary file not shown.
Binary file added Audio/basmala/24.OGG
Binary file not shown.
Binary file modified Audio/basmala/3.OGG
Binary file not shown.
Binary file modified Audio/basmala/4.OGG
Binary file not shown.
Binary file modified Audio/basmala/5.OGG
Binary file not shown.
Binary file modified Audio/basmala/6.OGG
Binary file not shown.
Binary file modified Audio/basmala/7.OGG
Binary file not shown.
Binary file modified Audio/basmala/8.OGG
Binary file not shown.
Binary file modified Audio/basmala/9.OGG
Binary file not shown.
Binary file added Audio/sounds/alert.ogg
Binary file not shown.
Binary file added Audio/sounds/change.ogg
Binary file not shown.
Binary file added Audio/sounds/clos.ogg
Binary file not shown.
Binary file added Audio/sounds/copy.ogg
Binary file not shown.
Binary file added Audio/sounds/error.ogg
Binary file not shown.
Binary file added Audio/sounds/message.ogg
Binary file not shown.
Binary file added Audio/sounds/move.ogg
Binary file not shown.
Binary file added Audio/sounds/next.ogg
Binary file not shown.
Binary file removed Audio/sounds/next.wav
Binary file not shown.
Binary file added Audio/sounds/open.ogg
Binary file not shown.
Binary file added Audio/sounds/previous.ogg
Binary file not shown.
Binary file removed Audio/sounds/previous.wav
Binary file not shown.
Binary file added Audio/sounds/save.ogg
Binary file not shown.
Binary file removed Audio/startup/1.ogg
Binary file not shown.
Binary file removed Audio/startup/10.ogg
Binary file not shown.
Binary file removed Audio/startup/2.ogg
Binary file not shown.
Binary file removed Audio/startup/3.ogg
Binary file not shown.
Binary file removed Audio/startup/4.ogg
Binary file not shown.
Binary file removed Audio/startup/5.ogg
Binary file not shown.
Binary file removed Audio/startup/6.ogg
Binary file not shown.
Binary file removed Audio/startup/7.ogg
Binary file not shown.
Binary file removed Audio/startup/8.ogg
Binary file not shown.
Binary file removed Audio/startup/9.ogg
Binary file not shown.
40 changes: 26 additions & 14 deletions albayan.iss
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#define MyAppName "Albayan"
#define MyAppVersion "1.3.0"
#define AppVersion "1.3.0"
#define MyAppVersion "2.0.0"
#define AppVersion "2.0.0"
#define MyAppPublisher "Tecwindow"
#define MyAppURL "https://tecwindow.net/"
#define MyAppExeName "Albayan.exe"


[Setup]
AppName={#MyAppName}
AppId={{5BDDE425-E22F-4A82-AF2F-72AF71301D3F}
Expand All @@ -28,7 +27,7 @@ DefaultDirName={sd}\program files\tecwindow\{#MyAppName}
DisableProgramGroupPage=yes
; Uncomment the following line to run in non-administrative install mode (install for the current user only.)
PrivilegesRequired=admin
OutputDir=Albayan
OutputDir=albayan_build
OutputBaseFilename=AlbayanSetup
Compression=lzma
CloseApplications=force
Expand All @@ -44,26 +43,25 @@ MinVersion=0,6.2
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "arabic"; MessagesFile: "compiler:Languages\Arabic.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"

[Files]
Source: "Albayan\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "Albayan\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "Audio\athkar\*"; DestDir: "{userappdata}\tecwindow\albayan\Audio\athkar"; Flags: ignoreversion recursesubdirs createallsubdirs

[CustomMessages]
arabic.AppLNGfile=Arabic
english.DeleteSettingsPrompt=Do you want to delete the settings folder?
arabic.DeleteSettingsPrompt=هل تريد حذف مجلد الإعدادات؟

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"

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

[Icons]
Name: "{autoprograms}\Albayan"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\Albayan"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon


[INI]
Filename: "{userappdata}\tecwindow\{#MyAppName}\Settingss.ini"; Section: "General"; Key: "language"; String: "{cm:AppLNGfile}"
Filename: "{userappdata}\tecwindow\{#MyAppName}\Settingss.ini"; Section: "general"; Key: "language"; String: "{cm:AppLNGfile}"

[UninstallDelete]
Type: filesandordirs; Name: "{pf}\tecwindow\Albayan"
Expand All @@ -72,6 +70,20 @@ Type: filesandordirs; Name: "{pf}\tecwindow\Albayan"
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall

[Code]
procedure DeleteOldInstallation();
begin
if DirExists(ExpandConstant('{sd}\program files\tecwindow\{#MyAppName}\Audio\sounds')) then
begin
DelTree(ExpandConstant('{sd}\program files\tecwindow\{#MyAppName}\Audio\sounds'), True, True, True);
end;
end;
function InitializeSetup(): Boolean;
begin
DeleteOldInstallation();
Result := True;
end;
procedure DeleteAthkarFolder();
begin
DelTree(ExpandConstant('{app}\Audio\athkar'), True, True, True);
Expand Down
38 changes: 38 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@echo off
set VENV_DIR=albayan_env

if not exist %VENV_DIR% (
echo Creating virtual environment...
py -3.12 -m venv %VENV_DIR%
)

call %VENV_DIR%\Scripts\activate

echo Updating pip...
python -m pip install --upgrade pip

if exist requirements.txt (
echo Installing/updating libraries from requirements.txt...
pip install -r requirements.txt --upgrade
) else (
echo requirements.txt not found!
exit /b 1
)

pip show cx-freeze >nul 2>&1
if %errorlevel% neq 0 (
echo Installing cx-Freeze...
pip install cx-freeze
)

if exist setup.py (
echo Building the program with cx-Freeze...
python setup.py build
) else (
echo setup.py not found!
exit /b 1
)

deactivate
echo Done!
pause
54 changes: 54 additions & 0 deletions core_functions/Reciters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import os
import sqlite3
from typing import List, Dict, Optional
from functools import lru_cache
from exceptions.database import DBNotFoundError


class RecitersManager:
def __init__(self, db_path: str) -> None:
self.db_path = db_path

def _connect(self) -> sqlite3.Connection:

if not os.path.isfile(self.db_path):
raise DBNotFoundError(self.db_path)

conn = sqlite3.connect(self.db_path)
conn.row_factory = sqlite3.Row

return conn

def get_reciters(self) -> List[sqlite3.Row]:
"""Fetches all reciters from the database."""
with self._connect() as conn:
cursor = conn.cursor()
cursor.execute("""
SELECT *,
CASE
WHEN bitrate < 64 THEN 'Low'
WHEN bitrate BETWEEN 64 AND 128 THEN 'Medium'
ELSE 'High'
END AS quality
FROM reciters
ORDER BY name, bitrate;
""")

return cursor.fetchall()

@lru_cache(maxsize=1)
def _get_base_url(self, reciter_id: int) -> Optional[str]:
with self._connect() as conn:
cursor = conn.cursor()
cursor.execute("SELECT url FROM reciters WHERE id = ?", (reciter_id,))
result = cursor.fetchone()
if result:
return result["url"]
return None

def get_url(self, reciter_id: int, surah_number: int, aya_number: int) -> Optional[str]:
base_url = self._get_base_url(reciter_id)
if base_url:
return f"{base_url}{surah_number:03}{aya_number:03}.mp3"
return None

38 changes: 0 additions & 38 deletions core_functions/athkar/athkar_player.py

This file was deleted.

Loading

0 comments on commit 32c5935

Please sign in to comment.