Skip to content

Commit

Permalink
Merge pull request #87 from aaronwmorris/dev
Browse files Browse the repository at this point in the history
Integrate suggested changes based on user feedback
  • Loading branch information
aaronwmorris authored Feb 20, 2022
2 parents 6489d82 + 4a5a943 commit 7845f22
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 20 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ git clone https://github.com/aaronwmorris/indi-allsky.git
```
1. Navigate to the indi-allky sub-directory
```
cd indi-allsky.git
cd indi-allsky/
```
1. Run setup.sh to install the relevant software
```
Expand All @@ -76,7 +76,7 @@ systemctl --user start indiserver
systemctl --user start indi-allsky
```
1. Login to the indi-allsky web application
https://raspberrypi/
https://raspberrypi.local/
* Note: The web server is configured with a self-signed certificate.

### Manual operation
Expand Down Expand Up @@ -243,8 +243,8 @@ All configuration is read from /etc/indi-allsky/config.json . You can find conf
| IMAGE_FOLDER | | (string) Base folder to save images |
| IMAGE_DEBAYER | Auto detected | (string) OpenCV debayering algorithm |
| IMAGE_GRAYSCALE | false | Convert image to grayscale |
| IMAGE_FLIP_V | false | (bool) Flip images vertically |
| IMAGE_FLIP_H | false | (bool) Flip images horizontally |
| IMAGE_FLIP_V | true | (bool) Flip images vertically |
| IMAGE_FLIP_H | true | (bool) Flip images horizontally |
| IMAGE_SCALE | 100 | (percent) Image scaling factor |
| IMAGE_CROP_ROI | [] | (array) Region of interest to crop image (x1, y1, x2, y2) |
| IMAGE_SAVE_RAW | false | (bool) Save raw image file |
Expand Down
4 changes: 2 additions & 2 deletions config.json_template
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"comment_IMAGE_DIR" : "local base folder for images, empty for current dir",
"IMAGE_FOLDER" : "/var/www/html/allsky/images",
"IMAGE_CROP_ROI" : [],
"IMAGE_FLIP_V" : false,
"IMAGE_FLIP_H" : false,
"IMAGE_FLIP_V" : true,
"IMAGE_FLIP_H" : true,
"IMAGE_SCALE" : 100,
"IMAGE_SAVE_RAW" : false,
"IMAGE_GRAYSCALE" : false,
Expand Down
6 changes: 5 additions & 1 deletion indi_allsky/flask/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ def FFMPEG_BITRATE_validator(form, field):


def TEXT_PROPERTIES__FONT_FACE_validator(form, field):
if not field.data:
return

fonts = (
'FONT_HERSHEY_SIMPLEX',
'FONT_HERSHEY_PLAIN',
Expand Down Expand Up @@ -508,6 +511,7 @@ class IndiAllskyConfigForm(FlaskForm):
('FONT_HERSHEY_COMPLEX_SMALL', 'Serif (small)'),
('FONT_HERSHEY_SCRIPT_SIMPLEX', 'Script'),
('FONT_HERSHEY_SCRIPT_COMPLEX', 'Script (complex)'),
('', 'Disabled'),
)

FILETRANSFER__CLASSNAME_choices = (
Expand Down Expand Up @@ -577,7 +581,7 @@ class IndiAllskyConfigForm(FlaskForm):
IMAGE_EXPIRE_DAYS = IntegerField('Image expiration (days)', validators=[DataRequired(), IMAGE_EXPIRE_DAYS_validator])
FFMPEG_FRAMERATE = IntegerField('FFMPEG Framerate', validators=[DataRequired(), FFMPEG_FRAMERATE_validator])
FFMPEG_BITRATE = StringField('FFMPEG Bitrate', validators=[DataRequired(), FFMPEG_BITRATE_validator])
TEXT_PROPERTIES__FONT_FACE = SelectField('Font', choices=TEXT_PROPERTIES__FONT_FACE_choices, validators=[DataRequired(), TEXT_PROPERTIES__FONT_FACE_validator])
TEXT_PROPERTIES__FONT_FACE = SelectField('Font', choices=TEXT_PROPERTIES__FONT_FACE_choices, validators=[TEXT_PROPERTIES__FONT_FACE_validator])
TEXT_PROPERTIES__FONT_HEIGHT = IntegerField('Font Height Offset', validators=[DataRequired(), TEXT_PROPERTIES__FONT_HEIGHT_validator])
TEXT_PROPERTIES__FONT_X = IntegerField('Font X Offset', validators=[DataRequired(), TEXT_PROPERTIES__FONT_X_validator])
TEXT_PROPERTIES__FONT_Y = IntegerField('Font Y Offset', validators=[DataRequired(), TEXT_PROPERTIES__FONT_Y_validator])
Expand Down
6 changes: 3 additions & 3 deletions indi_allsky/flask/templates/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
{{ form_config.IMAGE_FILE_COMPRESSION__JPG(class='form-control bg-secondary') }}
<div id="IMAGE_FILE_COMPRESSION__JPG-error" class="invalid-feedback text-danger" style="display: none;"></div>
</div>
<div class="col-sm-8">Compression factor for JPEG images</div>
<div class="col-sm-8">[1-100] Compression factor for JPEG images. Higher numbers increase quality and file sizes. Default: 90</div>
</div>

<div class="form-group row">
Expand All @@ -486,14 +486,14 @@
{{ form_config.IMAGE_FILE_COMPRESSION__PNG(class='form-control bg-secondary') }}
<div id="IMAGE_FILE_COMPRESSION__PNG-error" class="invalid-feedback text-danger" style="display: none;"></div>
</div>
<div class="col-sm-8">Compression factor for PNG images</div>
<div class="col-sm-8">[1-9] Compression factor for PNG images. Higher numbers increase quality and file sizes. Default: 9</div>
</div>

<div class="form-group row">
<div class="col-sm-2">
{{ form_config.IMAGE_FOLDER.label(class='col-form-label') }}
</div>
<div class="col-sm-4">
<div class="col-sm-6">
{{ form_config.IMAGE_FOLDER(class='form-control bg-secondary') }}
<div id="IMAGE_FOLDER-error" class="invalid-feedback text-danger" style="display: none;"></div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions indi_allsky/flask/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,8 @@ def get_context(self):
'IMAGE_FILE_COMPRESSION__JPG' : indi_allsky_config.get('IMAGE_FILE_COMPRESSION', {}).get('jpg', 90),
'IMAGE_FILE_COMPRESSION__PNG' : indi_allsky_config.get('IMAGE_FILE_COMPRESSION', {}).get('png', 9),
'IMAGE_FOLDER' : indi_allsky_config.get('IMAGE_FOLDER', '/var/www/html/allsky/images'),
'IMAGE_FLIP_V' : indi_allsky_config.get('IMAGE_FLIP_V', False),
'IMAGE_FLIP_H' : indi_allsky_config.get('IMAGE_FLIP_H', False),
'IMAGE_FLIP_V' : indi_allsky_config.get('IMAGE_FLIP_V', True),
'IMAGE_FLIP_H' : indi_allsky_config.get('IMAGE_FLIP_H', True),
'IMAGE_SCALE' : indi_allsky_config.get('IMAGE_SCALE', 100),
'IMAGE_SAVE_RAW' : indi_allsky_config.get('IMAGE_SAVE_RAW', False),
'IMAGE_GRAYSCALE' : indi_allsky_config.get('IMAGE_GRAYSCALE', False),
Expand Down
4 changes: 4 additions & 0 deletions indi_allsky/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,10 @@ def debayer(self, scidata):


def image_text(self, data_bytes, exposure, exp_date, exp_elapsed):
if not self.config['TEXT_PROPERTIES'].get('FONT_FACE'):
logger.warning('Image labels disabled')
return

image_height, image_width = data_bytes.shape[:2]

utcnow = datetime.utcnow() # ephem expects UTC dates
Expand Down
11 changes: 9 additions & 2 deletions indi_allsky/keogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ def finalize(self, outfile):
keogram_resized = cv2.resize(keogram_trimmed, (new_width, new_height), interpolation=cv2.INTER_AREA)

# apply time labels
if self.config.get('KEOGRAM_LABEL'):
self.applyLabels(keogram_resized)
self.applyLabels(keogram_resized)

logger.warning('Creating keogram: %s', outfile)
cv2.imwrite(str(outfile), keogram_resized, [cv2.IMWRITE_JPEG_QUALITY, self.config['IMAGE_FILE_COMPRESSION'][self.config['IMAGE_FILE_TYPE']]])
Expand Down Expand Up @@ -223,6 +222,14 @@ def trimEdges(self, image):


def applyLabels(self, keogram):
if not self.config.get('KEOGRAM_LABEL'):
logger.warning('Keogram labels disabled')
return

if not self.config['TEXT_PROPERTIES'].get('FONT_FACE'):
logger.warning('Image labels disabled')
return

height, width = keogram.shape[:2]

# starting point
Expand Down
2 changes: 1 addition & 1 deletion indi_allsky/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This file is monitored for changes via inotify
# Updates should restart gunicorn automatically
#
# Version 00003
# Version 00004
#
import logging

Expand Down
3 changes: 2 additions & 1 deletion requirements_alpha.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is targeted to Raspbian/Debian 10 and Python 3.7
pyindi-client
#pyindi-client
git+https://github.com/indilib/pyindi-client.git@d5dbe80#egg=pyindi-client
astropy
#https://www.piwheels.org/project/numpy/
numpy==1.21.4
Expand Down
3 changes: 1 addition & 2 deletions requirements_bravo.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This file is targeted to Raspbian/Debian 11 and Python 3.9
#pyindi-client
# temporarily use my fork for Raspbian 11
git+https://github.com/aaronwmorris/pyindi-client.git#egg=pyindi-client
git+https://github.com/indilib/pyindi-client.git@d5dbe80#egg=pyindi-client
astropy
#https://www.piwheels.org/project/numpy/
numpy==1.22.2
Expand Down
10 changes: 8 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ if [[ "$DISTRO_NAME" == "Raspbian" && "$DISTRO_RELEASE" == "11" ]]; then
python3-pip \
virtualenv \
git \
avahi-daemon \
apache2 \
libapache2-mod-php \
php-sqlite3 \
Expand Down Expand Up @@ -228,6 +229,7 @@ elif [[ "$DISTRO_NAME" == "Raspbian" && "$DISTRO_RELEASE" == "10" ]]; then
python3-pip \
virtualenv \
git \
avahi-daemon \
apache2 \
libapache2-mod-php \
php-sqlite3 \
Expand Down Expand Up @@ -299,6 +301,7 @@ elif [[ "$DISTRO_NAME" == "Debian" && "$DISTRO_RELEASE" == "11" ]]; then
python3-pip \
virtualenv \
git \
avahi-daemon \
apache2 \
libapache2-mod-php \
php-sqlite3 \
Expand Down Expand Up @@ -352,6 +355,7 @@ elif [[ "$DISTRO_NAME" == "Debian" && "$DISTRO_RELEASE" == "10" ]]; then
python3-pip \
virtualenv \
git \
avahi-daemon \
apache2 \
libapache2-mod-php \
php-sqlite3 \
Expand Down Expand Up @@ -407,6 +411,7 @@ elif [[ "$DISTRO_NAME" == "Ubuntu" && "$DISTRO_RELEASE" == "20.04" ]]; then
python3-pip \
virtualenv \
git \
avahi-daemon \
apache2 \
libapache2-mod-php \
php-sqlite3 \
Expand Down Expand Up @@ -463,6 +468,7 @@ elif [[ "$DISTRO_NAME" == "Ubuntu" && "$DISTRO_RELEASE" == "18.04" ]]; then
python3-pip \
virtualenv \
git \
avahi-daemon \
apache2 \
libapache2-mod-php \
php-sqlite3 \
Expand Down Expand Up @@ -902,9 +908,9 @@ echo " (You may have to manually access by IP)"
echo

if [[ "$ASTROBERRY" == "true" ]]; then
echo " https://$(hostname -s):444/"
echo " https://$(hostname -s).local:444/"
else
echo " https://$(hostname -s)/"
echo " https://$(hostname -s).local/"
fi

echo
Expand Down

0 comments on commit 7845f22

Please sign in to comment.