@cvp Okay. I believe that you have both given me enough information and exemplification to achieve what I am trying to do. I believe that the code particularly will be very useful to me. Thank you both very much.
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Best posts made by jaalburquerque
-
RE: Is it possible to present an alert with multicolored text in a Pythonista script?
Latest posts made by jaalburquerque
-
RE: Displaying html text rendered, not as plain text
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.
-
RE: Displaying html text rendered, not as plain text
Yes, that helps. Thanks so much.
-
Displaying html text rendered, not as plain text
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.
-
RE: Playing a list of audio files without blocking audio from other apps
Thanks for taking the time to answer the question that I had. Thanks for the information. Have a good day.
-
RE: Playing a list of audio files without blocking audio from other apps
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)
-
RE: Allowing the user to select a directory from the file system
Okay. It is very clear. Thanks again.
-
RE: Allowing the user to select a directory from the file system
Okay. I will try that. Thanks so much.
-
RE: Allowing the user to select a directory from the file system
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?
-
RE: Allowing the user to select a directory from the file system
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.
-
RE: Allowing the user to select a directory from the file system
Thanks again for your help. Have a good day again.