Resource icon

Multimedia raport 2019-12-06

No permission to download
Requirements/Wymagania: mediainfo , findutils
Ensure that mediainfo works in bash
Put below files in one directory:
mmedia.sh
Bash:
PAT="$@"
DUR=$(mediainfo --Inform="General;%Duration/String3%" "$@")
FSI=$(mediainfo --Inform="General;%FileSize/String%" "$@")
WI=$(mediainfo --Inform="Video;%Width%" "$@")
HI=$(mediainfo --Inform="Video;%Height%" "$@")
COD=$(mediainfo --Inform="Video;%CodecID%" "$@")
PRO=$(mediainfo --Inform="Video;%Format_Profile%" "$@")
SAM=$(mediainfo --Inform="Video;%ChromaSubsampling/String%" "$@")
#echo "\"$PAT\" \"$DUR\" \"$FSI\" \"$WI\" \"$HI\" \"$COD\" \"$PRO\" \"$SAM\""
echo "<TR>"
echo "<td>$PAT</td>"
echo "<td>$DUR</td>"
echo "<td>$FSI</td>"
echo "<td>$WI</td>"
echo "<td>$HI</td>"
echo "<td>$COD</td>"
echo "<td>$PRO</td>"
echo "<td>$SAM</td>"
echo "</TR>"

footer
HTML:
</tbody></table><p>
<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Poprawny CSS!" />
</a>
</p>
</body>
</html>

header
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>My fckin library!</title>
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap4.min.css" crossorigin="anonymous">
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"  crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap4.min.js" crossorigin="anonymous"></script>
<style type="text/css">body{background-color:#292B2C;color:#fff}</style>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
    $('#example').DataTable();
} );
</script>
<table id="example" class="table table-striped table-hover table-sm table-inverse table-responsive"><thead>
  <tr>
    <th>Path</th>
    <th>Duration</th>
    <th>FileSize</th>
    <th>Width</th>
    <th>Height</th>
    <th>Codec</th>
    <th>VideoProfile</th>
    <th>Sampling</th>
  </tr>
</thead><tbody>

generator.sh
Bash:
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Illegal number of parameters. Example usage:"
echo "$0 PathToFolder PathToOutputFile"
exit 1
fi

SCANDIR="$1"
OUTFILE="$2"

#check if folder exists
if [ ! -d "$1" ]; then
echo "Scan folder does not exists !"
exit 1
fi

#check if outfile is writeable
if [ ! -w "$2" ]; then
echo "File $2 is not writable!"
exit 1
fi

#clear output file
echo > $OUTFILE
cat header > $OUTFILE
find $SCANDIR -type f \( -name '*.mkv' -o -name '*.mp4' \) -exec mmedia.sh {} \; >> $OUTFILE
cat footer >> $OUTFILE

Usage/Użycie: Browse to folder where above files are located , execute ./generator.sh FolderToScan OutputHTMLFile , where FolderToScan is full path like /share/Multimedia/ , OutputHTMLFile is full path to report file in HTML format (it must exists).

Example output/Wynik działania:
Upload 2020 1 3 12 28 58
Author
pigers
Downloads
4
Views
249
First release
Last update
Rating
5.00 star(s) 1 ratings

More resources from pigers

Share this resource