Skip to content

Commit

Permalink
Merge pull request #717 from Dash-Industry-Forum/limiting
Browse files Browse the repository at this point in the history
Limiting
  • Loading branch information
Phencys authored Dec 11, 2024
2 parents e8211c6 + 630d4f9 commit d1e2174
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
23 changes: 13 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ EXPOSE 80

RUN apt-get update -y
RUN apt -y install \
apache2 apache2-doc php php-dev php-xml php-curl php-xdebug libapache2-mod-php \
python3 python-matplotlib-data \
openjdk-8-jdk ant \
sudo \
g++ gpac
#RUN curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
#RUN python3 get-pip.py
#RUN pip3 install matplotlib
g++ \
make \
python3 \
python-matplotlib-data \
openjdk-8-jdk \
apache2 \
php \
php-xml \
php-curl \
libapache2-mod-php \
php-xdebug \
sudo \
gpac
RUN update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

# let apache sudo this one specific script which filters the access logs
Expand All @@ -22,9 +27,7 @@ RUN echo >> /etc/sudoers "www-data ALL=NOPASSWD: /var/www/html/Conformance-Front
RUN rm /var/www/html/index.html
COPY --chown=www-data:www-data . /var/www/html/

COPY --chown=www-data:www-data ISOSegmentValidator /var/www/html/ISOSegmentValidator
RUN cd /var/www/html/ISOSegmentValidator/public/linux && make clean && make -j

COPY --chown=www-data:www-data Conformance-Frontend /var/www/html/Conformance-Frontend

CMD apachectl -D FOREGROUND
13 changes: 11 additions & 2 deletions Utils/Process_cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@
$argumentParser->addOption("compact", "C", "compact", "Make JSON output compact");
$argumentParser->addOption("silent", "S", "silent", "Do not output JSON to stdout");
$argumentParser->addOption("autodetect", "A", "autodetect", "Try to automatically detect profiles");
$argumentParser->addOption("unlimited", "U", "unlimited", "Unlimit the amount of segments downloaded (default is 5 per representation");
$argumentParser->addOption(
"unlimited",
"U",
"unlimited",
"Unlimit the amount of segments downloaded (default is 5 per representation"
);
$argumentParser->addOption("keep", "K", "keep", "Do not clear session directory after parsing");

$argumentParser->parseAll();

Expand Down Expand Up @@ -103,6 +109,7 @@
$compactOutput = $argumentParser->getOption("compact");
$autoDetect = $argumentParser->getOption("autodetect");
$detailedSegmentOutput = !$argumentParser->getOption("disable_detailed_segment_output");
$keepData = $argumentParser->getOption("keep");

global $limit;
$limit = 5;
Expand All @@ -122,4 +129,6 @@


global $session;
//$session->clearDirectory();
if (!$keepData) {
$session->clearDirectory();
}
15 changes: 13 additions & 2 deletions Utils/impl/MPDHandler/downloadAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

global $session, $limit;

$periodIdx = 0;

foreach ($this->segmentUrls as $periodIdx => $periodUrls) {
if ($limit != 0 && $periodIdx >= $limit) {
break;
}
$adaptationIdx = 0;
foreach ($periodUrls as $adaptationIdx => $adaptationUrls) {
if ($limit != 0 && $adaptationIdx >= $limit) {
break;
}
foreach ($adaptationUrls as $representationIdx => $representationUrls) {
$dir = $session->getRepresentationDir($periodIdx, $adaptationIdx, $representationIdx);
$assembly = ($assemble ? fopen("$dir/assembled.mp4", 'a+') : null);
Expand All @@ -23,8 +32,8 @@
$this->assembleSingle("$dir/seg${segmentPadded}.mp4", $assembly, $sizeFile, $index);
$index++;

if ($limit != 0 && $index >= $limit){
break;
if ($limit != 0 && $index >= $limit) {
break;
}
}

Expand All @@ -37,5 +46,7 @@
fclose($sizeFile);
}
}
$adaptationIdx++;
}
$periodIdx++;
}

0 comments on commit d1e2174

Please sign in to comment.