tChange 35mm order, remove old snapshot - filmtools - various tools for photographic film development and darkroom printing
 (HTM) git clone git://src.adamsgaard.dk/filmtools
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 114aa08838c019e9c4dacea81acfc3591e78f3d5
 (DIR) parent 3df21184b1937f8571f7c240f739210c749c3f96
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Mon, 20 Apr 2020 11:11:48 +0200
       
       Change 35mm order, remove old snapshot
       
       Diffstat:
         A filmprice                           |     184 +++++++++++++++++++++++++++++++
         D filmprice.sh                        |     184 -------------------------------
         D filmprice_2020-04-18                |      44 -------------------------------
       
       3 files changed, 184 insertions(+), 228 deletions(-)
       ---
 (DIR) diff --git a/filmprice b/filmprice
       t@@ -0,0 +1,184 @@
       +#!/bin/sh
       +# get current film prices from fotoimpex and return price per roll
       +
       +rolls_per_bulk_roll=19
       +
       +die() {
       +        printf 'error: %s' "$1" >&2
       +        exit 1
       +}
       +
       +# 1: product string, 2: format
       +fotoimpex_path() {
       +        case "$2" in
       +                120)
       +                        case "$1" in
       +                                kodak-portra-400|fuji-pro-400-h)
       +                                        printf '%s-120-medium-format-film-single-roll.html' "$1";;
       +                                *)
       +                                        printf '%s-120-medium-format-film.html' "$1";;
       +                        esac;;
       +                135)
       +                        case "$1" in
       +                                ilford-pan-f)
       +                                        printf '%s-13536-50-asa.html' "$1";;
       +                                ilford-fp4)
       +                                        printf '%s-125-asa-13536.html' "$1";;
       +                                ilford-hp5)
       +                                        printf '%s-13536-400-asa.html' "$1";;
       +                                fuji-fujicolor-c200)
       +                                        printf '%s-135-36-single-pack.html' "$1";;
       +                                kodak-t-max-p3200)
       +                                        printf '%s-tmz-35-mm-film.html' "$1";;
       +                                kodak-portra-400|rollei*)
       +                                        printf '%s-135-36.html' "$1";;
       +                                kodak-ektar-100)
       +                                        printf '%s-35mm-film-13536.html' "$1";;
       +                                *)
       +                                        printf '%s-13536.html' "$1";;
       +                        esac;;
       +                30.5m)
       +                        case "$1" in
       +                                ilford-delta-400)
       +                                        printf '%s-kb-305m-bulk-roll.html' "$1";;
       +                                ilford-fp4|ilford-hp5)
       +                                        printf '%s-13536-bulk-roll-305m.html' "$1";;
       +                                kodak*)
       +                                        printf '%s-305m-bulk-film.html' "$1";;
       +                                rollei-rpx-400)
       +                                        printf '%s-35mm-305m-bulk-roll.html' "$1";;
       +                                *)
       +                                        printf '%s-305m-bulk-roll.html' "$1";;
       +                        esac;;
       +                4x5)
       +                        printf '%s-102x127-cm-4x5-inch-25-sheets.html' "$1";;
       +                *)
       +                        die "unknown film format '$2'"
       +        esac
       +}
       +
       +# 1: product string, 2: format
       +fotoimpex_url() {
       +        printf 'https://www.fotoimpex.com/films/%s\n' "$(fotoimpex_path "$1" "$2")"
       +}
       +
       +macodirect_url() {
       +        printf 'https://www.macodirect.de/en/film/%s\n' "$(fotoimpex_path "$1" "$2")"
       +}
       +
       +fotoimpex_extract_price() {
       +        if grep -qE 'From  *10' "$1"; then
       +                if grep -qE 'From  *5' "$1"; then
       +                        n=6
       +                else
       +                        n=4
       +                fi
       +        else
       +                n=2
       +        fi
       +        price="$(grep EUR "$1" | head -$n | tail -1 | \
       +                sed 's,.*<b>,,
       +                     s#,#.#g
       +                         s,&nbsp;, ,g
       +                         s,</b>.*,,
       +                         s, *EUR,,')"
       +        if [ ! -z "$price" ]; then
       +                if [ "$2" = "30.5m" ]; then
       +                        printf '%.2f' \
       +                                "$(echo "${price}"/"${rolls_per_bulk_roll}" | bc -l)"
       +                else
       +                        printf '%s' "$price"
       +                fi
       +        else
       +                printf '--\t--'
       +        fi
       +}
       +
       +get_html() {
       +        if type -v hurl >/dev/null 2>&1; then
       +                hurl "$1" 2>/dev/null
       +        elif type -v curl >/dev/null 2>&1; then
       +                curl -s "$1" 2>/dev/null
       +        else
       +                die 'no suitable html fetcher found'
       +        fi
       +        sleep 1
       +        if [ $? -ne 0 ]; then
       +                return 1
       +        fi
       +}
       +
       +eur_to_dkk() {
       +        printf '%.2f' "$(printf '%s*7.46\n' "$1" | bc -l)"
       +}
       +
       +fotoimpex() {
       +        out="fotoimpex_${1}_${2}.html"
       +        url="$(fotoimpex_url "$1" "$2")"
       +        if [ ! -e "$out" ]; then
       +                if ! get_html "$url" > "$out"; then
       +                        rm -f "$out"
       +                fi
       +        fi
       +        if [ -e "$out" ]; then
       +                price="$(fotoimpex_extract_price "$out" "$2")"
       +                if [ ! "$price" = "--        --" ]; then
       +                        printf '%-24s\t%s\t' "$1" "$2"
       +                        printf '%s\tEUR\t' "$price"
       +                        printf '%s\tDKK\t' "$(eur_to_dkk "$price")"
       +                        printf '%s\n' "$url"
       +                fi
       +        fi
       +}
       +
       +macodirect() {
       +        out="macodirect_${1}_${2}.html"
       +        url="$(macodirect_url "$1" "$2")"
       +        if [ ! -e "$out" ]; then
       +                if ! get_html "$url" > "$out"; then
       +                        rm -f "$out"
       +                fi
       +        fi
       +#        if [ -e "$out" ]; then
       +#                price="$(macodirect_extract_price "$out" "$2")"
       +#                if [ ! "$price" = "--        --" ]; then
       +#                        printf '%-24s\t%s\t' "$1" "$2"
       +#                        printf '%s\tEUR\t' "$price"
       +#                        printf '%s\tDKK\t' "$(eur_to_dkk "$price")"
       +#                        printf '%s\n' "$url"
       +#                fi
       +#        fi
       +}
       +
       +
       +film_products="ilford-delta-100
       +ilford-delta-400
       +ilford-pan-f
       +ilford-fp4
       +ilford-hp5
       +fuji-neopan-acros-ii-neu-100
       +fuji-fujicolor-c200
       +fuji-pro-400-h
       +kodak-t-max-100
       +kodak-t-max-400
       +kodak-t-max-p3200
       +kodak-tri-x-400
       +kodak-ektar-100
       +kodak-portra-160
       +kodak-portra-400
       +kodak-portra-800
       +rollei-rpx-25
       +rollei-rpx-100
       +rollei-rpx-400"
       +
       +film_formats="135
       +30.5m
       +120
       +4x5"
       +
       +for p in $film_products; do
       +        for f in $film_formats; do
       +                fotoimpex "$p" "$f"
       +                macodirect "$p" "$f"
       +        done
       +done
 (DIR) diff --git a/filmprice.sh b/filmprice.sh
       t@@ -1,184 +0,0 @@
       -#!/bin/sh
       -# get current film prices from fotoimpex and return price per roll
       -
       -rolls_per_bulk_roll=19
       -
       -die() {
       -        printf 'error: %s' "$1" >&2
       -        exit 1
       -}
       -
       -# 1: product string, 2: format
       -fotoimpex_path() {
       -        case "$2" in
       -                120)
       -                        case "$1" in
       -                                kodak-portra-400|fuji-pro-400-h)
       -                                        printf '%s-120-medium-format-film-single-roll.html' "$1";;
       -                                *)
       -                                        printf '%s-120-medium-format-film.html' "$1";;
       -                        esac;;
       -                135)
       -                        case "$1" in
       -                                ilford-pan-f)
       -                                        printf '%s-13536-50-asa.html' "$1";;
       -                                ilford-fp4)
       -                                        printf '%s-125-asa-13536.html' "$1";;
       -                                ilford-hp5)
       -                                        printf '%s-13536-400-asa.html' "$1";;
       -                                fuji-fujicolor-c200)
       -                                        printf '%s-135-36-single-pack.html' "$1";;
       -                                kodak-t-max-p3200)
       -                                        printf '%s-tmz-35-mm-film.html' "$1";;
       -                                kodak-portra-400|rollei*)
       -                                        printf '%s-135-36.html' "$1";;
       -                                kodak-ektar-100)
       -                                        printf '%s-35mm-film-13536.html' "$1";;
       -                                *)
       -                                        printf '%s-13536.html' "$1";;
       -                        esac;;
       -                30.5m)
       -                        case "$1" in
       -                                ilford-delta-400)
       -                                        printf '%s-kb-305m-bulk-roll.html' "$1";;
       -                                ilford-fp4|ilford-hp5)
       -                                        printf '%s-13536-bulk-roll-305m.html' "$1";;
       -                                kodak*)
       -                                        printf '%s-305m-bulk-film.html' "$1";;
       -                                rollei-rpx-400)
       -                                        printf '%s-35mm-305m-bulk-roll.html' "$1";;
       -                                *)
       -                                        printf '%s-305m-bulk-roll.html' "$1";;
       -                        esac;;
       -                4x5)
       -                        printf '%s-102x127-cm-4x5-inch-25-sheets.html' "$1";;
       -                *)
       -                        die "unknown film format '$2'"
       -        esac
       -}
       -
       -# 1: product string, 2: format
       -fotoimpex_url() {
       -        printf 'https://www.fotoimpex.com/films/%s\n' "$(fotoimpex_path "$1" "$2")"
       -}
       -
       -macodirect_url() {
       -        printf 'https://www.macodirect.de/en/film/%s\n' "$(fotoimpex_path "$1" "$2")"
       -}
       -
       -fotoimpex_extract_price() {
       -        if grep -qE 'From  *10' "$1"; then
       -                if grep -qE 'From  *5' "$1"; then
       -                        n=6
       -                else
       -                        n=4
       -                fi
       -        else
       -                n=2
       -        fi
       -        price="$(grep EUR "$1" | head -$n | tail -1 | \
       -                sed 's,.*<b>,,
       -                     s#,#.#g
       -                         s,&nbsp;, ,g
       -                         s,</b>.*,,
       -                         s, *EUR,,')"
       -        if [ ! -z "$price" ]; then
       -                if [ "$2" = "30.5m" ]; then
       -                        printf '%.2f' \
       -                                "$(echo "${price}"/"${rolls_per_bulk_roll}" | bc -l)"
       -                else
       -                        printf '%s' "$price"
       -                fi
       -        else
       -                printf '--\t--'
       -        fi
       -}
       -
       -get_html() {
       -        if type -v hurl >/dev/null 2>&1; then
       -                hurl "$1" 2>/dev/null
       -        elif type -v curl >/dev/null 2>&1; then
       -                curl -s "$1" 2>/dev/null
       -        else
       -                die 'no suitable html fetcher found'
       -        fi
       -        sleep 1
       -        if [ $? -ne 0 ]; then
       -                return 1
       -        fi
       -}
       -
       -eur_to_dkk() {
       -        printf '%.2f' "$(printf '%s*7.46\n' "$1" | bc -l)"
       -}
       -
       -fotoimpex() {
       -        out="fotoimpex_${1}_${2}.html"
       -        url="$(fotoimpex_url "$1" "$2")"
       -        if [ ! -e "$out" ]; then
       -                if ! get_html "$url" > "$out"; then
       -                        rm -f "$out"
       -                fi
       -        fi
       -        if [ -e "$out" ]; then
       -                price="$(fotoimpex_extract_price "$out" "$2")"
       -                if [ ! "$price" = "--        --" ]; then
       -                        printf '%-24s\t%s\t' "$1" "$2"
       -                        printf '%s\tEUR\t' "$price"
       -                        printf '%s\tDKK\t' "$(eur_to_dkk "$price")"
       -                        printf '%s\n' "$url"
       -                fi
       -        fi
       -}
       -
       -macodirect() {
       -        out="macodirect_${1}_${2}.html"
       -        url="$(macodirect_url "$1" "$2")"
       -        if [ ! -e "$out" ]; then
       -                if ! get_html "$url" > "$out"; then
       -                        rm -f "$out"
       -                fi
       -        fi
       -#        if [ -e "$out" ]; then
       -#                price="$(macodirect_extract_price "$out" "$2")"
       -#                if [ ! "$price" = "--        --" ]; then
       -#                        printf '%-24s\t%s\t' "$1" "$2"
       -#                        printf '%s\tEUR\t' "$price"
       -#                        printf '%s\tDKK\t' "$(eur_to_dkk "$price")"
       -#                        printf '%s\n' "$url"
       -#                fi
       -#        fi
       -}
       -
       -
       -film_products="ilford-delta-100
       -ilford-delta-400
       -ilford-pan-f
       -ilford-fp4
       -ilford-hp5
       -fuji-neopan-acros-ii-neu-100
       -fuji-fujicolor-c200
       -fuji-pro-400-h
       -kodak-t-max-100
       -kodak-t-max-400
       -kodak-t-max-p3200
       -kodak-tri-x-400
       -kodak-ektar-100
       -kodak-portra-160
       -kodak-portra-400
       -kodak-portra-800
       -rollei-rpx-25
       -rollei-rpx-100
       -rollei-rpx-400"
       -
       -film_formats="135
       -120
       -4x5
       -30.5m"
       -
       -for p in $film_products; do
       -        for f in $film_formats; do
       -                fotoimpex "$p" "$f"
       -                macodirect "$p" "$f"
       -        done
       -done
 (DIR) diff --git a/filmprice_2020-04-18 b/filmprice_2020-04-18
       t@@ -1,44 +0,0 @@
       -ilford-delta-100                135        6.60        EUR        49.24        DKK        https://www.fotoimpex.com/films/ilford-delta-100-13536.html
       -ilford-delta-100                120        5.65        EUR        42.15        DKK        https://www.fotoimpex.com/films/ilford-delta-100-120-medium-format-film.html
       -ilford-delta-100                4x5        58.20        EUR        434.17        DKK        https://www.fotoimpex.com/films/ilford-delta-100-102x127-cm-4x5-inch-25-sheets.html
       -ilford-delta-100                30.5m        4.99        EUR        37.23        DKK        https://www.fotoimpex.com/films/ilford-delta-100-305m-bulk-roll.html
       -ilford-delta-400                135        6.60        EUR        49.24        DKK        https://www.fotoimpex.com/films/ilford-delta-400-13536.html
       -ilford-delta-400                120        5.65        EUR        42.15        DKK        https://www.fotoimpex.com/films/ilford-delta-400-120-medium-format-film.html
       -ilford-delta-400                30.5m        4.99        EUR        37.23        DKK        https://www.fotoimpex.com/films/ilford-delta-400-kb-305m-bulk-roll.html
       -ilford-pan-f                    135        7.10        EUR        52.97        DKK        https://www.fotoimpex.com/films/ilford-pan-f-13536-50-asa.html
       -ilford-pan-f                    120        6.10        EUR        45.51        DKK        https://www.fotoimpex.com/films/ilford-pan-f-120-medium-format-film.html
       -ilford-fp4                      135        5.90        EUR        44.01        DKK        https://www.fotoimpex.com/films/ilford-fp4-125-asa-13536.html
       -ilford-fp4                      120        4.90        EUR        36.55        DKK        https://www.fotoimpex.com/films/ilford-fp4-120-medium-format-film.html
       -ilford-fp4                      4x5        51.20        EUR        381.95        DKK        https://www.fotoimpex.com/films/ilford-fp4-102x127-cm-4x5-inch-25-sheets.html
       -ilford-fp4                      30.5m        4.84        EUR        36.11        DKK        https://www.fotoimpex.com/films/ilford-fp4-13536-bulk-roll-305m.html
       -ilford-hp5                      135        5.60        EUR        41.78        DKK        https://www.fotoimpex.com/films/ilford-hp5-13536-400-asa.html
       -ilford-hp5                      120        4.90        EUR        36.55        DKK        https://www.fotoimpex.com/films/ilford-hp5-120-medium-format-film.html
       -ilford-hp5                      4x5        50.20        EUR        374.49        DKK        https://www.fotoimpex.com/films/ilford-hp5-102x127-cm-4x5-inch-25-sheets.html
       -ilford-hp5                      30.5m        4.42        EUR        32.97        DKK        https://www.fotoimpex.com/films/ilford-hp5-13536-bulk-roll-305m.html
       -fuji-neopan-acros-ii-neu-100        135        12.95        EUR        96.61        DKK        https://www.fotoimpex.com/films/fuji-neopan-acros-ii-neu-100-13536.html
       -fuji-fujicolor-c200             135        2.99        EUR        22.31        DKK        https://www.fotoimpex.com/films/fuji-fujicolor-c200-135-36-single-pack.html
       -fuji-pro-400-h                  135        9.90        EUR        73.85        DKK        https://www.fotoimpex.com/films/fuji-pro-400-h-13536.html
       -fuji-pro-400-h                  120        8.15        EUR        60.80        DKK        https://www.fotoimpex.com/films/fuji-pro-400-h-120-medium-format-film-single-roll.html
       -kodak-t-max-100                 135        7.10        EUR        52.97        DKK        https://www.fotoimpex.com/films/kodak-t-max-100-13536.html
       -kodak-t-max-100                 120        7.10        EUR        52.97        DKK        https://www.fotoimpex.com/films/kodak-t-max-100-120-medium-format-film.html
       -kodak-t-max-400                 135        8.00        EUR        59.68        DKK        https://www.fotoimpex.com/films/kodak-t-max-400-13536.html
       -kodak-t-max-400                 120        7.10        EUR        52.97        DKK        https://www.fotoimpex.com/films/kodak-t-max-400-120-medium-format-film.html
       -kodak-t-max-p3200               135        9.80        EUR        73.11        DKK        https://www.fotoimpex.com/films/kodak-t-max-p3200-tmz-35-mm-film.html
       -kodak-tri-x-400                 135        7.50        EUR        55.95        DKK        https://www.fotoimpex.com/films/kodak-tri-x-400-13536.html
       -kodak-tri-x-400                 120        8.20        EUR        61.17        DKK        https://www.fotoimpex.com/films/kodak-tri-x-400-120-medium-format-film.html
       -kodak-tri-x-400                 30.5m        9.95        EUR        74.23        DKK        https://www.fotoimpex.com/films/kodak-tri-x-400-305m-bulk-film.html
       -kodak-ektar-100                 135        9.00        EUR        67.14        DKK        https://www.fotoimpex.com/films/kodak-ektar-100-35mm-film-13536.html
       -kodak-ektar-100                 120        6.80        EUR        50.73        DKK        https://www.fotoimpex.com/films/kodak-ektar-100-120-medium-format-film.html
       -kodak-portra-160                135        9.10        EUR        67.89        DKK        https://www.fotoimpex.com/films/kodak-portra-160-13536.html
       -kodak-portra-160                120        9.25        EUR        69.00        DKK        https://www.fotoimpex.com/films/kodak-portra-160-120-medium-format-film.html
       -kodak-portra-400                135        9.55        EUR        71.24        DKK        https://www.fotoimpex.com/films/kodak-portra-400-135-36.html
       -kodak-portra-400                120        9.00        EUR        67.14        DKK        https://www.fotoimpex.com/films/kodak-portra-400-120-medium-format-film-single-roll.html
       -kodak-portra-800                135        12.60        EUR        94.00        DKK        https://www.fotoimpex.com/films/kodak-portra-800-13536.html
       -kodak-portra-800                120        11.70        EUR        87.28        DKK        https://www.fotoimpex.com/films/kodak-portra-800-120-medium-format-film.html
       -rollei-rpx-25                   135        5.49        EUR        40.96        DKK        https://www.fotoimpex.com/films/rollei-rpx-25-135-36.html
       -rollei-rpx-25                   120        5.00        EUR        37.30        DKK        https://www.fotoimpex.com/films/rollei-rpx-25-120-medium-format-film.html
       -rollei-rpx-100                  135        4.75        EUR        35.44        DKK        https://www.fotoimpex.com/films/rollei-rpx-100-135-36.html
       -rollei-rpx-100                  120        5.15        EUR        38.42        DKK        https://www.fotoimpex.com/films/rollei-rpx-100-120-medium-format-film.html
       -rollei-rpx-400                  135        4.70        EUR        35.06        DKK        https://www.fotoimpex.com/films/rollei-rpx-400-135-36.html
       -rollei-rpx-400                  120        5.15        EUR        38.42        DKK        https://www.fotoimpex.com/films/rollei-rpx-400-120-medium-format-film.html
       -rollei-rpx-400                  30.5m        3.29        EUR        24.54        DKK        https://www.fotoimpex.com/films/rollei-rpx-400-35mm-305m-bulk-roll.html