Multimedia raport 2019-12-06

custom mediainfo reports

  1. pigers
    Requirements/Wymagania: mediainfo , findutils
    Ensure that mediainfo works in bash
    Put below files in one directory:
    mmedia.sh
    Code (Bash):
    1. PAT="$@"
    2. DUR=$(mediainfo --Inform="General;%Duration/String3%" "$@")
    3. FSI=$(mediainfo --Inform="General;%FileSize/String%" "$@")
    4. WI=$(mediainfo --Inform="Video;%Width%" "$@")
    5. HI=$(mediainfo --Inform="Video;%Height%" "$@")
    6. COD=$(mediainfo --Inform="Video;%CodecID%" "$@")
    7. PRO=$(mediainfo --Inform="Video;%Format_Profile%" "$@")
    8. SAM=$(mediainfo --Inform="Video;%ChromaSubsampling/String%" "$@")
    9. #echo "\"$PAT\" \"$DUR\" \"$FSI\" \"$WI\" \"$HI\" \"$COD\" \"$PRO\" \"$SAM\""
    10. echo "<TR>"
    11. echo "<td>$PAT</td>"
    12. echo "<td>$DUR</td>"
    13. echo "<td>$FSI</td>"
    14. echo "<td>$WI</td>"
    15. echo "<td>$HI</td>"
    16. echo "<td>$COD</td>"
    17. echo "<td>$PRO</td>"
    18. echo "<td>$SAM</td>"
    19. echo "</TR>"
    footer
    Code (HTML5):
    1. </tbody></table><p>
    2. <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>
    3. <a href="http://jigsaw.w3.org/css-validator/check/referer">
    4. <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Poprawny CSS!" />
    5. </a>
    6. </p>
    7. </body>
    8. </html>
    header
    Code (HTML5):
    1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    2. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    3. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    4. <title>My fckin library!</title>
    5. <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>
    6. <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
    7. <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">
    8. <link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap4.min.css" crossorigin="anonymous">
    9. <script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"  crossorigin="anonymous"></script>
    10. <script src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap4.min.js" crossorigin="anonymous"></script>
    11. <style type="text/css">body{background-color:#292B2C;color:#fff}</style>
    12. </head>
    13. <script type="text/javascript">
    14. $(document).ready(function() {
    15.     $('#example').DataTable();
    16. } );
    17. <table id="example" class="table table-striped table-hover table-sm table-inverse table-responsive"><thead>
    18.   <tr>
    19.     <th>Path</th>
    20.     <th>Duration</th>
    21.     <th>FileSize</th>
    22.     <th>Width</th>
    23.     <th>Height</th>
    24.     <th>Codec</th>
    25.     <th>VideoProfile</th>
    26.     <th>Sampling</th>
    27.   </tr>
    generator.sh
    Code (Bash):
    1. #!/bin/bash
    2. if [[ $# -ne 2 ]]; then
    3. echo "Illegal number of parameters. Example usage:"
    4. echo "$0 PathToFolder PathToOutputFile"
    5. exit 1
    6. fi
    7.  
    8. SCANDIR="$1"
    9. OUTFILE="$2"
    10.  
    11. #check if folder exists
    12. if [ ! -d "$1" ]; then
    13. echo "Scan folder does not exists !"
    14. exit 1
    15. fi
    16.  
    17. #check if outfile is writeable
    18. if [ ! -w "$2" ]; then
    19. echo "File $2 is not writable!"
    20. exit 1
    21. fi
    22.  
    23. #clear output file
    24. echo > $OUTFILE
    25. cat header > $OUTFILE
    26. find $SCANDIR -type f \( -name '*.mkv' -o -name '*.mp4' \) -exec mmedia.sh {} \; >> $OUTFILE
    27. 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.