-
jaalburquerque
Thank you for the information. I am working with HTML and I may need to reduce it to plain text for easy searching and processing later. The information is useful if I should need to reduce the HTML to plain text. Thanks again.
-
-
jaalburquerque
Hello everyone. I have some html in a string that I would like to display (rendered, not as plain text). Would someone know a quick and easy way to do this using Pythonista? I would really appreciate it. Thanks so much.
-
jaalburquerque
Thanks for taking the time to answer the question that I had. Thanks for the information. Have a good day.
-
jaalburquerque
Hello. I was able to write a preliminary version of the script to play the audio files. The script is designed to play audio files contained in a directory in the file system. It assumes that all of the files in the specified directory are audio files. It uses the “
FolderPicker
” class mentioned in the other topic that I opened asking how to allow the user to select a directory in the file system [1]. I am attaching the script below. The script plays the audio files fine when I run it in the Pythonista app, but when I minimize the app, the audio stops playing. I would like the audio to continue playing even if the app is minimized and I use other apps. Would anyone know if this is possible?Note: I edited the original post to move the [1] reference directly below the paragraph that references it. Also, I added a change to the script to make it runnable using a pythonista URL scheme, for example “pythonista://PlayAudioDirectory?action=run&argv=audio_directory
import sys import re import dialogs import FolderPicker from pathlib import Path import sound import time IPHONE_VOLUME_PATH = '/private/var/mobile/Containers/Shared/AppGroup/193D444B-2870-447A-A797-33D935C572B3/File Provider Storage' ICLOUD_VOLUME_PATH = '/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs' audioDirectory = None if len(sys.argv) > 1: audioDirectory = sys.argv[1] audioDirectory = re.sub(r'^On My iPhone', IPHONE_VOLUME_PATH, audioDirectory) audioDirectory = re.sub(r'^iCloud Drive', ICLOUD_VOLUME_PATH, audioDirectory) else: volume = None volumerChoice = dialogs.list_dialog('Select location of directory', ['This iPhone', 'iCloud']) if volumerChoice == 'This iPhone': volume = IPHONE_VOLUME_PATH elif volumerChoice == 'iCloud': volume = ICLOUD_VOLUME_PATH if volume != None: audioDirectory = FolderPicker.folder_picker_dialog('Please select the audio folder', root_dir = volume) if audioDirectory != None: audioPath = Path(audioDirectory) for child in sorted(audioPath.iterdir()): audioFilename = str(child.resolve()) player = sound.Player(audioFilename) duration = player.duration player.play() time.sleep(duration)
-
-
-
jaalburquerque
Thanks. And would you be able to tell me how I might use the “FolderPicker” script in my own script to open a directory either “On My iPhone” or on the iCloud Drive?
-
jaalburquerque
Would any of you know if it is possible to open a folder that is contained in the iPhone file system (“On My iPhone”) or in the iCloud Drive to play the audio files in that folder? The audio files are located in directories in both these locations.
-