RomeoDespres / reapy

A pythonic wrapper for REAPER's ReaScript Python API
MIT License
111 stars 25 forks source link

Added RPR_InsertMedia as Project.import_media() and SetMediaItemSelected as Project.select_item() #112

Open makingpippop opened 3 years ago

makingpippop commented 3 years ago

Hi!

I've added the method to import a file in a REAPER project. To use it simply call:

project.import_media('path/to/file')

REAPER will create a new track and place the imported Item at the beginning of the project [00:00]. If the file is not found or invalid it will raise an Exception

You can also use the argument addToSelectedTrack : bool [optional] To import the media to the selected track in the project. If no track is selected, it will raise an IndexError

setToCursorPosition : bool [optional] To set the imported Item's position to the cursor position

I also added a tool called file_handler.validate_path('path/to/file/or/folder',ext=None, isFolder=False) Basically this method executes some validation on the path and raises for multiple reasons.

  1. The file or folder doesn't exists (The path is relative to the project location [reapy.Project().path])
  2. The file type is not supported by REAPER
  3. The file type does not match the extension passed as an optional argument "ext".
makingpippop commented 3 years ago

Sorry! I totally forgot that I've also added project.select_item() which allow to select a specific item in REAPER.

By default, the item will be added to the current selection. By using the argument makeUnique=True the current selection will be removed and only the specified Item will be selected.

Levitanus commented 3 years ago

I'm not a valid reviewer here, so these are just suggestions as from contributor, But maybe they help)) Thanks!

komjum6 commented 1 year ago

Can't figure out why this isn't merged

drunkenQCat commented 4 months ago

Can't figure out why this isn't merged

Maybe the indent of his code is not matched to original repo.

Levitanus commented 4 months ago

Repository is not maintained. You always can use reapy-boost from my repository. And I try to approve all PR's, which do not break the repo. But I also almost forgot of this project, as stated to write extensions in rust, and, even added a lot of reapy philosophy there.

drunkenQCat commented 4 months ago

Repository is not maintained. You always can use reapy-boost from my repository. And I try to approve all PR's, which do not break the repo. But I also almost forgot of this project, as stated to write extensions in rust, and, even added a lot of reapy philosophy there.

Thanks a lot for your reply, And I am happy to use see your works. Actually, I am a new one to reaper programming, and I am going to spend time on translate reapy to c# version. I will read your code for further inspiration, thank you.