polish/napi: Add new port

"napi.sh" is a napiprojekt.pl client written in Bash. The purpose of
the project was to create simple tool for systems with very limited
resources (NAS QNAP drives, Synology, OpenWRT routers, Popcorn
streamers, etc). It was inspired by "pynapi.py" script.

"napi.sh" is distributed together with automatic subtitle format
converter "subotage.sh" created specially for "napi.sh". "subotage.sh"
is written in Bash and uses awk for text processing.

PR:		245996
This commit is contained in:
Dominik Lisiak 2021-11-01 00:44:19 +09:00 committed by Yasuhiro Kimura
parent 2d15853d06
commit 670f711350
8 changed files with 162 additions and 0 deletions

View File

@ -10,6 +10,7 @@
SUBDIR += libreoffice
SUBDIR += libtlen
SUBDIR += mythes
SUBDIR += napi
SUBDIR += qnapi
SUBDIR += tleenx2
SUBDIR += trf

56
polish/napi/Makefile Normal file
View File

@ -0,0 +1,56 @@
PORTNAME= napi
PORTVERSION= 2.0.1
CATEGORIES= polish multimedia
MAINTAINER= dominik.lisiak@bemsoft.pl
COMMENT= Command line subtitles downloader for napiprojekt.pl
LICENSE= GPLv3
RUN_DEPENDS= 7z:archivers/p7zip \
base64:converters/base64 \
bash:shells/bash \
mediainfo:multimedia/mediainfo \
wget:ftp/wget
USES= cmake shebangfix
USE_GITLAB= yes
GL_ACCOUNT= hesperos
GL_PROJECT= ${PORTNAME}
GL_COMMIT= ac404649571e470bf9494f788bd8a74843956851
SHEBANG_GLOB= *.sh *.sh.in
STRIP=
NO_ARCH= yes
OPTIONS_DEFINE= COVER NFO RMORIG SUBRIP UTF8
COVER_DESC= Always try to download cover (-c)
NFO_DESC= Always try to download .nfo file (-n)
RMORIG_DESC= Always remove intermediate files (-d)
SUBRIP_DESC= Convert subtitles to SubRip (.srt) by default (-f subrip)
UTF8_DESC= Convert subtitles to UTF-8 by default (-C UTF-8)
NAPI_CONF= libs/libnapi_sysconf.sh
post-patch-COVER-on:
@${REINPLACE_CMD} -e 's|\(napiprojekt\.cover\.download\)=0|\1=1|' ${WRKSRC}/${NAPI_CONF}
post-patch-NFO-on:
@${REINPLACE_CMD} -e 's|\(napiprojekt\.nfo\.download\)=0|\1=1|' ${WRKSRC}/${NAPI_CONF}
post-patch-RMORIG-on:
@${REINPLACE_CMD} -e 's|\(napiprojekt\.subtitles\.orig\.delete\)=0|\1=1|' ${WRKSRC}/${NAPI_CONF}
post-patch-SUBRIP-on:
@${REINPLACE_CMD} -e 's|\(napiprojekt\.subtitles\.format\)=default|\1=subrip|' ${WRKSRC}/${NAPI_CONF}
post-patch-UTF8-on:
@${REINPLACE_CMD} -e 's|\(napiprojekt\.subtitles\.encoding\)=default|\1=UTF-8|' ${WRKSRC}/${NAPI_CONF}
post-install:
@${RM} -r ${STAGEDIR}${LOCALBASE}/lib/napi/*.in
.include <bsd.port.mk>

3
polish/napi/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1624840400
SHA256 (hesperos-napi-ac404649571e470bf9494f788bd8a74843956851_GL0.tar.gz) = 41919054d04b93f90d5a4a13f2964322111194afe60212bb434f105f6c7675e0
SIZE (hesperos-napi-ac404649571e470bf9494f788bd8a74843956851_GL0.tar.gz) = 106739

View File

@ -0,0 +1,29 @@
--- libs/libnapi_fs.sh.orig 2020-04-24 07:22:41 UTC
+++ libs/libnapi_fs.sh
@@ -54,7 +54,7 @@ _fs_configureStat_GV() {
# verify stat tool
___g_fsWrappers[$___g_fsStat]="stat -c%s "
- if wrappers_isSystemDarwin; then
+ if wrappers_isSystemDarwin || wrappers_isSystemFreeBSD; then
# stat may be installed through macports, check if
# there's a need to reconfigure it to BSD flavour
${___g_fsWrappers[$___g_fsStat]} "$0" >/dev/null 2>&1 ||
@@ -72,6 +72,8 @@ _fs_configureBase64_GV() {
# verify base64
wrappers_isSystemDarwin &&
___g_fsWrappers[$___g_fsBase64]="base64 -D"
+ wrappers_isSystemFreeBSD &&
+ ___g_fsWrappers[$___g_fsBase64]="base64 -d"
}
#
@@ -83,6 +85,8 @@ _fs_configureMd5_GV() {
# verify md5 tool
___g_fsWrappers[$___g_fsMd5]="md5sum"
wrappers_isSystemDarwin &&
+ ___g_fsWrappers[$___g_fsMd5]="md5"
+ wrappers_isSystemFreeBSD &&
___g_fsWrappers[$___g_fsMd5]="md5"
}

View File

@ -0,0 +1,16 @@
--- libs/libnapi_subs.sh.orig 2020-04-26 01:52:36 UTC
+++ libs/libnapi_subs.sh
@@ -189,11 +189,11 @@ subs_convertFormat() {
subotage_processFile \
"${videoFileDir}/${sourceSubsFileName}" \
"none" \
- "0" \
+ "${fps}" \
"" \
"${videoFileDir}/${destSubsFileName}" \
"${format}" \
- "${fps}" \
+ "0" \
""
convStatus=$?

View File

@ -0,0 +1,24 @@
--- libs/libnapi_wrappers.sh.orig 2020-04-24 07:38:48 UTC
+++ libs/libnapi_wrappers.sh
@@ -129,13 +129,20 @@ wrappers_isSystemDarwin() {
}
#
+# @brief returns true if system is FreeBSD
+#
+wrappers_isSystemFreeBSD() {
+ [ "$(wrappers_getSystem_SO)" = "freebsd" ]
+}
+
+#
# @brief determines number of available cpu's in the system
#
# @param system type (linux|darwin)
#
wrappers_getCores_SO() {
local os="${1:-linux}"
- if wrappers_isSystemDarwin; then
+ if wrappers_isSystemDarwin || wrappers_isSystemFreeBSD; then
sysctl hw.ncpu | cut -d ' ' -f 2
else
grep -i processor /proc/cpuinfo | wc -l

10
polish/napi/pkg-descr Normal file
View File

@ -0,0 +1,10 @@
"napi.sh" is a napiprojekt.pl client written in Bash. The purpose of the project
was to create simple tool for systems with very limited resources (NAS QNAP
drives, Synology, OpenWRT routers, Popcorn streamers, etc). It was inspired by
"pynapi.py" script.
"napi.sh" is distributed together with automatic subtitle format converter
"subotage.sh" created specially for "napi.sh". "subotage.sh" is written in Bash
and uses awk for text processing.
WWW: https://gitlab.com/hesperos/napi

23
polish/napi/pkg-plist Normal file
View File

@ -0,0 +1,23 @@
bin/napi.sh
bin/subotage.sh
lib/napi/actions/libnapi_download.sh
lib/napi/actions/libnapi_scan.sh
lib/napi/actions/libnapi_search.sh
lib/napi/actions/libnapi_subtitles.sh
lib/napi/libnapi_argv.sh
lib/napi/libnapi_assoc.sh
lib/napi/libnapi_constants.sh
lib/napi/libnapi_fs.sh
lib/napi/libnapi_hooks.sh
lib/napi/libnapi_http.sh
lib/napi/libnapi_language.sh
lib/napi/libnapi_logging.sh
lib/napi/libnapi_napiprojekt.sh
lib/napi/libnapi_retvals.sh
lib/napi/libnapi_subotage.sh
lib/napi/libnapi_subs.sh
lib/napi/libnapi_sysconf.sh
lib/napi/libnapi_tools.sh
lib/napi/libnapi_version.sh
lib/napi/libnapi_wrappers.sh
lib/napi/libnapi_xml.sh