NSLU2-Linux
view · edit · print · history

Puppy.SendMp3sToToppy History

Hide minor edits - Show changes to markup

October 01, 2005, at 11:28 AM by epg -- updated to reflect Puppy\'s new turbo behaviour
Changed lines 37-38 from:
to:
 puppy -c turbo 1
Changed lines 40-41 from:
 puppy -t -c mkdir \\MP3\\"$the_dir"
to:
 puppy -c mkdir \\MP3\\"$the_dir"
Changed line 46 from:
        puppy -t -c put "$file" \\MP3\\"$the_dir"\\"$this_file";
to:
        puppy -c put "$file" \\MP3\\"$the_dir"\\"$this_file";
Added lines 50-52:
 puppy -c turbo 0
June 21, 2005, at 02:10 AM by tman --
Deleted lines 3-4:
Changed lines 6-7 from:
to:

(:table border=0 width=100% bgcolor=#eeffee:) (:cell:)

Changed lines 10-11 from:
 #       create a directory of the same name on the Topfield (in the Topfield's \MP3? directory)
 #       copy all of the mp3s from the source directory to the new directory on the Topfield 
to:
 #       create a directory of the same name on the Topfield (in the Topfield's \MP3 directory)
 #       copy all of the MP3s from the source directory to the new directory on the Topfield 
Changed lines 38-40 from:
 echo "making a directory called \\Mp3\\"$the_dir" (on the Topfield)"
 puppy -t -c mkdir \\MP3?\\"$the_dir"
to:
 echo "making a directory called \\Mp3\\"$the_dir" (on the Topfield)"
 puppy -t -c mkdir \\MP3\\"$the_dir"
Changed line 45 from:
        puppy -t -c put "$file" \\MP3?\\"$the_dir"\\"$this_file";
to:
        puppy -t -c put "$file" \\MP3\\"$the_dir"\\"$this_file";
Changed lines 49-50 from:
to:

(:tableend:)

Changed lines 55-56 from:
to:

(:table border=0 width=100% bgcolor=#eeffee:) (:cell:)

Changed line 61 from:
 # This script copies *.mp3 files to a Topfield 5000 PVRt?
to:
 # This script copies *.mp3 files to a Topfield 5000 PVRt
Changed line 63 from:
 # Set Dirmp3Src? to your mp3 source directory
to:
 # Set Dirmp3Src to your mp3 source directory
Changed line 77 from:
 # of 128 folders in each; e.g. under MP3?  "MP3?/Artists A to M" and "MP3?/Artists N to Z"
to:
 # of 128 folders in each; e.g. under MP3  "MP3/Artists A to M" and "MP3/Artists N to Z"
Changed line 103 from:
 # After copying all the MP3s? to the PVR, you should restart the PVR. It looks 
to:
 # After copying all the MP3s to the PVR, you should restart the PVR. It looks 
Changed line 113 from:
 # start copying mp3 files from here - typically this is a Linux/Windows remote share
to:
 # start copying MP3 files from here - typically this is a Linux/Windows remote share
Changed lines 115-116 from:

Dirmp3Src?=/root/P4

to:
 Dirmp3Src=/root/P4
Changed lines 118-123 from:
 # always be MP3? to suit jukebox TAPs?

Dirmp3Dest?=MP3?

 # we'll keep count of how many mp3 files are copied

mp3count=0

to:
 # always be MP3 to suit jukebox TAPs
 Dirmp3Dest=MP3

 # we'll keep count of how many MP3 files are copied
 mp3count=0
Changed lines 125-127 from:
to:
 StartTime=`date`
 StopTime=
Changed lines 131-132 from:

if [ -d "$Dirmp3Src" ] then

to:
 if [ -d "$Dirmp3Src" ]
 then
Changed line 136 from:

else

to:
 else
Changed lines 139-140 from:

fi

to:
 fi
Changed lines 144-149 from:

artistCount=0

echo "Counting number of Artist directories - please wait ..."

for file in $Dirmp3Src/* do

to:
 artistCount=0

 echo "Counting number of Artist directories - please wait ..."

 for file in $Dirmp3Src/*
 do
Changed lines 153-154 from:

done

to:
 done
Changed lines 166-167 from:
  if [ $? -ne 0 ]; then echo "ERROR detected by $0: Topfield PVR not turned on OR busy OR could not make directory"; exit 1; fi
to:
  if [ $? -ne 0 ]; then echo "ERROR detected by $0: " \
    "Topfield PVR not turned on OR busy OR could not make directory"; exit 1; fi
Changed lines 172-173 from:

for file in $Dirmp3Src/* do

to:
 for file in $Dirmp3Src/*
 do
Changed line 176 from:
  DirArtist?=`basename "$file"`
to:
  DirArtist=`basename "$file"`
Changed line 187 from:
    DirAlbum?=`basename "$file"`
to:
    DirAlbum=`basename "$file"`
Changed lines 198-199 from:
      puppy -t -q -c put "$Dirmp3Src/$DirArtist/$DirAlbum/$mp3File" "$Dirmp3Dest\\$DirArtist\\$DirAlbum\\$mp3File"
to:
      puppy -t -q -c put "$Dirmp3Src/$DirArtist/$DirAlbum/$mp3File" \
        "$Dirmp3Dest\\$DirArtist\\$DirAlbum\\$mp3File"
Changed lines 205-206 from:

done

to:
 done

 StopTime=`date`
Deleted line 213:
 StopTime?=`date`
Changed line 215 from:
 echo "mp3 files copied : $mp3count"
to:
 echo "MP3 files copied : $mp3count"
Changed lines 220-222 from:
to:

(:tableend:)

June 09, 2005, at 09:28 PM by JP --
Changed lines 124-126 from:
to:
June 09, 2005, at 11:02 AM by JP --
Changed line 80 from:
 # sort it all out later using ftpd-topfield - probably the prferred method. You could 
to:
 # sort it all out later using ftpd-topfield - probably the preferred method. You could 
June 09, 2005, at 11:00 AM by JP --
Changed line 60 from:
 # This script copies *.mp3 files to a Topfield 500 PVRt?
to:
 # This script copies *.mp3 files to a Topfield 5000 PVRt?
June 09, 2005, at 10:59 AM by JP --
Changed lines 206-221 from:

echo ""

echo "Done!"

echo "Start time : $StartTime"

StopTime?=`date`

echo "Stop time : $StopTime"

echo "mp3 files copied : $mp3count"

echo ""

exit 0

to:
 echo ""
 echo "Done!"
 echo "Start time       : $StartTime"
 StopTime?=`date`
 echo "Stop time        : $StopTime"
 echo "mp3 files copied : $mp3count"
 echo ""
 exit 0
June 09, 2005, at 10:58 AM by JP --
Added line 207:
Added line 209:
Added line 211:
Added line 213:
Added line 215:
Added line 217:
June 09, 2005, at 08:10 AM by JP --
Changed lines 56-113 from:
  1. !/bin/sh
  2. cpmp3tf.sh - should be runnable using any old path
  3. This script copies *.mp3 files to a Topfield 500 PVRt?
  4. It creates all directories as needed on the PVR
  5. Set Dirmp3Src? to your mp3 source directory
  6. Script assumes a "..\artist\album\song" layout
  7. Empty directories are still created at the PVR
  8. files in upper level directories, ie not in an album directory, are ignored
  9. Only files with an mp3 extension are copied
  10. 25 GB of data takes about 12 hours to copy over to the Topfield!
  11. Some other limitations:
  12. 1) The Toppy application only all allows 128 directory and/or files per directory
  13. Programs accessing the Toppy via the USB interface will allow more to be created
  14. but the actual Toppy application will have a heart attack. To overcome this, you
  15. can put groups of artists under additional directories, all containing a maximum
  16. of 128 folders in each; e.g. under MP3? "MP3?/Artists A to M" and "MP3?/Artists N to Z"
  17. An exception here is the directory "Various artists" - it may exceed the 128 maximum
  18. and this isn't checked for. Currently the script will not execute if more 128 artists
  19. are found. You could comment this code out, then copy all the mp3s over and then
  20. sort it all out later using ftpd-topfield - probably the prferred method. You could
  21. use ftpd-topfield to do all the copying but this script perhaps has the advantage
  22. that it will keep going even if say some USB error occurs.
  23. 2) mp3 files that have accented characters in their filename may cause problems on
  24. that file e.g. Clannard's Celtic Collection.
  25. 3) Currently puppy doesn't return an appropriate error return status for this script
  26. so the on Error exits don't work - not really a big problem
  27. 4) because puppy cannot indicate if a directory already exists, this script should
  28. be run only once. A second run will result in heaps of error msgs being shown as
  29. puppy tries to create pre existing directories.
  30. Possible improvements:
  31. 1) It would be useful to change this code so that any error msgs from puppy were
  32. sent to a text file.
  33. 2) Artists with "The" in their name all get sorted together. It may be a good idea
  34. to mod this script to remove these prefixes from the file name except for the artist
  35. "The The"!
  36. After copying all the MP3s? to the PVR, you should restart the PVR. It looks
  37. like the directory layout may be loaded at start up by the Toppy app and
  38. therefore needs to be refreshed.
  39. If altering this script; beware of spaces in directory/filenames
  40. some code could be replaced with ls -d but its results are bit
  41. weird if used on the working directory so was avoided
  42. ---------------------------------------------------
  43. start copying mp3 files from here - typically this is a Linux/Windows remote share
  44. Typically P4 (this is a Pentium 4 in my case) would be mapped to say C:/Music on the share
to:
 #!/bin/sh

 # cpmp3tf.sh - should be runnable using any old path

 # This script copies *.mp3 files to a Topfield 500 PVRt?
 # It creates all directories as needed on the PVR
 # Set Dirmp3Src? to your mp3 source directory
 # Script assumes a "..\artist\album\song" layout
 # Empty directories are still created at the PVR
 # files in upper level directories, ie not in an album directory, are ignored
 # Only files with an mp3 extension are copied

 # 25 GB of data takes about 12 hours to copy over to the Topfield!

 # Some other limitations:

 # 1) The Toppy application only all allows 128 directory and/or files per directory
 # Programs accessing the Toppy via the USB interface will allow more to be created
 # but the actual Toppy application will have a heart attack. To overcome this, you
 # can put groups of artists under additional directories, all containing a maximum
 # of 128 folders in each; e.g. under MP3?  "MP3?/Artists A to M" and "MP3?/Artists N to Z"
 # An exception here is the directory "Various artists" - it may exceed the 128 maximum
 # and this isn't checked for. Currently the script will not execute if more 128 artists
 # are found. You could comment this code out, then copy all the mp3s over and then
 # sort it all out later using ftpd-topfield - probably the prferred method. You could 
 # use ftpd-topfield to do all the copying but this script perhaps has the advantage 
 # that it will keep going even if say some USB error occurs.

 # 2) mp3 files that have accented characters in their filename may cause problems on 
 # that file e.g. Clannard's Celtic Collection.

 # 3) Currently puppy doesn't return an appropriate error return status for this script
 # so the on Error exits don't work - not really a big problem

 # 4) because puppy cannot indicate if a directory already exists, this script should
 # be run only once. A second run will result in heaps of error msgs being shown as
 # puppy tries to create pre existing directories.

 # Possible improvements:
 # 1) It would be useful to change this code so that any error msgs from puppy were
 # sent to a text file.

 # 2) Artists with "The" in their name all get sorted together. It may be a good idea
 # to mod this script to remove these prefixes from the file name except for the artist
 # "The The"!

 # After copying all the MP3s? to the PVR, you should restart the PVR. It looks 
 # like the directory layout may be loaded at start up by the Toppy app and
 # therefore needs to be refreshed.

 # If altering this script; beware of spaces in directory/filenames
 # some code could be replaced with ls -d but its results are bit
 # weird if used on the working directory so was avoided

 #---------------------------------------------------

 # start copying mp3 files from here - typically this is a Linux/Windows remote share
 # Typically P4 (this is a Pentium 4 in my case) would be mapped to say C:/Music on the share
Changed lines 116-117 from:
  1. destination directory on the Topfield PVR - it's created and should
  2. always be MP3? to suit jukebox TAPs?
to:
 # destination directory on the Topfield PVR - it's created and should
 # always be MP3? to suit jukebox TAPs?
Changed line 120 from:
  1. we'll keep count of how many mp3 files are copied
to:
 # we'll keep count of how many mp3 files are copied
Changed line 123 from:
  1. also the start and stop time
to:
 # also the start and stop time
Changed lines 127-129 from:
  1. ---------------------------------------------------
  2. got a valid mp3 source directory?
to:
 #---------------------------------------------------

 # got a valid mp3 source directory?
Changed lines 140-142 from:
  1. ---------------------------------------------------
  2. count the number of artists
to:
 #---------------------------------------------------

 # count the number of artists
Changed line 154 from:
  1. do the artist count
to:
 # do the artist count
Changed lines 161-162 from:
  1. ---------------------------------------------------
to:
 #---------------------------------------------------
Changed lines 167-169 from:
  1. ---------------------------------------------------
  2. loop through all the artists and create the corresponding destination directory
to:
 #---------------------------------------------------

 # loop through all the artists and create the corresponding destination directory
Changed lines 204-205 from:
  1. ---------------------------------------------------
to:
 #---------------------------------------------------
Changed lines 216-219 from:
  1. ---------------------------------------------------
to:
 #---------------------------------------------------
June 09, 2005, at 08:07 AM by JP -- Another mp3 copy script
Added lines 50-219:

Here is another mp3 copy script:

  1. !/bin/sh
  2. cpmp3tf.sh - should be runnable using any old path
  3. This script copies *.mp3 files to a Topfield 500 PVRt?
  4. It creates all directories as needed on the PVR
  5. Set Dirmp3Src? to your mp3 source directory
  6. Script assumes a "..\artist\album\song" layout
  7. Empty directories are still created at the PVR
  8. files in upper level directories, ie not in an album directory, are ignored
  9. Only files with an mp3 extension are copied
  10. 25 GB of data takes about 12 hours to copy over to the Topfield!
  11. Some other limitations:
  12. 1) The Toppy application only all allows 128 directory and/or files per directory
  13. Programs accessing the Toppy via the USB interface will allow more to be created
  14. but the actual Toppy application will have a heart attack. To overcome this, you
  15. can put groups of artists under additional directories, all containing a maximum
  16. of 128 folders in each; e.g. under MP3? "MP3?/Artists A to M" and "MP3?/Artists N to Z"
  17. An exception here is the directory "Various artists" - it may exceed the 128 maximum
  18. and this isn't checked for. Currently the script will not execute if more 128 artists
  19. are found. You could comment this code out, then copy all the mp3s over and then
  20. sort it all out later using ftpd-topfield - probably the prferred method. You could
  21. use ftpd-topfield to do all the copying but this script perhaps has the advantage
  22. that it will keep going even if say some USB error occurs.
  23. 2) mp3 files that have accented characters in their filename may cause problems on
  24. that file e.g. Clannard's Celtic Collection.
  25. 3) Currently puppy doesn't return an appropriate error return status for this script
  26. so the on Error exits don't work - not really a big problem
  27. 4) because puppy cannot indicate if a directory already exists, this script should
  28. be run only once. A second run will result in heaps of error msgs being shown as
  29. puppy tries to create pre existing directories.
  30. Possible improvements:
  31. 1) It would be useful to change this code so that any error msgs from puppy were
  32. sent to a text file.
  33. 2) Artists with "The" in their name all get sorted together. It may be a good idea
  34. to mod this script to remove these prefixes from the file name except for the artist
  35. "The The"!
  36. After copying all the MP3s? to the PVR, you should restart the PVR. It looks
  37. like the directory layout may be loaded at start up by the Toppy app and
  38. therefore needs to be refreshed.
  39. If altering this script; beware of spaces in directory/filenames
  40. some code could be replaced with ls -d but its results are bit
  41. weird if used on the working directory so was avoided
  42. ---------------------------------------------------
  43. start copying mp3 files from here - typically this is a Linux/Windows remote share
  44. Typically P4 (this is a Pentium 4 in my case) would be mapped to say C:/Music on the share

Dirmp3Src?=/root/P4

  1. destination directory on the Topfield PVR - it's created and should
  2. always be MP3? to suit jukebox TAPs?

Dirmp3Dest?=MP3?

  1. we'll keep count of how many mp3 files are copied

mp3count=0

  1. also the start and stop time

StartTime?=`date` StopTime?=

  1. ---------------------------------------------------
  2. got a valid mp3 source directory?

if [ -d "$Dirmp3Src" ] then

  echo    "Source directory is      :  $Dirmp3Src"
  echo -e "Destination directory is :  \\$Dirmp3Dest"
  echo ""

else

  echo "ERROR detected by $0: mp3 source directory $Dirmp3Src does not exist"
  exit 1

fi

  1. ---------------------------------------------------
  2. count the number of artists

artistCount=0

echo "Counting number of Artist directories - please wait ..."

for file in $Dirmp3Src/* do

  if ! [ -d "$file" ]; then continue; fi

  artistCount=`expr $artistCount + 1`

done

  1. do the artist count if [ $artistCount -gt 128 ] then echo "ERROR detected by $0: Too many Artist directories - must be <= 128 but found $artistCount" exit 1 fi
  2. ---------------------------------------------------
  echo "Creating Topfield 5000PVRt directory:  \\$Dirmp3Dest"
  puppy -t -c mkdir \\"$Dirmp3Dest"
  if [ $? -ne 0 ]; then echo "ERROR detected by $0: Topfield PVR not turned on OR busy OR could not make directory"; exit 1; fi
  1. ---------------------------------------------------
  2. loop through all the artists and create the corresponding destination directory

for file in $Dirmp3Src/* do

  if ! [ -d "$file" ]; then continue; fi

  DirArtist?=`basename "$file"`
  echo "Creating Topfield PVR directory:  \\..\\$DirArtist"
  puppy -t -c mkdir "\\$Dirmp3Dest\\$DirArtist"
  if [ $? -ne 0 ]; then echo "ERROR detected by $0: could not make directory"; exit 1; fi


  # loop through all the albums and create the corresponding destination directory
  for file in "$Dirmp3Src/$DirArtist"/*
  do
    if ! [ -d "$file" ]; then continue; fi

    DirAlbum?=`basename "$file"`
    echo -e "\tCreating Topfield PVR directory:  \\..\\..\\$DirAlbum"
    puppy -t -c mkdir "\\$Dirmp3Dest\\$DirArtist\\$DirAlbum"
    if [ $? -ne 0 ]; then echo "ERROR detected by $0: could not make directory"; exit 1; fi


    # copy the mp3s to the PVR
    for mp3File in "$Dirmp3Src/$DirArtist/$DirAlbum/"*.mp3
    do
      mp3File=`basename "$mp3File"`
      echo -e "\t\tCopying track:  $mp3File"
      puppy -t -q -c put "$Dirmp3Src/$DirArtist/$DirAlbum/$mp3File" "$Dirmp3Dest\\$DirArtist\\$DirAlbum\\$mp3File"
      if [ $? -ne 0 ]; then echo "ERROR detected by $0: could not copy mp3 file"; exit 1; fi

      mp3count=`expr $mp3count + 1`
    done
  done

done

  1. ---------------------------------------------------

echo "" echo "Done!" echo "Start time : $StartTime" StopTime?=`date` echo "Stop time : $StopTime" echo "mp3 files copied : $mp3count" echo ""

exit 0

  1. ---------------------------------------------------
March 28, 2005, at 09:22 AM by epg --
Changed lines 1-49 from:

Describe SendMp3sToToppy here.

to:

The following is a script that I use to quickly transfer music from a Linux PC to the Topfield 5000 PVR. It uses Puppy to 'copy' a specified directory, and all of its mp3 files, to the Topfield.

Warnings: I Am Not A Programmer. This script does very little error checking.

 #!/bin/bash
 # specify a source directory and this script will:
 #       create a directory of the same name on the Topfield (in the Topfield's \MP3? directory)
 #       copy all of the mp3s from the source directory to the new directory on the Topfield 
 #
 # e.g. usage: send_mp3s_to_toppy.sh /home/rik/music/various_artists/trainspotting
 #
 # WARNING: use at your own risk. IANAP!
 #


 if [ $# != 1 ]; then
        echo "ERROR: Please specify the directory to send to the Topfield" 1>&2
        echo "Usage: send_mp3s_to_toppy directory" 1>&2
        exit 1
 fi

 if [ ! -d "$1" ]; then
        echo "ERROR: $1 does not seem to be a directory" 1>&2
        echo "Usage: send_mp3s_to_toppy directory" 1>&2
        exit 1
 else
        dir="$1"
 fi


 echo "------------- Copying $dir to the Topfield..."

 the_dir=`basename "$dir"`

 echo "making a directory called \\Mp3\\"$the_dir" (on the Topfield)"
 puppy -t -c mkdir \\MP3?\\"$the_dir"

 for file in "$dir"/*.mp3; do
        this_file=`basename "$file"`
        echo
        echo "------------- PROCESSING $this_file";
        puppy -t -c put "$file" \\MP3?\\"$the_dir"\\"$this_file";
        echo "------------- FINISHED $this_file";
        echo
 done
view · edit · print · history · Last edited by epg.
Based on work by tman and JP.
Originally by epg.
Page last modified on October 01, 2005, at 11:28 AM