Skip to content

Commit

Permalink
Merge pull request #32 from varlog00/varlogs
Browse files Browse the repository at this point in the history
add tif/tiff support
  • Loading branch information
NautiluX authored Mar 11, 2021
2 parents 09677ff + 9834406 commit 1464c77
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 27 deletions.
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
VERSION ?= 0.0.0
BINARY ?= slide
ARCH ?= noarch

.PHONY: all
all: build

.PHONY: install-deps-deb
install-deps-deb:
apt install qt5-qmake libexif12 qt5-default libexif-dev qt5-image-formats-plugins

check-deps-deb:
dpkg -l | grep qt5-qmake
dpkg -l | grep libexif12
dpkg -l | grep libexif-dev
dpkg -l | grep qt5-default
dpkg -l | grep qt5-image-formats-plugins

.PHONY: clean
clean:
rm -rf build

build:
mkdir -p build
qmake src/slide.pro -o build/Makefile
make -C build

PACKAGE_DIR=build/slide_$(VERSION)

.PHONY: package
package: clean build
mkdir -p $(PACKAGE_DIR)
cp -r "./build/$(BINARY)" $(PACKAGE_DIR)
cp "INSTALL.md" $(PACKAGE_DIR)
cp "LICENSE" $(PACKAGE_DIR)
cd build && tar cfz slide_$(ARCH)_$(VERSION).tar.gz slide_$(VERSION)
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Simple, lightweight slideshow selecting random images from specified directory.
Tested versions:
* Raspberry Pi 3 running Raspbian Stretch.
* Raspberry Pi 3 running Raspbian Buster.
* Raspberry Pi Zero running Raspbian Buster.

Screen background is filled with a scaled version of the image to prevent pure black background.

Expand Down Expand Up @@ -44,26 +45,34 @@ slide [-t rotation_seconds] [-o background_opacity(0..255)] [-b blur_radius] -p

## Dependencies

* libexif
* qt5-qmake
* qt5
* qt5-image-formats-plugins
* libexif

Ubuntu/Raspbian:

```
sudo apt install libexif12 qt5-default
sudo make install-deps-deb
```

## Build

dev libs needed to build slide on from source:
Install dependencies

```
sudo apt install libexif-dev
make install-deps-deb
```

Build project

```
mkdir -p make
cd make
qmake ../src/slide.pro
make
```

Install binaries

```
sudo make install
```

Expand All @@ -74,9 +83,7 @@ Prerequisite: brew
```
brew install qt5
brew install libexif
mkdir -p build
cd build
qmake ../src/slide.pro
brew install libexif
make
```

Expand All @@ -87,7 +94,7 @@ This article has more helpful ways that you could use this repo as a picture fra
https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi
```

## Removing black border
## Removing black border (Raspberry Pi)

```
if you find that you have a black border around your screen you can remove it by disabling overscan. This is done by editing /boot/config.txt and uncommenting disable_overscan=1
Expand Down
17 changes: 7 additions & 10 deletions sbin/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@


DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ARCH=$1
VERSION=$2
export ARCH=$1
export VERSION=$2

set -euo pipefail

Expand All @@ -22,11 +22,8 @@ if [[ "$ARCH" == "osx" ]]; then
fi

cd "$DIR/.."
mkdir -p make/slide_$VERSION
cd make
qmake ../src/slide.pro
make
cp -r "$BINARY" "slide_$VERSION/"
cp "../INSTALL.md" "slide_$VERSION/"
cp "../LICENSE" "slide_$VERSION/"
tar cfz slide_${ARCH}_$VERSION.tar.gz "slide_$VERSION"
if ! make check-deps-deb; then
sudo make install-deps-deb
fi

make package
10 changes: 10 additions & 0 deletions sbin/package_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -euxo pipefail
VERSION=$1
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

make clean
$DIR/package_remote.sh pi picframe pi $VERSION
$DIR/package_remote.sh pi raspberrypi pi-0 $VERSION
$DIR/package.sh amd64 $VERSION
mv build/slide_amd64_$VERSION.tar.gz .
8 changes: 4 additions & 4 deletions sbin/package_remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ VERSION=$4

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

cd $DIR/..
rsync -av --delete $(pwd)/* $USER@$HOSTNAME:/tmp/slide_build
ssh $USER@$HOSTNAME "rm -rf /tmp/slide_build/build;/tmp/slide_build/sbin/package.sh $ARCH $VERSION"
scp $USER@$HOSTNAME:/tmp/slide_build/make/slide_*.tar.gz .
cd "$DIR/.."
rsync -av --delete "$(pwd)"/* "$USER@$HOSTNAME:/tmp/slide_build"
ssh "$USER@$HOSTNAME" "rm -rf /tmp/slide_build/build;/tmp/slide_build/sbin/package.sh $ARCH $VERSION"
scp "$USER@$HOSTNAME:/tmp/slide_build/build/slide_*.tar.gz" .
13 changes: 11 additions & 2 deletions src/pathtraverser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ PathTraverser::PathTraverser(const std::string path):

PathTraverser::~PathTraverser() {}

QStringList PathTraverser::getImageFormats() const {
QStringList imageFormats;
imageFormats << "*.jpg" << "*.JPG" << "*.jpeg" << "*.JPEG";
imageFormats << "*.PNG" << "*.png";
imageFormats << "*.tiff" << "*.TIFF" << "*.tif" << "*.TIF";
return imageFormats;
}

RecursivePathTraverser::RecursivePathTraverser(const std::string path):
PathTraverser(path)
{}
Expand All @@ -22,7 +30,8 @@ RecursivePathTraverser::~RecursivePathTraverser() {}

QStringList RecursivePathTraverser::getImages() const
{
QDirIterator it(QString(path.c_str()), QStringList() << "*.jpg" << "*.JPG" << "*.jpeg" << "*.JPEG" << "*.PNG" << "*.png", QDir::Files, QDirIterator::Subdirectories);
QDirIterator it(QString(path.c_str()), getImageFormats(),
QDir::Files, QDirIterator::Subdirectories);
QStringList files;
while (it.hasNext())
{
Expand All @@ -46,7 +55,7 @@ DefaultPathTraverser::~DefaultPathTraverser() {}

QStringList DefaultPathTraverser::getImages() const
{
return directory.entryList(QStringList() << "*.jpg" << "*.JPG" << "*.jpeg" << "*.JPEG" << "*.PNG" << "*.png", QDir::Files);
return directory.entryList(getImageFormats(), QDir::Files);
}

const std::string DefaultPathTraverser::getImagePath(const std::string image) const
Expand Down
1 change: 1 addition & 0 deletions src/pathtraverser.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class PathTraverser

protected:
const std::string path;
QStringList getImageFormats() const;
};

class RecursivePathTraverser : public PathTraverser
Expand Down

0 comments on commit 1464c77

Please sign in to comment.