larigira package¶
Subpackages¶
Submodules¶
larigira.audioform_base module¶
larigira.audioform_http module¶
- class larigira.audioform_http.AudioForm(*args, **kwargs)[source]¶
Bases:
BaseForm- nick = <UnboundField(StringField, ('Audio nick',), {'validators': [<wtforms.validators.Required object>], 'description': 'A simple name to recognize this audio'})>¶
- submit = <UnboundField(SubmitField, ('Submit',), {})>¶
- urls = <UnboundField(StringField, ('URLs',), {'validators': [<wtforms.validators.Required object>], 'description': 'URL of the file to download'})>¶
larigira.audioform_mostrecent module¶
- class larigira.audioform_mostrecent.AudioForm(*args, **kwargs)[source]¶
Bases:
BaseForm- maxage = <UnboundField(StringField, ('Max age',), {'validators': [<wtforms.validators.Required object>], 'description': 'in seconds, or human-readable (like 9w3d12h)'})>¶
- nick = <UnboundField(StringField, ('Audio nick',), {'validators': [<wtforms.validators.Required object>], 'description': 'A simple name to recognize this audio'})>¶
- path = <UnboundField(AutocompleteStringField, ('dl-suggested-dirs', 'Path'), {'validators': [<wtforms.validators.Required object>], 'description': 'Directory to pick file from'})>¶
- submit = <UnboundField(SubmitField, ('Submit',), {})>¶
larigira.audioform_podcast module¶
- class larigira.audioform_podcast.AudioForm(*args, **kwargs)[source]¶
Bases:
BaseForm- max_len = <UnboundField(StringField, ('Accetta solo audio lunghi al massimo:',), {'description': 'Leaving this empty will disable this filter'})>¶
- min_len = <UnboundField(StringField, ('Accetta solo audio lunghi almeno:',), {'description': 'Leaving this empty will disable this filter'})>¶
- nick = <UnboundField(StringField, ('Audio nick',), {'validators': [<wtforms.validators.Required object>], 'description': 'A simple name to recognize this audio'})>¶
- reverse = <UnboundField(BooleanField, ('Reverse sort (descending)',), {})>¶
- sort_by = <UnboundField(SelectField, ('Sort episodes',), {'choices': [('none', "Don't sort"), ('random', 'Random'), ('duration', 'Duration'), ('date', 'date')]})>¶
- start = <UnboundField(IntegerField, ('Play from episode number',), {'description': 'Episodes count from 0; 0 is a sane default'})>¶
- submit = <UnboundField(SubmitField, ('Submit',), {})>¶
- url = <UnboundField(URLField, ('URL',), {'validators': [<wtforms.validators.Required object>], 'description': 'URL of the podcast; it must be valid xml'})>¶
larigira.audioform_randomdir module¶
- class larigira.audioform_randomdir.Form(*args, **kwargs)[source]¶
Bases:
BaseForm- howmany = <UnboundField(IntegerField, ('Number',), {'validators': [<wtforms.validators.Optional object>], 'default': 1, 'description': 'How many songs to be pickedfrom this dir; defaults to 1'})>¶
- nick = <UnboundField(StringField, ('Audio nick',), {'validators': [<wtforms.validators.Required object>], 'description': 'A simple name to recognize this audio'})>¶
- path = <UnboundField(AutocompleteStringField, ('dl-suggested-dirs', 'Path'), {'validators': [<wtforms.validators.Required object>], 'description': 'Full path to source directory'})>¶
- submit = <UnboundField(SubmitField, ('Submit',), {})>¶
larigira.audioform_script module¶
- class larigira.audioform_script.ScriptAudioForm(*args, **kwargs)[source]¶
Bases:
BaseForm- args = <UnboundField(StringField, ('Arguments',), {'description': 'arguments, separated by ";"'})>¶
- name = <UnboundField(AutocompleteStringField, ('dl-suggested-scripts', 'Name'), {'validators': [<wtforms.validators.Required object>], 'description': 'filename (NOT path) of the script'})>¶
- nick = <UnboundField(StringField, ('Audio nick',), {'validators': [<wtforms.validators.Required object>], 'description': 'A simple name to recognize this audio'})>¶
- submit = <UnboundField(SubmitField, ('Submit',), {})>¶
larigira.audioform_static module¶
- class larigira.audioform_static.StaticAudioForm(*args, **kwargs)[source]¶
Bases:
BaseForm- nick = <UnboundField(StringField, ('Audio nick',), {'validators': [<wtforms.validators.Required object>], 'description': 'A simple name to recognize this audio'})>¶
- path = <UnboundField(AutocompleteStringField, ('dl-suggested-files', 'Path'), {'validators': [<wtforms.validators.Required object>], 'description': 'Full path to audio file'})>¶
- submit = <UnboundField(SubmitField, ('Submit',), {})>¶
larigira.audiogen module¶
larigira.audiogen_http module¶
larigira.audiogen_mostrecent module¶
larigira.audiogen_mpdrandom module¶
larigira.audiogen_podcast module¶
larigira.audiogen_randomdir module¶
larigira.audiogen_script module¶
script audiogenerator: uses an external program to generate audio URIs
a script can be any valid executable in $XDG_CONFIG_DIR/larigira/scripts/<name>; for security reasons, it must be executable and owned by the current user. The audiospec can specify arguments to the script, while the environment cannot be customized (again, this is for security reasons).
The script should assume a minimal environment, and being run from /. It must output one URI per line; please remember that URI must be understood from mpd, so file paths are not valid; file:///file/path.ogg is a valid URI instead. The output MUST be UTF-8-encoded. Empty lines will be skipped. stderr will be logged, so please be careful. any non-zero exit code will result in no files being added.and an exception being logged.
larigira.audiogen_static module¶
larigira.config module¶
Taken from flask-appconfig
- larigira.config.from_envvars(prefix=None, envvars=None, as_json=True)[source]¶
Load environment variables in a dictionary
Values are parsed as JSON. If parsing fails with a ValueError, values are instead used as verbatim strings.
- Parameters:
prefix – If
Noneis passed as envvars, all variables fromenvironstarting with this prefix are imported. The prefix is stripped upon import.envvars – A dictionary of mappings of environment-variable-names to Flask configuration names. If a list is passed instead, names are mapped 1:1. If
None, see prefix argument.as_json – If False, values will not be parsed as JSON first.
larigira.db module¶
larigira.entrypoints_utils module¶
larigira.event module¶
larigira.event_manage module¶
larigira.eventutils module¶
larigira.forms module¶
larigira.formutils module¶
- class larigira.formutils.DateTimeInput(input_type=None)[source]¶
Bases:
Input- input_type = 'datetime-local'¶
- class larigira.formutils.EasyDateTimeField(*args, **kwargs)[source]¶
Bases:
Fielda “fork” of DateTimeField which uses HTML5 datetime-local
The format is not customizable, because it is imposed by the HTML5 specification.
This field does not ensure that browser actually supports datetime-local input type, nor does it provide polyfills.
- formats = ('%Y-%m-%dT%H:%M:%S', '%Y-%m-%dT%H:%M')¶
- process_formdata(valuelist)[source]¶
Process data received over the wire from a form.
This will be called during form construction with data supplied through the formdata argument.
- Parameters:
valuelist – A list of strings to process.
- widget = <larigira.formutils.DateTimeInput object>¶
larigira.fsutils module¶
larigira.main module¶
larigira.mpc module¶
larigira.test_unused module¶
- larigira.test_unused.test_watch_notmp_error(unusedcleaner)[source]¶
Files not in TMPDIR are not added
larigira.timeform_base module¶
- class larigira.timeform_base.FrequencyAlarmForm(*args, **kwargs)[source]¶
Bases:
BaseForm- end = <UnboundField(EasyDateTimeField, ('End date and time',), {'validators': [<wtforms.validators.Optional object>], 'description': 'After this, no alarm will ring. Expressed as YYYY-MM-DDTHH:MM:SS. If omitted, the alarm will always ring'})>¶
- exclude = <UnboundField(TextAreaField, ('Any matching time will be excluded',), {'description': 'Supported formats: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS or cron-like format'})>¶
- interval = <UnboundField(StringField, ('Frequency',), {'validators': [<wtforms.validators.Required object>], 'description': 'in seconds, or human-readable (like 9w3d12h)'})>¶
- nick = <UnboundField(StringField, ('Alarm nick',), {'validators': [<wtforms.validators.Required object>], 'description': 'A simple name to recognize this alarm'})>¶
- start = <UnboundField(EasyDateTimeField, ('Start date and time',), {'validators': [<wtforms.validators.Optional object>], 'description': 'Before this, no alarm will ring. Expressed as YYYY-MM-DDTHH:MM:SS. If omitted, the alarm will always ring'})>¶
- submit = <UnboundField(SubmitField, ('Submit',), {})>¶
- weekdays = <UnboundField(SelectMultipleField, ('Days on which the alarm should be played',), {'choices': [('1', 'Monday'), ('2', 'Tuesday'), ('3', 'Wednesday'), ('4', 'Thursday'), ('5', 'Friday'), ('6', 'Saturday'), ('7', 'Sunday')], 'default': ['1', '2', '3', '4', '5', '6', '7'], 'validators': [<wtforms.validators.Required object>], 'description': 'The alarm will ring only on selected weekdays'})>¶
- class larigira.timeform_base.SingleAlarmForm(*args, **kwargs)[source]¶
Bases:
BaseForm- dt = <UnboundField(EasyDateTimeField, ('Date and time',), {'validators': [<wtforms.validators.Required object>], 'description': 'Date to ring on, expressed as 2000-12-31T13:42:00'})>¶
- nick = <UnboundField(StringField, ('Alarm nick',), {'validators': [<wtforms.validators.Required object>], 'description': 'A simple name to recognize this alarm'})>¶
- submit = <UnboundField(SubmitField, ('Submit',), {})>¶
larigira.timeform_cron module¶
- class larigira.timeform_cron.CronAlarmForm(*args, **kwargs)[source]¶
Bases:
BaseForm- cron_format = <UnboundField(StringField, ('cron-like format',), {'validators': [<wtforms.validators.Required object>], 'description': 'the frequency specification, as in the <tt>cron</tt> command; see <a href="https://crontab.guru/">crontab.guru</a> for a hepl with cron format'})>¶
- exclude = <UnboundField(TextAreaField, ('Any matching time will be excluded',), {'description': 'Supported formats: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS or cron-like format'})>¶
- nick = <UnboundField(StringField, ('Alarm nick',), {'validators': [<wtforms.validators.Required object>], 'description': 'A simple name to recognize this alarm'})>¶
- submit = <UnboundField(SubmitField, ('Submit',), {})>¶
larigira.timegen module¶
larigira.timegen_cron module¶
larigira.timegen_every module¶
- class larigira.timegen_every.Alarm(obj)[source]¶
Bases:
object
- class larigira.timegen_every.FrequencyAlarm(obj)[source]¶
Bases:
AlarmWithExclusionsrings on {t | exists a k integer >= 0 s.t. t = start+k*t, start<t<end}
- description = 'Events at a specified frequency. Example: every 30minutes'¶
larigira.timegen_exclusions module¶
- class larigira.timegen_exclusions.DateExclusion(line: str)[source]¶
Bases:
BaseExclusion- PATTERN = re.compile('^\\d\\d\\d\\d-\\d\\d-\\d\\d$')¶
- class larigira.timegen_exclusions.DateTimeExclusion(line: str)[source]¶
Bases:
BaseExclusion- NUMBER = re.compile('\\d+')¶
- PATTERN = re.compile('^\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d$')¶
- larigira.timegen_exclusions.multi_exclusion(line: str, exclusions=[<class 'larigira.timegen_exclusions.DateTimeExclusion'>, <class 'larigira.timegen_exclusions.DateExclusion'>, <class 'larigira.timegen_exclusions.CronExclusion'>]) BaseExclusion | None[source]¶
larigira.unused module¶
- This component will look for files to be removed. There are some assumptions:
Only files in $TMPDIR are removed. Please remember that larigira has its own specific TMPDIR
MPD URIs are parsed, and only file:/// is supported