Switch to unified view

a/src/radio_scripts/radio-paradise-get-flac.py b/src/radio_scripts/radio-paradise-get-flac.py
1
#!/usr/bin/env python
1
#!/usr/bin/env python3
2
# Checked to run with either Python 2 or 3
2
# Checked to run with either Python 2 or 3
3
#
3
#
4
# Copyright (C) 2017-2018 J.F.Dockes
4
# Copyright (C) 2017-2018 J.F.Dockes
5
#   This program is free software; you can redistribute it and/or modify
5
#   This program is free software; you can redistribute it and/or modify
6
#   it under the terms of the GNU General Public License as published by
6
#   it under the terms of the GNU General Public License as published by
...
...
36
36
37
import requests
37
import requests
38
import json
38
import json
39
import sys
39
import sys
40
import os
40
import os
41
42
PY3 = sys.version > '3'
41
43
42
tmpname = '/tmp/up-rp-pldata.json'
44
tmpname = '/tmp/up-rp-pldata.json'
43
45
44
def debug(x):
46
def debug(x):
45
    print("radio-paradise-get-flac.py: %s" % x, file=sys.stderr)
47
    print("radio-paradise-get-flac.py: %s" % x, file=sys.stderr)
...
...
144
    # Last song: reload a bit earlier so that we can queue the URL
146
    # Last song: reload a bit earlier so that we can queue the URL
145
    if currentk == len(songs) -1 and reload > 3:
147
    if currentk == len(songs) -1 and reload > 3:
146
        reload -= 2
148
        reload -= 2
147
    out['reload'] = reload
149
    out['reload'] = reload
148
150
149
debug("%s" % makebytes(json.dumps(out)))
151
if PY3:
152
    sys.stdout.buffer.write(makebytes(json.dumps(out)))
153
else:
150
print("%s" % makebytes(json.dumps(out)))
154
    print("%s" % makebytes(json.dumps(out)))