Skip to content

Commit

Permalink
Change to include presets into plugin zip package
Browse files Browse the repository at this point in the history
  • Loading branch information
ryukau committed Nov 26, 2023
1 parent 3a6c404 commit 8e7da2d
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 44 deletions.
21 changes: 12 additions & 9 deletions docs/manual/common/contact_installation_guiconfig_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ You can fund the development through [paypal.me/ryukau](https://www.paypal.com/p

## Installation
### Plugin
Place `*.vst3` directory to:
Move `*.vst3` directory to:

- `/Program Files/Common Files/VST3/` for Windows.
- `$HOME/.vst3/` for Linux.
Expand All @@ -16,19 +16,22 @@ DAW may provides additional VST3 directory. For more information, please refer t
### Presets
**Notice**: Some plugins don't have presets provided by Uhhyou Plugins.

To install presets, follow the steps below.
Presets are included in the plugin package linked at the top of this page. To install presets, follow the steps below.

1. Download presets from a link at the top of this page.
2. Extract `*Presets.zip`. `*` here is [wildcard character](https://en.wikipedia.org/wiki/Wildcard_character).
3. Place unzipped directory into an OS specific preset directory (see below).
1. Download plugin from a link at the top of this page.
2. Extract downloaded zip file.
3. Open `presets` directory placed in extracted package.
4. Move `Uhhyou` directory into an OS specific preset directory (see below).

Below is a list of preset directories for each OS.

- Windows : `/Users/$USERNAME/Documents/VST3 Presets/Uhhyou`
- Linux : `$HOME/.vst3/presets/Uhhyou`
- macOS : `/Users/$USERNAME/Library/Audio/Presets/Uhhyou`
- Windows : `/Users/$USERNAME/Documents/VST3 Presets`
- Linux : `$HOME/.vst3/presets`
- macOS : `/Users/$USERNAME/Library/Audio/Presets`

Preset directory name must be the same as the plugin. Make `Uhhyou` directory if it does not exist.
Preset directory name must be the same as the plugin. If preset directory does not exist, create it.

- [Preset Locations - VST 3 Developer Portal](https://steinbergmedia.github.io/vst3_dev_portal/pages/Technical+Documentation/Locations+Format/Preset+Locations.html)

### Windows Specific
If DAW doesn't recognize the plugin, try installing C++ redistributable (`vc_redist.x64.exe`). Installer can be found in the link below.
Expand Down
20 changes: 11 additions & 9 deletions docs/manual/common/contact_installation_guiconfig_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@
DAW によっては上記とは別に VST3 をインストールできるディレクトリを提供していることがあります。詳しくは利用している DAW のマニュアルを参照してください。

### プリセット
**注意**: プラグインによっては Uhhyou Plugins が提供するプリセットがないものがあります
**注意**: プリセットの無いプラグインもあります

以下はプリセットのインストール手順です。
プリセットはページの最上部のリンクからダウンロードできるプラグインパッケージに含まれています。以下はプリセットのインストール手順です。

1. ページの最上部のリンクからプリセットをダウンロード
2. ダウンロードした `*Presets.zip` を解凍
3. 解凍したディレクトリを OS ごとに決められたディレクトリに配置。
1. ページの最上部のリンクからプラグインをダウンロード
2. ダウンロードした zip ファイルを解凍
3. `presets` ディレクトリ内の `Uhhyou` ディレクトリを OS ごとに決められたディレクトリに配置。

以下は OS ごとのプリセットの配置先の一覧です。

- Windows : `/Users/$USERNAME/Documents/VST3 Presets/Uhhyou`
- Linux : `$HOME/.vst3/presets/Uhhyou`
- macOS : `/Users/$USERNAME/Library/Audio/Presets/Uhhyou`
- Windows : `/Users/$USERNAME/Documents/VST3 Presets`
- Linux : `$HOME/.vst3/presets`
- macOS : `/Users/$USERNAME/Library/Audio/Presets`

プリセットディレクトリの名前はプラグインと同じである必要があります。 `Uhhyou` ディレクトリが無いときは作成してください。
プリセットディレクトリの名前はプラグインと同じである必要があります。配置先のディレクトリが無いときは作成してください。

- [Preset Locations - VST 3 Developer Portal](https://steinbergmedia.github.io/vst3_dev_portal/pages/Technical+Documentation/Locations+Format/Preset+Locations.html)

### Windows
プラグインが DAW に認識されないときは C++ redistributable をインストールしてみてください。インストーラは次のリンクからダウンロードできます。ファイル名は `vc_redist.x64.exe` です。
Expand Down
71 changes: 51 additions & 20 deletions package/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
import shutil
from pathlib import Path


def copy_resource(src, dst, error_msg):
dst.mkdir(parents=True, exist_ok=True)
if src.exists():
shutil.copytree(src, dst, dirs_exist_ok=True)
else:
print(error_msg)


def check_file(file_path):
"""Check existence of a file."""
if not file_path.is_file():
print(f"{file_path} does not exist")
exit(1)


def create_full_archive_from_github_actions_artifact(version):
with open("manual.json", "r", encoding="utf-8") as fi:
manual_dict = json.load(fi)
Expand Down Expand Up @@ -43,8 +46,9 @@ def create_full_archive_from_github_actions_artifact(version):
for vst3_dir in pack_dir.glob("*.vst3"):
plugin_name = vst3_dir.stem

manual_name = (plugin_name
if not plugin_name in manual_dict else manual_dict[plugin_name])
manual_name = (
plugin_name if not plugin_name in manual_dict else manual_dict[plugin_name]
)

# Do not make package if a plugin doesn't have manual.
if not Path(f"../docs/manual/{manual_name}").exists():
Expand All @@ -62,13 +66,14 @@ def create_full_archive_from_github_actions_artifact(version):
check_file(vst3_dir / Path(f"Contents/x86_64-linux/{plugin_name}.so"))
check_file(vst3_dir / Path(f"Contents/MacOS/{plugin_name}"))

packed_path_str = shutil.make_archive(
str(vst3_dir.parent / Path(f"{plugin_name}_{version[plugin_name]}")),
"zip",
pack_dir,
vst3_dir.name,
create_zip_archive(
vst3_dir.parent / Path(f"{plugin_name}_{version[plugin_name]}"),
plugin_name,
vst3_dir,
Path(f"../presets/Uhhyou/{plugin_name}"),
)


def create_macos_archive_from_github_actions_artifact(version):
"""
Ad-hoc method. Merge this to `create_full_archive_from_github_actions_artifact`
Expand Down Expand Up @@ -96,8 +101,9 @@ def create_macos_archive_from_github_actions_artifact(version):
for vst3_dir in pack_dir.glob("*.vst3"):
plugin_name = vst3_dir.stem

manual_name = (plugin_name
if not plugin_name in manual_dict else manual_dict[plugin_name])
manual_name = (
plugin_name if not plugin_name in manual_dict else manual_dict[plugin_name]
)

# Do not make package if a plugin doesn't have manual.
if not Path(f"../docs/manual/{manual_name}").exists():
Expand All @@ -107,20 +113,44 @@ def create_macos_archive_from_github_actions_artifact(version):
# Ensuring that no binary is missing.
check_file(vst3_dir / Path(f"Contents/MacOS/{plugin_name}"))

packed_path_str = shutil.make_archive(
str(vst3_dir.parent / Path(f"{plugin_name}_{version[plugin_name]}_macOS")),
"zip",
pack_dir,
vst3_dir.name,
create_zip_archive(
vst3_dir.parent / Path(f"{plugin_name}_{version[plugin_name]}_macOS"),
plugin_name,
vst3_dir,
Path(f"../presets/Uhhyou/{plugin_name}"),
)


def create_zip_archive(archive_dir, plugin_name, vst3_dir, presets_dir):
archive_dir.mkdir(parents=True, exist_ok=True)

archive_vst3_dir = archive_dir / vst3_dir.name
if archive_vst3_dir.exists():
shutil.rmtree(archive_vst3_dir)
shutil.move(vst3_dir, archive_dir)

presets_dir = Path(f"../presets/Uhhyou/{plugin_name}")
if presets_dir.exists():
target_dir = Path(*presets_dir.parts[1:]) # Remove relative part.
shutil.copytree(presets_dir, archive_dir / target_dir, dirs_exist_ok=True)

packed_path_str = shutil.make_archive(
archive_dir,
"zip",
archive_dir,
)


def get_version():
re_major_version = re.compile(r"^#define MAJOR_VERSION_INT ([0-9]+)",
flags=re.MULTILINE | re.DOTALL)
re_minor_version = re.compile(r"^#define SUB_VERSION_INT ([0-9]+)",
flags=re.MULTILINE | re.DOTALL)
re_patch_version = re.compile(r"^#define RELEASE_NUMBER_INT ([0-9]+)",
flags=re.MULTILINE | re.DOTALL)
re_major_version = re.compile(
r"^#define MAJOR_VERSION_INT ([0-9]+)", flags=re.MULTILINE | re.DOTALL
)
re_minor_version = re.compile(
r"^#define SUB_VERSION_INT ([0-9]+)", flags=re.MULTILINE | re.DOTALL
)
re_patch_version = re.compile(
r"^#define RELEASE_NUMBER_INT ([0-9]+)", flags=re.MULTILINE | re.DOTALL
)

with open("../CMakeLists.txt", "r", encoding="utf-8") as fi:
top_level_cmake_text = fi.read()
Expand All @@ -143,6 +173,7 @@ def get_version():
version[plugin_name] = f"{major}.{minor}.{patch}"
return version


if __name__ == "__main__":
version = get_version()
create_macos_archive_from_github_actions_artifact(version)
Expand Down
20 changes: 20 additions & 0 deletions presets/pack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import shutil
from pathlib import Path

# `print` are added for debugging GitHub Actions.
print("presets/pack.py: Packing presets.")

if __name__ == "__main__":
pack_dir = Path("pack")
pack_dir.mkdir(parents=True, exist_ok=True)

for preset_dir in Path("Uhhyou").glob("*"):
if not preset_dir.is_dir():
continue
packed_path_str = shutil.make_archive(
str(pack_dir / Path(f"{preset_dir.name}_Presets")),
"zip",
".",
preset_dir,
)
print(packed_path_str)
6 changes: 0 additions & 6 deletions presets/pack.sh

This file was deleted.

0 comments on commit 8e7da2d

Please sign in to comment.