Apple Landschaftsaufnahmen

Die wunderbaren Landschaftsaufnahmen des Apple TV Bildschirmschoners sind auch für MacOS und Windows zu haben. Genauso beeindruckend ist der Film HOME.

Um sich vorab einen Eindruck zu verschaffen sind hier alle Apple Original Videos einzeln verlinkt.



Notizen:

  • Stand 2017
  • Duplikate raus gefiltert
  • Geprüft mit Safari, Chrome, iOS und Android, aber nicht jeder Browse unterstützt das Abspielen von *.mov Files
  • Es gibt Zusammenschnitte auf Youtube um alle Videos in einer Endlosschleife zu schauen
  • Quellen: Apple, Apple JASON & Benjamin Mayo
  • Video-Player: WordPress plugin FV Flowplayer

Generator für den Flowplayer-Code:

Crude Code Snippet (quick hack) um diese Seite halb-automatisch zu bauen:

#! ksh
# (c) 2017 Nikolai von Krusenstiern
#[...]

## Variables
#link="https://s1.mzstatic.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json"
link="http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json"
wpHome="http://blog.krusenstiern.de"
wpPath="$wpHome/wp-content/uploads"
wp="$wpPath/2017/11"
md5Sum="c317ad2dff82027eae3271ed9e658626"

## Functions
# get City of Video from JASON
# IN: movie file name
# OUT: city or area of this file, taken from the Apple JASON file
getTitle () {
        cat $tmp0                               |
        awk -F '"' '{
                if ( $0 ~ file ) {
                        on=1
                }
                if ( on == 1 && $0 ~ "Label" ) {
                        print $(NF-1)
                        on=0
                }
        }' file="/$1"                           |
        sed 's/ /_/g'
}

# Echo only, if not in cron
# IN: String to echo
# OUT: echo, if not called with --cron option
ECHO () {
        if [[ -z $cron ]] ; then
                echo $1
        fi
}

# Echo on empty line, if not in cron
# IN: call to this function
# OUT: echo empty line, if not called with --cron option
ECHOline () {
        ECHO ""
}

# output a progress bar, one dot in the same line per call
# IN: call of this function
# OUT: an additional dot at the end of the progressBar line with NO newline
progressBar () {
        if [[ -z $cron ]] ; then
                echo -n .
        fi
}

## Main

# count current number of thumbnail files
# IN: list of local copies of Thumbnail files (*.png)
# OUT: number of such files
numberOfPNGs=$(
        echo *.png                              |
        wc -l
)

# get JASON file from Apple
progressBar
# IN: URL
# OUT: Jason file
wget --quiet -O $tmp0 $link

# get the Videos URLs
progressBar
# IN: Jason file
# OUT: List of movie URLS in a file
cat $tmp0                                       |
tr -s '[["]]' '\n'                              |
sort -u                                         |
grep http                                       > $tmp1

# download the video files
progressBar
# IN: List of movie URLS in a file
# OUT: local copies of Movie files (*.mov)
wget --quiet -c -i $tmp1

#remove duplicate videos, if any
progressBar
# IN: list of local copies of Movie files (*.mov) w/ file size
# OUT: list of files which have a duplicate (only one file for the two being duplicate)
find . -name "*.mov" -type f -exec stat -c "%s %n" {} \;        |
sort -n                                         |
awk '{
        if ( $1 == oldSize ) {
                print old, $2
        }
        oldSize=$1
        old=$2
}'                                              |
xargs -L 1 diff -s                              |
grep identical                                  |
awk '{ print $2 }'                              > $tmp7

# now collect all video file names
progressBar
# IN: list of local copies of Movie files (*.mov)
# OUT: list of local copies of Movie files (*.mov)
listAll=$(
        ls *.mov
)

# now remove one file of each pair of duplicate files
progressBar
# IN: list of all local copies of Movie files (*.mov)
# OUT: reduced list of local copies of Movie files (*.mov), without duplicates
list=$(
        for file in $listAll
        do
                grep $file $tmp7                > /dev/null
                grepExit=$?
                if [[ $grepExit -eq 1 ]] ; then
                        echo $file
                fi
        done
)

# create thumbnails file names
# first connect video with city (from Jason file)
progressBar
# IN: reduced list of local copies of Movie files (*.mov), without duplicates
# OUT: list of local copies of Movie files, with added City (Area) Name in front
(
        for file in $list
        do
                title=$(
                        getTitle $file
                )

                echo $title $file
        done
)                                               |
sort -u                                         |
awk '{
        # Then group movies of same city together
        # IN: list of local copies of Movie files, with added City (Area) Name in front
        # OUT: list of City (area) followed by all movie files for that City in one line
        if ( length( fileNames[$1] ) > 0 ) {
                fileNames[$1]=sprintf("%s %s", fileNames[$1], $2 )
        } else {
                fileNames[$1]=$2
        }
}
END{
        # and then one city, with all videos in one line
        for ( city in fileNames ) {
                print city, fileNames[city]
        }
}'                                              |
sort -u                                         |
awk '{
        # now count the movie for each city,
        # and give thumb file names accordingly (counting up)
        # IN: list of City (area) followed by all movie files for that City in one line
        # OUT: numbered list of City (area) followed by one movie file per line
        for ( n=2 ; n < = NF ; n++ ) { num=n-1 printf("%s_%02d %s\n", $1, num, $(n)) } }' > $tmp2

# create an inline script to create the thumbnail,
# and than add the file name (city & number) as a Watermark
progressBar
# IN: numbered list of City (area) followed by one movie file per line
# OUT: 4 lines of ksh script for each movie file:
        # 1.) test if thumbnail is there,
        # 2.) if not, get thumbnail from movie
        # 3.) and also add City (area) name on thumbnail
        # 4.) end the if
cat $tmp2                               |
awk '{
        printf( "if [[ ! -s %s.png ]] ; then\n", $1 )
        printf( "\tffmpeg -y -loglevel 16 -itsoffset -1 -i %s -vframes 1 -filter:v scale=\"560:-1\" %s.png\n", $2, tmp )
        printf( "\tconvert %s.png -quiet -fill white -undercolor Black -gravity South -pointsize 40 -annotate +0+5 \" %s \" %s.png\n", tmp, $1, $1 )
        printf( "fi\n" )
}' tmp=$tmp9                                    > $tmp3

# execute the inline script
progressBar
# IN: 4 lines of ksh script for each movie file
# OUT: thumbnail (*.png) with text (file name) for each movie
source $tmp3

# make syntax for WP video player
progressBar
# IN: numbered list of City (area) followed by one movie file per line
# OUT: WP video player syntax into file
cat $tmp2                                       |
awk '
function URL(file) {
        cmd=sprintf("grep -w %s %s", file, tfile )
        cmd | getline out
        close(cmd)
        return out
}
{
        newURL=URL($2)
        if (NR == 1 ) {
                printf( "\n\n\n\n\n\n")
}' wp=$wp tfile=$tmp1                           > $tmp4


# prepare for scp to macOS or Windows, to upload to WP
# IN: new png files
# OUT: remove old png files from web-space, copy over all png files
progressBar
rm -f ./apple.screensaver.movies/*.png
cp -f *.png ./apple.screensaver.movies

# check if we have any changes
# IN: WP video player syntax from file
# OUT: crc, and error if we got any changes
progressBar
md5SumNew=$(
        cat $tmp4                               |
        md5sum                                  |
        cut -d " " -f1
)

#  check if md5 sum changed
ECHOline
if [[ $md5SumNew != $md5Sum ]] ; then

        # console out for cut & copy to WP
        # IN: WP video player syntax from file
        # OUT: WP video player syntax for cut and copy into WP site
        cat $tmp4

        # check if we have any double entries, which would be an error in the code!
        # IN: WP video player syntax from file
        # OUT: duplicates, if any, of either Thumbnail files (*.png) or Videos (*.mov)
        cat $tmp4                               |
        tr -s '[[,;"]]' '\n'                    |
        sort                                    |
        uniq -c                                 |
        awk '{
                if ( $1 != 1 ) {
                        print
                }
        }'

        # count new number of thumbnail files
        # IN: list of local copies of Thumbnail files (*.png)
        # OUT: number of such files
        newNumberOfPNGs=$(
                echo *.png                      |
                wc -l
        )

        (( deltaPNGs = newNumberOfPNGs - numberOfPNGs ))
        if [[ $deltaPNGs -gt 0 ]] ; then
                echo "$name: Warning: $deltaPNGs new movies arrived, update website: $wpHome"
        else
                echo "$name: Info: No new PNGs generated"
        fi

        echo "Update WP video player syntax, see above..."

else
        ECHO "No changes"

fi


#------------------------------------------------
# END
#------------------------------------------------

Kommentare sind geschlossen