reapy icon indicating copy to clipboard operation
reapy copied to clipboard

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

Open makingpippop opened this issue 4 years ago • 6 comments

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 avatar Jan 18 '21 17:01 makingpippop

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.

makingpippop avatar Jan 18 '21 17:01 makingpippop

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

Levitanus avatar Jan 18 '21 18:01 Levitanus

Can't figure out why this isn't merged

komjum6 avatar Oct 19 '23 00:10 komjum6

Can't figure out why this isn't merged

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

drunkenQCat avatar Jul 11 '24 02:07 drunkenQCat

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.

Levitanus avatar Jul 11 '24 05:07 Levitanus

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.

drunkenQCat avatar Jul 11 '24 05:07 drunkenQCat