TheDesk Mio (ver.3)

This commit is contained in:
cutls
2018-05-20 15:17:10 +09:00
parent a379617427
commit de8f063aea
29 changed files with 591 additions and 93 deletions

59
app/node_modules/itunes-nowplaying-mac/README.md generated vendored Normal file
View File

@@ -0,0 +1,59 @@
# itunes-nowplaying-mac
tested in macOS High Sierra 10.13.2 and iTunes 12.7.2.58
## install
```
npm install itunes-nowplaying-mac
```
## how to use
TypeScript:
```typescript
import nowplaying from "itunes-nowplyaing-mac"
nowplaying().then(console.log)
import {getRawData as nowplaying} from "itunes-nowplaying-mac"
nowplaying().then(console.log) // return iTunes raw data
```
JavaScript:
```javascript
const nowplaying = require("itunes-nowplaying-mac")
nowplaying().then(console.log)
nowplaying.getRawData().then(console.log) // return iTunes raw data
```
example return data:
```json
{
"name": "AnemoneStar",
"duration": 211.29299926757812,
"artist": "渋谷凛 (福原綾香)",
"composer": "Yasushi",
"album": {
"name": "THE IDOLM@STER CINDERELLA GIRLS STARLIGHT MASTER 01",
"artist": "",
"loved": false,
"disliked": false
},
"genre": "Soundtrack",
"track": {
"length": 7,
"number": 3
},
"disc": {
"length": 1,
"number": 1
},
"sampleRate": 44100,
"comment": "",
"loved": true,
"disliked": false,
"state": "playing"
}
```

View File

4
app/node_modules/itunes-nowplaying-mac/dist/demo.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("./index");
index_1.default().then(console.log);

30
app/node_modules/itunes-nowplaying-mac/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
export declare function getRawData(): Promise<{
[key: string]: any;
} | null>;
declare function getData(): Promise<{
name: string;
duration: number;
artist: string;
composer: string;
album: {
name: string;
artist: string;
loved: boolean;
disliked: boolean;
};
genre: string;
track: {
length: number;
number: number;
};
disc: {
length: number;
number: number;
};
sampleRate: number;
comment: string;
loved: boolean;
disliked: boolean;
state: "playing" | "paused";
} | null>;
export default getData;

70
app/node_modules/itunes-nowplaying-mac/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const child_process = require("child_process");
const path = require("path");
async function getRawData() {
const raw_res = await new Promise((resolve, reject) => {
var stdout = "";
var stderr = "";
var process = child_process.spawn("osascript", [path.join(__dirname, "itunes.js")]);
process.stdout.on("data", (data) => {
if (data instanceof Buffer) {
data = data.toString("utf-8");
}
stdout += data;
});
process.stderr.on("data", (data) => {
if (data instanceof Buffer) {
data = data.toString("utf-8");
}
stderr += data;
});
process.on("close", (code) => {
if (code != 0) {
reject(stderr);
}
else {
resolve(stdout);
}
});
});
const res = JSON.parse(raw_res);
return res;
}
exports.getRawData = getRawData;
async function getData() {
const res = await getRawData();
if (res == null) {
return null;
}
return {
name: res.name,
duration: res.duration,
artist: res.artist,
composer: res.composer,
album: {
name: res.album,
artist: res.albumArtist,
loved: res.albumLoved,
disliked: res.albumDisliked,
},
genre: res.genre,
track: {
length: res.trackCount,
number: res.trackNumber,
},
disc: {
length: res.discCount,
number: res.discNumber,
},
sampleRate: res.sampleRate,
comment: res.comment,
loved: res.loved,
disliked: res.disliked,
state: res.state,
};
}
Object.defineProperty(getData, "default", { value: getData });
module.exports = getData;
module.exports.getRawData = getRawData;
exports.default = getData;

17
app/node_modules/itunes-nowplaying-mac/dist/itunes.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
"use strict";
var itunes = Application("iTunes");
var track = itunes.currentTrack;
function run(argv) {
var state = itunes.playerState()
if (state != "playing" && state != "paused") {
return "null"
}
track = track.properties();
Object.keys(track).filter(function (name) {
if (name.startsWith("purchase") || name.endsWith("ID")) {
track[name] = undefined;
}
});
track.state = state
return JSON.stringify(track, null, 4);
}

60
app/node_modules/itunes-nowplaying-mac/package.json generated vendored Normal file
View File

@@ -0,0 +1,60 @@
{
"_from": "itunes-nowplaying-mac",
"_id": "itunes-nowplaying-mac@0.2.3",
"_inBundle": false,
"_integrity": "sha512-1n418TnV4BnpSP6IzuxVECgPYnlm/nUZIXsblvzFVu4+rxmswXPnz3xi8XUq0r28I9njTi3g6vmBFa5YFHb8TA==",
"_location": "/itunes-nowplaying-mac",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "itunes-nowplaying-mac",
"name": "itunes-nowplaying-mac",
"escapedName": "itunes-nowplaying-mac",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/itunes-nowplaying-mac/-/itunes-nowplaying-mac-0.2.3.tgz",
"_shasum": "88e39b78100f6b9cd864b8293f5391de8fcfbf72",
"_spec": "itunes-nowplaying-mac",
"_where": "/Users/aa/TheDesk/app",
"author": {
"name": "rinsuki"
},
"bugs": {
"url": "https://github.com/rinsuki/itunes-nowplaying-mac/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "tested in macOS High Sierra 10.13.2 and iTunes 12.7.2.58",
"devDependencies": {
"@types/node": "^9.3.0",
"typescript": "^2.6.2"
},
"engines": {
"node": ">= 7.6.0"
},
"homepage": "https://github.com/rinsuki/itunes-nowplaying-mac#readme",
"license": "MIT",
"main": "dist/index.js",
"name": "itunes-nowplaying-mac",
"os": [
"darwin"
],
"repository": {
"type": "git",
"url": "git+https://github.com/rinsuki/itunes-nowplaying-mac.git"
},
"scripts": {
"build": "tsc",
"prepublish": "npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"typings": "dist/index.d.ts",
"version": "0.2.3"
}

59
app/node_modules/itunes-nowplaying-mac/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,59 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation: */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./dist/", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
},
"include": [
"src/**/*.ts",
"src/**/*.js",
]
}