Old 01-11-2019, 08:40 AM   #721
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,404
Default

Quote:
Originally Posted by amagalma View Post
Hmm, so what is a PackageEntry? I thought it meant an entry in the ReaPack Package Browser. Not all packages have dll's.. For example, if I want to check and get the info about your Song Switcher script, is this possible? Or I can get info only about dll's?
It represents an installed package. I meant dll in the context of js_ReaScriptAPI. The GetOwner API function takes a filename (either relative to the resource path or absolute) and returns a PackageEntry for the package which installed it. For example, any of these gives a PackageEntry for Song switcher if installed:

Code:
reaper.ReaPack_GetOwner('Scripts/ReaTeam Scripts/Various/cfillion_Song switcher.lua')
reaper.ReaPack_GetOwner('Scripts/ReaTeam Scripts/Various/cfillion_Song switcher/cfillion_Song switcher (next).lua')
reaper.ReaPack_GetOwner('reaper_www_root/song_switcher.html')
That API was meant mostly for this kind of usage:
Code:
function onHelpButtonClick()
  local owner = reaper.ReaPack_GetOwner(({reaper.get_action_context()})[2])
  if owner then
    reaper.ReaPack_AboutInstalledPackage(owner)
    reaper.ReaPack_FreeEntry(owner)
  end
end
To get and check js_ReaScriptAPI's installed (not loaded!) version:
Code:
function getJSAPIVersion()
  -- less usable because of the platform-dependent filename
  local owner = reaper.ReaPack_GetOwner('UserPlugins/reaper_js_ReaScriptAPI64.dylib')
  if owner then
    local version = ({reaper.ReaPack_GetEntryInfo(owner)})[7]
    reaper.ReaPack_FreeEntry(owner)
    return version
  end
end

if reaper.ReaPack_CompareVersion(getJSAPIVersion(), "1.0.4") < 0 then
  reaper.ShowConsoleMsg("js_ReaScriptAPI is too old!\n")
end
Quote:
Originally Posted by amagalma View Post
No, I haven't seen it! This is great! Thanks! Question: submitting via Upload tools creates a pull request, meaning that I still have to log in to Github and merge the branch to master?
Exactly, so that we (ReaTeam members) can check public submissions and have them tested by the bot first. Since you're a ReaTeam member, you can self-merge your PR once the indexing bot has finished its work.

Quote:
Originally Posted by amagalma View Post
Something simple like this is enough or should I do more checks?
Like that, plus ProcessQueue(true) to immediately finish importing the repository and/or refresh opened windows (see the gist linked in my post above).

Last edited by cfillion; 01-11-2019 at 09:02 AM.
cfillion is offline   Reply With Quote
Old 01-13-2019, 08:20 AM   #722
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,455
Default

Thank you so much for all the help!
amagalma is offline   Reply With Quote
Old 01-13-2019, 05:05 PM   #723
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 679
Default

I would love to add my Ultraschall-API to ReaPack and I have some questions about adding my own github-repo to the ReaPack-Package-Manager and I hope, you can help.

First some general questions about it:
1. I intend to add at some point an extension-plugin, like the JS-plugin or SWS. As far as I understood, the JS-plugin can be installed via ReaPack. How does it do it? Can ReaPack unregister the plugin and runtime, install the new version and reregister it?
I tried to remove an old version of a plugin to install a new one while Reaper is running with a restart of Reaper after installation, but Reaper "blocks" the plugin by accessing it while it runs(which is logical, as Reaper is using it).
I wonder now, how ReaPack does this for the JS-Plugin?

2. I would need to install my API into the UserPlugins-folder, not the scripts-folder. Does the ReaPack-manager allow me to do that?


Now some questions about the process of adding my repo:
1. Is there a full explanation, how to do that? Some kind of manual? I just found one X-Raym wrote, but it is some time since he wrote it, so I guess, some information is outdated.

2. I read somewhere, that there's a tool, that creates the .xml-file needed by ReaPack, but where can I find it? I found on the ReaPack-site(https://reapack.com/upload) only a way to add files to the official ReaPack-repo.
Even though this would be possible to do, it would be too impractical, as I add bugfixes quite often and don't want to upload it every few days to the ReaPack-repo, but rather add my own repo instead.
Where can I find that tool and a manual to use it? And does it support a complex folder-structure with dozens of files as well?


Hope, you can help me with that.
Cheers and great work on the Package-Manager. It's one of the tools I thought "this is fantastic" the first time I ran it
__________________
Ultraschall-API: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs for Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 01-13-2019, 10:39 PM   #724
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,404
Default

Quote:
Originally Posted by mespotine View Post
How does it do it? Can ReaPack unregister the plugin and runtime, install the new version and reregister it?
I tried to remove an old version of a plugin to install a new one while Reaper is running with a restart of Reaper after installation, but Reaper "blocks" the plugin by accessing it while it runs(which is logical, as Reaper is using it).
I wonder now, how ReaPack does this for the JS-Plugin?
REAPER must be restarted for the new version to be loaded, but I think you're referring to Windows' limitations disallowing writing to running executables. ReaPack works around that by moving the running .dll to a temporary location on that OS. (Overwriting or deleting running executables is allowed on Unix-like systems.)

Quote:
Originally Posted by mespotine View Post
2. I would need to install my API into the UserPlugins-folder, not the scripts-folder. Does the ReaPack-manager allow me to do that?
Mark either entire packages or individual files to go in UserPlugins as being of the "extension" type. I find it odd to have Lua scripts outside of the Scripts directory, however ReaPack-installed script files must be in a subdirectory named after the repository (eg. "Scripts/Ultraschall/api.lua"). Extension files do not have this requirement.

Quote:
Originally Posted by mespotine View Post
Now some questions about the process of adding my repo:
1. Is there a full explanation, how to do that? Some kind of manual? I just found one X-Raym wrote, but it is some time since he wrote it, so I guess, some information is outdated.

I read somewhere, that there's a tool, that creates the .xml-file needed by ReaPack, but where can I find it? Where can I find that tool and a manual to use it?
The tool is reapack-index. Its user guide is at https://github.com/cfillion/reapack-index/wiki. The XML index format itself is documented at https://github.com/cfillion/reapack/wiki/Index-Format.

https://reapack.com/upload, as a GUI editor, can help generate the metadata headers for reapack-index (just don't click on "Create pull request" if you want to use your own repository instead ).

Quote:
Originally Posted by mespotine View Post
And does it support a complex folder-structure with dozens of files as well?
I see your API .zip contains a few empty directories (eg. in 3rd_party_for_everyone). ReaPack, reapack-index, and git all only deals with actual files. Using an empty hidden file named ".gitkeep" or ".keep" is common.

Last edited by cfillion; 01-13-2019 at 10:47 PM.
cfillion is offline   Reply With Quote
Old 01-16-2019, 08:15 AM   #725
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 679
Default

@cfillion

Thanks for your answers

Quote:
Mark either entire packages or individual files to go in UserPlugins as being of the "extension" type. I find it odd to have Lua scripts outside of the Scripts directory, however ReaPack-installed script files must be in a subdirectory named after the repository (eg. "Scripts/Ultraschall/api.lua"). Extension files do not have this requirement.
So if I understood right, I can have ultraschall_api.lua in the UserPlugins-folder if I upload it as extension, while as script-upload, it must be in a subfolder, right?

Quote:
I see your API .zip contains a few empty directories (eg. in 3rd_party_for_everyone). ReaPack, reapack-index, and git all only deals with actual files. Using an empty hidden file named ".gitkeep" or ".keep" is common.
Thanks, added to my repo


Another question, how do you add JSFX-plugins into a running Reaper? Does Reaper need to be restarted for them to be added?

And a final question: what kinds of things can't be added using ReaPack-packagemanager? If I wanted to install the contents of a ReaperConfigZip-file from a repo using ReaPack rather than having to use ReaperConfigZip-file, what could I install and what would be missing?
e.g. could I add ini-files as well, that are stored in the RessourcesFolder?

I'm asking, as we think about using ReaPack for our Ultraschall-development.
We switched to managing the development-branch in git, however our betatesters are usually not that experienced with git to install the repo into a portable Reaper-version.
We would love to give betatesters an easy way of updating their beta-versions of Ultraschall using ReaPack.

Currently, we still would rely on building a ReaperConfigZip-file but this isn't flexible enough to represent the latest changes in the repo and slows down the pace of beta-testing...
__________________
Ultraschall-API: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs for Reaper: https://forum.cockos.com/showthread.php?t=207635

Last edited by mespotine; 01-16-2019 at 08:23 AM.
mespotine is offline   Reply With Quote
Old 01-16-2019, 08:57 AM   #726
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,404
Default

Quote:
Originally Posted by mespotine View Post
So if I understood right, I can have ultraschall_api.lua in the UserPlugins-folder if I upload it as extension, while as script-upload, it must be in a subfolder, right?
That's right. The type determines the root installation directory. You can choose the type of a package and optionally override it per-file (so, if you want it to be displayed as such, you could make a "Script" package install some "extension" files in UserPlugins).

Quote:
Originally Posted by mespotine View Post
Another question, how do you add JSFX-plugins into a running Reaper? Does Reaper need to be restarted for them to be added?
Only extension plugins require a restart. REAPER detects newly added JSFX automatically.

Quote:
Originally Posted by mespotine View Post
And a final question: what kinds of things can't be added using ReaPack-packagemanager? If I wanted to install the contents of a ReaperConfigZip-file from a repo using ReaPack rather than having to use ReaperConfigZip-file, what could I install and what would be missing?
e.g. could I add ini-files as well, that are stored in the RessourcesFolder?
ReaPack packages can currently write files into the AutomationItems, ColorThemes, Data, Effects, LangPack, MIDINoteNames, ProjectTemplates, reaper_www_root, Scripts, TrackTemplates and UserPlugins directories. Writing directly to the resource directory is not allowed (unsafe, especially considering many users choose to install everything).

I'm not sure how well externally overwriting an .ini while REAPER is running would work as some settings are kept in memory...

Last edited by cfillion; 01-16-2019 at 09:10 AM.
cfillion is offline   Reply With Quote
Old 01-16-2019, 09:21 AM   #727
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 679
Default

Ah, sounds good.

Would it be an option to add an API-function to ReaPack, that allows me programmatically install a ReaPack-package?
Like reaper.ReaPack_InstallPackage(string xml_file) ?

That way, I could install our git and do the rest with ini-files manually within one script, but I would need to know first, whether it was installed.
With such a function, I would be able to know that within my script.
__________________
Ultraschall-API: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs for Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 01-16-2019, 09:29 AM   #728
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,404
Default

There is no API to manage individual packages, however you can configure your repository to install every packages it contains and synchronize. GetOwner can detect whether a package is installed.

You can also open the package browser with a filter of your choice pre-filled (BrowsePackage(searchPattern)).

(Alternatively, maybe the .ini-copying script could be included along with the rest, only waiting to be manually run after installation?)

Last edited by cfillion; 01-16-2019 at 09:38 AM.
cfillion is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:12 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.