%global debug_package %{nil} %global repo_owner cgzirim %global repo_name seek-tune %global commit 0000000000000000000000000000000000000000 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global current_date %(date +%%Y%%m%%d) Name: seek-tune Version: 0.0.1 Release: 1.%{current_date}git%{shortcommit}%{?dist} Summary: An implementation of Shazam's song recognition algorithm License: MIT URL: https://github.com/%{repo_owner}/%{repo_name} Source0: https://github.com/%{repo_owner}/%{repo_name}/archive/main.tar.gz#/%{name}-main.tar.gz BuildRequires: golang BuildRequires: nodejs BuildRequires: npm BuildRequires: git BuildRequires: make Requires: ffmpeg Requires: yt-dlp # Optional: mongodb-server (project defaults to sqlite, can use mongo) %description SeekTune is an implementation of Shazam's song recognition algorithm. It integrates Spotify and YouTube APIs to find and download songs, create audio fingerprints, and identify songs from audio samples. This package includes: - The Go backend server - The React frontend static files %prep %setup -q -n %{repo_name}-main %build # --- Build Frontend --- pushd client # Install dependencies npm install # Build the production static files npm run build popd # --- Build Backend --- pushd server # Download Go modules (Note: In a strict RPM environment, vendor these) go mod download # Build the binary go build -v -o seek-tune-server . popd %install # Create directories install -d -m 755 %{buildroot}%{_bindir} install -d -m 755 %{buildroot}%{_datadir}/%{name}/html install -d -m 755 %{buildroot}%{_sysconfdir}/%{name} # Install Backend Binary install -m 755 server/seek-tune-server %{buildroot}%{_bindir}/seek-tune-server # Install Frontend Static Files cp -r client/build/* %{buildroot}%{_datadir}/%{name}/html/ # Install Default Config (Example .env) # Creating a template config file cat < %{buildroot}%{_sysconfdir}/%{name}/config.env # SeekTune Configuration PORT=5000 DB_TYPE=sqlite # DB_TYPE=mongo # DB_HOST=localhost # DB_PORT=27017 # DB_USER= # DB_PASS= # DB_NAME=seektune # Spotify Credentials (REQUIRED) SPOTIFY_CLIENT_ID=your_client_id_here SPOTIFY_CLIENT_SECRET=your_client_secret_here # Paths STATIC_DIR=%{_datadir}/%{name}/html EOF # Install Systemd Service install -d -m 755 %{buildroot}%{_unitdir} cat < %{buildroot}%{_unitdir}/%{name}.service [Unit] Description=SeekTune Song Recognition Server After=network.target [Service] Type=simple User=root WorkingDirectory=%{_datadir}/%{name} EnvironmentFile=%{_sysconfdir}/%{name}/config.env ExecStart=%{_bindir}/seek-tune-server serve -port \${PORT} Restart=on-failure [Install] WantedBy=multi-user.target EOF %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %license LICENSE %doc README.md %{_bindir}/seek-tune-server %{_datadir}/%{name}/ %config(noreplace) %{_sysconfdir}/%{name}/config.env %{_unitdir}/%{name}.service %changelog %autochangelog