iobroker.foobar2000 2.0.4 → 2.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.github/auto-merge.yml +17 -0
- package/.github/dependabot.yml +18 -0
- package/.github/workflows/dependabot-auto-merge.yml +27 -0
- package/.github/workflows/test-and-release.yml +52 -96
- package/.prettierignore +2 -0
- package/.prettierrc.js +9 -0
- package/.releaseconfig.json +3 -0
- package/LICENSE +1 -0
- package/README.md +46 -20
- package/foobar2000.js +46 -40
- package/io-package.json +67 -22
- package/package.json +40 -24
- package/.mocharc.json +0 -10
package/.eslintignore
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Configure here which dependency updates should be merged automatically.
|
|
2
|
+
# The recommended configuration is the following:
|
|
3
|
+
- match:
|
|
4
|
+
# Only merge patches for production dependencies
|
|
5
|
+
dependency_type: production
|
|
6
|
+
update_type: "semver:patch"
|
|
7
|
+
- match:
|
|
8
|
+
# Except for security fixes, here we allow minor patches
|
|
9
|
+
dependency_type: production
|
|
10
|
+
update_type: "security:minor"
|
|
11
|
+
- match:
|
|
12
|
+
# and development dependencies can have a minor update, too
|
|
13
|
+
dependency_type: development
|
|
14
|
+
update_type: "semver:minor"
|
|
15
|
+
|
|
16
|
+
# The syntax is based on the legacy dependabot v1 automerged_updates syntax, see:
|
|
17
|
+
# https://dependabot.com/docs/config-file/#automerged_updates
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: npm
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
time: "04:00"
|
|
8
|
+
timezone: Europe/Berlin
|
|
9
|
+
open-pull-requests-limit: 15
|
|
10
|
+
versioning-strategy: increase
|
|
11
|
+
|
|
12
|
+
- package-ecosystem: github-actions
|
|
13
|
+
directory: "/"
|
|
14
|
+
schedule:
|
|
15
|
+
interval: weekly
|
|
16
|
+
time: "04:00"
|
|
17
|
+
timezone: Europe/Berlin
|
|
18
|
+
open-pull-requests-limit: 15
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Automatically merge Dependabot PRs when version comparison is within the range
|
|
2
|
+
# that is configured in .github/auto-merge.yml
|
|
3
|
+
|
|
4
|
+
name: Auto-Merge Dependabot PRs
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
# WARNING: This needs to be run in the PR base, DO NOT build untrusted code in this action
|
|
8
|
+
# details under https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
|
|
9
|
+
pull_request_target:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
auto-merge:
|
|
13
|
+
if: github.actor == 'dependabot[bot]'
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Check if PR should be auto-merged
|
|
20
|
+
uses: ahmadnassri/action-dependabot-auto-merge@v2
|
|
21
|
+
with:
|
|
22
|
+
# In order to use this, you need to go to https://github.com/settings/tokens and
|
|
23
|
+
# create a Personal Access Token with the permission "public_repo".
|
|
24
|
+
# Enter this token in your repository settings under "Secrets" and name it AUTO_MERGE_TOKEN
|
|
25
|
+
github-token: ${{ secrets.AUTO_MERGE_TOKEN }}
|
|
26
|
+
# By default, squash and merge, so Github chooses nice commit messages
|
|
27
|
+
command: squash and merge
|
|
@@ -5,14 +5,19 @@ name: Test and Release
|
|
|
5
5
|
on:
|
|
6
6
|
push:
|
|
7
7
|
branches:
|
|
8
|
-
-
|
|
8
|
+
- 'master'
|
|
9
9
|
tags:
|
|
10
10
|
# normal versions
|
|
11
|
-
-
|
|
11
|
+
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
12
12
|
# pre-releases
|
|
13
|
-
-
|
|
13
|
+
- 'v[0-9]+.[0-9]+.[0-9]+-**'
|
|
14
14
|
pull_request: {}
|
|
15
15
|
|
|
16
|
+
# Cancel previous PR/branch runs when a new commit is pushed
|
|
17
|
+
concurrency:
|
|
18
|
+
group: ${{ github.ref }}
|
|
19
|
+
cancel-in-progress: true
|
|
20
|
+
|
|
16
21
|
jobs:
|
|
17
22
|
# Performs quick checks before the expensive test runs
|
|
18
23
|
check-and-lint:
|
|
@@ -20,117 +25,68 @@ jobs:
|
|
|
20
25
|
|
|
21
26
|
runs-on: ubuntu-latest
|
|
22
27
|
|
|
23
|
-
strategy:
|
|
24
|
-
matrix:
|
|
25
|
-
node-version: [14.x]
|
|
26
|
-
|
|
27
28
|
steps:
|
|
28
|
-
-
|
|
29
|
-
uses: actions/checkout@v2
|
|
30
|
-
|
|
31
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
32
|
-
uses: actions/setup-node@v1
|
|
29
|
+
- uses: ioBroker/testing-action-check@v1
|
|
33
30
|
with:
|
|
34
|
-
node-version:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- name: Lint source code
|
|
40
|
-
run: npm run lint
|
|
41
|
-
- name: Test package files
|
|
42
|
-
run: npm run test:package
|
|
31
|
+
node-version: '18.x'
|
|
32
|
+
# Uncomment the following line if your adapter cannot be installed using 'npm ci'
|
|
33
|
+
# install-command: 'npm install'
|
|
34
|
+
lint: true
|
|
43
35
|
|
|
44
36
|
# Runs adapter tests on all supported node versions and OSes
|
|
45
37
|
adapter-tests:
|
|
46
38
|
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
|
47
39
|
|
|
48
|
-
needs: [check-and-lint]
|
|
49
|
-
|
|
50
40
|
runs-on: ${{ matrix.os }}
|
|
51
41
|
strategy:
|
|
52
42
|
matrix:
|
|
53
|
-
node-version: [
|
|
43
|
+
node-version: [16.x, 18.x, 20.x]
|
|
54
44
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
55
45
|
|
|
56
46
|
steps:
|
|
57
|
-
-
|
|
58
|
-
uses: actions/checkout@v2
|
|
59
|
-
|
|
60
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
61
|
-
uses: actions/setup-node@v1
|
|
47
|
+
- uses: ioBroker/testing-action-adapter@v1
|
|
62
48
|
with:
|
|
63
49
|
node-version: ${{ matrix.node-version }}
|
|
50
|
+
os: ${{ matrix.os }}
|
|
51
|
+
# Uncomment the following line if your adapter cannot be installed using 'npm ci'
|
|
52
|
+
# install-command: 'npm install'
|
|
64
53
|
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
# TODO: To enable automatic npm releases, create a token on npmjs.org
|
|
55
|
+
# Enter this token as a GitHub secret (with name NPM_TOKEN) in the repository options
|
|
56
|
+
# Then uncomment the following block:
|
|
67
57
|
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
# Deploys the final package to NPM
|
|
59
|
+
deploy:
|
|
60
|
+
needs: [check-and-lint, adapter-tests]
|
|
70
61
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
# Trigger this step only when a commit on any branch is tagged with a version number
|
|
63
|
+
if: |
|
|
64
|
+
contains(github.event.head_commit.message, '[skip ci]') == false &&
|
|
65
|
+
github.event_name == 'push' &&
|
|
66
|
+
startsWith(github.ref, 'refs/tags/v')
|
|
74
67
|
|
|
75
|
-
|
|
76
|
-
if: startsWith(runner.OS, 'windows')
|
|
77
|
-
run: set DEBUG=testing:* & npm run test:integration
|
|
68
|
+
runs-on: ubuntu-latest
|
|
78
69
|
|
|
79
|
-
#
|
|
80
|
-
|
|
81
|
-
|
|
70
|
+
# Write permissions are required to create Github releases
|
|
71
|
+
permissions:
|
|
72
|
+
contents: write
|
|
82
73
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
#
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
#
|
|
95
|
-
#
|
|
96
|
-
#
|
|
97
|
-
#
|
|
98
|
-
#
|
|
99
|
-
#
|
|
100
|
-
#
|
|
101
|
-
#
|
|
102
|
-
#
|
|
103
|
-
# - name: Use Node.js ${{ matrix.node-version }}
|
|
104
|
-
# uses: actions/setup-node@v1
|
|
105
|
-
# with:
|
|
106
|
-
# node-version: ${{ matrix.node-version }}
|
|
107
|
-
#
|
|
108
|
-
# - name: Extract the version and commit body from the tag
|
|
109
|
-
# # The body may be multiline, therefore newlines and % need to be escaped
|
|
110
|
-
# run: |
|
|
111
|
-
# VERSION="${{ github.ref }}"
|
|
112
|
-
# VERSION=${VERSION##*/v}
|
|
113
|
-
# echo "::set-env name=VERSION::$VERSION"
|
|
114
|
-
# BODY=$(git show -s --format=%b)
|
|
115
|
-
# BODY="${BODY//'%'/'%25'}"
|
|
116
|
-
# BODY="${BODY//$'\n'/'%0A'}"
|
|
117
|
-
# BODY="${BODY//$'\r'/'%0D'}"
|
|
118
|
-
# echo "::set-env name=BODY::$BODY"
|
|
119
|
-
#
|
|
120
|
-
# - name: Publish package to npm
|
|
121
|
-
# run: |
|
|
122
|
-
# npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
|
|
123
|
-
# npm whoami
|
|
124
|
-
# npm publish
|
|
125
|
-
#
|
|
126
|
-
# - name: Create Github Release
|
|
127
|
-
# uses: actions/create-release@v1
|
|
128
|
-
# env:
|
|
129
|
-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
130
|
-
# with:
|
|
131
|
-
# tag_name: ${{ github.ref }}
|
|
132
|
-
# release_name: Release v${{ env.VERSION }}
|
|
133
|
-
# draft: false
|
|
134
|
-
# # Prerelease versions create prereleases on Github
|
|
135
|
-
# prerelease: ${{ contains(env.VERSION, '-') }}
|
|
136
|
-
# body: ${{ env.BODY }}
|
|
74
|
+
steps:
|
|
75
|
+
- uses: ioBroker/testing-action-deploy@v1
|
|
76
|
+
with:
|
|
77
|
+
node-version: '18.x'
|
|
78
|
+
# Uncomment the following line if your adapter cannot be installed using 'npm ci'
|
|
79
|
+
# install-command: 'npm install'
|
|
80
|
+
npm-token: ${{ secrets.NPM_TOKEN }}
|
|
81
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
82
|
+
|
|
83
|
+
# When using Sentry for error reporting, Sentry can be informed about new releases
|
|
84
|
+
# To enable create a API-Token in Sentry (User settings, API keys)
|
|
85
|
+
# Enter this token as a GitHub secret (with name SENTRY_AUTH_TOKEN) in the repository options
|
|
86
|
+
# Then uncomment and customize the following block:
|
|
87
|
+
# sentry: true
|
|
88
|
+
# sentry-token: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
89
|
+
# sentry-project: "iobroker-pid"
|
|
90
|
+
# sentry-version-prefix: "iobroker.pid"
|
|
91
|
+
# # If your sentry project is linked to a GitHub repository, you can enable the following option
|
|
92
|
+
# # sentry-github-integration: true
|
package/.prettierignore
ADDED
package/.prettierrc.js
ADDED
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,61 +1,87 @@
|
|
|
1
1
|

|
|
2
|
-
# Foobar2000 adapter for iobroker
|
|
3
|
-
  [](https://www.npmjs.com/package/iobroker.foobar2000)
|
|
4
|
-
[](https://www.npmjs.com/package/iobroker.foobar2000)
|
|
5
|
-
[](https://github.com/instalator/ioBroker.foobar2000/actions/)
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
# iobroker.foobar2000
|
|
8
4
|
|
|
9
|
-
[](https://github.com/iobroker-community-adapters/ioBroker.foobar2000/blob/master/LICENSE)
|
|
6
|
+
[](https://www.npmjs.com/package/iobroker.foobar2000)
|
|
7
|
+

|
|
8
|
+
[](https://weblate.iobroker.net/engage/adapters/?utm_source=widget)</br>
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+
</br>
|
|
14
|
+
**Version:** </br>
|
|
15
|
+
[](https://www.npmjs.com/package/iobroker.foobar2000)
|
|
16
|
+

|
|
17
|
+

|
|
18
|
+
</br>
|
|
19
|
+
**Tests:** </br>
|
|
20
|
+
[](https://github.com/iobroker-community-adapters/ioBroker.foobar2000/actions/workflows/test-and-release.yml)
|
|
21
|
+
[](https://github.com/iobroker-community-adapters/ioBroker.foobar2000/actions/workflows/codeql.yml)
|
|
22
|
+
|
|
23
|
+
<!--
|
|
24
|
+
## Sentry
|
|
25
|
+
**This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.**
|
|
26
|
+
For more details and for information how to disable the error reporting see [Sentry-Plugin Documentation](https://github.com/ioBroker/plugin-sentry#plugin-sentry)! Sentry reporting is used starting with js-controller 3.0.
|
|
27
|
+
-->
|
|
28
|
+
|
|
29
|
+
## Foobar2000 adapter for iobroker
|
|
11
30
|
|
|
12
31
|

|
|
13
32
|
|
|
14
33
|
## Using
|
|
15
|
-
Описание [тут](http://blog.instalator.ru/archives/541).
|
|
16
|
-
Для управления проигрывателем необходимо установить плагин [foo_httpcontrol](https://bitbucket.org/oblikoamorale/foo_httpcontrol/downloads/).
|
|
17
|
-
Для отображения обложки как ссылка на файл, необходимо в файле ```c:\Users\{USER}\AppData\Roaming\foobar2000\foo_httpcontrol_data\foobar2000controller\config``` изменить параметр ```albumart_prefer_embedded=0```
|
|
18
34
|
|
|
19
35
|
To control the player, you must install the plugin [foo_httpcontrol](https://bitbucket.org/oblikoamorale/foo_httpcontrol/downloads/).
|
|
20
36
|
To display the cover as a link to a file, in the file ```c:\Users\{USER}\AppData\Roaming\foobar2000\foo_httpcontrol_data\foobar2000controller\config``` change the parameter ```albumart_prefer_embedded = 0```
|
|
21
37
|
|
|
22
38
|
## Changelog
|
|
23
39
|
|
|
24
|
-
|
|
40
|
+
<!--
|
|
41
|
+
Placeholder for the next version (at the beginning of the line):
|
|
42
|
+
### **WORK IN PROGRESS**
|
|
43
|
+
-->
|
|
44
|
+
### 2.1.0-alpha.0 (2023-11-07)
|
|
45
|
+
* (mcm1957) Adapter requires nodejs16 or newer now.
|
|
46
|
+
* (mcm1957) Adapter has been moved to iobroker-community-adapters organization.
|
|
47
|
+
* (mcm1957) Dependencies have been updated.
|
|
48
|
+
|
|
49
|
+
### 2.0.4
|
|
25
50
|
* (instalator) fixed error
|
|
26
51
|
|
|
27
|
-
|
|
52
|
+
### 2.0.3
|
|
28
53
|
* (instalator) fixed admin error
|
|
29
54
|
|
|
30
|
-
|
|
55
|
+
### 2.0.2
|
|
31
56
|
* (instalator) fixed error
|
|
32
57
|
|
|
33
|
-
|
|
58
|
+
### 2.0.0
|
|
34
59
|
* (instalator) Completely rewritten
|
|
35
60
|
|
|
36
|
-
|
|
61
|
+
### 1.0.0
|
|
37
62
|
* (instalator) Up to stable
|
|
38
63
|
|
|
39
|
-
|
|
64
|
+
### 0.2.0
|
|
40
65
|
* (instalator) Change for widgets vis-players
|
|
41
66
|
|
|
42
|
-
|
|
67
|
+
### 0.1.2
|
|
43
68
|
* (instalator) del widgets folders
|
|
44
69
|
* (instalator) change log level
|
|
45
70
|
* (instalator) add news object
|
|
46
71
|
|
|
47
|
-
|
|
72
|
+
### 0.1.1
|
|
48
73
|
* (instalator) fix start, exit for local
|
|
49
74
|
|
|
50
|
-
|
|
75
|
+
### 0.1.0
|
|
51
76
|
* (instalator) beta (20.10.2016)
|
|
52
77
|
|
|
53
|
-
|
|
78
|
+
### 0.0.1
|
|
54
79
|
* (instalator) initial (12.10.2016)
|
|
55
80
|
|
|
56
81
|
## License
|
|
57
82
|
The MIT License (MIT)
|
|
58
83
|
|
|
84
|
+
Copyright (c) 2023 iobroker-community-adapters <mcm57@gmx.at>
|
|
59
85
|
Copyright (c) 2021 instalator <vvvalt@mail.ru>
|
|
60
86
|
|
|
61
87
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
package/foobar2000.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
const utils = require('@iobroker/adapter-core');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let adapter
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const http = require('http');
|
|
4
|
+
const exec = require('child_process').exec;
|
|
5
|
+
let adapter;
|
|
6
|
+
let foobarPath = null;
|
|
7
|
+
let timerPoll;
|
|
8
|
+
let timeout;
|
|
9
|
+
let muteVol = 100;
|
|
10
|
+
let request;
|
|
11
|
+
let old_states;
|
|
12
|
+
const states = {
|
|
13
|
+
playlist: []
|
|
14
|
+
};
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
const Commands = {
|
|
11
17
|
'play': 'Start',
|
|
12
18
|
'stop': 'Stop',
|
|
13
19
|
'next': 'StartNext',
|
|
@@ -40,7 +46,7 @@ function startAdapter(options){
|
|
|
40
46
|
timerPoll && clearInterval(timerPoll);
|
|
41
47
|
timeout && clearTimeout(timeout);
|
|
42
48
|
try {
|
|
43
|
-
debug('cleaned everything up...');
|
|
49
|
+
adapter.log.debug('cleaned everything up...');
|
|
44
50
|
callback();
|
|
45
51
|
} catch (e) {
|
|
46
52
|
callback();
|
|
@@ -50,7 +56,7 @@ function startAdapter(options){
|
|
|
50
56
|
if (id && state && !state.ack){
|
|
51
57
|
adapter.log.debug(`state ${id} changed: ${state.val} (ack = ${state.ack})`);
|
|
52
58
|
let param;
|
|
53
|
-
id = id.split(
|
|
59
|
+
id = id.split('.')[2].toString().toLowerCase();
|
|
54
60
|
if (id === 'start' || id === 'exit'){
|
|
55
61
|
launch(id);
|
|
56
62
|
return;
|
|
@@ -137,14 +143,14 @@ function startAdapter(options){
|
|
|
137
143
|
path: '/foobar2000controller/?cmd=Browse¶m1=' + param + '¶m2=EnqueueDirSubdirs' //¶m3=browser.json
|
|
138
144
|
};*/
|
|
139
145
|
timeout && clearTimeout(timeout);
|
|
140
|
-
httpGet('Browse', [param, 'EnqueueDirSubdirs'], (
|
|
146
|
+
httpGet('Browse', [param, 'EnqueueDirSubdirs'], (_data) => {
|
|
141
147
|
timeout = setTimeout(() => {
|
|
142
148
|
getPlaylist();
|
|
143
149
|
}, 1000);
|
|
144
150
|
});
|
|
145
151
|
}
|
|
146
152
|
} else {
|
|
147
|
-
|
|
153
|
+
const cmd = Commands[id];
|
|
148
154
|
if (cmd){
|
|
149
155
|
if (param !== undefined){
|
|
150
156
|
httpGet(cmd, [param]);
|
|
@@ -165,7 +171,7 @@ function httpGet(cmd, param, cb){
|
|
|
165
171
|
params += '¶m' + (i + 1) + '=' + key;
|
|
166
172
|
});
|
|
167
173
|
}
|
|
168
|
-
|
|
174
|
+
const options = {
|
|
169
175
|
host: adapter.config.ip || '127.0.0.1',
|
|
170
176
|
port: adapter.config.port || 8888,
|
|
171
177
|
path: '/foobar2000controller/?cmd=' + cmd + params
|
|
@@ -355,41 +361,41 @@ function setInfoConnection(val){
|
|
|
355
361
|
function secToText(sec){
|
|
356
362
|
let res;
|
|
357
363
|
let m = Math.floor(sec / 60);
|
|
358
|
-
|
|
359
|
-
|
|
364
|
+
const s = sec % 60;
|
|
365
|
+
const h = Math.floor(m / 60);
|
|
360
366
|
m = m % 60;
|
|
361
367
|
if (h > 0){
|
|
362
|
-
res = pad2(h) +
|
|
368
|
+
res = pad2(h) + ':' + pad2(m) + ':' + pad2(s);
|
|
363
369
|
} else {
|
|
364
|
-
res = pad2(m) +
|
|
370
|
+
res = pad2(m) + ':' + pad2(s);
|
|
365
371
|
}
|
|
366
372
|
return res;
|
|
367
373
|
}
|
|
368
374
|
|
|
369
375
|
function pad2(num){
|
|
370
|
-
|
|
371
|
-
return (s.length < 2) ?
|
|
376
|
+
const s = num.toString();
|
|
377
|
+
return (s.length < 2) ? '0' + s :s;
|
|
372
378
|
}
|
|
373
379
|
|
|
374
380
|
function getPlaylist(){
|
|
375
381
|
httpGet('PlaylistItemsPerPage', [16384], (res) => {
|
|
376
382
|
if (res && res.playlist){
|
|
377
|
-
|
|
378
|
-
|
|
383
|
+
const playlist = [];
|
|
384
|
+
//const arr = res.songs;
|
|
379
385
|
res.playlist.forEach((key, i) => {
|
|
380
386
|
playlist[i] = {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
387
|
+
'id': i + 1,
|
|
388
|
+
'artist': key.artist,
|
|
389
|
+
'album': key.album,
|
|
390
|
+
'bitrate': 0,
|
|
391
|
+
'title': key.track,
|
|
392
|
+
'file': '',
|
|
393
|
+
'genre': '',
|
|
394
|
+
'year': 0,
|
|
395
|
+
'len': key.len,
|
|
396
|
+
'rating': key.rating,
|
|
397
|
+
'cover': ''
|
|
398
|
+
};
|
|
393
399
|
});
|
|
394
400
|
states.playlist = JSON.stringify(playlist);
|
|
395
401
|
states.playlists = JSON.stringify(res.playlists);
|
|
@@ -406,8 +412,8 @@ function launch(cmd){
|
|
|
406
412
|
sendShellCommand('exit');
|
|
407
413
|
}
|
|
408
414
|
} else if (adapter.config.cmdstart){
|
|
409
|
-
|
|
410
|
-
|
|
415
|
+
const parts = adapter.config.path.split(':');
|
|
416
|
+
const options = {
|
|
411
417
|
host: parts[0],
|
|
412
418
|
port: parts[1],
|
|
413
419
|
path: ''
|
|
@@ -455,18 +461,18 @@ function browser(cmd, param){
|
|
|
455
461
|
}
|
|
456
462
|
|
|
457
463
|
function filemanager(val, arr){
|
|
458
|
-
|
|
464
|
+
const browser = {}, files = [];
|
|
459
465
|
arr.forEach((item, i, arr) => {
|
|
460
|
-
|
|
461
|
-
|
|
466
|
+
const obj = {};
|
|
467
|
+
const size = parseFloat(arr[i].fs) * 1024;
|
|
462
468
|
if (!isNaN(size)){
|
|
463
469
|
obj.size = (parseFloat(arr[i].fs.replace(',', '.')) * 1024).toFixed(0);
|
|
464
470
|
} else {
|
|
465
471
|
obj.size = '';
|
|
466
472
|
}
|
|
467
473
|
if (arr[i].ft && ~arr[i].ft.indexOf(':')){
|
|
468
|
-
|
|
469
|
-
|
|
474
|
+
const mod = arr[i].ft.split(' '); //"27.05.2004 01:50" 2016-02-27 16:05:46
|
|
475
|
+
const d = mod[0].split('.').reverse().join('-');
|
|
470
476
|
arr[i].ft = d + ' ' + mod[1];
|
|
471
477
|
}
|
|
472
478
|
if (arr[i].fs){
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "foobar2000",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.1.0-alpha.0",
|
|
5
5
|
"news": {
|
|
6
|
+
"2.1.0-alpha.0": {
|
|
7
|
+
"en": "Adapter requires nodejs16 or newer now.\nAdapter has been moved to iobroker-community-adapters organization.\nDependencies have been updated.",
|
|
8
|
+
"de": "Adapter benötigt jetzt nodejs16 oder neuer.\nAdapter wurde auf iobroker-community-Adapter Organisation verschoben.\nAbhängigkeiten wurden aktualisiert.",
|
|
9
|
+
"ru": "Адаптер требует nodejs16 или новее теперь.\nАдаптер переехал в организацию iobroker-community-adapters.\nОбновлены зависимости.",
|
|
10
|
+
"pt": "Adaptador requer nodejs16 ou mais recente agora.\nAdapter foi movido para iobroker-community-adapters organização.\nAs dependências foram atualizadas.",
|
|
11
|
+
"nl": "Adapter vereist nodejs16 of Newer nu.\nAdapter is verplaatst naar iobroker-community-papters organisatie.\nAfhankelijkheid is geüpdateerd.",
|
|
12
|
+
"fr": "Adaptateur nécessite nodejs16 ou plus récent maintenant.\nL'adaptateur a été déplacé à l'organisation iobroker-community-adapters.\nLes dépendances ont été mises à jour.",
|
|
13
|
+
"it": "Adattatore richiede nodejs16 o più nuovo ora.\nL'adattatore è stato trasferito all'organizzazione iobroker-community-adapters.\nLe dipendenze sono state aggiornate.",
|
|
14
|
+
"es": "Adaptador requiere nodejs16 o nuevo ahora.\nEl adaptador ha sido trasladado a la organización de ibroker-community-adapters.\nSe han actualizado las dependencias.",
|
|
15
|
+
"pl": "Adapter wymaga węzłów 16 lub nowszych.\nAdapter przeniesiono do organizacji iobroker-community-adapter.\nW zależności zostały zaktualizowane.",
|
|
16
|
+
"uk": "Адаптер вимагає nodejs16 або новіший зараз.\nПереміщено перехід на організацію iobroker-community-adapters.\nОновлено залежність.",
|
|
17
|
+
"zh-cn": "道歉要求现在不再出现。.\n现已移到加勒比妓院。.\n情况已经更新。."
|
|
18
|
+
},
|
|
6
19
|
"2.0.4": {
|
|
7
20
|
"en": "fixed error",
|
|
8
21
|
"de": "fixed error",
|
|
@@ -14,7 +27,8 @@
|
|
|
14
27
|
"es": "fixed error",
|
|
15
28
|
"pl": "fixed error",
|
|
16
29
|
"zh-cn": "fixed error"
|
|
17
|
-
},
|
|
30
|
+
},
|
|
31
|
+
"2.0.3": {
|
|
18
32
|
"en": "fixed admin error",
|
|
19
33
|
"de": "fixed admin error",
|
|
20
34
|
"ru": "fixed admin error",
|
|
@@ -39,37 +53,64 @@
|
|
|
39
53
|
"zh-cn": "Completely rewritten"
|
|
40
54
|
}
|
|
41
55
|
},
|
|
42
|
-
"
|
|
56
|
+
"titleLang": {
|
|
57
|
+
"en": "Control foobar2000 player",
|
|
58
|
+
"de": "Steuerung foobar2000 Player",
|
|
59
|
+
"ru": "Управление foobar2000 игроком",
|
|
60
|
+
"pt": "Control foobar2000 jogador",
|
|
61
|
+
"nl": "Controle:",
|
|
62
|
+
"fr": "Contrôle du joueur de foobar2000",
|
|
63
|
+
"it": "Controllo del lettore foobar2000",
|
|
64
|
+
"es": "Control foobar2000 jugador",
|
|
65
|
+
"pl": "Foobar2000 player",
|
|
66
|
+
"uk": "Контроль фобар2000",
|
|
67
|
+
"zh-cn": "控制软禁2000年"
|
|
68
|
+
},
|
|
43
69
|
"desc": {
|
|
44
70
|
"en": "Control your foobar2000 player",
|
|
45
|
-
"de": "Steuern Sie Ihren foobar2000
|
|
46
|
-
"ru": "
|
|
47
|
-
"pt": "Controle o seu foobar2000
|
|
48
|
-
"nl": "
|
|
71
|
+
"de": "Steuern Sie Ihren foobar2000 Player",
|
|
72
|
+
"ru": "Контролируйте своего игрока foobar2000",
|
|
73
|
+
"pt": "Controle o seu jogador foobar2000",
|
|
74
|
+
"nl": "Controleer je foobar2000 speler",
|
|
49
75
|
"fr": "Contrôlez votre lecteur foobar2000",
|
|
50
|
-
"it": "Controlla il tuo
|
|
51
|
-
"es": "
|
|
52
|
-
"pl": "
|
|
53
|
-
"
|
|
76
|
+
"it": "Controlla il tuo lettore foobar2000",
|
|
77
|
+
"es": "Controle su jugador foobar2000",
|
|
78
|
+
"pl": "Kontrola nad foobar2000",
|
|
79
|
+
"uk": "Керуйте фобар2000",
|
|
80
|
+
"zh-cn": "控制你的野蛮2000年事件"
|
|
54
81
|
},
|
|
55
|
-
"license": "MIT",
|
|
56
82
|
"authors": [
|
|
57
|
-
"instalator"
|
|
83
|
+
"instalator",
|
|
84
|
+
"iobroker-community-adapters <mcm57@gmx.at>"
|
|
85
|
+
],
|
|
86
|
+
"keywords": [
|
|
87
|
+
"foobar2000",
|
|
88
|
+
"player"
|
|
58
89
|
],
|
|
90
|
+
"license": "MIT",
|
|
59
91
|
"platform": "Javascript/Node.js",
|
|
60
|
-
"
|
|
92
|
+
"main": "foobar2000.js",
|
|
61
93
|
"icon": "foobar2000.png",
|
|
62
94
|
"enabled": false,
|
|
63
|
-
"
|
|
64
|
-
"
|
|
95
|
+
"extIcon": "https://raw.githubusercontent.com/iobroker-community-adapters/iobroker.foobar2000/master/admin/foobar2000.png",
|
|
96
|
+
"readme": "https://github.com/iobroker-community-adapters/iobroker.foobar2000/blob/master/README.md",
|
|
65
97
|
"loglevel": "info",
|
|
98
|
+
"mode": "daemon",
|
|
66
99
|
"type": "multimedia",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
100
|
+
"compact": true,
|
|
101
|
+
"connectionType": "local",
|
|
102
|
+
"dataSource": "pull",
|
|
103
|
+
"materialize": true,
|
|
104
|
+
"dependencies": [
|
|
105
|
+
{
|
|
106
|
+
"js-controller": ">=4.0.24"
|
|
107
|
+
}
|
|
71
108
|
],
|
|
72
|
-
"
|
|
109
|
+
"globalDependencies": [
|
|
110
|
+
{
|
|
111
|
+
"admin": ">=5.1.13"
|
|
112
|
+
}
|
|
113
|
+
]
|
|
73
114
|
},
|
|
74
115
|
"native": {
|
|
75
116
|
"ip": "127.0.0.1",
|
|
@@ -403,7 +444,11 @@
|
|
|
403
444
|
"read": true,
|
|
404
445
|
"write": true,
|
|
405
446
|
"def": false,
|
|
406
|
-
"states": {
|
|
447
|
+
"states": {
|
|
448
|
+
"0": "Off",
|
|
449
|
+
"1": "All",
|
|
450
|
+
"2": "One"
|
|
451
|
+
}
|
|
407
452
|
},
|
|
408
453
|
"native": {}
|
|
409
454
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.foobar2000",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-alpha.0",
|
|
4
4
|
"description": "ioBroker Foobar2000 player adapter",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "instalator",
|
|
@@ -10,9 +10,13 @@
|
|
|
10
10
|
{
|
|
11
11
|
"name": "instalator",
|
|
12
12
|
"email": "vvvalt@mail.ru"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "iobroker-community-adapters",
|
|
16
|
+
"email": "mcm57@gmx.at"
|
|
13
17
|
}
|
|
14
18
|
],
|
|
15
|
-
"homepage": "https://github.com/
|
|
19
|
+
"homepage": "https://github.com/iobroker-community-adapters/iobroker.foobar2000",
|
|
16
20
|
"license": "MIT",
|
|
17
21
|
"keywords": [
|
|
18
22
|
"ioBroker",
|
|
@@ -22,42 +26,54 @@
|
|
|
22
26
|
],
|
|
23
27
|
"repository": {
|
|
24
28
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/
|
|
29
|
+
"url": "https://github.com/iobroker-community-adapters/ioBroker.foobar2000.git"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=16"
|
|
26
33
|
},
|
|
27
34
|
"dependencies": {
|
|
28
|
-
"@iobroker/adapter-core": "^
|
|
35
|
+
"@iobroker/adapter-core": "^3.0.4"
|
|
29
36
|
},
|
|
30
37
|
"devDependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@types/
|
|
39
|
-
"@types/
|
|
40
|
-
"
|
|
41
|
-
"
|
|
38
|
+
"@alcalzone/release-script": "^3.6.0",
|
|
39
|
+
"@alcalzone/release-script-plugin-iobroker": "^3.6.0",
|
|
40
|
+
"@alcalzone/release-script-plugin-license": "^3.5.9",
|
|
41
|
+
"@alcalzone/release-script-plugin-manual-review": "^3.5.9",
|
|
42
|
+
"@iobroker/adapter-dev": "^1.2.0",
|
|
43
|
+
"@iobroker/testing": "^4.1.0",
|
|
44
|
+
"@tsconfig/node14": "^14.1.0",
|
|
45
|
+
"@types/chai": "^4.3.8",
|
|
46
|
+
"@types/chai-as-promised": "^7.1.6",
|
|
47
|
+
"@types/mocha": "^10.0.2",
|
|
48
|
+
"@types/node": "^20.8.6",
|
|
49
|
+
"@types/proxyquire": "^1.3.29",
|
|
50
|
+
"@types/sinon": "^17.0.0",
|
|
51
|
+
"@types/sinon-chai": "^3.2.10",
|
|
52
|
+
"chai": "^4.3.10",
|
|
42
53
|
"chai-as-promised": "^7.1.1",
|
|
43
|
-
"eslint": "^
|
|
44
|
-
"
|
|
45
|
-
"
|
|
54
|
+
"eslint": "^8.51.0",
|
|
55
|
+
"eslint-config-prettier": "^8.9.0",
|
|
56
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
57
|
+
"mocha": "^10.2.0",
|
|
58
|
+
"prettier": "^3.0.3",
|
|
46
59
|
"proxyquire": "^2.1.3",
|
|
47
|
-
"sinon": "^
|
|
48
|
-
"sinon-chai": "^3.
|
|
60
|
+
"sinon": "^17.0.1",
|
|
61
|
+
"sinon-chai": "^3.7.0",
|
|
62
|
+
"typescript": "~5.2.2"
|
|
49
63
|
},
|
|
50
64
|
"main": "foobar2000.js",
|
|
51
65
|
"scripts": {
|
|
52
|
-
"test:js": "mocha \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
|
|
66
|
+
"test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
|
|
53
67
|
"test:package": "mocha test/package --exit",
|
|
54
|
-
"test:unit": "mocha test/unit --exit",
|
|
55
68
|
"test:integration": "mocha test/integration --exit",
|
|
56
69
|
"test": "npm run test:js && npm run test:package",
|
|
57
|
-
"
|
|
70
|
+
"check": "tsc --noEmit -p tsconfig.check.json",
|
|
71
|
+
"lint": "eslint .",
|
|
72
|
+
"translate": "translate-adapter",
|
|
73
|
+
"release": "release-script"
|
|
58
74
|
},
|
|
59
75
|
"bugs": {
|
|
60
|
-
"url": "https://github.com/
|
|
76
|
+
"url": "https://github.com/iobroker-community-adapters/iobroker.foobar2000/issues"
|
|
61
77
|
},
|
|
62
78
|
"readmeFilename": "README.md"
|
|
63
79
|
}
|