Sign up here and you can log into the forum!

3/15/2013 Plugin: Random Music Player 1.1

The WDTVExt plugin depot. Plugins/libraries/code only

Re: 1/29/2013 Plugin: Random Music Player 1.0   

Postby KAD » Wed Mar 13, 2013 5:12 pm

I don't know why that \r is showing up

I'll pull my device out tonight and see if I can test
figure out what is wrong
If you like my work please consider a Donation. Donate
Please read the appropriate documentation before posting questions! READ ME FAQ WIKI
PM's are for private matters. Post support questions to the appropriate forum, or they will be ignored.
User avatar
KAD
Global Moderator
 
Posts: 5103
Joined: Mon Apr 12, 2010 4:59 pm
Location: Seattle, WA USA

Re: 1/29/2013 Plugin: Random Music Player 1.0   

Postby KAD » Wed Mar 13, 2013 5:26 pm

initial output from cmd line

Code: Select all
# which RandomMusicPlayerLoop
/bin/RandomMusicPlayerLoop
# readlink /bin/RandomMusicPlayerLoop
/tmp/wdtvext-plugins/RandomMusicPlayer/bin/RandomMusicPlayerLoop
# RandomMusicPlayerLoop "/tmp/media/usb/Music/Bethany Dillon" ".*\.(mp3|wma|mpa|m4a|mp4a|ogg|wav|aac|flac|aif|aiff|mka)"
Index 0 : /tmp/media/usb/Music/Bethany Dillon/01 Revolutionaries.mp3
Index 1 : /tmp/media/usb/Music/Bethany Dillon/03 Beautiful.mp3
Index 2 : /tmp/media/usb/Music/Bethany Dillon/04 Move Forward.mp3
Index 3 : /tmp/media/usb/Music/Bethany Dillon/07 Aimless.mp3
Index 4 : /tmp/media/usb/Music/Bethany Dillon/05 For My Love.mp3
Index 5 : /tmp/media/usb/Music/Bethany Dillon/08 Lead Me On.mp3
Index 6 : /tmp/media/usb/Music/Bethany Dillon/06 All I Need.mp3
Index 7 : /tmp/media/usb/Music/Bethany Dillon/09 Exodus (Faithful).mp3
Index 8 : /tmp/media/usb/Music/Bethany Dillon/10 Why.mp3
Index 9 : /tmp/media/usb/Music/Bethany Dillon/02 Great Big Mystery.mp3
Index 10 : /tmp/media/usb/Music/Bethany Dillon/11 A Voice Calling Out.mp3
Current State : STOPPED
Total Number of Files : 11
Selected File : /tmp/media/usb/Music/Bethany Dillon/11 A Voice Calling Out.mp3


Play File :  /tmp/media/usb/Music/Bethany Dillon/11 A Voice Calling Out.mp3
Removed Arrey Element Number:  10  File:  /tmp/media/usb/Music/Bethany Dillon/11 A Voice Calling Out.mp3
Remaing Array Elements
Index 0 : /tmp/media/usb/Music/Bethany Dillon/01 Revolutionaries.mp3
Index 1 : /tmp/media/usb/Music/Bethany Dillon/03 Beautiful.mp3
Index 2 : /tmp/media/usb/Music/Bethany Dillon/04 Move Forward.mp3
Index 3 : /tmp/media/usb/Music/Bethany Dillon/07 Aimless.mp3
Index 4 : /tmp/media/usb/Music/Bethany Dillon/05 For My Love.mp3
Index 5 : /tmp/media/usb/Music/Bethany Dillon/08 Lead Me On.mp3
Index 6 : /tmp/media/usb/Music/Bethany Dillon/06 All I Need.mp3
Index 7 : /tmp/media/usb/Music/Bethany Dillon/09 Exodus (Faithful).mp3
Index 8 : /tmp/media/usb/Music/Bethany Dillon/10 Why.mp3
Index 9 : /tmp/media/usb/Music/Bethany Dillon/02 Great Big Mystery.mp3
Current State :  TRANSITIONING
Current Number of Files in Array :  10
Current State :  PLAYING
Current Number of Files in Array :  10
Current State :  PLAYING
Current Number of Files in Array :  10
Current State :  PLAYING
Current Number of Files in Array :  10
#


even if I specify bash as the shell, I get no errors

Time for Dinner, will test some more later
If you like my work please consider a Donation. Donate
Please read the appropriate documentation before posting questions! READ ME FAQ WIKI
PM's are for private matters. Post support questions to the appropriate forum, or they will be ignored.
User avatar
KAD
Global Moderator
 
Posts: 5103
Joined: Mon Apr 12, 2010 4:59 pm
Location: Seattle, WA USA

Re: 1/29/2013 Plugin: Random Music Player 1.0   

Postby KAD » Wed Mar 13, 2013 6:17 pm

I still can't produce any errors on this end

anybody else have idea's
basically not having access to Area 51, he's tried to build his own 1.05.04-dev with working wdtvext
to summarize here's what I see, 4 items, which may or may not be related

lots of webend errors related to wdlxtv_options.php which is one of the primary webend files
some missing wdtvext webend bits
unable to call script which is symlinked into /bin/
directly calling script while specifying bash as shell, produces errors, which I'm unable to reproduce
If you like my work please consider a Donation. Donate
Please read the appropriate documentation before posting questions! READ ME FAQ WIKI
PM's are for private matters. Post support questions to the appropriate forum, or they will be ignored.
User avatar
KAD
Global Moderator
 
Posts: 5103
Joined: Mon Apr 12, 2010 4:59 pm
Location: Seattle, WA USA

Re: 1/29/2013 Plugin: Random Music Player 1.0   

Postby sonic_blue » Wed Mar 13, 2013 9:21 pm

Since it was complaining of an unexpected "(" on line 7, I got rid of the "(" from line 7 so that it looks like this:

Code: Select all
VIDEOS=$(find "$FILELOOP_DIR" -type f -regextype posix-extended -iregex "$FILELOOP_TYPE")


And now that line will execute without errors.

So, it seems there are some major syntax difference between the system you coded it on and the one that is running on mine.

Are they the same kernel version? Is it possible you are using a different 1.05-dev than mine? Different RandomMusicPlayerLoop script? Is the one you uploaded the same one you are running on your box?
sonic_blue
DLX'er
 
Posts: 53
Joined: Wed Feb 20, 2013 8:31 am

Re: 1/29/2013 Plugin: Random Music Player 1.0   

Postby mad_ady » Wed Mar 13, 2013 10:36 pm

Can you provide the following info (for the unmodified file)?

Code: Select all
md5sum /tmp/wdtvext-plugins/RandomMusicPlayer/bin/RandomMusicPlayerLoop
bash -x /tmp/wdtvext-plugins/RandomMusicPlayer/bin/RandomMusicPlayerLoop "/tmp/media/usb/USB1/989F-7BB5/Audio/" ".*.(mp3|wma|mpa|m4a|mp4a|ogg|wav|aac|flac|aif|aiff|mka)" 2>&1 | tee /tmp/play.log
cat /tmp/play.log


You can either use a propper telnet client (like putty) and copy-paste the output in a code block here, or copy the /tmp/play.log file and open it on your PC.
User avatar
mad_ady
Developer
 
Posts: 4553
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: 1/29/2013 Plugin: Random Music Player 1.0   

Postby KAD » Wed Mar 13, 2013 10:41 pm

sonic_blue wrote:Since it was complaining of an unexpected "(" on line 7, I got rid of the "(" from line 7 so that it looks like this:

Code: Select all
VIDEOS=$(find "$FILELOOP_DIR" -type f -regextype posix-extended -iregex "$FILELOOP_TYPE")


And now that line will execute without errors.

So, it seems there are some major syntax difference between the system you coded it on and the one that is running on mine.

Are they the same kernel version? Is it possible you are using a different 1.05-dev than mine? Different RandomMusicPlayerLoop script? Is the one you uploaded the same one you are running on your box?


there are 2 kernel's available, to my knowledge they should not make a difference regarding the behavior of bash
however
here's what I'm running
Code: Select all
# uname -a
Linux WDLXTV-LIVE 2.6.22.19-19-4 #9 PREEMPT Mon Aug 1 14:35:04 CST 2011 mips GNU/Linux
# bash --version
GNU bash, version 4.0.28(1)-release (mipsel-unknown-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
#


as for your change
this
Code: Select all
VIDEOS=$(find "$FILELOOP_DIR" -type f -regextype posix-extended -iregex "$FILELOOP_TYPE")

creates a single variable and will not work

here's the output
Code: Select all
# RandomMusicPlayerLoop "/tmp/media/usb/Music/Bethany Dillon" ".*\.(mp3|wma|mpa|m4a|mp4a|ogg|wav|aac|flac|aif|aiff|mka)"
Index 0 : /tmp/media/usb/Music/Bethany Dillon/01 Revolutionaries.mp3
/tmp/media/usb/Music/Bethany Dillon/03 Beautiful.mp3
/tmp/media/usb/Music/Bethany Dillon/04 Move Forward.mp3
/tmp/media/usb/Music/Bethany Dillon/07 Aimless.mp3
/tmp/media/usb/Music/Bethany Dillon/05 For My Love.mp3
/tmp/media/usb/Music/Bethany Dillon/08 Lead Me On.mp3
/tmp/media/usb/Music/Bethany Dillon/06 All I Need.mp3
/tmp/media/usb/Music/Bethany Dillon/09 Exodus (Faithful).mp3
/tmp/media/usb/Music/Bethany Dillon/10 Why.mp3
/tmp/media/usb/Music/Bethany Dillon/02 Great Big Mystery.mp3
/tmp/media/usb/Music/Bethany Dillon/11 A Voice Calling Out.mp3
Current State : PLAYING
Total Number of Files : 1
Selected File : /tmp/media/usb/Music/Bethany Dillon/01 Revolutionaries.mp3 /tmp/media/usb/Music/Bethany Dillon/03 Beautiful.mp3 /tmp/media/usb/Music/Bethany Dillon/04 Move Forward.mp3 /tmp/media/usb/Music/Bethany Dillon/07 Aimless.mp3 /tmp/media/usb/Music/Bethany Dillon/05 For My Love.mp3 /tmp/media/usb/Music/Bethany Dillon/08 Lead Me On.mp3 /tmp/media/usb/Music/Bethany Dillon/06 All I Need.mp3 /tmp/media/usb/Music/Bethany Dillon/09 Exodus (Faithful).mp3 /tmp/media/usb/Music/Bethany Dillon/10 Why.mp3 /tmp/media/usb/Music/Bethany Dillon/02 Great Big Mystery.mp3 /tmp/media/usb/Music/Bethany Dillon/11 A Voice Calling Out.mp3
Removed Arrey Element Number:  0  File:  /tmp/media/usb/Music/Bethany Dillon/01 Revolutionaries.mp3 /tmp/media/usb/Music/Bethany Dillon/03 Beautiful.mp3 /tmp/media/usb/Music/Bethany Dillon/04 Move Forward.mp3 /tmp/media/usb/Music/Bethany Dillon/07 Aimless.mp3 /tmp/media/usb/Music/Bethany Dillon/05 For My Love.mp3 /tmp/media/usb/Music/Bethany Dillon/08 Lead Me On.mp3 /tmp/media/usb/Music/Bethany Dillon/06 All I Need.mp3 /tmp/media/usb/Music/Bethany Dillon/09 Exodus (Faithful).mp3 /tmp/media/usb/Music/Bethany Dillon/10 Why.mp3 /tmp/media/usb/Music/Bethany Dillon/02 Great Big Mystery.mp3 /tmp/media/usb/Music/Bethany Dillon/11 A Voice Calling Out.mp3
/bin/RandomMusicPlayerLoop: line 45: unset: VIDEOS: not an array variable
Remaing Array Elements
Index 0 : /tmp/media/usb/Music/Bethany Dillon/01 Revolutionaries.mp3
/tmp/media/usb/Music/Bethany Dillon/03 Beautiful.mp3
/tmp/media/usb/Music/Bethany Dillon/04 Move Forward.mp3
/tmp/media/usb/Music/Bethany Dillon/07 Aimless.mp3
/tmp/media/usb/Music/Bethany Dillon/05 For My Love.mp3
/tmp/media/usb/Music/Bethany Dillon/08 Lead Me On.mp3
/tmp/media/usb/Music/Bethany Dillon/06 All I Need.mp3
/tmp/media/usb/Music/Bethany Dillon/09 Exodus (Faithful).mp3
/tmp/media/usb/Music/Bethany Dillon/10 Why.mp3
/tmp/media/usb/Music/Bethany Dillon/02 Great Big Mystery.mp3
/tmp/media/usb/Music/Bethany Dillon/11 A Voice Calling Out.mp3


Notice the total number of files is only 1
also the selected file, what a mess
and you end up with unset array errors because the variable is not actually stated as an array

but this
Code: Select all
VIDEOS=($(find "$FILELOOP_DIR" -type f -regextype posix-extended -iregex "$FILELOOP_TYPE"))

creates an array

the output
Code: Select all
# RandomMusicPlayerLoop "/tmp/media/usb/Music/Bethany Dillon" ".*\.(mp3|wma|mpa|m4a|mp4a|ogg|wav|aac|flac|aif|aiff|mka)"
Index 0 : /tmp/media/usb/Music/Bethany Dillon/01 Revolutionaries.mp3
Index 1 : /tmp/media/usb/Music/Bethany Dillon/03 Beautiful.mp3
Index 2 : /tmp/media/usb/Music/Bethany Dillon/04 Move Forward.mp3
Index 3 : /tmp/media/usb/Music/Bethany Dillon/07 Aimless.mp3
Index 4 : /tmp/media/usb/Music/Bethany Dillon/05 For My Love.mp3
Index 5 : /tmp/media/usb/Music/Bethany Dillon/08 Lead Me On.mp3
Index 6 : /tmp/media/usb/Music/Bethany Dillon/06 All I Need.mp3
Index 7 : /tmp/media/usb/Music/Bethany Dillon/09 Exodus (Faithful).mp3
Index 8 : /tmp/media/usb/Music/Bethany Dillon/10 Why.mp3
Index 9 : /tmp/media/usb/Music/Bethany Dillon/02 Great Big Mystery.mp3
Index 10 : /tmp/media/usb/Music/Bethany Dillon/11 A Voice Calling Out.mp3
Current State : STOPPED
Total Number of Files : 11
Selected File : /tmp/media/usb/Music/Bethany Dillon/10 Why.mp3


Play File :  /tmp/media/usb/Music/Bethany Dillon/10 Why.mp3
Removed Arrey Element Number:  8  File:  /tmp/media/usb/Music/Bethany Dillon/10 Why.mp3
Remaing Array Elements
Index 0 : /tmp/media/usb/Music/Bethany Dillon/01 Revolutionaries.mp3
Index 1 : /tmp/media/usb/Music/Bethany Dillon/03 Beautiful.mp3
Index 2 : /tmp/media/usb/Music/Bethany Dillon/04 Move Forward.mp3
Index 3 : /tmp/media/usb/Music/Bethany Dillon/07 Aimless.mp3
Index 4 : /tmp/media/usb/Music/Bethany Dillon/05 For My Love.mp3
Index 5 : /tmp/media/usb/Music/Bethany Dillon/08 Lead Me On.mp3
Index 6 : /tmp/media/usb/Music/Bethany Dillon/06 All I Need.mp3
Index 7 : /tmp/media/usb/Music/Bethany Dillon/09 Exodus (Faithful).mp3
Index 8 : /tmp/media/usb/Music/Bethany Dillon/02 Great Big Mystery.mp3
Index 9 : /tmp/media/usb/Music/Bethany Dillon/11 A Voice Calling Out.mp3
Current State :  TRANSITIONING
Current Number of Files in Array :  10


Notice again the number of elements in the array
If you like my work please consider a Donation. Donate
Please read the appropriate documentation before posting questions! READ ME FAQ WIKI
PM's are for private matters. Post support questions to the appropriate forum, or they will be ignored.
User avatar
KAD
Global Moderator
 
Posts: 5103
Joined: Mon Apr 12, 2010 4:59 pm
Location: Seattle, WA USA

Re: 1/29/2013 Plugin: Random Music Player 1.0   

Postby sonic_blue » Thu Mar 14, 2013 12:57 am

mad_ady wrote:Can you provide the following info (for the unmodified file)?

Code: Select all
md5sum /tmp/wdtvext-plugins/RandomMusicPlayer/bin/RandomMusicPlayerLoop
bash -x /tmp/wdtvext-plugins/RandomMusicPlayer/bin/RandomMusicPlayerLoop "/tmp/media/usb/USB1/989F-7BB5/Audio/" ".*.(mp3|wma|mpa|m4a|mp4a|ogg|wav|aac|flac|aif|aiff|mka)" 2>&1 | tee /tmp/play.log
cat /tmp/play.log


You can either use a propper telnet client (like putty) and copy-paste the output in a code block here, or copy the /tmp/play.log file and open it on your PC.


Code: Select all
# md5sum /tmp/wdtvext-plugins/RandomMusicPlayer/bin/RandomMusicPlayerLoop
9b7f1db9a5262edd74f71b7624e987bf  /tmp/wdtvext-plugins/RandomMusicPlayer/bin/RandomMusicPlayerLoop


play.log

Code: Select all
+ IFS='

'
+ FILELOOP_DIR=$'/tmp/media/usb/USB2/200F-68D0/Audio/\r'
+ FILELOOP_TYPE='.*\.(mp3|wma|mpa|m4a|mp4a|ogg|wav|aac|flac|aif|aiff|mka)
'
++ find $'/tmp/media/usb/USB2/200F-68D0/Audio/\r' -type f -regextype posix-extended -iregex '.*\.(mp3|wma|mpa|m4a|mp4a|ogg|wav|aac|flac|aif|aiff|mka)
'
find: `/tmp/media/usb/USB2/200F-68D0/Audio/\r': No such file or directory
+ VIDEOS='()
'
/tmp/wdtvext-plugins/RandomMusicPlayer/bin/RandomMusicPlayerLoop: line 9: syntax error near unexpected token `do
'
/tmp/wdtvext-plugins/RandomMusicPlayer/bin/RandomMusicPlayerLoop: line 9: `do
'



It's got to be something to do with that carriage return \r.

It doesn't have any trouble reading in the path string if I do it manually:

Code: Select all
#
# FILELOOP_DIR="/tmp/media/usb/USB2/200F-68D0/Audio/"
# echo $FILELOOP_DIR
/tmp/media/usb/USB2/200F-68D0/Audio/
#


it's just something about script files which it cannot cope with. :evil:
sonic_blue
DLX'er
 
Posts: 53
Joined: Wed Feb 20, 2013 8:31 am

Re: 1/29/2013 Plugin: Random Music Player 1.0   

Postby mad_ady » Thu Mar 14, 2013 1:33 am

Hmm, I'm not sure where it gets that \r from - some sort of CR from a funky terminal - have you tried putty instead of the webend client? Might make all the difference.

However, you can try this also - edit the script and before the find line you can "sanitize" the path like this (note - I haven't seen the original code - you might need to adjust this):
Code: Select all
FILELOOP_DIR=`echo $FILELOOP_DIR | sed 's/\r//g'`

This should remove any \rs from your string.
User avatar
mad_ady
Developer
 
Posts: 4553
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: 1/29/2013 Plugin: Random Music Player 1.0   

Postby recliq » Thu Mar 14, 2013 1:36 am

The \r suggests the file was edited in a non linux editor... (Windows? OSX?)
Try converting to to linux format using dos2unix.

Have you tried with a fresh, unaltered copy of the app.bin/plugin?
­WDLXTV Project Maintainer
-:] If you like my contributions feel free to donate for a beer or a new flash drive. ...and always remember: RTFM! (README, FAQ, WIKI) [:-
User avatar
recliq
WDLXTV Team
 
Posts: 5513
Joined: Thu Apr 15, 2010 8:09 am
Location: Kiel, Germany

Re: 1/29/2013 Plugin: Random Music Player 1.0   

Postby sonic_blue » Thu Mar 14, 2013 1:55 am

mad_ady wrote:Hmm, I'm not sure where it gets that \r from - some sort of CR from a funky terminal - have you tried putty instead of the webend client? Might make all the difference.

However, you can try this also - edit the script and before the find line you can "sanitize" the path like this (note - I haven't seen the original code - you might need to adjust this):
Code: Select all
FILELOOP_DIR=`echo $FILELOOP_DIR | sed 's/\r//g'`

This should remove any \rs from your string.


Thanks, but of course it didn't work :)

It's actually adding the \r much later in the script, because if I just echo $FILELOOP_DIR on the line immediately after $FILELOOP_DIR="$1", the string it echoes is fine and doesn't have the \r.

So, buggered if I know what's going on. For some reason the shell is adding all these carriage returns \r's during the script execution.
sonic_blue
DLX'er
 
Posts: 53
Joined: Wed Feb 20, 2013 8:31 am

PreviousNext

Return to WDTVExt plugins

Who is online

Users browsing this forum: No registered users and 3 guests