Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,12 @@ import pyperclip
|
|
| 6 |
|
| 7 |
logging.basicConfig(level=logging.INFO)
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def create_readme():
|
| 12 |
"""Creates a readme.txt file with the specified text"""
|
|
@@ -56,13 +61,7 @@ def android_download():
|
|
| 56 |
|
| 57 |
def iphone_download():
|
| 58 |
try:
|
| 59 |
-
|
| 60 |
-
android_ringtone_path = os.path.join(DOWNLOAD_FOLDER, 'AndroidRingtone.mp3')
|
| 61 |
-
if not os.path.exists(android_ringtone_path):
|
| 62 |
-
return "Error: Android ringtone not found. Please create the Android ringtone first."
|
| 63 |
-
|
| 64 |
-
# Convert Android ringtone to iPhone format
|
| 65 |
-
command = ['ffmpeg', '-i', android_ringtone_path, '-t', '20', '-acodec', 'aac', '-b:a', '128k', '-f', 'mp4', f'{DOWNLOAD_FOLDER}/iPhoneRingtone.m4r']
|
| 66 |
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
| 67 |
stdout, stderr = process.communicate()
|
| 68 |
|
|
@@ -123,3 +122,9 @@ iface.launch(share=True)
|
|
| 123 |
|
| 124 |
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
logging.basicConfig(level=logging.INFO)
|
| 8 |
|
| 9 |
+
# Use the current working directory (Hugging Face compatible)
|
| 10 |
+
DOWNLOAD_FOLDER = './output'
|
| 11 |
+
|
| 12 |
+
# Ensure the directory exists
|
| 13 |
+
if not os.path.exists(DOWNLOAD_FOLDER):
|
| 14 |
+
os.makedirs(DOWNLOAD_FOLDER)
|
| 15 |
|
| 16 |
def create_readme():
|
| 17 |
"""Creates a readme.txt file with the specified text"""
|
|
|
|
| 61 |
|
| 62 |
def iphone_download():
|
| 63 |
try:
|
| 64 |
+
command = ['ffmpeg', '-i', f'{DOWNLOAD_FOLDER}/AndroidRingtone.mp3', '-t', '20', '-acodec', 'aac', '-b:a', '128k', '-f', 'mp4', f'{DOWNLOAD_FOLDER}/iPhoneRingtone.m4r']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
| 66 |
stdout, stderr = process.communicate()
|
| 67 |
|
|
|
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
|