1#!/usr/bin/env python 2 3import os 4import sys 5import shutil 6 7download_fail_times = 0 8pvmp3_path = sys.path[0] 9download_path = os.path.join(pvmp3_path, "platform_external_opencore") 10final_src_path = os.path.join(pvmp3_path, "src") 11 12print('download pvmp3 source file') 13if not os.path.exists(final_src_path): 14 while True: 15 if not os.path.exists(download_path): 16 #os.system("git clone https://github.com/aosp-mirror/platform_external_opencore.git -b android-2.2.3_r2.1 " + str(download_path)) 17 os.system("git clone https://gitee.com/mirrors_aosp-mirror/platform_external_opencore.git -b android-2.2.3_r2.1 \"" + str(download_path) + "\"") 18 if os.path.exists(download_path): 19 print("Download pvaac source success!\n") 20 break 21 else: 22 download_fail_times = download_fail_times + 1 23 24 if download_fail_times >= 3: 25 print("Download pvaac fail!\n") 26 break 27 break 28 29 shutil.copytree('platform_external_opencore/codecs_v2/audio/aac/dec/src', 'src') 30 shutil.copytree('platform_external_opencore/codecs_v2/audio/aac/dec/include', 'include') 31 shutil.copyfile('platform_external_opencore/oscl/oscl/osclerror/src/oscl_error_codes.h', "include/oscl_error_codes.h") 32 shutil.copyfile('platform_external_opencore/codecs_v2/audio/aac/patent_disclaimer.txt', 'patent_disclaimer.txt') 33 os.rename('src/fft_rx4_tables_fxp.cpp', 'src/fft_rx4_tables_fxp.c') 34 35print('Download opencore aac source file success!') 36 37 38