Skip to content

Commit

Permalink
Merge pull request #14 from RomeoDespres/temp
Browse files Browse the repository at this point in the history
v 0.2.0
  • Loading branch information
RomeoDespres authored Mar 23, 2019
2 parents ac2e22a + b82d725 commit b656e7e
Show file tree
Hide file tree
Showing 24 changed files with 775 additions and 81 deletions.
36 changes: 27 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

All notable changes to this project will be documented in this file.

## [Unreleased]

TODO Take.sort_notes

### Added

UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_time, time_to_ppq)
#### API Helper Functions

- [`test_api`]

#### Audio Management

- class [`AudioAccessor`]
- class [`AudioAccessor`](https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.AudioAccessor)
- [`Take.add_audio_accessor`], [`Track.add_audio_accessor`]
- [`Source.delete`]

Expand Down Expand Up @@ -60,8 +58,10 @@ UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_
- [`Take.is_midi`]
- [`Take.n_cc`], [`Take.n_notes`], [`Take.n_text_sysex`]
- [`Take.add_note`]
- [`Take.notes`]
- [`Take.time_to_ppq`], [`Take.ppq_to_time`]
- [`Take.select_all_midi_events`], [`Take.unselect_all_midi_events`]
- class [`Note`]
- class [`MIDIEditor`]
- [`midi.reinit`]

Expand All @@ -72,7 +72,7 @@ UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_
#### Project Management

- [`open_project`]
- [`get_projects`] UNTESTED
- [`get_projects`]

#### Track Management

Expand All @@ -86,15 +86,23 @@ UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_

#### User Interface

- [`get_last_color_theme_file`]
- [`browse_for_file`]
- [`ui.get_color_theme`], [`ui.set_color_theme`]
- [`ui.get_leftmost_track_in_mixer`], [`ui.set_leftmost_track_in_mixer`]
- [`get_main_window`]
- [`Window.refresh`]
- class [`ToolTip`]

### Removed

#### Envelope Management

- `Track.get_envelope` (replaced by [`Track.envelopes`])

### Fixed

- Bug when enabling `reapy` for MacOS (issue [here](https://forum.cockos.com/showpost.php?p=2110136&postcount=27))
- Bug when enabling `reapy` when no Control/OSC/web has ever been enabled in REAPER (issue [here](https://forum.cockos.com/showpost.php?p=2110177&postcount=30))

## [0.1.0] - 2019-02-28

Expand Down Expand Up @@ -180,6 +188,7 @@ UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_
[`Marker.delete`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Marker.delete
[`Marker`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Marker
[`NormalizedFXParam.format_value`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.NormalizedFXParam.format_value
[`Note`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Note
[`Project.add_marker`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Project.add_marker
[`Project.add_region`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Project.add_region
[`Project.add_track`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Project.add_track
Expand Down Expand Up @@ -266,8 +275,10 @@ UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_
[`Take.n_notes`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Take.n_notes
[`Take.n_text_sysex`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Take.n_text_sysex
[`Take.name`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Take.name
[`Take.notes`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Take.notes
[`Take.ppq_to_time`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Take.ppq_to_time
[`Take.select_all_midi_events`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Take.select_all_midi_events
[`Take.sort_events`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Take.sort_events
[`Take.source`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Take.source
[`Take.time_to_ppq`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Take.time_to_ppq
[`Take.track`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Take.track
Expand All @@ -278,6 +289,7 @@ UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_
[`TimeSelection.looping`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.TimeSelection.looping
[`TimeSelection.shift`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.TimeSelection.shift
[`TimeSelection.unloop`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.TimeSelection.unloop
[`ToolTip`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.ToolTip
[`Track.add_audio_accessor`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Track.add_audio_accessor
[`Track.add_fx`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Track.add_fx
[`Track.add_item`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Track.add_item
Expand All @@ -302,6 +314,7 @@ UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_
[`Track.select`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Track.select
[`Track.unselect`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Track.unselect
[`Track.visible_fx`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Track.visible_fx
[`Window.refresh`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.Window.refresh
[`add_reascript`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.add_reascript
[`arm_command`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.arm_command
[`at_exit`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.defer.at_exit
Expand All @@ -315,6 +328,7 @@ UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_
[`audio.is_prebuffer`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.audio.is_prebuffer
[`audio.is_running`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.audio.is_running
[`audio.quit`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.audio.quit
[`browse_for_file`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.browse_for_file
[`clear_console`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.clear_console
[`clear_peak_cache`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.clear_peak_cache
[`dB_to_slider`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.dB_to_slider
Expand All @@ -328,7 +342,6 @@ UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_
[`get_ext_state`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.get_ext_state
[`get_global_automation_mode`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.get_global_automation_mode
[`get_ini_file`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.get_ini_file
[`get_last_color_theme_file`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.get_last_color_theme_file
[`get_last_touched_track`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.get_last_touched_track
[`get_main_window`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.get_main_window
[`get_projects`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.get_projects
Expand Down Expand Up @@ -358,7 +371,12 @@ UNTESTED : Take.add_note (and project.time_to_beats, beats_to_time, take.ppq_to_
[`show_console_message`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.show_console_message
[`show_message_box`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.show_message_box
[`slider_to_dB`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.slider_to_dB
[`test_api`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.test_api
[`time.time`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.time.time
[`ui.get_color_theme`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.ui.get_color_theme
[`ui.get_leftmost_track_in_mixer`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.ui.get_leftmost_track_in_mixer
[`ui.set_color_theme`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.ui.set_color_theme
[`ui.set_leftmost_track_in_mixer`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.ui.set_leftmost_track_in_mixer
[`update_arrange`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.update_arrange
[`update_timeline`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.update_timeline
[`view_prefs`]: https://python-reapy.readthedocs.io/en/latest/reapy.core.reaper.html#reapy.core.reaper.reaper.view_prefs
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* [ReaScript API](#reascript-api)
* [`reapy` API](#reapy-api)
* [Performance](#performance)
* [More](#more)
* [Documentation](#documentation)
3. [Contributing](#contributing)
4. [Author](#author)
5. [License](#license)
Expand Down Expand Up @@ -96,9 +96,9 @@ When used from inside REAPER, `reapy` has almost identical performance than nati

```

### More
### Documentation

Check the [documentation](https://python-reapy.readthedocs.io/ "reapy online documentation") and especially the [API guide](https://python-reapy.readthedocs.io/en/latest/api_guide.html) for more information.
Check the [documentation](https://python-reapy.readthedocs.io/ "reapy online documentation") and especially the [API guide](https://python-reapy.readthedocs.io/en/latest/api_guide.html) and [Translation Table](https://python-reapy.readthedocs.io/en/latest/api_table.html) for more information.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion docs/api.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/source/api_table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ API Helper Functions
"`ValidatePtr <https://www.reaper.fm/sdk/reascript/reascripthelp.html#ValidatePtr>`_",""
"`genGuid <https://www.reaper.fm/sdk/reascript/reascripthelp.html#genGuid>`_",""
"`format_timestr <https://www.reaper.fm/sdk/reascript/reascripthelp.html#format_timestr>`_",""
"`APITest <https://www.reaper.fm/sdk/reascript/reascripthelp.html#APITest>`_",""
"`APITest <https://www.reaper.fm/sdk/reascript/reascripthelp.html#APITest>`_","`test_api <reapy.core.reaper.html#reapy.core.reaper.reaper.test_api>`_"
"`ClearConsole <https://www.reaper.fm/sdk/reascript/reascripthelp.html#ClearConsole>`_","`clear_console <reapy.core.reaper.html#reapy.core.reaper.reaper.clear_console>`_"
"`mkvolstr <https://www.reaper.fm/sdk/reascript/reascripthelp.html#mkvolstr>`_",""
"`stringToGuid <https://www.reaper.fm/sdk/reascript/reascripthelp.html#stringToGuid>`_",""
Expand Down Expand Up @@ -472,9 +472,9 @@ MIDI Management
"`MIDI_CountEvts <https://www.reaper.fm/sdk/reascript/reascripthelp.html#MIDI_CountEvts>`_","`Take.n_cc <reapy.core.html#reapy.core.Take.n_cc>`_; `Take.n_notes <reapy.core.html#reapy.core.Take.n_notes>`_; `Take.n_text_sysex <reapy.core.html#reapy.core.Take.n_text_sysex>`_"
"`MIDIEditor_GetSetting_str <https://www.reaper.fm/sdk/reascript/reascripthelp.html#MIDIEditor_GetSetting_str>`_","`MIDIEditor <reapy.core.html#reapy.core.MIDIEditor>`_"
"`TakeIsMIDI <https://www.reaper.fm/sdk/reascript/reascripthelp.html#TakeIsMIDI>`_","`Take.is_midi <reapy.core.html#reapy.core.Take.is_midi>`_"
"`MIDI_Sort <https://www.reaper.fm/sdk/reascript/reascripthelp.html#MIDI_Sort>`_",""
"`MIDI_Sort <https://www.reaper.fm/sdk/reascript/reascripthelp.html#MIDI_Sort>`_","`Take.sort_events <reapy.core.html#reapy.core.Take.sort_events>`_"
"`MIDI_DeleteTextSysexEvt <https://www.reaper.fm/sdk/reascript/reascripthelp.html#MIDI_DeleteTextSysexEvt>`_",""
"`MIDI_GetNote <https://www.reaper.fm/sdk/reascript/reascripthelp.html#MIDI_GetNote>`_",""
"`MIDI_GetNote <https://www.reaper.fm/sdk/reascript/reascripthelp.html#MIDI_GetNote>`_","`Take.notes <reapy.core.html#reapy.core.Take.notes>`_; `Note <reapy.core.html#reapy.core.Note>`_"
"`MIDI_SetCC <https://www.reaper.fm/sdk/reascript/reascripthelp.html#MIDI_SetCC>`_",""
"`SetTrackMIDINoteNameEx <https://www.reaper.fm/sdk/reascript/reascripthelp.html#SetTrackMIDINoteNameEx>`_",""
"`MIDI_GetProjQNFromPPQPos <https://www.reaper.fm/sdk/reascript/reascripthelp.html#MIDI_GetProjQNFromPPQPos>`_",""
Expand Down Expand Up @@ -773,7 +773,7 @@ User Interface
.. csv-table::
:header: "ReaScript API function", "reapy API function"

"`SetMixerScroll <https://www.reaper.fm/sdk/reascript/reascripthelp.html#SetMixerScroll>`_",""
"`SetMixerScroll <https://www.reaper.fm/sdk/reascript/reascripthelp.html#SetMixerScroll>`_","`ui.set_leftmost_track_in_mixer <reapy.core.reaper.html#reapy.core.reaper.ui.set_leftmost_track_in_mixer>`_"
"`RefreshToolbar <https://www.reaper.fm/sdk/reascript/reascripthelp.html#RefreshToolbar>`_",""
"`GetUserInputs <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetUserInputs>`_",""
"`RefreshToolbar2 <https://www.reaper.fm/sdk/reascript/reascripthelp.html#RefreshToolbar2>`_",""
Expand All @@ -783,28 +783,28 @@ User Interface
"`DockWindowActivate <https://www.reaper.fm/sdk/reascript/reascripthelp.html#DockWindowActivate>`_",""
"`GetMousePosition <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetMousePosition>`_",""
"`DockWindowAddEx <https://www.reaper.fm/sdk/reascript/reascripthelp.html#DockWindowAddEx>`_",""
"`GetLastColorThemeFile <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetLastColorThemeFile>`_","`get_last_color_theme_file <reapy.core.reaper.html#reapy.core.reaper.reaper.get_last_color_theme_file>`_"
"`GetLastColorThemeFile <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetLastColorThemeFile>`_","`ui.get_color_theme <reapy.core.reaper.html#reapy.core.reaper.ui.get_color_theme>`_"
"`ViewPrefs <https://www.reaper.fm/sdk/reascript/reascripthelp.html#ViewPrefs>`_","`view_prefs <reapy.core.reaper.html#reapy.core.reaper.reaper.view_prefs>`_"
"`MB <https://www.reaper.fm/sdk/reascript/reascripthelp.html#MB>`_","`reapy.show_message_box <reapy.core.reaper.html#reapy.core.reaper.reapy.show_message_box>`_"
"`LICE_ClipLine <https://www.reaper.fm/sdk/reascript/reascripthelp.html#LICE_ClipLine>`_",""
"`GetMouseModifier <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetMouseModifier>`_",""
"`GetConfigWantsDock <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetConfigWantsDock>`_",""
"`Dock_UpdateDockID <https://www.reaper.fm/sdk/reascript/reascripthelp.html#Dock_UpdateDockID>`_",""
"`DockWindowRemove <https://www.reaper.fm/sdk/reascript/reascripthelp.html#DockWindowRemove>`_",""
"`GetUserFileNameForRead <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetUserFileNameForRead>`_",""
"`GetUserFileNameForRead <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetUserFileNameForRead>`_","`browse_for_file <reapy.core.reaper.html#reapy.core.reaper.reaper.browse_for_file>`_"
"`GR_SelectColor <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GR_SelectColor>`_",""
"`OpenColorThemeFile <https://www.reaper.fm/sdk/reascript/reascripthelp.html#OpenColorThemeFile>`_",""
"`OpenColorThemeFile <https://www.reaper.fm/sdk/reascript/reascripthelp.html#OpenColorThemeFile>`_","`ui.set_color_theme <reapy.core.reaper.html#reapy.core.reaper.ui.set_color_theme>`_"
"`my_getViewport <https://www.reaper.fm/sdk/reascript/reascripthelp.html#my_getViewport>`_",""
"`GetMixerScroll <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetMixerScroll>`_",""
"`DockWindowRefresh <https://www.reaper.fm/sdk/reascript/reascripthelp.html#DockWindowRefresh>`_",""
"`GetMixerScroll <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetMixerScroll>`_","`ui.get_leftmost_track_in_mixer <reapy.core.reaper.html#reapy.core.reaper.ui.get_leftmost_track_in_mixer>`_"
"`DockWindowRefresh <https://www.reaper.fm/sdk/reascript/reascripthelp.html#DockWindowRefresh>`_","`Window.refresh <reapy.core.html#reapy.core.Window.refresh>`_"
"`GetMainHwnd <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetMainHwnd>`_","`get_main_window <reapy.core.reaper.html#reapy.core.reaper.reaper.get_main_window>`_"
"`ShowMessageBox <https://www.reaper.fm/sdk/reascript/reascripthelp.html#ShowMessageBox>`_","`show_message_box <reapy.core.reaper.html#reapy.core.reaper.reaper.show_message_box>`_"
"`DockIsChildOfDock <https://www.reaper.fm/sdk/reascript/reascripthelp.html#DockIsChildOfDock>`_",""
"`DockWindowAdd <https://www.reaper.fm/sdk/reascript/reascripthelp.html#DockWindowAdd>`_",""
"`TrackCtl_SetToolTip <https://www.reaper.fm/sdk/reascript/reascripthelp.html#TrackCtl_SetToolTip>`_",""
"`TrackCtl_SetToolTip <https://www.reaper.fm/sdk/reascript/reascripthelp.html#TrackCtl_SetToolTip>`_","`ToolTip <reapy.core.html#reapy.core.ToolTip>`_"
"`ShowPopupMenu <https://www.reaper.fm/sdk/reascript/reascripthelp.html#ShowPopupMenu>`_",""
"`DockWindowRefreshForHWND <https://www.reaper.fm/sdk/reascript/reascripthelp.html#DockWindowRefreshForHWND>`_",""
"`GetTooltipWindow <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetTooltipWindow>`_",""
"`GetTooltipWindow <https://www.reaper.fm/sdk/reascript/reascripthelp.html#GetTooltipWindow>`_","`ToolTip <reapy.core.html#reapy.core.ToolTip>`_"
"`SetMouseModifier <https://www.reaper.fm/sdk/reascript/reascripthelp.html#SetMouseModifier>`_",""


8 changes: 8 additions & 0 deletions docs/source/reapy.core.reaper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ reapy.core.reaper.reaper module
:undoc-members:
:show-inheritance:

reapy.core.reaper.ui module
-------------------------------

.. automodule:: reapy.core.reaper.ui
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------
Expand Down
26 changes: 24 additions & 2 deletions reapy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,41 @@
from reapy.reascripts import activate_reapy_server

from configparser import ConfigParser
from collections import OrderedDict
import json
import os

REAPY_SERVER_PORT = 2306
WEB_INTERFACE_PORT = 2307


class CaseInsensitiveDict(OrderedDict):

"""OrderedDict with case-insensitive keys."""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._dict = OrderedDict(*args, **kwargs)
for key, value in self._dict.items():
self._dict[key.lower()] = value

def __contains__(self, key):
return key.lower() in self._dict

def __getitem__(self, key):
return self._dict[key.lower()]

def __setitem__(self, key, value):
super().__setitem__(key, value)
self._dict[key.lower()] = value


class Config(ConfigParser):

"""Parser for REAPER .ini file."""

def __init__(self):
super(Config, self).__init__(strict=False, delimiters="=")
super(Config, self).__init__(strict=False, delimiters="=", dict_type=CaseInsensitiveDict)
self.optionxform = str
self.read(reapy.get_ini_file())

Expand All @@ -37,7 +59,7 @@ def create_new_web_interface(port):
Web interface port.
"""
config = Config()
csurf_count = int(config["reaper"]["csurf_cnt"])
csurf_count = int(config["reaper"].get("csurf_cnt", "0"))
csurf_count += 1
config["reaper"]["csurf_cnt"] = str(csurf_count)
key = "csurf_{}".format(csurf_count - 1)
Expand Down
Loading

0 comments on commit b656e7e

Please sign in to comment.