Merged in seth/obs-download (pull request #63)

Seth/obs download

* wip

* Merge branch 'develop' into seth/obs-download

* Working. Waiting on final UI approval

* Merge branch 'develop' into seth/obs-download
This commit is contained in:
Seth Call 2025-06-15 00:44:11 +00:00
parent 5f3a327d35
commit e4d5fccdf5
9 changed files with 232 additions and 7 deletions

View File

@ -5,6 +5,25 @@ class Spacer
('%-5.5s' % percentage).gsub(' ', ' ') + '% - ' + val.to_s
end
end
=begin
select
count(id) as total,
count(first_downloaded_client_at) as downloaded,
count(first_ran_client_at) as ran_client,
count(first_certified_gear_at) as ftue,
count(first_music_session_at) as any_session,
count(first_real_music_session_at) as real_session,
count(first_good_music_session_at) as good_session,
count(first_invited_at) as invited,
count(first_friended_at) as friended,
count(first_subscribed_at) as subscribed
from users where users.created_at >= '2024-11-01' AND users.created_at < '2025-04-01'
select first_name, last_name, email
from users where users.created_at >= '2024-11-01' AND users.created_at < '2025-04-01'
AND first_music_session_at is NULL;
=end
ActiveAdmin.register_page "Subscription Cohorts" do
menu :parent => 'Reports'

View File

@ -112,6 +112,19 @@ class Cohort < ActiveRecord::Base
def self.cohort_users(cohort)
User.where(created_at: cohort.group_start..cohort.group_end)
end
=begin
SELECT played.user_id FROM
(SELECT user_id, COUNT(*) cnt FROM music_sessions_user_history msuh1
WHERE
msuh1.created_at >= '2024-11-01' AND
msuh1.created_at <= '202' AND
EXTRACT(EPOCH FROM (msuh1.session_removed_at - msuh1.created_at)) >= 900 AND
(SELECT COUNT(*) FROM music_sessions_user_history msuh2
WHERE msuh1.music_session_id = msuh2.music_session_id
) > 1
GROUP BY user_id
) played
=end
def _played_online_subquery(constraint)
where = if constraint.is_a?(Range)

View File

@ -116,7 +116,7 @@ const JKDownloads = () => {
<div>
<h5>Download the free JamKazam app</h5>
{/* <p>{currentOS}</p> */}
<p>
<p className="mb-lg-4">
You must use the JamKazam app to get into online sessions with other musicians. Our app also gives you the most feature-rich experience for JamTracks, recordings, live broadcasting, and other features. Click the button below to download the JamKazam app installer, then double click the installer to run it. For more detailed instructions,&nbsp;
{isMacOS ? <a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000130025" target='_blank'>see this help article</a> : isWindows && <a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000130024" target="_blank">see this help article</a>}.
</p>
@ -126,7 +126,7 @@ const JKDownloads = () => {
<img src={downloadImageUrl} alt="Download JamKazam" />
</a>
</div>
<div className='mt-3 mt-lg-0 ml-lg-3' style={ { flexGrow: 1, flexShrink: 1, flexBasis: '75%' } }>
<div className='mt-3 mt-lg-0 ml-lg-5' style={ { flexGrow: 1, flexShrink: 1, flexBasis: '75%' } }>
<div>Need a different version?</div>
<ul className='list-unstyled'>
{availablePlatforms.filter(platform => platform !== currentOS).map(platform => (

View File

@ -121,7 +121,7 @@ const JKDownloadsLegacy = () => {
<h5>Download the older legacy JamKazam app</h5>
{/* <p>{currentOS}</p>
<p>{selectedPlatform}</p> */}
<p>
<p className="mb-lg-4">
You must use the JamKazam app to get into online sessions with other musicians. Our app also gives you the most feature-rich experience for JamTracks, recordings, live broadcasting, and other features. Click the button below to download the JamKazam app installer, then double click the installer to run it. For more detailed instructions,&nbsp;
{isMacOS ? <a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000130025" target="_blank">see this help article</a> : isWindows && <a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000130024" target="_blank">see this help article</a>}.
</p>
@ -131,7 +131,7 @@ const JKDownloadsLegacy = () => {
<img src={downloadImageUrl} alt="Download JamKazam" />
</a>
</div>
<div className='mt-3 mt-lg-0 ml-lg-3' style={ { flexGrow: 1, flexShrink: 1, flexBasis: '75%' } }>
<div className='mt-3 mt-lg-0 ml-lg-5' style={ { flexGrow: 1, flexShrink: 1, flexBasis: '75%' } }>
<div>Need a different version?</div>
<ul className='list-unstyled'>
{availablePlatforms.filter(platform => platform !== selectedPlatform).map(platform => (
@ -143,7 +143,7 @@ const JKDownloadsLegacy = () => {
</ul>
</div>
</div>
<div className='mt-1 mt-lg-4'>
<div className='mt-lg-4'>
<div><strong>System Requirements</strong></div>
{selectedPlatform === 'MacOSX' ? (
<p>

View File

@ -0,0 +1,174 @@
import React, { useState, useEffect } from 'react'
import { detectOS, isAppleSilicon } from '../../helpers/utils'
import {getClientDownloads, getObsPluginDownloads} from '../../helpers/rest'
import { Link } from 'react-router-dom'
const DownloadButtonMacAppleMx = '/img/downloads/Download-Button-Obs-Mac-Apple-Mx.png'
const DownloadButtonMacIntel = '/img/downloads/Download-Button-Obs-Mac-Intel.png'
const DownloadButtonWindows = '/img/downloads/Download-Button-Obs-Windows.png'
const JKObsDownloads = () => {
const [currentOS, setCurrentOS] = useState(null)
const [downloads, setDownloads] = useState({})
const availablePlatforms = React.useMemo(() => {
const keys = Object.keys(downloads)
//only show JamClientModern versions
const sortedStrings = keys.filter(key => key.startsWith('OBSPlugin')).map(key => key.substring('OBSPlugin/'.length))
return sortedStrings
}, [downloads])
const detectAndSetOS = () => {
let os = detectOS()
if (os == "MacOSX") {
const silicon = isAppleSilicon();
if (silicon == true) {
os = "MacOSX-M";
}
else {
os = "MacOSX-Intel";
}
}
if (!os) {
os = "Win32"
}
setCurrentOS(os)
}
const fetchClientDownloads = () => {
getObsPluginDownloads()
.then(resp => {
if (resp.status === 200) {
return resp.json()
}
}).then(data => {
const platforms = Object.keys(data)
const downloadUris = {}
platforms.filter(p => p === 'OBSPlugin/MacOSX-M' || p === 'OBSPlugin/MacOSX-Intel' || p === 'OBSPlugin/Win32').forEach(platform => {
downloadUris[platform] = data[platform].uri
})
setDownloads(downloadUris)
detectAndSetOS()
})
.catch(err => {
console.error(err)
})
}
useEffect(() => {
fetchClientDownloads()
}, [])
const downloadLink = React.useMemo(() => {
if (!currentOS) return null
return downloads[`OBSPlugin/${currentOS}`]
}, [currentOS]);
const selectPlatform = (platform) => {
console.log('_DEBUG_ platform', platform)
setCurrentOS(platform)
}
const downloadImageUrl = React.useMemo(() => {
if (!currentOS) return null
switch (currentOS) {
case 'MacOSX-M':
return DownloadButtonMacAppleMx
case 'MacOSX-Intel':
return DownloadButtonMacIntel
case 'Win32':
return DownloadButtonWindows
}
}, [currentOS])
const isMacOS = React.useMemo(() => {
if (!currentOS) return false
return currentOS.startsWith('MacOSX')
}, [currentOS])
const isWindows = React.useMemo(() => {
if (!currentOS) return false
return currentOS === 'Win32'
}, [currentOS])
const platformDisplayName = (platform) => {
switch (platform) {
case 'MacOSX-M':
return 'JamKazam for Mac (Apple Silicon)'
case 'MacOSX-Intel':
return 'JamKazam for Mac (Intel)'
case 'Win32':
return 'JamKazam for Windows'
}
}
const onClickPlatform = (event, platform) => {
event.preventDefault()
selectPlatform(platform)
}
return (
<>
{Object.keys(downloads).length > 0 && currentOS ? (
<div>
<h5>Download and install OBS Studio</h5>
{/* <p>{currentOS}</p> */}
<p>
Before installing the JamKazam plugin for OBS, you must first download and install OBS Studio.
If you have not already done so, <a target="_blank" href="https://jamkazam.freshdesk.com/support/solutions/articles/66000525817">follow the instructions in this help article</a> to download
and install OBS Studio version 30.2.3. Please note that you cannot use OBS video features with the legacy
JamKazam application - only with the current version of our app.
</p>
<h5 className="mt-lg-4">Download and install JamKazam plugin for OBS</h5>
<p className="mb-lg-4">
After installing OBS Studio as explained above, you'll need to install the JamKazam
plugin for OBS. This plugin lets JamKazam and OBS Studio work together. Click the button
below to download the plugin installer. When the download is complete, double click the
installer, and then follow the on-screen instructions to install the plugin. For more detailed
instructions, <a target="_blank" href="https://jamkazam.freshdesk.com/support/solutions/articles/66000525817">see this help article</a>.
</p>
<div className='mt-2 d-flex flex-column flex-md-row'>
<div style={ { flexGrow: 0, flexShrink: 0, flexBasis: '25%' } }>
<a href={downloadLink} target='_blank'>
<img src={downloadImageUrl} alt="Download JamKazam" />
</a>
</div>
<div className='mt-3 mt-lg-0 ml-lg-5' style={ { flexGrow: 1, flexShrink: 1, flexBasis: '75%' } }>
<div>Need a different version?</div>
<ul className='list-unstyled'>
{availablePlatforms.filter(platform => platform !== currentOS).map(platform => (
<li key={platform}><a href="#" onClick={(e) => onClickPlatform(e, platform)}>{platformDisplayName(platform)}</a></li>
))}
</ul>
</div>
</div>
<div className='mt-lg-4'>
<h5>System Requirements</h5>
{isMacOS ? (
<p>
To install the JamKazam plugin for OBS Studio:<br />
- OBS Studio version 30.2.3 must already be installed on your computer <br />
- Your Mac must be running macOS 10.15 (Catalina) or higher <br />
</p>
) : isWindows ? (
<p>
To install the JamKazam plugin for OBS Studio<br />
- OBS Studio version 30.2.3 must already be installed on your computer <br />
- Your computer must be running Windows 10 or 11, 64-bit (32-bit not supported)
</p>
) : null}
</div>
</div>
) : (
<div>Loading...</div>
)}
</>
)
}
export default JKObsDownloads

View File

@ -685,6 +685,13 @@ export const getClientDownloads = () => {
.catch(error => reject(error));
});
}
export const getObsPluginDownloads = () => {
return new Promise((resolve, reject) => {
apiFetch(`/artifacts/OBSPlugin`)
.then(response => resolve(response))
.catch(error => reject(error));
});
}
//paypalPlaceOrder
export const paypalPlaceOrder = (options = {}) => {

View File

@ -10,6 +10,7 @@ import JKForum from '../components/public/help/JKForum';
import JKUnsubscribe from '../components/public/JKUnsubscribe';
import JKDownloads from '../components/public/JKDownloads';
import JKDownloadsLegacy from '../components/public/JKDownloadsLegacy';
import JKObsDownloads from '../components/public/JKObsDownloads';
import JKJamTracksLanding from '../components/jamtracks/JKJamTracksLandingDev';
import JKJamTracksArtistLanding from '../components/jamtracks/JKJamTracksArtistLandingDev';
@ -24,6 +25,7 @@ const JKPublicRoutes = ({ match: { url } }) => (
<Route path={`${url}/unsubscribe`} exact component={JKUnsubscribe} />
<Route path={`${url}/downloads`} exact component={JKDownloads} />
<Route path={`${url}/downloads-legacy`} exact component={JKDownloadsLegacy} />
<Route path={`${url}/obs-plugin-download`} exact component={JKObsDownloads} />
<Route path={`${url}/backing-tracks/:artist/:song`} component={JKJamTracksLanding} />
<Route path={`${url}/backing-tracks/:artist`} component={JKJamTracksArtistLanding} />

View File

@ -4,6 +4,7 @@ module JamRuby
DEFAULT_ENVIRONMENT = 'public'
CLIENT_PREFIX = 'JamClient'
CLIENT_PREFIX_MODERN = 'JamClientModern'
OBS_PLUGIN_PREFIX = 'OBSPlugin'
PRODUCTS = [
"#{CLIENT_PREFIX}/Win32",
@ -13,7 +14,10 @@ module JamRuby
"#{CLIENT_PREFIX_MODERN}/Win32",
"#{CLIENT_PREFIX_MODERN}/MacOSX-Intel",
"#{CLIENT_PREFIX_MODERN}/MacOSX-M",
"#{CLIENT_PREFIX_MODERN}/MacOSX"
"#{CLIENT_PREFIX_MODERN}/MacOSX",
"#{OBS_PLUGIN_PREFIX}/Win32",
"#{OBS_PLUGIN_PREFIX}/MacOSX-Intel",
"#{OBS_PLUGIN_PREFIX}/MacOSX-M",
]
self.primary_key = 'id'

View File

@ -16,7 +16,13 @@ class ArtifactsController < ApiController
clients = ArtifactUpdate.where('product ilike ? and environment = ?', "JamClient/#{params[:type]}", ArtifactUpdate::DEFAULT_ENVIRONMENT).order(:product)
end
else
clients = ArtifactUpdate.where("product like '%JamClient%' and environment = '#{ArtifactUpdate::DEFAULT_ENVIRONMENT}'").order(:product)
if params[:type]
clients = ArtifactUpdate.where("product like ? and environment = '#{ArtifactUpdate::DEFAULT_ENVIRONMENT}'", "%" + params[:type] + "%").order(:product)
else
clients = ArtifactUpdate.where("product like '%JamClient%' and environment = '#{ArtifactUpdate::DEFAULT_ENVIRONMENT}'").order(:product)
end
end
if is_jamblaster && params[:serialno]