Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Welcome to the Rockbox Technical Forums!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Audio Playback, Database and Playlists
| | |-+  Directories in M3U files?
« previous next »
  • Print
Pages: 1 [2]

Author Topic: Directories in M3U files?  (Read 4787 times)

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Directories in M3U files?
« Reply #15 on: January 30, 2008, 01:20:22 AM »
It sounds like your real problem is that your podcatcher doesn't let you pick where to put the files?
Logged

Offline brianary

  • Member
  • *
  • Posts: 11
Re: Directories in M3U files?
« Reply #16 on: January 30, 2008, 10:45:34 AM »
Quote from: Llorean on January 30, 2008, 01:20:22 AM
It sounds like your real problem is that your podcatcher doesn't let you pick where to put the files?

I suppose that's fair. Being closed source, I don't expect a lot of flexibility, and their responsiveness to my questions and suggestions has been nonexistant. But until Rockbox adds a module to run a podcatcher on the host OS, I prefer this to something that requires installation on the host OS and doesn't store the data on the DAP.
Logged

Offline brianary

  • Member
  • *
  • Posts: 11
Re: Directories in M3U files?
« Reply #17 on: February 13, 2008, 12:12:36 AM »
For the time being, I built a bash and cmd script that reads each file named /playlists/*.dirs, each of which is expected to have a directory (/dirA/dir1) on each line. The scripts each build an .m3u file with the same base name as the .dirs file from the mp3, wma, ogg, and spx in each directory.

For anyone that is interested, here are the scripts (to be placed in the device root):

dirs2m3u.sh
Code: [Select]
#/bin/bash
for dirs in playlists/*.dirs ; do
echo Build: ${dirs%.dirs}.m3u
if [ -f ${dirs%.dirs}.m3u ] ; then rm ${dirs%.dirs}.m3u ; fi
cat $dirs | while read d ; do
find "${d#/}" \( -iname '*.mp3' -o -iname '*.ogg' -o -iname '*.wma' \
-o -iname '*.spx' \) -printf '/' -print >>${dirs%.dirs}.m3u
done
done
echo Done.

dirs2m3u.cmd
Code: [Select]
@echo off
for %%a in (playlists\*.dirs) do (
echo Build: %%~pna.m3u
del %%~pna.m3u
for /f "tokens=*" %%d in (%%a) do (
for /f "tokens=2,3,4 delims=\" %%w in ('dir /b /s "%%d\*.mp3" "%%d\*.ogg" "%%d\*.wma" "%%d\*.spx" 2^>nul') do (
echo /%%w/%%x/%%y>>%%~pna.m3u
)
)
)
echo Done.

« Last Edit: February 13, 2008, 12:17:46 AM by brianary »
Logged

Offline ColdSphinx

  • Member
  • *
  • Posts: 147
Re: Directories in M3U files?
« Reply #18 on: February 13, 2008, 06:20:18 AM »
I've included all the audiofiletypes from filetypes.c

dirs2m3u.sh
Code: [Select]
#/bin/bash
for dirs in playlists/*.dirs ; do
 Â  echo Build: ${dirs%.dirs}.m3u
 Â  if [ -f ${dirs%.dirs}.m3u ] ; then rm ${dirs%.dirs}.m3u ; fi
 Â  cat $dirs | while read d ; do
 Â     find "${d#/}" \( -iname '*.mp3' -o -iname '*.mp2' -o -iname '*.mpa' \
 Â          -o -iname '*.mp1' -o -iname '*.ogg' -o -iname '*.wma' -o -iname '*.wmv' \
 Â          -o -iname '*.asf' -o -iname '*.wav' -o -iname '*.flac' -o -iname '*.ac3' \
 Â          -o -iname '*.a52' -o -iname '*.mpc' -o -iname '*.wv' -o -iname '*.m4a' \
 Â          -o -iname '*.m4b' -o -iname '*.mp4' -o -iname '*.shn' -o -iname '*.aif' \
 Â          -o -iname '*.aiff' -o -iname '*.spx' -o -iname '*.sid' -o -iname '*.adx' \
 Â          -o -iname '*.nsf' -o -iname '*.nsfe' -o -iname '*.spc' -o -iname '*.ape' \
 Â          -o -iname '*.mac' \) -printf '/' -print >>${dirs%.dirs}.m3u
 Â  done
done
echo Done.

Edit:
dirs2m3u.cmd
Code: [Select]
@echo off
for %%a in (playlists\*.dirs) do (
echo Build: %%~pna.m3u
del %%~pna.m3u
for /f "tokens=*" %%d in (%%a) do (
for /f "tokens=2,3,4 delims=\" %%w in ('dir /b /s "%%d\*.mp3" "%%d\*.mp2" "%%d\*.mpa" "%%d\*.mp1" "%%d\*.ogg" "%%d\*.wma" "%%d\*.wmv" "%%d\*.asf" "%%d\*.wav" "%%d\*.flac" "%%d\*.ac3" "%%d\*.a52" "%%d\*.mpc" "%%d\*.wv" "%%d\*.m4a" "%%d\*.m4b" "%%d\*.mp4" "%%d\*.shn" "%%d\*.aif" "%%d\*.aiff" "%%d\*.spx" "%%d\*.sid" "%%d\*.adx" "%%d\*.nsf" "%%d\*.nsfe" "%%d\*.spc" "%%d\*.ape" "%%d\*.mac" 2^>nul') do (
echo /%%w/%%x/%%y>>%%~pna.m3u
)
)
)
echo Done.
« Last Edit: February 13, 2008, 06:26:00 AM by ColdSphinx »
Logged
Rockbox.src

Offline brianary

  • Member
  • *
  • Posts: 11
Re: Directories in M3U files?
« Reply #19 on: February 14, 2008, 11:38:43 PM »
Here are those changes, cleaned up a bit:

dirs2m3u.sh
Code: [Select]
#/bin/bash
for dirs in playlists/*.dirs ; do
echo Build: ${dirs%.dirs}.m3u
if [ -f ${dirs%.dirs}.m3u ] ; then rm ${dirs%.dirs}.m3u ; fi
cat $dirs | while read d ; do
find "${d#/}" -regextype posix-egrep \
-iregex '.*\.(a(52|c3|dx|iff?|pe|sf)|flac|m(4[ab]|ac|p[1234ac])|nsfe?|ogg|s(hn|id|p[cx])|w(a?v|m[av]))$' \
-printf '/' -print >>${dirs%.dirs}.m3u
done
done
echo Done.

dirs2m3u.cmd
Code: [Select]
@echo off
for %%a in (playlists\*.dirs) do (
echo Build: %%~pna.m3u
del %%~pna.m3u
for /f "tokens=*" %%d in (%%a) do (
for /f "tokens=2,3,4 delims=\" %%w in ('dir /b /s "%%d\*.mp3" "%%d\*.mp2" "%%d\*.mpa" ^
"%%d\*.mp1" "%%d\*.ogg" "%%d\*.wma" "%%d\*.wmv" "%%d\*.asf" "%%d\*.wav" ^
"%%d\*.flac" "%%d\*.ac3" "%%d\*.a52" "%%d\*.mpc" "%%d\*.wv" "%%d\*.m4a" ^
"%%d\*.m4b" "%%d\*.mp4" "%%d\*.shn" "%%d\*.aif" "%%d\*.aiff" "%%d\*.spx" ^
"%%d\*.sid" "%%d\*.adx" "%%d\*.nsf" "%%d\*.nsfe" "%%d\*.spc" "%%d\*.ape" ^
"%%d\*.mac" 2^>nul') do (
echo /%%w/%%x/%%y>>%%~pna.m3u
)
)
)
echo Done.
« Last Edit: February 14, 2008, 11:40:38 PM by brianary »
Logged

Offline GodEater

  • Member
  • *
  • Posts: 2829
Re: Directories in M3U files?
« Reply #20 on: February 15, 2008, 03:07:26 AM »
Folks, could I respectfully suggest you move all this lovely bash code into a page in the wiki please? It'll get lost if it stays here.
Logged

Read The Manual Please

  • Print
Pages: 1 [2]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Audio Playback, Database and Playlists
| | |-+  Directories in M3U files?
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.081 seconds with 15 queries.