Skip to content

Commit bc443ca

Browse files
committed
fixed version sorting, removed hard-coded web address
1 parent 7eaa366 commit bc443ca

File tree

22 files changed

+114
-107
lines changed

22 files changed

+114
-107
lines changed

docs/_apps/aapb-pua-kaldi-wrapper/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ classes: wide
44
title: AAPB-PUA Kaldi Wrapper
55
---
66
A CLAMS wrapper for Kaldi-based ASR software originally developed by PopUpArchive and hipstas, and later updated by Kyeongmin Rim at Brandeis University. Wrapped software can be found at https://github.com/brandeis-llc/aapb-pua-kaldi-docker .
7-
- [v2](http://apps.clams.ai/aapb-pua-kaldi-wrapper/v2) ([`keighrim`](https://github.com/keighrim))
8-
- [v1](http://apps.clams.ai/aapb-pua-kaldi-wrapper/v1) ([`keighrim`](https://github.com/keighrim))
7+
- [v2]({{ url }}/aapb-pua-kaldi-wrapper/v2) ([`keighrim`](https://github.com/keighrim))
8+
- [v1]({{ url }}/aapb-pua-kaldi-wrapper/v1) ([`keighrim`](https://github.com/keighrim))

docs/_apps/barsdetection/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ classes: wide
44
title: Bars Detection
55
---
66
This tool detects SMPTE color bars.
7-
- [v1.1](http://apps.clams.ai/barsdetection/v1.1) ([`keighrim`](https://github.com/keighrim))
8-
- [v1.0](http://apps.clams.ai/barsdetection/v1.0) ([`keighrim`](https://github.com/keighrim))
7+
- [v1.1]({{ url }}/barsdetection/v1.1) ([`keighrim`](https://github.com/keighrim))
8+
- [v1.0]({{ url }}/barsdetection/v1.0) ([`keighrim`](https://github.com/keighrim))

docs/_apps/brandeis-acs-wrapper/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ classes: wide
44
title: Brandeis ACS Wrapper
55
---
66
Brandeis Acoustic Classification & Segmentation (ACS) is a audio segmentation tool developed at Brandeis Lab for Linguistics and Computation. The original software can be found at https://github.com/brandeis-llc/acoustic-classification-segmentation .
7-
- [v2](http://apps.clams.ai/brandeis-acs-wrapper/v2) ([`keighrim`](https://github.com/keighrim))
8-
- [v1](http://apps.clams.ai/brandeis-acs-wrapper/v1) ([`keighrim`](https://github.com/keighrim))
7+
- [v2]({{ url }}/brandeis-acs-wrapper/v2) ([`keighrim`](https://github.com/keighrim))
8+
- [v1]({{ url }}/brandeis-acs-wrapper/v1) ([`keighrim`](https://github.com/keighrim))

docs/_apps/chyron-detection/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ classes: wide
44
title: Chyron Detection
55
---
66
This tool detects chyrons, generates time segments.
7-
- [v1.0](http://apps.clams.ai/chyron-detection/v1.0) ([`keighrim`](https://github.com/keighrim))
7+
- [v1.0]({{ url }}/chyron-detection/v1.0) ([`keighrim`](https://github.com/keighrim))

docs/_apps/dbpedia-spotlight-wrapper/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ classes: wide
44
title: Dbpedia Spotlight Wrapper
55
---
66
Apply named entity linking to all text documents in a MMIF file.
7-
- [v1.2](http://apps.clams.ai/dbpedia-spotlight-wrapper/v1.2) ([`wricketts`](https://github.com/wricketts))
8-
- [v1.1](http://apps.clams.ai/dbpedia-spotlight-wrapper/v1.1) ([`keighrim`](https://github.com/keighrim))
9-
- [v1.0](http://apps.clams.ai/dbpedia-spotlight-wrapper/v1.0) ([`wricketts`](https://github.com/wricketts))
7+
- [v1.2]({{ url }}/dbpedia-spotlight-wrapper/v1.2) ([`wricketts`](https://github.com/wricketts))
8+
- [v1.1]({{ url }}/dbpedia-spotlight-wrapper/v1.1) ([`keighrim`](https://github.com/keighrim))
9+
- [v1.0]({{ url }}/dbpedia-spotlight-wrapper/v1.0) ([`wricketts`](https://github.com/wricketts))

docs/_apps/doctr-wrapper/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ classes: wide
44
title: CLAMS docTR Wrapper
55
---
66
CLAMS app wraps the [docTR, End-to-End OCR model](https://pypi.org/project/python-doctr). The model can detect text regions in the input image and recognize text in the regions (via parseq OCR model, only English is support at the moment). The text-localized regions are organized hierarchically by the model into "pages" > "blocks" > "lines" > "words", and this CLAMS app translates them into `TextDocument`, `Paragraphs`, `Sentence`, and `Token` annotations to represent recognized text contents. See descriptions for I/O types below for details on how annotations are aligned to each other.
7-
- [v1.1](http://apps.clams.ai/doctr-wrapper/v1.1) ([`keighrim`](https://github.com/keighrim))
8-
- [v1.0](http://apps.clams.ai/doctr-wrapper/v1.0) ([`keighrim`](https://github.com/keighrim))
7+
- [v1.1]({{ url }}/doctr-wrapper/v1.1) ([`keighrim`](https://github.com/keighrim))
8+
- [v1.0]({{ url }}/doctr-wrapper/v1.0) ([`keighrim`](https://github.com/keighrim))

docs/_apps/east-textdetection/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ classes: wide
44
title: EAST Text Detection
55
---
66
OpenCV-based text localization app that used EAST text detection model. Please visit the source code repository for full documentation.
7-
- [v1.1](http://apps.clams.ai/east-textdetection/v1.1) ([`keighrim`](https://github.com/keighrim))
8-
- [v1.0](http://apps.clams.ai/east-textdetection/v1.0) ([`keighrim`](https://github.com/keighrim))
7+
- [v1.1]({{ url }}/east-textdetection/v1.1) ([`keighrim`](https://github.com/keighrim))
8+
- [v1.0]({{ url }}/east-textdetection/v1.0) ([`keighrim`](https://github.com/keighrim))

docs/_apps/easyocr-wrapper/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ classes: wide
44
title: Easyocr Wrapper
55
---
66
Using EasyOCR to extract text from timeframes
7-
- [v1.1](http://apps.clams.ai/easyocr-wrapper/v1.1) ([`snewman-aa`](https://github.com/snewman-aa))
8-
- [v1.0](http://apps.clams.ai/easyocr-wrapper/v1.0) ([`snewman-aa`](https://github.com/snewman-aa))
7+
- [v1.1]({{ url }}/easyocr-wrapper/v1.1) ([`snewman-aa`](https://github.com/snewman-aa))
8+
- [v1.0]({{ url }}/easyocr-wrapper/v1.0) ([`snewman-aa`](https://github.com/snewman-aa))

docs/_apps/fewshotclassifier/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ classes: wide
44
title: Few Shot Classifier
55
---
66
This tool uses a vision model to classify video segments. Currenly supports "chyron" frame type.
7-
- [v1.0](http://apps.clams.ai/fewshotclassifier/v1.0) ([`keighrim`](https://github.com/keighrim))
7+
- [v1.0]({{ url }}/fewshotclassifier/v1.0) ([`keighrim`](https://github.com/keighrim))

docs/_apps/gentle-forced-aligner-wrapper/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ classes: wide
44
title: Gentle Forced Aligner Wrapper
55
---
66
This CLAMS app aligns transcript and audio track using Gentle. Gentle is a robust yet lenient forced aligner built on Kaldi.This app only works when Gentle is already installed locally.Unfortunately, Gentle is not distributed as a Python package distribution.To get Gentle installation instruction, see https://lowerquality.com/gentle/ Make sure install Gentle from the git commit specified in ``analyzer_version`` in this metadata.
7-
- [v1.0](http://apps.clams.ai/gentle-forced-aligner-wrapper/v1.0) ([`keighrim`](https://github.com/keighrim))
7+
- [v1.0]({{ url }}/gentle-forced-aligner-wrapper/v1.0) ([`keighrim`](https://github.com/keighrim))

docs/_apps/inaspeechsegmenter-wrapper/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ classes: wide
44
title: inaSpeechSegmenter Wrapper
55
---
66
inaSpeechSegmenter is a CNN-based audio segmentation toolkit. The original software can be found at https://github.com/ina-foss/inaSpeechSegmenter .
7-
- [v2.0](http://apps.clams.ai/inaspeechsegmenter-wrapper/v2.0) ([`keighrim`](https://github.com/keighrim))
8-
- [v1.2](http://apps.clams.ai/inaspeechsegmenter-wrapper/v1.2) ([`keighrim`](https://github.com/keighrim))
9-
- [v1.1](http://apps.clams.ai/inaspeechsegmenter-wrapper/v1.1) ([`keighrim`](https://github.com/keighrim))
10-
- [v1.0](http://apps.clams.ai/inaspeechsegmenter-wrapper/v1.0) ([`keighrim`](https://github.com/keighrim))
7+
- [v2.0]({{ url }}/inaspeechsegmenter-wrapper/v2.0) ([`keighrim`](https://github.com/keighrim))
8+
- [v1.2]({{ url }}/inaspeechsegmenter-wrapper/v1.2) ([`keighrim`](https://github.com/keighrim))
9+
- [v1.1]({{ url }}/inaspeechsegmenter-wrapper/v1.1) ([`keighrim`](https://github.com/keighrim))
10+
- [v1.0]({{ url }}/inaspeechsegmenter-wrapper/v1.0) ([`keighrim`](https://github.com/keighrim))

docs/_apps/llava-captioner/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ classes: wide
44
title: Llava Captioner
55
---
66
Applies llava to video frames.
7-
- [v1.1](http://apps.clams.ai/llava-captioner/v1.1) ([`kelleyl`](https://github.com/kelleyl))
8-
- [v1.0](http://apps.clams.ai/llava-captioner/v1.0) ([`kelleyl`](https://github.com/kelleyl))
7+
- [v1.1]({{ url }}/llava-captioner/v1.1) ([`kelleyl`](https://github.com/kelleyl))
8+
- [v1.0]({{ url }}/llava-captioner/v1.0) ([`kelleyl`](https://github.com/kelleyl))

docs/_apps/parseqocr-wrapper/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ classes: wide
44
title: Parseq OCR Wrapper
55
---
66
This tool applies Parseq OCR to a video or image and generates text boxes and OCR results.
7-
- [v1.0](http://apps.clams.ai/parseqocr-wrapper/v1.0) ([`keighrim`](https://github.com/keighrim))
7+
- [v1.0]({{ url }}/parseqocr-wrapper/v1.0) ([`keighrim`](https://github.com/keighrim))

docs/_apps/pyscenedetect-wrapper/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ classes: wide
44
title: Pyscenedetect Wrapper
55
---
66
CLAMS app wraps PySceneDetect and performs shot boundary detection on input videos
7-
- [v3](http://apps.clams.ai/pyscenedetect-wrapper/v3) ([`kelleyl`](https://github.com/kelleyl))
8-
- [v2](http://apps.clams.ai/pyscenedetect-wrapper/v2) ([`keighrim`](https://github.com/keighrim))
9-
- [v1](http://apps.clams.ai/pyscenedetect-wrapper/v1) ([`keighrim`](https://github.com/keighrim))
7+
- [v3]({{ url }}/pyscenedetect-wrapper/v3) ([`kelleyl`](https://github.com/kelleyl))
8+
- [v2]({{ url }}/pyscenedetect-wrapper/v2) ([`keighrim`](https://github.com/keighrim))
9+
- [v1]({{ url }}/pyscenedetect-wrapper/v1) ([`keighrim`](https://github.com/keighrim))

docs/_apps/simple-timepoints-stitcher/index.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ classes: wide
44
title: Simple Timepoints Stitcher
55
---
66
Stitches a sequence of `TimePoint` annotations into a sequence of `TimeFrame` annotations, performing simple smoothing of short peaks of positive labels.
7-
- [v2.0](http://apps.clams.ai/simple-timepoints-stitcher/v2.0) ([`keighrim`](https://github.com/keighrim))
8-
- [v1.3](http://apps.clams.ai/simple-timepoints-stitcher/v1.3) ([`keighrim`](https://github.com/keighrim))
9-
- [v1.2](http://apps.clams.ai/simple-timepoints-stitcher/v1.2) ([`keighrim`](https://github.com/keighrim))
10-
- [v1.1](http://apps.clams.ai/simple-timepoints-stitcher/v1.1) ([`keighrim`](https://github.com/keighrim))
11-
- [v1.0](http://apps.clams.ai/simple-timepoints-stitcher/v1.0) ([`keighrim`](https://github.com/keighrim))
7+
- [v2.0]({{ url }}/simple-timepoints-stitcher/v2.0) ([`keighrim`](https://github.com/keighrim))
8+
- [v1.3]({{ url }}/simple-timepoints-stitcher/v1.3) ([`keighrim`](https://github.com/keighrim))
9+
- [v1.2]({{ url }}/simple-timepoints-stitcher/v1.2) ([`keighrim`](https://github.com/keighrim))
10+
- [v1.1]({{ url }}/simple-timepoints-stitcher/v1.1) ([`keighrim`](https://github.com/keighrim))
11+
- [v1.0]({{ url }}/simple-timepoints-stitcher/v1.0) ([`keighrim`](https://github.com/keighrim))

docs/_apps/slatedetection/index.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ classes: wide
44
title: Slate Detection
55
---
66
This tool detects slates.
7-
- [v2.1](http://apps.clams.ai/slatedetection/v2.1) ([`keighrim`](https://github.com/keighrim))
8-
- [v2.0](http://apps.clams.ai/slatedetection/v2.0) ([`keighrim`](https://github.com/keighrim))
9-
- [v1.2](http://apps.clams.ai/slatedetection/v1.2) ([`keighrim`](https://github.com/keighrim))
10-
- [v1.1](http://apps.clams.ai/slatedetection/v1.1) ([`keighrim`](https://github.com/keighrim))
11-
- [v1.0](http://apps.clams.ai/slatedetection/v1.0) ([`kelleyl`](https://github.com/kelleyl))
7+
- [v2.1]({{ url }}/slatedetection/v2.1) ([`keighrim`](https://github.com/keighrim))
8+
- [v2.0]({{ url }}/slatedetection/v2.0) ([`keighrim`](https://github.com/keighrim))
9+
- [v1.2]({{ url }}/slatedetection/v1.2) ([`keighrim`](https://github.com/keighrim))
10+
- [v1.1]({{ url }}/slatedetection/v1.1) ([`keighrim`](https://github.com/keighrim))
11+
- [v1.0]({{ url }}/slatedetection/v1.0) ([`kelleyl`](https://github.com/kelleyl))

docs/_apps/spacy-wrapper/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ classes: wide
44
title: CLAMS wrapper for spaCy NLP
55
---
66
Apply spaCy NLP to all text documents in a MMIF file.
7-
- [v1.2](http://apps.clams.ai/spacy-wrapper/v1.2) ([`marcverhagen`](https://github.com/marcverhagen))
8-
- [v1.1](http://apps.clams.ai/spacy-wrapper/v1.1) ([`keighrim`](https://github.com/keighrim))
9-
- [v1](http://apps.clams.ai/spacy-wrapper/v1) ([`keighrim`](https://github.com/keighrim))
7+
- [v1.2]({{ url }}/spacy-wrapper/v1.2) ([`marcverhagen`](https://github.com/marcverhagen))
8+
- [v1.1]({{ url }}/spacy-wrapper/v1.1) ([`keighrim`](https://github.com/keighrim))
9+
- [v1]({{ url }}/spacy-wrapper/v1) ([`keighrim`](https://github.com/keighrim))

docs/_apps/swt-detection/index.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ classes: wide
44
title: Scenes-with-text Detection
55
---
66
Detects scenes with text, like slates, chyrons and credits.
7-
- [v5.0](http://apps.clams.ai/swt-detection/v5.0) ([`marcverhagen`](https://github.com/marcverhagen))
8-
- [v4.4](http://apps.clams.ai/swt-detection/v4.4) ([`keighrim`](https://github.com/keighrim))
9-
- [v4.3](http://apps.clams.ai/swt-detection/v4.3) ([`keighrim`](https://github.com/keighrim))
10-
- [v4.2](http://apps.clams.ai/swt-detection/v4.2) ([`keighrim`](https://github.com/keighrim))
11-
- [v4.1](http://apps.clams.ai/swt-detection/v4.1) ([`keighrim`](https://github.com/keighrim))
12-
- [v4.0](http://apps.clams.ai/swt-detection/v4.0) ([`marcverhagen`](https://github.com/marcverhagen))
13-
- [v3.0](http://apps.clams.ai/swt-detection/v3.0) ([`marcverhagen`](https://github.com/marcverhagen))
14-
- [v2.1](http://apps.clams.ai/swt-detection/v2.1) ([`marcverhagen`](https://github.com/marcverhagen))
15-
- [v2.0](http://apps.clams.ai/swt-detection/v2.0) ([`marcverhagen`](https://github.com/marcverhagen))
16-
- [v1.0](http://apps.clams.ai/swt-detection/v1.0) ([`marcverhagen`](https://github.com/marcverhagen))
7+
- [v5.0]({{ url }}/swt-detection/v5.0) ([`marcverhagen`](https://github.com/marcverhagen))
8+
- [v4.4]({{ url }}/swt-detection/v4.4) ([`keighrim`](https://github.com/keighrim))
9+
- [v4.3]({{ url }}/swt-detection/v4.3) ([`keighrim`](https://github.com/keighrim))
10+
- [v4.2]({{ url }}/swt-detection/v4.2) ([`keighrim`](https://github.com/keighrim))
11+
- [v4.1]({{ url }}/swt-detection/v4.1) ([`keighrim`](https://github.com/keighrim))
12+
- [v4.0]({{ url }}/swt-detection/v4.0) ([`marcverhagen`](https://github.com/marcverhagen))
13+
- [v3.0]({{ url }}/swt-detection/v3.0) ([`marcverhagen`](https://github.com/marcverhagen))
14+
- [v2.1]({{ url }}/swt-detection/v2.1) ([`marcverhagen`](https://github.com/marcverhagen))
15+
- [v2.0]({{ url }}/swt-detection/v2.0) ([`marcverhagen`](https://github.com/marcverhagen))
16+
- [v1.0]({{ url }}/swt-detection/v1.0) ([`marcverhagen`](https://github.com/marcverhagen))

docs/_apps/tesseractocr-wrapper/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ classes: wide
44
title: Tesseract OCR Wrapper
55
---
66
This tool applies Tesseract OCR to a video or image and generates text boxes and OCR results.
7-
- [v1.0](http://apps.clams.ai/tesseractocr-wrapper/v1.0) ([`keighrim`](https://github.com/keighrim))
7+
- [v1.0]({{ url }}/tesseractocr-wrapper/v1.0) ([`keighrim`](https://github.com/keighrim))

docs/_apps/tonedetection/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ classes: wide
44
title: Tone_Detector
55
---
66
Detects spans of monotonic audio within an audio file
7-
- [v1.0](http://apps.clams.ai/tonedetection/v1.0) ([`MrSqually`](https://github.com/MrSqually))
7+
- [v1.0]({{ url }}/tonedetection/v1.0) ([`MrSqually`](https://github.com/MrSqually))

docs/_apps/whisper-wrapper/index.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ classes: wide
44
title: Whisper Wrapper
55
---
66
A CLAMS wrapper for Whisper-based ASR software originally developed by OpenAI.
7-
- [v6](http://apps.clams.ai/whisper-wrapper/v6) ([`keighrim`](https://github.com/keighrim))
8-
- [v5](http://apps.clams.ai/whisper-wrapper/v5) ([`keighrim`](https://github.com/keighrim))
9-
- [v4](http://apps.clams.ai/whisper-wrapper/v4) ([`keighrim`](https://github.com/keighrim))
10-
- [v3](http://apps.clams.ai/whisper-wrapper/v3) ([`keighrim`](https://github.com/keighrim))
11-
- [v2](http://apps.clams.ai/whisper-wrapper/v2) ([`keighrim`](https://github.com/keighrim))
12-
- [v1](http://apps.clams.ai/whisper-wrapper/v1) ([`keighrim`](https://github.com/keighrim))
7+
- [v6]({{ url }}/whisper-wrapper/v6) ([`keighrim`](https://github.com/keighrim))
8+
- [v5]({{ url }}/whisper-wrapper/v5) ([`keighrim`](https://github.com/keighrim))
9+
- [v4]({{ url }}/whisper-wrapper/v4) ([`keighrim`](https://github.com/keighrim))
10+
- [v3]({{ url }}/whisper-wrapper/v3) ([`keighrim`](https://github.com/keighrim))
11+
- [v2]({{ url }}/whisper-wrapper/v2) ([`keighrim`](https://github.com/keighrim))
12+
- [v1]({{ url }}/whisper-wrapper/v1) ([`keighrim`](https://github.com/keighrim))

scripts/app_page_data.py

+55-48
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,55 @@
1-
import os
2-
import json
3-
4-
directory = '../docs/_apps'
5-
6-
apps = [app for app in os.listdir(directory) if os.path.isdir(os.path.join(directory, app)) and not app.startswith('_')]
7-
8-
for app in apps:
9-
app_dir = os.path.join(directory, app)
10-
app_vers = [app_ver for app_ver in os.listdir(app_dir) if os.path.isdir(os.path.join(app_dir, app_ver))]
11-
sorted_app_info = sorted([app_ver.lstrip('v') for app_ver in app_vers], reverse=True) # sort versions from latest to earliest
12-
app_info_dict = {'v' + app_ver: tuple() for app_ver in sorted_app_info}
13-
for app_ver in app_vers:
14-
app_ver_dir = os.path.join(app_dir, app_ver)
15-
json_files = [json_file for json_file in os.listdir(app_ver_dir) if json_file[-5:] == '.json']
16-
for json_file in json_files:
17-
json_file_path = os.path.join(app_ver_dir, json_file)
18-
if json_file == 'metadata.json':
19-
with open(json_file_path) as metadata_file:
20-
metadata = json.load(metadata_file)
21-
title = metadata['name']
22-
ver_num = metadata['app_version']
23-
if ver_num.lstrip('v') == sorted_app_info[0]:
24-
description = metadata['description'] # get description for the latest app version
25-
elif json_file == 'submission.json':
26-
with open(json_file_path) as submission_file:
27-
submission = json.load(submission_file)
28-
submitter = submission['submitter']
29-
30-
app_info_dict[app_ver] = (ver_num, submitter)
31-
32-
file_name = os.path.join(directory, app, 'index.md')
33-
34-
f = open(file_name, "w")
35-
36-
f.write('---\n')
37-
f.write("layout: posts\n")
38-
f.write("classes: wide\n")
39-
f.write(f"title: {title}\n")
40-
f.write("---\n")
41-
f.write(f"{description}\n")
42-
43-
for app_info in app_info_dict:
44-
ver_num = app_info_dict[app_info][0]
45-
submitter = app_info_dict[app_info][1]
46-
f.write(f"- [{ver_num}](http://apps.clams.ai/{app}/{ver_num}) ([`{submitter}`](https://github.com/{submitter}))\n")
47-
48-
f.close()
1+
import os
2+
import json
3+
import datetime
4+
5+
app_par_dir = os.path.join(os.path.dirname(__file__), '..', 'docs', '_apps')
6+
7+
apps = [app for app in os.listdir(app_par_dir) if os.path.isdir(os.path.join(app_par_dir, app)) and not app.startswith('_')]
8+
9+
for app in apps:
10+
app_dir = os.path.join(app_par_dir, app)
11+
app_vers = [app_ver for app_ver in os.listdir(app_dir) if os.path.isdir(os.path.join(app_dir, app_ver))]
12+
app_submitters = dict()
13+
app_descriptions = {app_ver: tuple() for app_ver in app_vers}
14+
app_vers_sorted = list()
15+
for app_ver in app_vers:
16+
app_ver_dir = os.path.join(app_dir, app_ver)
17+
json_files = [json_file for json_file in os.listdir(app_ver_dir) if json_file[-5:] == '.json']
18+
for json_file in json_files:
19+
json_file_path = os.path.join(app_ver_dir, json_file)
20+
if json_file == 'metadata.json':
21+
with open(json_file_path) as metadata_file:
22+
metadata = json.load(metadata_file)
23+
app_title = metadata['name']
24+
ver_num = metadata['app_version']
25+
app_descriptions[app_ver] = metadata['description']
26+
elif json_file == 'submission.json':
27+
with open(json_file_path) as submission_file:
28+
app_submission = json.load(submission_file)
29+
app_submitter = app_submission['submitter']
30+
submission_time = app_submission['time']
31+
app_submitters[app_ver] = app_submitter
32+
app_vers_sorted.append({'app_ver': app_ver, 'submission_time': submission_time})
33+
34+
app_vers_sorted.sort(key=lambda x: x['submission_time'], reverse=True)
35+
app_description = app_descriptions[app_vers_sorted[0]['app_ver']]
36+
37+
file_name = os.path.join(app_par_dir, app, 'index.md')
38+
39+
f = open(file_name, "w")
40+
41+
f.write('---\n')
42+
f.write("layout: posts\n")
43+
f.write("classes: wide\n")
44+
f.write(f"title: {app_title}\n")
45+
f.write("---\n")
46+
f.write(f"{app_description}\n")
47+
48+
clams_url = "{{ url }}"
49+
50+
for app_ver in app_vers_sorted:
51+
ver_num = app_ver['app_ver']
52+
app_submitter = app_submitters[ver_num]
53+
f.write(f"- [{ver_num}]({clams_url}/{app}/{ver_num}) ([`{app_submitter}`](https://github.com/{app_submitter}))\n")
54+
55+
f.close()

0 commit comments

Comments
 (0)