
import sys
import subprocess

d_models = """120
140
150
305
315
335
345
375
385
712
713
717
735
745
765
785
862
865""".split()

no_d_models = """
715
725
""".split()


live = True

if __name__ == '__main__':

    version=sys.argv[1].strip()

 
    fn_formatd = 'snomD{}-{}-SIP-r.bin'
    fn_format = 'snom{}-{}-SIP-r.bin'

    urls = (
        [ ('https://downloads.snom.com/fw/{}/bin/' + fn_formatd).format(version, model, version) for model in d_models ]
        +
        [ ('https://downloads.snom.com/fw/{}/bin/' + fn_format).format(version, model, version) for model in no_d_models ]
        )
    

    print(urls)

    if live:
        subprocess.call(['wget', '-nc'] + urls)

    for model in d_models:
        d = fn_formatd.format(model, version)
        no_d = fn_format.format(model, version)
        print(d, no_d)
        if live:
            subprocess.call(['ln', '-s', d, no_d])
