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

MBVM-89: Show info about signing up on first fetch #246

Merged
merged 1 commit into from Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
57 changes: 57 additions & 0 deletions build/musicbrainz-dev/scripts/fetch-dump.sh
Expand Up @@ -98,6 +98,59 @@ then
exit 64 # EX_USAGE
fi

# Show information about signing up for data use

if [[ $TARGET != sample &&
! -a "$DB_DUMP_DIR/.for-commercial-use" &&
! -a "$DB_DUMP_DIR/.for-non-commercial-use"
]]
then
prompt=$(cat <<-EOQ
The data you are about to download is provided by the MetaBrainz Foundation.
Are you planning to use this data for commercial or business purposes?
(y/n)
yvanzo marked this conversation as resolved.
Show resolved Hide resolved
EOQ
)
read -e -p "$prompt " -r
while [[ ! ${REPLY:0:1} =~ [YNyn] ]]
do
read -e -p "Invalid reply. Yes or no? " -r
yvanzo marked this conversation as resolved.
Show resolved Hide resolved
done
echo
if [[ ${REPLY:0:1} =~ [Yy] ]]
then
prompt=$(cat <<-EOQ
The MetaBrainz Foundation is supported by commercial users of our data and
through end-user donations. If you are using our data in a commercial context,
we require you to support MetaBrainz financially in order for us ensure the
availability of these datasets in the future.

Please sign up at https://metabrainz.org/supporters/account-type

[Press any key when OK]
EOQ
)
read -e -N 1 -p "$prompt" -r -s
echo OK
touch "$DB_DUMP_DIR/.for-commercial-use"
else
prompt=$(cat <<-EOQ
Could you please sign up at https://metabrainz.org/supporters/account-type
(for free!) so that we may better understand how our data is being used?

We also encourage our non-commercial users who can afford it to make a donation
to the MetaBrainz Foundation so that we may continue our mission:
https://metabrainz.org/donate

[Press any key when OK]
EOQ
)
read -e -N 1 -p "$prompt" -r -s
echo OK
touch "$DB_DUMP_DIR/.for-non-commercial-use"
fi
fi

# Keep support for (deprecated) FTP option (which still takes precedence)

BASE_DOWNLOAD_URL="${BASE_FTP_URL:-$BASE_DOWNLOAD_URL}"
Expand All @@ -120,6 +173,8 @@ then
then
find "$SEARCH_DUMP_DIR" \
! -path "$SEARCH_DUMP_DIR" \
! -path "$DB_DUMP_DIR/.for-commercial-use" \
! -path "$DB_DUMP_DIR/.for-non-commercial-use" \
! -path "$SEARCH_DUMP_DIR/LATEST" \
-delete
fi
Expand Down Expand Up @@ -206,6 +261,8 @@ then
then
find "$DB_DUMP_DIR" \
! -path "$DB_DUMP_DIR" \
! -path "$DB_DUMP_DIR/.for-commercial-use" \
! -path "$DB_DUMP_DIR/.for-non-commercial-use" \
! -path "$DB_DUMP_DIR/LATEST" \
! -path "$DB_DUMP_DIR/LATEST-WITH-SEARCH-INDEXES" \
-delete
Expand Down
57 changes: 57 additions & 0 deletions build/musicbrainz/scripts/fetch-dump.sh
Expand Up @@ -98,6 +98,59 @@ then
exit 64 # EX_USAGE
fi

# Show information about signing up for data use

if [[ $TARGET != sample &&
! -a "$DB_DUMP_DIR/.for-commercial-use" &&
! -a "$DB_DUMP_DIR/.for-non-commercial-use"
]]
then
prompt=$(cat <<-EOQ
The data you are about to download is provided by the MetaBrainz Foundation.
Are you planning to use this data for commercial or business purposes?
(y/n)
EOQ
)
read -e -p "$prompt " -r
while [[ ! ${REPLY:0:1} =~ [YNyn] ]]
do
read -e -p "Invalid reply. Yes or no? " -r
done
echo
if [[ ${REPLY:0:1} =~ [Yy] ]]
then
prompt=$(cat <<-EOQ
The MetaBrainz Foundation is supported by commercial users of our data and
Copy link
Member

Choose a reason for hiding this comment

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

I think that the duplication of the text is not great, since that is bound to get out of sync. Would it be possible to have the text defined in a single file, that then gets used by these two files?

Copy link
Contributor Author

@yvanzo yvanzo Apr 24, 2023

Choose a reason for hiding this comment

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

It is a known general issue that many things are duplicated between build contexts for production and development versions of MusicBrainz server. This script is the same for both but others have small differences. There is no way to use symbolic links here and having a common build context would be more overhead.

through end-user donations. If you are using our data in a commercial context,
we require you to support MetaBrainz financially in order for us ensure the
availability of these datasets in the future.

Please sign up at https://metabrainz.org/supporters/account-type

[Press any key when OK]
EOQ
)
read -e -N 1 -p "$prompt" -r -s
echo OK
touch "$DB_DUMP_DIR/.for-commercial-use"
else
prompt=$(cat <<-EOQ
Could you please sign up at https://metabrainz.org/supporters/account-type
(for free!) so that we may better understand how our data is being used?

We also encourage our non-commercial users who can afford it to make a donation
to the MetaBrainz Foundation so that we may continue our mission:
https://metabrainz.org/donate

[Press any key when OK]
EOQ
)
read -e -N 1 -p "$prompt" -r -s
echo OK
touch "$DB_DUMP_DIR/.for-non-commercial-use"
fi
fi

# Keep support for (deprecated) FTP option (which still takes precedence)

BASE_DOWNLOAD_URL="${BASE_FTP_URL:-$BASE_DOWNLOAD_URL}"
Expand All @@ -120,6 +173,8 @@ then
then
find "$SEARCH_DUMP_DIR" \
! -path "$SEARCH_DUMP_DIR" \
! -path "$DB_DUMP_DIR/.for-commercial-use" \
! -path "$DB_DUMP_DIR/.for-non-commercial-use" \
! -path "$SEARCH_DUMP_DIR/LATEST" \
-delete
fi
Expand Down Expand Up @@ -206,6 +261,8 @@ then
then
find "$DB_DUMP_DIR" \
! -path "$DB_DUMP_DIR" \
! -path "$DB_DUMP_DIR/.for-commercial-use" \
! -path "$DB_DUMP_DIR/.for-non-commercial-use" \
! -path "$DB_DUMP_DIR/LATEST" \
! -path "$DB_DUMP_DIR/LATEST-WITH-SEARCH-INDEXES" \
-delete
Expand Down