napi

授权协议 GPL-3.0 License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 花阳秋
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

This project has been permanently moved to gitlab. It will no longer be maintained here. Please, refer to gitlab repository for updates and new releases.

Bashnapi - napiprojekt.pl client

This script is a NapiProjekt client written in bash. Itautomatically downloads subtitles from napiprojekt.pl database basing on thevideo file.

This script works on Linux & OS X systems. It has very limited requirements andis mostly depending on bash (it is proven to run from bash 2.04 - which makesit ideal for embedded devices) and coreutils (which should be available on mostmodern systems, no Perl or Python is required).

Installation

Bashnapi uses cmake to build itself and install.Typical install procedure is very simple:

$ cd bashnapi
$ mkdir build && cd build
$ cmake ..
$ make && make install

Installation on embedded devices

In case you want to install bashnapi on a host which doesn't haveCMake, the procedure is very similar. Just install to a localdirectory and deploy that to your device. Below is an example:

$ cd bashnapi
$ mkdir build
$ cmake -DCMAKE_INSTALL_PREFIX=napi_install -DNAPI_INSTALL_PREFIX=/opt/napi ..
$ make && make install

bashnapi is now installed in the napi_install directory on your localmachine. Just deploy that to your device (with scp, ftp, or whatever youprefer) and add the path to a directory under /opt/napi/bin to yourPATH. The variables:

- `CMAKE_INSTALL_PREFIX` - defines the directory on the host to which napi
will be installed

- `NAPI_INSTALL_PREFIX` - defines the directory on the target to which napi
should be deployed

You can use any directory names, napi_install and /opt/napi have been pickedarbitrarily without any strict reason.

Dockerized application

napi.sh is available as well as a Dockerized application. In order to use itwith docker, just build the container image:

$ docker build -t napi .

Once it's built it can be used through docker:

$ docker run -v /media:/mnt -it napi scan /mnt

The above command maps the directory /media to a directory /mnt in thecontainer and invokes napi.sh scan action in container's /mnt.

Actions

Script functionality has been divided into actions. Each action implements aspecific request type. Available actions:

  • scan - scan a directory (or a single file) and download subtitles for allfound video files,
  • download - download subtitles using a "dc link"
  • search - search for a movie
  • subtitles - list subtitles for given movie

Each action has its own command set and its own help system as well so,

 $ napi.sh scan --help

... and

$ napi.sh download --help

... will produce different output. Try out help for different actions to learnabout how to use them and what do they do. Generic options, shared by allactions are listed in the global help:

$ napi.sh --help

Below are some usage examples

scan action

This action is the equivalent of napi 1.X versions behaviour. It goes eitherthrough given directories or media files and, creates a media file list andtries to download subtitles for all found media files.

Examples:

  • Download subtitles for video_file.avi:

    $ napi.sh scan video_file.avi

  • Iterate through all elements in current directory and try to downloadsubtitles for them. If directory contains subdirectories - than the script willalso iterate through all the files in subdirectories:

    $ napi.sh scan *

  • Try to find and download subtitles for all files in movie_dir/ directory:

    $ napi.sh scan movie_dir/

  • This will recursively search for video file in directories like:

    $ napi.sh scan dir1/ dir2/ dir3/ dir_other/

  • It has file size limitation too ! Download subtitles for all supported videofiles which are bigger than 100 MB:

    $ napi.sh scan -b 100 *

  • Not to mention that it integrates a separate subtitles converter writtencompletely in bash & awk. To download subtitles for all supported videofiles and convert them to subrip format on the fly, just use the -f option:

    $ napi.sh -f subrip *

download action (experimental)

This action can be used to download a selected subtitles from napiprojekt.plusing the subtitles id, which can be obtained from napiprojekt.pl site.

  • Download subtitles having its hash/id:

    $ napi.sh download napiprojekt:06aec10a749a68403613b2af8b2c4db8

search action (experimental)

This action can be used to search for a given movie in napiprojekt.pl database.

  • Search for movie "terminator":

    $ napi.sh search -k movie terminator$ napi.sh search "the big bang theory"

subtitles action (experimental)

This action can be used to list all the available subtitles for a given movietitle. It accepts the url to the movie page, typical work flow is as follows:

$ napi.sh search -k movie "lord of the rings"
...
00:0003 - Wyszukuje tytul: [hobbit]
29516 | Hobbit: Niezwykła podróż | http://napiprojekt.pl/napisy-29516-Hobbit-Niezwykła-podróż-(2012)
37789 | Hobbit: Pustkowie Smauga | http://napiprojekt.pl/napisy-37789-Hobbit-Pustkowie-Smauga-(2013)
44148 | Hobbit: Bitwa Pięciu Armii | http://napiprojekt.pl/napisy-44148-Hobbit-Bitwa-Pięciu-Armii-(2014)
162 | Hobbit | http://napiprojekt.pl/napisy-162-Hobbit-(1977)
$ napi.sh subtitles "http://napiprojekt.pl/napisy-29516-Hobbit-Niezwykła-podróż-(2012)"
...
00:0003 - Przetwarzam:  [http://napiprojekt.pl/napisy-29516-Hobbit-Niezwykła-podróż-(2012)]
Rozmiar:       2491657374 bajtow | fps: 29.534 | napiprojekt:f2bed6d99e5ecc9d7b2b3cb7c51c273e
Rozmiar:       1608081408 bajtow | fps: 29.534 | napiprojekt:1e81de9b83485336d2821d8dcfefb8bd
Rozmiar:       1742344634 bajtow | fps: 29.534 | napiprojekt:51f8741fc142f3ed80313544c728d9d4
Rozmiar:       1442403786 bajtow | fps: 29.534 | napiprojekt:ee4096dce1902ea5f985dc929c9a8479
Rozmiar:        782801208 bajtow | fps: 29.535 | napiprojekt:7fd27d9777eea21f7a2b92c10919c43c
...

The last call has returned a set of napiprojekt subtitles identifiers which canbe directly used to get subtitles:

$ napi.sh download napiprojekt:1e81de9b83485336d2821d8dcfefb8bd

You can specify more than one hash/id at once as well:

$ napi.sh download napiprojekt:51f8741fc142f3ed80313544c728d9d4 napiprojekt:ee4096dce1902ea5f985dc929c9a8479

subotage.sh

subotage.sh is a simple subtitles format converter bundled with napi.sh

Currently supported formats:

  • mpl2
  • tmplayer (most of the versions)
  • subrip
  • subviewer
  • microdvd

Usage

The properly convert from/to microdvd format (or any other format based onframes) a valid information about input/output file frame rate isneeded! The default value (if not specified in the command line) is 23.98 fpsfor input/output.

Examples:

  • Convert from microdvd 23.98 fps to subrip. Subrip is default output format soit doesn't have to be specified. The input frame rate is also equal to thedefault one, so no addition specification in the command line has been made.

    $ subotage.sh -i input_file.txt -o output_file.srt

  • Convert from microdvd 25 fps to subviewer:

    $ subotage.sh -i input_file.txt -fi 25 -of subviewer -o output_file.sub

  • Convert from subrip to mpl2

    $ subotage.sh -i input_file.srt -of mpl2 -o output_file.fab

  • Convert from microdvd 25 fps to microdvd 29.98 fps:

    $ subotage.sh -i input_file.txt -fi 25 -fo 29.98 -of microdvd -o output_file.txt

Colaboration

bashnapi is an open project. Feel free to send patches and pull requests.Check the COLABORATION for more details.

  • NAPI简介 NAPI是什么 NAPI提供了一套C/C++接口,用于js和C/C++之间的转换调用,起到承上启下的作用。 NAPI官网链接 NAPI官网提供了详细的接口说明以及使用方法,链接如下, http://nodejs.cn/api/n-api.html(中文) https://nodejs.org/api/n-api.html (英文) NAPI基本数据类型 基本数据类型简介 napi_s

  • 0x01 概述 使用electron开进行桌面程序的开发,似乎成了WEB前端开发人员转桌面程序开发的首选。近期有一些使用在electron中使用加密锁的需求,学习了一下在Node.js中通过ffi-napi模块调用动态链接库,把几款加密锁产品的动态库使用javascript封装了一下,实现了electron中使用加密锁功能。 开发过程中遇到了一些问题,踩了一些坑,这里总结记录一下。这里使用接口函数

  • NAPI面向C++的异步接口(promise) promise方式的处理方式 承接上文,与callback方式不同的是,promise对象由C++侧创建以返回值的方式传递回js/ets侧,promise对象存储异步执行的结果。 // foundation/filemanagement/file_api/interfaces/kits/js/src/common/napi/n_async/n_asy

  • NAPI是什么? 简单点理解就是在Openharmony里,实现上层js或ets应用与底层C/C++之间交互的框架。 Openharmony里的官方解释:NAPI(Native API)组件是一套对外接口基于Node.js N-API规范开发的原生模块扩展开发框架。还有NAPI适合封装IO、CPU密集型、OS底层等能力并对外暴露JS接口,通过NAPI可以实现JS与C/C++代码互相访问。我们可以通

  • https://wiki.linuxfoundation.org/networking/napi napi NAPI (“New API”) is an extension to the device driver packet processing framework, which is designed to improve the performance of high-speed netw

  • NAPI 的核心在于:在一个繁忙网络,每次有网络数据包到达时,不需要都引发中断,因为高频率的中断可能会影响系统的整体效率,假象一个场景,我们此时使用标准的 100M 网卡,可能实际达到的接收速率为 80MBits/s,而此时数据包平均长度为 1500Bytes,则每秒产生的中断数目为:   80M bits/s / (8 Bits/Byte * 1500 Byte) = 6667 个中断 /s  

  • 本文主要介绍在 Electron13.x 中,使用ffi-napi,ref-array-napi,ref-napi 加载 Windows 动态链接库,并在Vue 渲染进程中使用。 这里列出所使用的环境: Visual Studio 2017 NodeJS v14.16.1(x64) node-gyp v9.1.0 Python 3.8.6 Electron :13.0.0 @vue/cli : 4

  • napi_value是NAPI中非常重要的数据结构,定义如下 typedef struct napi_value__* napi_value; 学过c语言的同学应该知道typedef是什么意思,他的作用就是定义类型别名。 typedef int intType; intType a = 1; 但是我们发现搜遍Node.js的源码都找不到napi_value__定义,那这个定义是什么意思呢?c语

  • 1 NAPI简介 现在的的网卡为了提升性能,大部分已经已经使用NAPI的方式接受数据帧。linxu内核使用了struct napi_struct来管理NAPI设备的新特性和操作。系统受到数据包后,支持NAPI模式的网络设备会将网络设备的struct napi_struct数据结构的实例放到CPU的struct softnet_data数据结构的poll_list中。当网络子系统接受到软中断NET_

  • 软中断 在我们的系统中,有几种软中断(在硬件中断的下部分执行): enum { HI_SOFTIRQ=0, TIMER_SOFTIRQ, NET_TX_SOFTIRQ, NET_RX_SOFTIRQ, BLOCK_SOFTIRQ, IRQ_POLL_SOFTIRQ, TASKLET_SOFTIRQ, SCHED_SOFTIRQ, HRTIMER_SOFTIRQ, /* Unuse

  • Node.js的napi极大地方便了c++ addon的编写,使得用户不再那么需要面对复杂的v8。本文通过一个例子来分析一下napi的使用和napi到底做了什么。 1 导出给js使用的功能 #include <node_api.h> NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) 上面的代码是使用napi时的通用模式,我们只需要实现Init函数就行(当然也可以叫其

  • 本文在【OpenHarmony】napi基本用法----HelloWorld的基础上展开。 什么是promise promise是javascript语言中的一个对象,其可以表示一个异步操作的成功或者失败。 promise的优势是链式调用,在过去,要想做多重的异步操作,会导致经典的回调地狱。有了promise的链式调用,就可以把回调绑定到返回的 Promise 上,形成一个 Promise 链。

  • Now for NAPI enabled Ethernet driver initially whenever packets comes at interface ,it is notified to CPU and appropriate Ethernet driver code (Interrupt handler) is executed .Inside the interrupt han

  • 创建NodeJS AddOn的方式很多,在NodeJS开发出c/c++ addon with NAPI之后,大家基本上都用NAPI写addon了,最基本的原因就是NAPI可以脱离v8修改的依赖,NAPI对v8中的api进行了封装,不同版本的Node会自动适用v8底层的API变化。 node-ffi-napi是一个开源的module,该模块内部通过nodejs napi加载我们自己写的dll中输出的

  • 网卡收包流程: 1、网卡将数据包拷贝到主存(一般不需要cpu介入),触发硬中断 2、硬中断函数为驱动probe函数注册的中断回调函数,非napi时一般为netif_rx,napi时一般为驱动自己实现的函数,函数内部触发软中断。napi和非napi触发的软中断都会net_rx_action。 3、backlog_process为默认的poll函数(使用默认poll函数时,硬中断函数中一般调用neti

  • 用electron做一个访问can卡的上位机 使用node-ffi-napi 访问dll文件,需要安装 ffi-napi ref-napi ref-array-napi ref-struct-napi 安装ffi需要用到node-gyp,安装教程可以百度下 以下是使用过程 需要调用的dll的.h头文件如下,此dll是用来访问can卡的 #ifndef CONTROLCAN_H #define CO

  • 前言 Electron作为一款流行的跨平台桌面应用框架,允许我们使用Web技术开发Native应用。但是当应用需要高性能计算或访问系统API时,Web技术的性能会成为瓶颈。 这时,我们可以使用C++开发底层库,然后在Electron中使用Node.js的ffi-napi模块调用这些C++库来实现高性能功能。ffi-napi可以帮助我们在Node.js中加载和调用C/C++的动态链接库。 1. C+

 相关资料
  • 我使用以下代码更改手机上的委托(G3226) 但性能几乎相同,不确定会发生什么。 > 电话G3226 TFLite版本 实现'org.tensorflow: tenorflow lite: 0.0.0-夜间'实现'org.tensorflow: tenorflow lite-gpu: 0.0.0-夜间'实现'org.tensorflow: tenorflow lite-support: 0.0.0

  • HarmonyOS Next中NAPI方式交互的性能问题如何优化? 当C++原生线程需要调用TS方法时,需要使用缓存的Env,这个Env是主线程的,这时需要切换到主线程才可以调用TS方法,如果是特别频繁的交互,C++原生线程需要频繁切换到主线程去调用(长连接网络、实时音视频流处理)等,这种情况会有等待主线程的线程问题吗?该如何优化呢?