Anduril wrote: 
> My files are sorted like this: /child/book1/CD1
You mean \child\book1\CD1:confused::p

Anduril wrote: 
> The challenging part for my is to pick 2 randomized story files.
> Regards,
> Anduril

That was the Fun part:cool:

You need to change in : para
    
-  musicfolder (Where is your Childstuff is located)
-  playlisthome (Where is your Playlistfolder)
-  maybe kids_n8_tales_prefix (For better sorting/finding these
  "special" Playlists you should name them "special")
  

Everything else should work as designed...


Code:
--------------------
    
  echo on
  setlocal 
  
  :para
  set "musicfolder=M:\child"
  set "playlisthome=M:\playlist"
  set "kids_n8_tales_prefix=kids_n8_tales"
  
  :do all the folders with mp3 and .jpg
  for /f "delims=" %%a in ('dir /b /S /ad "%musicfolder%\"') do (
        if exist "%%a\*.mp3" call :generate "%%~dpna"
        )
  
  goto :eof
  
  
  :generate
  cd /d "%~1"
  if not exist *.mp3 goto :eof
  
  :cleanup running vars
  for %%a in (first_file first_random_file second_random_file last_file) do set 
%%a=
  
  :get foldername
  for /f "delims=" %%a in ('cd') do set "folder=%%~na"
  
  :get numbers of mediafiles
  for /f "tokens=1" %%a in ('dir *.mp3^|findstr "("^|findstr /v "fr"') do set 
files=%%a
  set /a files=%files%
  
  if %files% leq 3 (
        echo not enough files here !!!
        pause
        goto :eof
        )
  
  :randomizer
  set "rnd1=%Random% %% %files%"
  set "rnd2=%Random% %% %files%"
  
  Set /a first=(%rnd1%)+1
  Set /a second=(%rnd2%)+1
  if %second% leq %first% goto randomizer
  if %first% equ %second% goto randomizer
  if %first% equ 1 goto randomizer
  if %first% leq 9 set first=0%first%
  if %second% leq 9 set second=0%second%
  
  :get fqfilesname
  for /f "delims=" %%a in ('dir *.mp3 /b /O-N') do set "first_file=%%~dpnxa"
  for /f "delims=" %%a in ('dir *%first%*.mp3 /b /O-N') do set 
"first_random_file=%%~dpnxa"
  for /f "delims=" %%a in ('dir *%second%*.mp3 /b /ON') do set 
"second_random_file=%%~dpnxa"
  for /f "delims=" %%a in ('dir *.mp3 /b /ON') do set "last_file=%%~dpnxa":
  
  :make_playlist
  echo "%first_file%">"%playlisthome%\%kids_n8_tales_prefix%_%folder%.m3u"
  echo 
"%first_random_file%">>"%playlisthome%\%kids_n8_tales_prefix%_%folder%.m3u"
  echo 
"%second_random_file%">>"%playlisthome%\%kids_n8_tales_prefix%_%folder%.m3u"
  echo "%last_file%">>"%playlisthome%\%kids_n8_tales_prefix%_%folder%.m3u"
  
  ::eof
--------------------


------------------------------------------------------------------------
DJanGo's Profile: http://forums.slimdevices.com/member.php?userid=1516
View this thread: http://forums.slimdevices.com/showthread.php?t=108465

_______________________________________________
Squeezecenter mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/squeezecenter

Reply via email to