daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Apr 29th, 2012 32 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # this is the code
  2. import os
  3. import subprocess
  4. import ipdb
  5.  
  6. root_dir = '/home/pratz/Desktop/music/'
  7. target_dir = '/home/pratz/Desktop/test_music/'
  8.  
  9. for root, subfolder, files in os.walk(root_dir) :
  10.  
  11.     ipdb.set_trace()
  12.  
  13.     for fl in files :
  14.         if ".mp3" in fl :
  15.             target = target_dir + fl.replace(' ','_')
  16.             compress_ffmpeg = ["ffmpeg","-i",fl,"-ab","128k", target]
  17.             subprocess.call(compress_ffmpeg,shell=True)
  18.  
  19.  
  20. # And this is the dir structure ( ipython )
  21.  
  22. In [6]: test_walk = os.walk("/home/pratz/Desktop/music/")
  23.  
  24. In [7]: [ (x,y,z) for x,y,z in  test_walk]
  25. Out[7]:
  26. [('/home/pratz/Desktop/music/', ['akon'], []),
  27.  ('/home/pratz/Desktop/music/akon', ['Freedom [2008]'], []),
  28.  ('/home/pratz/Desktop/music/akon/Freedom [2008]',
  29.   [],
  30.   ['14-Akon-Clap Again (BONUS).mp3',
  31.    '12-Akon-Over The Edge.mp3',
  32.    "05-Akon-We Don't Care.mp3",
  33.    '01-Akon-Right Now (Na Na Na).mp3',
  34.    '03-Akon-Keep You Much Longer.mp3',
  35.    '04-Akon-Troublemaker Ft. Sweet Rush.mp3',
  36.    '08-Akon-Against The Grain Ft. Ray Lavender.mp3',
  37.    '11-Akon-Birthmark.mp3',
  38.    '10-Akon-Sunny Day Ft. Wyclef.mp3',
  39.    '13-Akon-Freedom.mp3',
  40.    '07-Akon-Holla Holla Ft. T-Pain.mp3',
  41.    "06-Akon-I'm So Paid Ft. Lil' Wayne And Young Jeezy.mp3",
  42.    '09-Akon-Be With You.mp3',
  43.    '00-Akon-Freedom-2008-[NoFS]-COVER.jpg',
  44.    "02-Akon-Beautiful Ft. Colby O'Donis And Kardinal Offishall.mp3"])]
  45.  
  46. # when i run the program i am getting the error
  47. FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  48.   configuration: --extra-version=4:0.5.1-1ubuntu1.3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  49.   libavutil     49.15. 0 / 49.15. 0
  50.   libavcodec    52.20. 1 / 52.20. 1
  51.   libavformat   52.31. 0 / 52.31. 0
  52.   libavdevice   52. 1. 0 / 52. 1. 0
  53.   libavfilter    0. 4. 0 /  0. 4. 0
  54.   libswscale     0. 7. 1 /  0. 7. 1
  55.   libpostproc   51. 2. 0 / 51. 2. 0
  56.   built on Dec 21 2011 18:37:21, gcc: 4.4.3
  57. At least one output file must be specified
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top