Skip to content

Commit

Permalink
Allow external download links
Browse files Browse the repository at this point in the history
  • Loading branch information
savbmeta committed Jul 15, 2024
1 parent b5b8ca0 commit 63f82df
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 42 deletions.
12 changes: 0 additions & 12 deletions content/Introduction.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
## Sound Sphere 2: A High-resolution HRTF Database

The RLR HRTF Database is a high-resolution database of 78 head-related transfer functions (HRTFs), that were collected during the 2022 Audio Engineering Society AVAR conference. The database is freely available for download.


> [Download full dataset (final link TBD)](https://github.com/facebook/rlraudioweb/blob/main/files/HRIRs_mannequins.zip)
> > [Download HRIRs (human participants)](https://github.com/facebook/rlraudioweb/raw/main/files/HRIRs.zip?download=)
> >
> > [Download HRIRs (mannequins)](https://github.com/facebook/rlraudioweb/raw/main/files/HRIRs_mannequins.zip?download=)
> >
> > [Download HRIRs (repeated human participants)](https://github.com/facebook/rlraudioweb/raw/main/files/HRIRs_Repeated_Measurements.zip?download=)
> >
> > [Download Headphone Filters](https://github.com/facebook/rlraudioweb/raw/main/files/Hp_Filters.zip?download=)
> >
> > [Download Docmmentation (final link TBD)](https://github.com/facebook/rlraudioweb/raw/main/files/Hp_Filters.zip?download=)
32 changes: 25 additions & 7 deletions files/Database.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
{
"title": "HRTF Database",
"Documentation": "RLR Audio Web.pdf",
"files": [
"HRIRs.zip",
"HRIRs_mannequins.zip",
"HRIRs_Repeated_Measurements.zip",
"Hp_Filters.zip",
"sample.zip"
"item": {
"name": "Download full dataset (final link TBD)",
"url": "https://github.com/facebook/rlraudioweb/blob/main/files/HRIRs_mannequins.zip?download="
},
"subitems": [
{
"name": "Download HRIRs (human participants)",
"url": "https://github.com/facebook/rlraudioweb/raw/main/files/HRIRs.zip?download="
},
{
"name": "Download HRIRs (mannequins)",
"url": "https://github.com/facebook/rlraudioweb/raw/main/files/HRIRs_mannequins.zip?download="
},
{
"name": "Download HRIRs (repeated human participants)",
"url": "https://github.com/facebook/rlraudioweb/raw/main/files/HRIRs_Repeated_Measurements.zip?download="
},
{
"name": "Download Headphone Filters",
"url": "https://github.com/facebook/rlraudioweb/raw/main/files/Hp_Filters.zip?download="
},
{
"name": "Download Docmmentation (final link TBD)",
"url": "https://github.com/facebook/rlraudioweb/raw/main/files/Hp_Filters.zip?download="
}
]
}
16 changes: 10 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/Accordion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const itemButtonclass = [

export const AccordionItem = ({ children, title, id, onSelect, isSelected }) => {
const contentClasses = [
isSelected ? 'max-h-screen' : 'max-h-0',
isSelected ? '' : 'max-h-0',
'overflow-hidden',
'transition-all',
'ease-in-out',
Expand Down
14 changes: 8 additions & 6 deletions src/components/DownloadFile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ const classes = [
'justify-between'
]

const DownloadFile = ({ url, name }) => {
const DownloadFile = ({ url, name, hasMetaFile = false }) => {
const [sizeStr, setSizeStr] = useState('')

useEffect(() => {
fetch(`${url}.meta`)
.then(res => res.json())
.then(json => setSizeStr(buildFilesizeStr(json.size)))
}, [])
if (hasMetaFile) {
useEffect(() => {
fetch(`${url}.meta`)
.then(res => res.json())
.then(json => setSizeStr(buildFilesizeStr(json.size)))
}, [])
}

return <div className={classNames(classes)}>
<div>
Expand Down
37 changes: 27 additions & 10 deletions src/components/DownloadItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import buildFilesizeStr from '../buildFilesizeStr'
import DownloadFile from './DownloadFile'
import DownloadButton from './DownloadButton'

import { Header3, Header4, Header5 } from './Heading'
import { Header4 } from './Heading'

const classes = [
'dark:bg-gray-700',
Expand All @@ -18,30 +18,47 @@ const classes = [
const FileDownload = ({item, zips, pdfs}) => {
const [sizeStr, setSizeStr] = useState('')

const fileDownloads = item.files.map((f, i) =>
<DownloadFile key={`${f}${i}`} name={f} url={zips.find(z => z.includes(f)) } /> )
const fileDownloads = item.subitems.map((subitem, i) => {
const nameUrl = typeof(subitem) == 'string'
? {name: subitem, url: subitem}
: subitem

const hasMetaFile = zips.find(zip => zip.includes(nameUrl.name)) != undefined

const pdfUrl = pdfs.find(p => p.includes(item.documentation))
return <DownloadFile
hasMetaFile={hasMetaFile}
key={`${nameUrl.name}${nameUrl.url}`}
name={nameUrl.name}
url={nameUrl.url} />
})

const nameUrl = typeof(item.item) == 'string'
? {name: 'Documentation', url: item.item}
: item.item

const itemUrl = pdfs.find(p => p.includes(nameUrl.url))

useEffect(() => {
fetch(`${pdfUrl}.meta`)
.then(res => res.json())
.then(json => setSizeStr(buildFilesizeStr(json.size)))
if (itemUrl != undefined) {
fetch(`${itemUrl}.meta`)
.then(res => res.json())
.then(json => setSizeStr(buildFilesizeStr(json.size)))
}
}, [])

return <div className={classNames(classes)}>
<div className='flex justify-between'>
<div>
<Header4>Documentation</Header4>
<Header4>{nameUrl.name}</Header4>
<div className='prose dark:prose-invert'>{item.documentation}</div>
<span className='prose dark:prose-invert'>{sizeStr}</span>

</div>
<div>
<DownloadButton url={pdfUrl} />
<DownloadButton url={nameUrl.url} />
</div>
</div>
{fileDownloads}
</div>
}

export default FileDownload

0 comments on commit 63f82df

Please sign in to comment.