Forum Archive

Pythonista 3.3 beta notification module

Ichicoro

Hello! I'm trying out the new Pythonista beta, and the documentation for the new notification module seems a bit confusing. Specifically, I don't understand the trigger parameter.
Can anyone help me?

omz

Could you be a bit more specific, please? Which parts of the explanation in the documentation do you have trouble with? Do you have a use case in mind?

cvp

@Ichicoro for instance, if you set this trigger parameter, you'll get a notification when you arrive approximatively under the Eiffel Tower

trigger = {'latitude':48.858370, 'longitude':2.294481, 'entry':True}
Ichicoro

@omz I don't understand the possible values for parameters like repeats
I'd like to set up a repeating notification that either triggers every Monday to Friday at a certain hour or every Monday to Friday at a certain location, but only once per day.

@cvp thanks for the example :)

omz

@Ichicoro First off, you cannot combine time- and location-based triggers, so the scenario "monday to friday at a certain location" is simply not possible.

Maybe it'll help if you look at Apple's documentation for UNCalendarNotificationTrigger. You don't have to understand Swift/ObjC, but the behavior should be the same in Pythonista (though not all functionality may be available in Pythonista).

ihf

What are the valid sound_names for the notification.schedule parameter? Also can Pythonista provide an arbitrary sound file, and if so, what is the format?

omz

@ihf The same as for sound.play_effect, so things like 'arcade:Coin_5'. You can show a list of these sound effects by tapping the + button in the bottom-right corner (while editing).

For custom sound effects, I'd recommend a m4a file, and you'd just pass the filename. It should not be longer than 30 seconds though.