Skip to content

Commit

Permalink
audio/tauonmb: Update script.
Browse files Browse the repository at this point in the history
- Too many dependencies already, a little cleanup.
- Switched to Unidecode (my python3-isounidecode is long dead).

Signed-off-by: Pouria Rezaei <[email protected]>
  • Loading branch information
RSKYS committed Jul 15, 2024
1 parent ce450ba commit 9fa0e49
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 7 deletions.
6 changes: 6 additions & 0 deletions audio/tauonmb/README
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ Optional dependencies:
python3-pypresence #Discord RPC
python3-tekore #Spotify API
picard #Internal tagger
libgme #Nintendo music emulation

To use GME, install the "libgme" first.
If desired, do:

LIBGME="yes" ./tauonmb.SlackBuild

By !red
83 changes: 83 additions & 0 deletions audio/tauonmb/config/fix-tauon-options.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
diff --git a/t_modules/t_lyrics.py b/t_modules/t_lyrics.py
index 8e5d197a..19b91bd8 100644
--- a/t_modules/t_lyrics.py
+++ b/t_modules/t_lyrics.py
@@ -18,7 +18,7 @@
# along with Tauon Music Box. If not, see <http://www.gnu.org/licenses/>.


-from isounidecode import unidecode
+from unidecode import unidecode
from bs4 import BeautifulSoup
import urllib.parse
import requests
@@ -81,7 +81,7 @@ def genius(artist, title, return_url=False):
line = line.replace("/", "-")
line = line.replace("-&-", "-and-")
line = line.replace("&", "-and-")
- line = unidecode(line).decode()
+ line = unidecode(line)
line = urllib.parse.quote(line)
line = f"https://genius.com/{line}-lyrics"

diff --git a/t_modules/t_main.py b/t_modules/t_main.py
index c2f2ebab..4848b7b2 100644
--- a/t_modules/t_main.py
+++ b/t_modules/t_main.py
@@ -591,7 +591,7 @@ from pathlib import Path
from xml.sax.saxutils import escape, unescape
from ctypes import *
from send2trash import send2trash
-from isounidecode import unidecode
+from unidecode import unidecode
from collections import OrderedDict

musicbrainzngs.set_useragent("TauonMusicBox", n_version, "https://github.com/Taiko2k/Tauon")
@@ -25663,14 +25663,14 @@ def worker2():
s_text = s_cn

if dia_mode:
- title = unidecode(title).decode()
+ title = unidecode(title)

- artist = unidecode(artist).decode()
- album_artist = unidecode(album_artist).decode()
- composer = unidecode(composer).decode()
- album = unidecode(album).decode()
- filename = unidecode(filename).decode()
- sartist = unidecode(sartist).decode()
+ artist = unidecode(artist)
+ album_artist = unidecode(album_artist)
+ composer = unidecode(composer)
+ album = unidecode(album)
+ filename = unidecode(filename)
+ sartist = unidecode(sartist)

if cache_string is None:
search_dia_string_cache[
@@ -30054,9 +30054,9 @@ class Over:
click=self.click, replace="github")

y += spacing
- ddt.text((x, y), "isounidecode", colours.box_sub_text, font)
- ddt.text((xx, y), "New BSD License", colours.box_text_label, font)
- draw_linked_text2(xxx, y, "https://github.com/redvasily/isounidecode", colours.box_sub_text, font,
+ ddt.text((x, y), "unidecode", colours.box_sub_text, font)
+ ddt.text((xx, y), "GPL-2.0+", colours.box_text_label, font)
+ draw_linked_text2(xxx, y, "https://github.com/avian2/unidecode", colours.box_sub_text, font,
click=self.click, replace="github")

y += spacing
diff --git a/t_modules/t_main.py b/t_modules/t_main.py
index 4848b7b2..cc662a74 100644
--- a/t_modules/t_main.py
+++ b/t_modules/t_main.py
@@ -4550,7 +4550,7 @@ try:
gme.gme_open_file.restype = ctypes.c_char_p

except:
- print("Cannont find libgme")
+ pass

def use_id3(tags, nt):
def natural_get(tag, track, frame, attr):
File renamed without changes.
156 changes: 156 additions & 0 deletions audio/tauonmb/config/obsolete-libgme.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
diff --git a/compile-phazor.sh b/compile-phazor.sh
index 090c318b..2313338d 100755
--- a/compile-phazor.sh
+++ b/compile-phazor.sh
@@ -3,7 +3,7 @@
set -e

gcc src/phazor/kissfft/kiss_fftr.c src/phazor/kissfft/kiss_fft.c src/phazor/phazor.c \
- `pkg-config --cflags --libs samplerate wavpack opusfile vorbisfile libmpg123 flac libopenmpt libgme` \
+ `pkg-config --cflags --libs samplerate wavpack opusfile vorbisfile libmpg123 flac libopenmpt` \
-shared -o libphazor.so -fPIC -Wall -O3 -g #-Wextra
mkdir -p lib
mv libphazor.so lib/libphazor.so
diff --git a/src/phazor/phazor.c b/src/phazor/phazor.c
index e89edaf6..ecb84259 100644
--- a/src/phazor/phazor.c
+++ b/src/phazor/phazor.c
@@ -55,7 +55,6 @@
#include <libopenmpt/libopenmpt_stream_callbacks_file.h>
#include "kissfft/kiss_fftr.h"
#include "wavpack/wavpack.h"
-#include "gme/gme.h"

#define BUFF_SIZE 240000 // Decoded data buffer size
#define BUFF_SAFE 100000 // Ensure there is this much space free in the buffer
@@ -209,7 +208,6 @@ enum decoder_types {
MPT,
FEED,
WAVPACK,
- GME,
};

enum result_status_enum {
@@ -318,11 +316,6 @@ char parse_buffer[2048 * 2];
FILE* mod_file = 0;
openmpt_module* mod = 0;

-
-// GME related -------------------
-
-Music_Emu* emu;
-
// FFMPEG related -----------------------------------------------------

FILE *ffm;
@@ -893,9 +886,6 @@ void stop_decoder() {
case MPT:
openmpt_module_destroy(mod);
break;
- case GME:
- gme_delete(emu);
- break;
}
//src_reset(src);
decoder_allocated = 0;
@@ -1132,9 +1122,6 @@ void decode_seek(int abs_ms, int sample_rate) {
case MPT:
openmpt_module_set_position_seconds(mod, abs_ms / 1000.0);
break;
- case GME:
- gme_seek(emu, (long) abs_ms);
- break;
}
}

@@ -1281,7 +1268,6 @@ int load_next() {
long rate;
int e = 0;
int old_sample_rate = sample_rate_src;
- src_channels = 2;

char *ext;
ext = strrchr(loaded_target_file, '.');
@@ -1424,21 +1410,6 @@ int load_next() {
)
) codec = MPT;

- if (codec == UNKNOWN && ext != NULL && (
- strcmp(ext, ".spc") == 0 || strcmp(ext, ".SPC") == 0 ||
- strcmp(ext, ".ay") == 0 || strcmp(ext, ".AY") == 0 ||
- strcmp(ext, ".gbs") == 0 || strcmp(ext, ".GBS") == 0 ||
- strcmp(ext, ".gym") == 0 || strcmp(ext, ".GYM") == 0 ||
- strcmp(ext, ".hes") == 0 || strcmp(ext, ".HES") == 0 ||
- strcmp(ext, ".kss") == 0 || strcmp(ext, ".KSS") == 0 ||
- strcmp(ext, ".nsf") == 0 || strcmp(ext, ".NSF") == 0 ||
- strcmp(ext, ".nsfe") == 0 || strcmp(ext, ".NSFE") == 0 ||
- strcmp(ext, ".sap") == 0 || strcmp(ext, ".SAP") == 0 ||
- strcmp(ext, ".vgm") == 0 || strcmp(ext, ".VGM") == 0 ||
- strcmp(ext, ".vgz") == 0 || strcmp(ext, ".VGZ") == 0
- )
- ) codec = GME;
-
if (codec == UNKNOWN && ext != NULL) {
if (strcmp(ext, ".flac") == 0 || strcmp(ext, ".FLAC") == 0) {
codec = FLAC;
@@ -1476,25 +1447,6 @@ int load_next() {
return 0;
}

- if (codec == GME){
-
- sample_rate_src = 48000;
- gme_open_file(loaded_target_file, &emu, (long) sample_rate_src);
- gme_start_track(emu, subtrack);
-
- if (load_target_seek > 0) gme_seek(emu, (long) load_target_seek);
-
- if (old_sample_rate != sample_rate_src) {
- src_reset(src);
- }
-
- pthread_mutex_unlock(&buffer_mutex);
- decoder_allocated = 1;
-
- return 0;
-
- }
-
if (codec == MPT){

mod_file = uni_fopen(loaded_target_file);
@@ -1811,20 +1763,6 @@ void pump_decode() {
pthread_mutex_unlock(&buffer_mutex);
}

- } else if (codec == GME) {
-
- gme_play(emu, 1024, temp16l);
-
- pthread_mutex_lock(&buffer_mutex);
- read_to_buffer_s16int(temp16l, 1024);
- samples_decoded += 1024;
- pthread_mutex_unlock(&buffer_mutex);
-
- if (gme_track_ended(emu)){
- decoder_eos();
- }
-
-
} else if (codec == FLAC) {
// FLAC decoding

@@ -1853,12 +1791,7 @@ void pump_decode() {

unsigned int done;

- if(src_channels == 1){
- done = op_read(opus_dec, opus_buffer, 4096, NULL);
- }
- else{
- done = op_read_stereo(opus_dec, opus_buffer, 1024 * 2) * 2;
- }
+ done = op_read_stereo(opus_dec, opus_buffer, 1024 * 2) * 2;

pthread_mutex_lock(&buffer_mutex);
read_to_buffer_s16int(opus_buffer, done);
4 changes: 0 additions & 4 deletions audio/tauonmb/doinst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi

if [ -x /usr/bin/update-mime-database ]; then
/usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1
fi

if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
if [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
Expand Down
13 changes: 11 additions & 2 deletions audio/tauonmb/tauonmb.SlackBuild
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=tauonmb
VERSION=${VERSION:-7.8.0}
SRCNAM=Tauon
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

Expand Down Expand Up @@ -66,6 +66,15 @@ tar xvf $CWD/$SRCNAM-$VERSION.tar.gz

cd $SRCNAM-$VERSION

# - Replace my own isounidecode with Unidecode.
# - Pass libgme.
patch -p1 < $CWD/config/fix-tauon-options.patch

# Make libgme optional, isn't this messy already?
if [ ! "${LIBGME:-no}" = "yes" ]; then
patch -p1 < "$CWD/config/obsolete-libgme.patch"
fi

# PHAZOR dependencies (Do not modify this part)
mkdir -p src/phazor/{kissfft,miniaudio}
tar xvf $CWD/kissfft-$KFVER.tar.gz --strip-components=1 -C src/phazor/kissfft
Expand All @@ -87,7 +96,7 @@ rm -f locale/*/*/*.po

case "$RPC" in
[yY][eE][sS])
patch -p1 < "$CWD/flatpak-rpc.diff"
patch -p1 < "$CWD/config/flatpak-rpc.diff"
;;
esac

Expand Down
2 changes: 1 addition & 1 deletion audio/tauonmb/tauonmb.info
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ MD5SUM="1e056ebbc649db767ff64e9275df60c1 \
01b821de48cdba3838239b6cbd5e13e5"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="libopenmpt libgme musicbrainzngs mutagen pylast python3-isounidecode python3-natsort python3-plexapi python3-pulsectl python3-pylyrics python3-pysdl2 send2trash setproctitle python3-websocket-client"
REQUIRES="libopenmpt musicbrainzngs mutagen pylast Unidecode python3-natsort python3-plexapi python3-pulsectl python3-pylyrics python3-pysdl2 send2trash setproctitle python3-websocket-client"
MAINTAINER="Pouria Rezaei"
EMAIL="[email protected]"

0 comments on commit 9fa0e49

Please sign in to comment.