Skip to content

Commit

Permalink
add ncp-previews
Browse files Browse the repository at this point in the history
Signed-off-by: nachoparker <nacho@ownyourbits.com>

add ncp-previews

Signed-off-by: nachoparker <nacho@ownyourbits.com>
  • Loading branch information
nachoparker committed Oct 28, 2019
1 parent f23d6c6 commit 0fc2390
Show file tree
Hide file tree
Showing 36 changed files with 2,848 additions and 12 deletions.
4 changes: 3 additions & 1 deletion bin/ncp/CONFIG/nc-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ EOF
ncc app:install notes
ncc app:install tasks
ncc app:install news
ncc app:install previewgenerator

ncc app:enable calendar
ncc app:enable contacts
ncc app:enable notes
ncc app:enable tasks
ncc app:enable news

# ncp-previewgenerator
cp -r /var/www/ncp-previewgenerator /var/www/nextcloud/apps/previewgenerator
ncc app:enable previewgenerator

# previews
Expand Down
8 changes: 7 additions & 1 deletion bin/ncp/CONFIG/nc-previews-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ configure()
cat > /usr/local/bin/nc-previews <<EOF
#!/bin/bash
echo -e "\n[ nc-previews-auto ]" >> /var/log/ncp.log
ionice -c3 nice -n20 /usr/local/bin/ncc preview:pre-generate -n -vvv 2>&1 >>/var/log/ncp.log &
(
for i in \$(seq 1 \$(nproc)); do
ionice -c3 nice -n20 /usr/local/bin/ncc preview:pre-generate -n -vvv &
done
wait
) 2>&1 >>/var/log/ncp.log &
PID=\$!
[[ "$RUNTIME" != 0 ]] && {
for i in \$(seq 1 1 $RUNTIME); do
Expand Down
19 changes: 17 additions & 2 deletions bin/ncp/TOOLS/nc-previews.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

configure()
{
pgrep -af preview:pre-generate &>/dev/null || pgrep -af preview:generate-all &>/dev/null && {
echo "nc-previews is already running"
return 1
}

[[ "$CLEAN" == "yes" ]] && {
local datadir
datadir=$( ncc config:system:get datadirectory ) || {
Expand All @@ -23,9 +28,19 @@ configure()
ncc files:scan-app-data -n
}
[[ "$INCREMENTAL" == "yes" ]] && { ncc preview:pre-generate -n -vvv; return $?; }
[[ "$INCREMENTAL" == "yes" ]] && {
for i in $(seq 1 $(nproc)); do
ncc preview:pre-generate -n -vvv &
done
wait
return
}
ncc preview:generate-all -n -v -p "$PATH1"
for i in $(seq 1 $(nproc)); do
[[ "$PATH1" != "" ]] && PATH_ARG=(-p "$PATH1")
ncc preview:generate-all -n -v ${PATH_ARG[@]} &
done
wait
}
install() { :; }
Expand Down
6 changes: 4 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

[v1.17.1](https://github.com/nextcloud/nextcloudpi/commit/b50801a) (2019-09-29) nc-backup: exclude group folders in dataless backup
[v1.18.0](https://github.com/nextcloud/nextcloudpi/commit/c140109) (2019-10-27) add ncp-previews

[v1.17.0](https://github.com/nextcloud/nextcloudpi/commit/05e78cc) (2019-09-28) upgrade to NC16.0.5
[v1.17.1 ](https://github.com/nextcloud/nextcloudpi/commit/c63cb27) (2019-09-29) nc-backup: exclude group folders in dataless backup

[v1.17.0 ](https://github.com/nextcloud/nextcloudpi/commit/05e78cc) (2019-09-28) upgrade to NC16.0.5

[v1.16.9 ](https://github.com/nextcloud/nextcloudpi/commit/46b2187) (2019-09-28) fix apt stuck in interactive conf file dialog

Expand Down
13 changes: 7 additions & 6 deletions docker/nextcloudpi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ SHELL ["/bin/bash", "-c"]
ENV DOCKERBUILD 1

RUN mkdir -p /tmp/ncp-build
COPY bin/ /tmp/ncp-build/bin/
COPY etc /tmp/ncp-build/etc/
COPY ncp.sh update.sh /tmp/ncp-build/
COPY ncp-web /tmp/ncp-build/ncp-web/
COPY ncp-app /tmp/ncp-build/ncp-app/
COPY docker /tmp/ncp-build/docker/
COPY bin/ /tmp/ncp-build/bin/
COPY etc /tmp/ncp-build/etc/
COPY ncp.sh update.sh /tmp/ncp-build/
COPY ncp-web /tmp/ncp-build/ncp-web/
COPY ncp-app /tmp/ncp-build/ncp-app/
COPY ncp-previewgenerator /tmp/ncp-build/ncp-previewgenerator/
COPY docker /tmp/ncp-build/docker/

RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \

Expand Down
45 changes: 45 additions & 0 deletions ncp-previewgenerator/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
language: php
php:
- 7
- 7.1
- 7.2

env:
global:
- CORE_BRANCH=master
- APP_NAME=previewgenerator
matrix:
- DB=sqlite

branches:
only:
- master
- /^stable\d+(\.\d+)?$/

before_install:
- wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
- . ./before_install.sh $APP_NAME $CORE_BRANCH $DB

# Add some output debugging information
- cd ../server
- ./occ check
- ./occ status
- ./occ app:list
- ./occ app:enable $APP_NAME

script:
- cd apps/$APP_NAME/

# Test the app
- sh -c "find . -name \*.php -exec php -l \"{}\" \;;"
- cd ../../
#- sh -c "./occ app:check-code $APP_NAME -c private -c strong-comparison;"
#- sh -c "./occ app:check-code $APP_NAME -c deprecation;"
- cd apps/$APP_NAME/

# Run phpunit tests
- cd tests/
- sh -c "phpunit --configuration phpunit.xml"

after_success:
- bash <(curl -s https://codecov.io/bash)
82 changes: 82 additions & 0 deletions ncp-previewgenerator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
## 2.1.0 - 2019-03-05
### Added
- Nextcloud 16 support

## 2.0.0 - 2018-11-08

- PHP 7.x required
- Nextcloud 14 only
- Moved to migrations for DB handling
- Added path option to generate command (thanks to @adduxa)
- Nextcloud 15 compatible

## 1.0.9 - 2017-12-29

### Fixes

### Added
- Show timestamp in occ commands [#88](https://github.com/rullzer/previewgenerator/pull/88)
- Add Composer Classmap for file (NC13) [#90](https://github.com/rullzer/previewgenerator/pull/90)
- Respect .nomedia [#92](https://github.com/rullzer/previewgenerator/pull/92)
- Use PID to check for already running process [#93](https://github.com/rullzer/previewgenerator/pull/93)

## 1.0.8 - 2017-12-21

### Fixes
- Do not add file if it already is in the table [#86](https://github.com/rullzer/previewgenerator/pull/86)

### Added
- Allow to specify sizes to be generated [#87](https://github.com/rullzer/previewgenerator/pull/86)

## 1.0.7 - 2017-09-26

### Fixes
- Updated/Fixed README
- [#55](https://github.com/rullzer/previewgenerator/pull/55) @Eeems
- [#58](https://github.com/rullzer/previewgenerator/pull/58) @MichaIng
- [#67](https://github.com/rullzer/previewgenerator/pull/67) @sndrr
- Avoid folder processing on pre-generate [#73](https://github.com/rullzer/previewgenerator/pull/73) @Seik

### Added
- Make NC13 Compatible [#63](https://github.com/rullzer/previewgenerator/pull/63)

## 1.0.6 - 2017-05-05

### Fixed
- Better preview error handling [#51](https://github.com/rullzer/previewgenerator/pull/51) @icewind1991
- Travis test runs [#53](https://github.com/rullzer/previewgenerator/pull/53)

### Added
- README.md [#52](https://github.com/rullzer/previewgenerator/pull/52)
- CHANGELOG.md [#52](https://github.com/rullzer/previewgenerator/pull/52)

## 1.0.5 - 2017-03-17

### Added
- Generate more preview sizes
- Add --force command to break lock

## 1.0.4 - 2017-03-14

### Fixed
- Lock timeout was 30 hours instead of minutes

## 1.0.3 - 2017-03-14

### Added
- Do not use app with encryption
- Check for already running command

## 1.0.2 - 2017-03-08

### Added
- More verbose output of commands
- Hack around preview generation errors by not trying the file again in the next run

## 1.0.1 - 2016-12-08

### Fixed
- Pimp info.xml

## 1.0.0 – 2016-12-07
Initial release
Loading

0 comments on commit 0fc2390

Please sign in to comment.