Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2022
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.60 KB | Software | 0 0
  1. @echo off
  2. set "_temp="
  3. md _REN_albums 2>nul
  4. for /d %%g in ("albums\*") do (
  5.     call :get_album2 "%%g"
  6.     for %%h in ("%%g\*.mp3") do call :get_songs "%%h"
  7.    
  8. )
  9. pause&exit
  10.  
  11. :get_album2
  12. set _cd=0
  13. set "_album=%~1"
  14. set "_album=%_album:albums\=%"
  15. if not "%_album%"=="%_album: CD1=%" set "_album=%_album: CD1=%"&set _cd=1&goto get_album_next
  16. if not "%_album%"=="%_album: CD2=%" set "_album=%_album: CD2=%"&set _cd=2&goto get_album_next
  17. if not "%_album%"=="%_album: CD3=%" set "_album=%_album: CD3=%"&set _cd=3&goto get_album_next
  18. if not "%_album%"=="%_album: CD4=%" set "_album=%_album: CD4=%"&set _cd=4&goto get_album_next
  19. :get_album_next
  20.  
  21. REM //will only count first album
  22. if not "%_temp%"=="%_album%" (
  23.     set "_temp=%_album%" & set /a _count=1
  24. )else (
  25.     if not exist "_REN_albums\%_album%\folder_cd%_cd%.jpg" copy /y "%~1\folder.jpg" "_REN_albums\%_album%\folder_cd%_cd%.jpg"
  26.     exit /b
  27. )
  28.  
  29. REM //detect track format from frist album, and first track
  30. set _trim=0
  31. if exist "%~1\001 -*" set _trim=3
  32. if exist "%~1\01 -*" set _trim=2
  33. if exist "%~1\1 -*" set _trim=1
  34.  
  35. md "_REN_albums\%_album%" 2>nul
  36.  
  37. REM //copy image from CD1
  38. copy /y "%~1\folder.jpg" "_REN_albums\%_album%\folder.jpg"
  39.  
  40. exit /b
  41.  
  42. :get_songs
  43. set "_song=%~n1"
  44.  
  45. if %_trim% equ 0 goto get_song_next
  46. if %_trim% equ 2 set "_song=%_song:~2%"&goto get_song_next
  47. if %_trim% equ 3 set "_song=%_song:~3%"&goto get_song_next
  48.  
  49. if "-"=="%_song:~2,1%" (
  50.     echo %_song:~3,1% "%_song%"
  51.     set "_song=%_song:~1%"
  52. )else (
  53.     set "_song=%_song:~2%"
  54. )
  55.  
  56.  
  57. :get_song_next
  58. copy "%~1" "_REN_albums\%_album%\%_count%%_song%.mp3" >nul
  59.  
  60. set /a _count+=1
  61. exit /b
Tags: batch script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement