Skip to content

Commit 749ba9b

Browse files
committed
player.in: exit if SONG_URI not set
1 parent 36de6e2 commit 749ba9b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ now-playing - Passed when a song starts playing
4949
end-song - Passed when a song finishes playing
5050
```
5151

52-
The default installation makes a copy of `/usr/libexec/mpdev/player` and `/usr/libexec/mpdev/playpause` in `$HOME/.mpdev` for the user with uid `1000`. The player script inserts or updates songs in the stat.db, sticker.db sqlite database when a song gets played. For bulk inserts, updates, deletion, the **mpdev** package also comes with `mpdev_update(1)` and `mpdev_cleanup(1)` programs that help in maintaining `stats.db`, `sticker.db` sqlite databases. This two programs use SQL Transactions and are extremely fast and takes just a few seconds to create/update the stats.db, sticker.db sqlite databases. You can disable all database updates by the player script, by setting **NO_DB_UPDATE** environment variable. In such a case, the player script will just print information about the song being played and actions like pause, stop, play. The default installation also makes a copy of `/usr/libexec/mpdev/output` and `/usr/libexec/mpdev/mixer` in `$HOME/mpdev`. At the moment, these scripts just print information of the state of output devices and the volume level. You can edit them if you can think of something useful. If you are installing mpdev from the [Open Build Service repository](https://software.opensuse.org//download.html?project=home%3Ambhangui%3Araspi&package=mpdev), the mpdev sevice will automatically update these scripts if they change in the package. If you don't want auto-udpate you can create an override file. e.g. If you create a file $HOME/.mpdev/.player.nooverwrite, the script $HOME/.mpdev/player will never be replaced with a newer script from the binary package.
52+
The default installation makes a copy of `/usr/libexec/mpdev/player` and `/usr/libexec/mpdev/playpause` in `$HOME/.mpdev` for the user with uid `1000`. The player script inserts or updates songs in the stat.db, sticker.db sqlite database when a song gets played. For bulk inserts, updates, deletion, the **mpdev** package also comes with `mpdev_update(1)` and `mpdev_cleanup(1)` programs that help in maintaining `stats.db`, `sticker.db` sqlite databases. This two programs use SQL Transactions and are extremely fast and takes just a few seconds to create/update the stats.db, sticker.db sqlite databases. You can disable all database updates by the player script, by setting **NO_DB_UPDATE** environment variable. In such a case, the player script will just print information about the song being played and actions like pause, stop, play. The default installation also makes a copy of `/usr/libexec/mpdev/output` and `/usr/libexec/mpdev/mixer` in `$HOME/mpdev`. At the moment, these scripts just print information of the state of output devices and the volume level. You can edit them if you can think of something useful. If you are installing mpdev from the [Open Build Service repository](https://software.opensuse.org//download.html?project=home%3Ambhangui%3Araspi&package=mpdev), the mpdev sevice will automatically update these scripts if they change in the package. If you don't want auto-update you can create an override file. e.g. If you create a file $HOME/.mpdev/.player.nooverwrite, the script $HOME/.mpdev/player will never be replaced with a newer script from the binary package.
5353

5454
Example 1. create stats.db in the current directory
5555

doc/ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Release 1.1 Start 30/06/2022 End --/--/----
5959
31. songi: fixed last_played when song has never been played
6060
- 11/02/2025
6161
32. player.in: return db operation 5 times on failure
62+
- 17/11/2025
63+
33. player.in: exit if SONG_URI not set
6264

6365
* Thu Jun 30 2022 18:32:58 IST Manvendra Bhangui <mpdev@indimail.org> 1.0-1.1%{?dist}
6466
Release 1.0 Start 02/03/2020 End 30/06/2022

player.in

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
#
33
#
4-
# $Id: player.in,v 1.56 2025-10-24 23:23:11+05:30 Cprogrammer Exp mbhangui $
4+
# $Id: player.in,v 1.57 2025-11-17 18:44:37+05:30 Cprogrammer Exp mbhangui $
55
#
66
get_mpd_conf_value()
77
{
@@ -650,6 +650,10 @@ case "$SYSTEM" in
650650
gnu_date=0
651651
;;
652652
esac
653+
if [ -z "$SONG_URI" ] ; then
654+
echo "SONG_URI not set" 1>&2
655+
exit 0
656+
fi
653657
# we don't handle stream uri currently
654658
echo $SONG_URI|grep -E "^http:|^https:" > /dev/null
655659
if [ $? -eq 0 ] ; then
@@ -699,6 +703,9 @@ fi
699703
exit 0
700704

701705
# $Log: player.in,v $
706+
# Revision 1.57 2025-11-17 18:44:37+05:30 Cprogrammer
707+
# exit if SONG_URI not set
708+
#
702709
# Revision 1.56 2025-10-24 23:23:11+05:30 Cprogrammer
703710
# fix syntax errors
704711
#

0 commit comments

Comments
 (0)