Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

makingpippop
Copy link

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 makingpippop changed the title Added RPR_InsertMedia as Project.import_media() Added RPR_InsertMedia as Project.import_media() and SetMediaItemSelected as Project.select_item() Jan 18, 2021
@makingpippop
Copy link
Author

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.

Copy link
Contributor

@Levitanus Levitanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid, if still item object is needed — it's quite more flexible to make everything on the item side.
More than, there are some methods like make_only_selected_iteem or something like these. I don't feel such project API is suitable here...

reapy/core/project/project.py Outdated Show resolved Hide resolved
reapy/core/project/project.py Outdated Show resolved Hide resolved
@Levitanus
Copy link
Contributor

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

Levitanus added a commit to Levitanus/reapy-boost that referenced this pull request Jan 18, 2021
…res#112

I've added it in this branch as the branch already has `Item.is_selected.setter` property
@Levitanus Levitanus mentioned this pull request Jan 18, 2021
@komjum6
Copy link

komjum6 commented Oct 19, 2023

Can't figure out why this isn't merged

@drunkenQCat
Copy link

Can't figure out why this isn't merged

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

@Levitanus
Copy link
Contributor

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants