Upload bestanden naar "/"

This commit is contained in:
topterrorist 2025-08-17 16:58:45 +02:00
parent 687450f21b
commit 89d83f6e27
4 changed files with 105 additions and 0 deletions

13
enqueue.desktop Normal file
View file

@ -0,0 +1,13 @@
# i made this cause i was missing the enque button that i used to have on windows
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=audio/basic;audio/wav;audio/x-wav;audio/x-aiff;audio/ogg;audio/vorbis+ogg;audio/mp4;audio/aac;audio/wavpack;audio/flac;application/vnd.apple.mpegurl;audio/mod;audio/x-mod;audio/x-xm;audio/x-s3m;audio/x-it;audio/x-mtm;audio/x-med;application/x-umx;audio/dsd;audio/x-dsf;audio/x-dff;application/x-dsd;audio/ape;audio/x-ape;application/x-cue
Actions=EnqueueFoobar
X-KDE-AuthorizeAction=shell_access
[Desktop Action EnqueueFoobar]
Name=Enqueue in Foobar2000
Icon=foobar2000.png
Exec="$HOME/foobar on linux/foo_play.sh" enque %F
Comment=Enqueue selected tracks in Foobar2000

81
foo_play.sh Normal file
View file

@ -0,0 +1,81 @@
#!/bin/bash
# rich presence and track loading handler to a Wine installation of foobar2000
# declare variables
enque=false
#paths
FOOBAR_HOME="$HOME/foobar on linux/foobar2000"
#the folder the foobar2000 executable folder is located in
# trigger wine discord IPC bridge script (optional)
<<bridge
PATH_BRIDGE="$HOME/foobar on linux"
#the folder the bridge executable folder is located in
{
# path to bridge executable
# Define the path to the flag file
FLAG_FILE="/tmp/.discordwineipcbridge_flag"
#Check if the flag file exists
if [ -f "$FLAG_FILE" ]; then
echo "bridge is active."
exit 1
fi
#make flag
touch "$FLAG_FILE"
# run ipc bridge
wine "$PATH_BRIDGE/bridge.exe"
# delete flag file when the ipc bridge dies for no reason eventually
rm $FLAG_FILE
} &
bridge
# Go through args, convert paths to existing files to Windows style without using winepath (cause its bad and doesnt work properly with long paths)
# i barely know how this thing works so if you have issues good luck
# also contains enque logic (idk this bad code but i dont care)
i=0
args=()
for arg in "$@"; do
# If the argument is "enque", skip it and don't add it to the args array
if [[ "$arg" == "enque" ]]; then
enque=true
continue
fi
# If the argument is a valid file or directory, handle it as a path
if [ -e "$arg" ]; then
if [[ "$arg" =~ ^/mnt/[a-zA-Z]/ ]]; then
# Convert /mnt/c/... to C:\...
win_path=$(echo "$arg" | sed -E 's|^/mnt/([a-zA-Z])|\\\1|;s|/|\\|g')
else
# For other Unix paths, replace slashes with backslashes
win_path=$(echo "$arg" | sed 's|/|\\|g')
fi
args[$i]="$win_path"
else
# If it's not a valid file, just use the argument as is
args[$i]="$arg"
fi
((++i))
done
#add drive letter and make it into a UNC path or smth i forgor
for i in "${!args[@]}"; do
args[$i]="\\\\?\\Z:\\${args[$i]}"
done
# Launch foobar2000 with a high process prio to prevent audio lag and hitching (only really noticable when doing high processor demanding tasks)
# if the argument "enque" has been submitted it will enque
if $enque; then
nice -n -20 wine "$FOOBAR_HOME/foobar2000.exe" "/add" "${args[@]}" 2>/dev/null &
else
nice -n -20 wine "$FOOBAR_HOME/foobar2000.exe" "${args[@]}" 2>/dev/null &
fi

11
foobar2000.desktop Normal file
View file

@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Name=foobar2000
GenericName=Plays Music
Comment=Plays music
Exec="$HOME/foobar on linux/foo_play.sh"
Terminal=false
StartupNotify=true
MimeType=audio/basic;audio/vnd.wav;audio/x-wav;audio/x-aiff;audio/ogg;audio/vorbis;audio/x-vorbis+ogg;audio/mpeg;audio/mp4;audio/aac;audio/x-wavpack;application/vnd.apple.mpegurl
Categories=AudioVideo;Audio;Player
Icon=foobar2000.png

BIN
foobar2000.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB