Keep sound paths independent from API data
This commit is contained in:
+5
-4
@@ -13,6 +13,9 @@
|
||||
# notifytype=soundpack # Enable sound notifications
|
||||
# notifies=default,mention,dm,me,follow,boost,favourite
|
||||
|
||||
my $soundDataDir = ($ENV{'XDG_DATA_HOME'} || "$ENV{'HOME'}/.local/share") .
|
||||
"/ttyverse";
|
||||
|
||||
sub notifier_soundpack {
|
||||
my $class = shift;
|
||||
my $text = shift;
|
||||
@@ -52,16 +55,14 @@ sub notifier_soundpack {
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Use the same XDG data directory as TTYverse and the extension manager.
|
||||
my $data_dir = $data;
|
||||
my $sound_file = "$data_dir/sounds/$sound_pack/" . lc($class) . ".ogg";
|
||||
my $sound_file = "$soundDataDir/sounds/$sound_pack/" . lc($class) . ".ogg";
|
||||
|
||||
if (!-f $sound_file) {
|
||||
# Only warn once per session per class
|
||||
my $warn_key = "warned_missing_sound_$class";
|
||||
if (!$store->{$warn_key}) {
|
||||
print $stdout "-- Warning: Sound file '$class.ogg' not found in pack '$sound_pack'\n";
|
||||
print $stdout "-- Place sound files in $data_dir/sounds/$sound_pack/\n";
|
||||
print $stdout "-- Place sound files in $soundDataDir/sounds/$sound_pack/\n";
|
||||
$store->{$warn_key} = 1;
|
||||
}
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user