Yh-j70

From chaoswiki
Revision as of 13:59, 30 April 2006 by Atari (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I own a Samsung YH-J70 mp3 player with 20gb of space. Because i dont really like to use windows i had to write a script so i can make playlists under linux. The script is more or less self explainary. If not, post your questions below.

Code: playlists.sh
#!/bin/bash
if [ -z "$1" -o -z "$2" ]; then
        echo "Use: <playlistname> \"<directory\""
        exit;
fi

if [ -z $1 ] ; then
   PLAYLIST=all
else
   PLAYLIST=$1
fi

if [ -z "$2" -a -n "$1" ] ; then
   DIRECTORY="/mnt/samsung/music"
else
   DIRECTORY=$2
fi

SOUNDDIR=`echo $DIRECTORY | sed 's|/mnt/samsung/||g'`

cp /mnt/samsung/data/playlist/head.txt /mnt/samsung/music/playlist/$PLAYLIST.spl
cd /mnt/samsung
find "$DIRECTORY" -type f -name *[mM][pP]3 | sed  's/music\//\\MUSIC\\/g' | sed 's/\//\\/g' | sort | sed 's/$/\x0D\x00/' | sed 's|.|\x00&|g' >> music/playlist/all.spl

cat /mnt/samsung/data/playlist/footer.txt >> /mnt/samsung/music/playlist/all.spl

Usage: ./playlist.sh <playlist> <directory of sound files/>


Code: head.txt
<FF><FE>S^@P^@L^@ ^@P^@L^@A^@Y^@L^@I^@S^@T^@^M^@
^@V^@E^@R^@S^@I^@O^@N^@ ^@1^@.^@0^@0^@^M^@
^@^M^@
Code: footer.txt
<FF><FE>S^@P^@L^@ ^@P^@L^@A^@Y^@L^@I^@S^@T^@^M^@
^@V^@E^@R^@S^@I^@O^@N^@ ^@1^@.^@0^@0^@^M^@

Take attention. head.txt and footer.txt include hex chars. These are needed by the YH-J70.

Any Suggestions?