Created
November 13, 2011 03:00
-
-
Save fahrinh/1361521 to your computer and use it in GitHub Desktop.
Script utk memisah mp3 ayat quran berdasarkan surah. Mp3 yang didonlot ada di http://www.versebyversequran.com/site/download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Script utk menempatkan ayat mp3 berdasarkan surah | |
# Langkah penggunaan : | |
# 1) Buka halaman web http://www.versebyversequran.com/site/download | |
# 2) Expand bagian "Ayat MP3 Recitations" | |
# 3) Cari audio quran yang diinginkan berdasarkan reciter | |
# 4) Download audio quran pada link (ZIP). File yang didonlot bernama 000_versebyverse.zip | |
# 5) Buat folder "quran" | |
# 6) Extract file 000_versebyverse.zip ke dalam folder "quran" | |
# 7) Tempatkan script "pisah_surah.py" ke dalam folder "quran" | |
# 8) Jalankan script dengan perintah : | |
# python pisah_surah.py | |
# 9) Selesai. Ayat mp3 sudah terpisah berdasarkan surah pada folder "quran" | |
import os | |
import re | |
import shutil | |
location = '/home/ubuntu/Music/murotal/verse' # Ganti lokasi yang diinginkan | |
daftar = { | |
"001" : ("Al-Fatihah" , "Pembukaan" , 1, 7), | |
"002" : ("Al-Baqarah" , "SapiBetina" , 2, 286), | |
"003" : ("Ali-'Imran" , "KeluargaImran" , 2, 200), | |
"004" : ("An-Nisa'" , "Wanita" , 2, 176), | |
"005" : ("Al-Ma'idah" , "Hidangan" , 2, 120), | |
"006" : ("Al-An'am" , "BinatangTernak" , 1, 165), | |
"007" : ("Al-A'raf" , "TempatTertinggi" , 1, 206), | |
"008" : ("Al-Anfal" , "HartaRampasanPerang" , 2, 75), | |
"009" : ("At-Tawbah" , "Pengampunan" , 2, 128), | |
"010" : ("Yunus" , "NabiYunusAs" , 1, 109), | |
"011" : ("Hud" , "NabiHudAs" , 1, 123), | |
"012" : ("Yusuf" , "NabiYusufAs" , 1, 111), | |
"013" : ("Ar-Ra'd" , "Guntur" , 2, 43), | |
"014" : ("Ibrahim" , "NabiIbrahim" , 1, 52), | |
"015" : ("Al-Hijr" , "Al-Hijr" , 1, 99), | |
"016" : ("An-Nahl" , "Lebah" , 1, 128), | |
"017" : ("Al-Isra'" , "PerjalananMalam" , 1, 111), | |
"018" : ("Al-Kahf" , "PenghuniGua" , 1, 110), | |
"019" : ("Maryam" , "Maryam" , 1, 98), | |
"020" : ("Thaha" , "Thaha" , 1, 135), | |
"021" : ("Al-Anbiya" , "ParaNabi" , 1, 112), | |
"022" : ("Al-Hajj" , "Haji" , 2, 78), | |
"023" : ("Al-Mu'minun" , "OrangOrangBeriman" , 1, 118), | |
"024" : ("An-Nur" , "Cahaya" , 2, 64), | |
"025" : ("Al-Furqon" , "Pembeda" , 1, 77), | |
"026" : ("Asy-Syu'ara" , "ParaPenyair" , 1, 227), | |
"027" : ("An-Naml" , "Semut" , 1, 93), | |
"028" : ("Al-Qashash" , "KisahKisah" , 1, 88), | |
"029" : ("Al-'Ankabut" , "LabaLaba" , 1, 69), | |
"030" : ("Ar-Rum" , "BangsaRomawi" , 1, 60), | |
"031" : ("Luqman" , "Luqman" , 1, 34), | |
"032" : ("As-Sajdah" , "Sujud" , 1, 30), | |
"033" : ("Al-Ahzab" , "GolonganBersekutu" , 2, 73), | |
"034" : ("Saba'" , "NegeriSaba'" , 1, 54), | |
"035" : ("Fathir" , "Pencipta" , 1, 45), | |
"036" : ("Yasin" , "Yasin" , 1, 83), | |
"037" : ("Ash-Shaffat'" , "YangBerbaris" , 1, 182), | |
"038" : ("Shad" , "Shad" , 1, 88), | |
"039" : ("Az-Zumar" , "RombonganRombongan" , 1, 75), | |
"040" : ("Al-Mu'min" , "OrangBeriman" , 1, 85), | |
"041" : ("Fushshilat" , "Dijelaskan" , 1, 54), | |
"042" : ("Asy-Syura" , "Musyawarah" , 1, 53), | |
"043" : ("Az-Zukhruf" , "Perhiasan" , 1, 89), | |
"044" : ("Ad-Dukhan" , "Kabut" , 1, 59), | |
"045" : ("Al-Jatsiyah" , "YangBerlutut" , 1, 37), | |
"046" : ("Al-Ahqaf" , "BukitBukitPasir" , 1, 35), | |
"047" : ("Muhammad" , "NabiMuhammadSAW" , 2, 38), | |
"048" : ("Al-Fath" , "Kemenangan" , 2, 29), | |
"049" : ("Al-Hujurat" , "KamarKamar" , 2, 18), | |
"050" : ("Qaf" , "Qaf" , 1, 45), | |
"051" : ("Adz-Dzariyat" , "DebuYangDiterbangkan", 1, 60), | |
"052" : ("Ath-Thur" , "Bukit" , 1, 49), | |
"053" : ("An-Najm" , "Bintang" , 1, 62), | |
"054" : ("Al-Qamar" , "Rembulan'" , 1, 55), | |
"055" : ("Ar-Rahman" , "YangMahaPemurah" , 2, 78), | |
"056" : ("Al-Waqi'ah" , "HariKiamat" , 1, 96), | |
"057" : ("Al-Hadid" , "Besi" , 2, 29), | |
"058" : ("Al-Mujadilah" , "YangBerbantahan" , 2, 22), | |
"059" : ("Al-Hasyr" , "Pengusiran" , 2, 24), | |
"060" : ("Al-Mumtahinah", "PerempuanYangDiuji" , 2, 13), | |
"061" : ("Ash-Shaff" , "Barisan" , 2, 14), | |
"062" : ("Al-Jumu'ah" , "HariJum'at" , 2, 11), | |
"063" : ("Al-Munafiqun" , "OrangOrangMunafik" , 2, 11), | |
"064" : ("At-Taghabun" , "HariDinampakkanKesalahan", 2, 18), | |
"065" : ("Ath-Thalaq" , "Perceraian" , 2, 12), | |
"066" : ("At-Tahrim" , "Pengharaman" , 2, 12), | |
"067" : ("Al-Mulk" , "Kerajaan" , 1, 30), | |
"068" : ("Al-Qalam" , "Pena" , 1, 52), | |
"069" : ("Al-Haqqah" , "HariYangPastiTerjadi", 1, 52), | |
"070" : ("Al-Ma'arij" , "TempatTempatNaik" , 1, 44), | |
"071" : ("Nuh" , "NabiNuhAs" , 1, 28), | |
"072" : ("Al-Jinn" , "Jin" , 1, 28), | |
"073" : ("Al-Muzzammil" , "OrangYangBerselimut" , 1, 20), | |
"074" : ("Al-Muddatstsir", "OrangYangBerkemul" , 1, 56), | |
"075" : ("Al-Qiyamah" , "HariKiamat" , 1, 40), | |
"076" : ("Al-Insan" , "Manusia" , 2, 31), | |
"077" : ("Al-Mursalat" , "MalaikatMalaikatYangDiutus", 1, 50), | |
"078" : ("An-Naba'" , "Berita" , 1, 40), | |
"079" : ("An-Nazi'at" , "MalaikatMalaikatYangMencabut", 1, 46), | |
"080" : ("'Abasa" , "BermukaMasam" , 1, 42), | |
"081" : ("At-Takwir" , "Tergulung" , 1, 29), | |
"082" : ("Al-Infithar" , "Terbelah" , 1, 19), | |
"083" : ("Al-Muthaffifin", "OrangOrangYangCurang", 1, 36), | |
"084" : ("Al-Insyiqaq" , "Terbelah" , 1, 25), | |
"085" : ("Al-Buruj" , "GugusanBintang" , 1, 22), | |
"086" : ("Ath-Thariq" , "YangDatangDiMalamHari", 1, 17), | |
"087" : ("Al-A'la" , "YangTertinggi" , 1, 19), | |
"088" : ("Al-Ghasyiyah" , "HariPembalasan" , 1, 26), | |
"089" : ("Al-Fajr" , "Fajar" , 1, 30), | |
"090" : ("Al-Balad" , "Negeri" , 1, 20), | |
"091" : ("Asy-Syams" , "Matahari" , 1, 15), | |
"092" : ("Al-Layl" , "Malam" , 1, 21), | |
"093" : ("Adh-Dhuha" , "WaktuMatahariSepenggalanNaik", 1, 11), | |
"094" : ("Al-Insyirah" , "Kelapangan" , 1, 8), | |
"095" : ("At-Tin" , "Tanah" , 1, 8), | |
"096" : ("Al-'Alaq" , "SegumpalDarah" , 1, 19), | |
"097" : ("Al-Qadr" , "Kemuliaan" , 1, 5), | |
"098" : ("Al-Bayyinah" , "Penjelasan" , 2, 8), | |
"099" : ("Az-Zalzalah" , "Kegoncangan" , 2, 8), | |
"100" : ("Al-Adiyat" , "KudaPerangYangBerlariKencang", 1, 11), | |
"101" : ("Al-Qari'ah" , "HariKiamat" , 1, 11), | |
"102" : ("At-Takatsur" , "Bermegahmegahan" , 1, 8), | |
"103" : ("Al-'Ashr" , "Masa" , 1, 3), | |
"104" : ("Al-Humazah" , "ParaPengumpat" , 1, 9), | |
"105" : ("Al-Fil" , "Gajah" , 1, 5), | |
"106" : ("Quraisy" , "SukuQuraisy" , 1, 4), | |
"107" : ("Al-Ma'un" , "BarangBarangYangBerguna" , 1, 7), | |
"108" : ("Al-Kawtsar" , "NikmatYangBanyak" , 1, 3), | |
"109" : ("Al-Kafirun" , "OrangOrangKafir" , 1, 5), | |
"110" : ("An-Nashr" , "Pertolongan" , 2, 3), | |
"111" : ("Al-Lahab" , "ApiYangBergejolak" , 1, 5), | |
"112" : ("Al-Ikhlas" , "Ikhlas" , 1, 4), | |
"113" : ("Al-Falaq" , "WaktuShubuh" , 1, 5), | |
"114" : ("An-Nas" , "Manusia" , 1, 6), | |
} | |
for key, (nama, arti, tempat_turun, jumlah_ayat) in daftar.iteritems() : | |
nama_folder = "%s_%s_%s_%s_%d" % (key, nama, arti, "Makkiyah" if tempat_turun == 1 else "Madaniyah" , jumlah_ayat) | |
print os.path.join(location, nama_folder) | |
if not os.path.exists(os.path.join(location, nama_folder)) : | |
os.makedirs(os.path.join(location, nama_folder)) | |
for filename in os.listdir(location) : | |
p = re.compile('^(' + key + ')') | |
ext = os.path.splitext(filename)[1] | |
if p.match(filename) and ext == '.mp3' and not os.path.exists(os.path.join(location, nama_folder, filename)): | |
shutil.copy(os.path.join(location,filename), os.path.join(location, nama_folder)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment