guo-yu / player

a command line player, supports play mp3 both from uri and local stream.
261 stars 66 forks source link

CLI Allow specifying of the path rather than assuming current directory #29

Closed yuvilio closed 9 years ago

yuvilio commented 9 years ago

If I pass the full path, it complains since the current directory is automatically tacked on. Only works if i specify a path relative to the current directory.

#doesn't work but should:
$ player play ~/.local/share/sounds/CRASH_6.mp3 

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: ENOENT, open '/home/yuvilio/home/yuvilio/.local/share/sounds/CRASH_6.mp3'
#works but too restricting: 
$ player play .local/share/sounds/CRASH_6.mp3 
$ 

Can we specify the path either way and the script will just use that?

My workaround is to wrap it in a subprocess using $(...) and change directory temporarily to the root so that my directory in my main process isn't changed:

$ echo $BEEPMP3 
/home/yuvilio/.local/share/sounds/CRASH_6.mp3
$ pwd
/home/yuvilio/.local/share
$ $(cd /; player play $BEEPMP3)
$ 
guo-yu commented 9 years ago

Sure, I'll fix that

guo-yu commented 9 years ago

Sorry for the delay since Im traveled in Okinawa last couple of days. This bug have been fixed with a new bugfix version v0.3.1 which has been shipped.

yuvilio commented 9 years ago

Just updated and works great. Can just pass the file path directly now. Thanks!