mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-07 20:10:03 +03:00
Compare commits
218 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdba83bd91 | ||
|
|
8bcf46d6aa | ||
|
|
945d2abd1a | ||
|
|
4094fda71d | ||
|
|
aed64b09fe | ||
|
|
fa2800a391 | ||
|
|
4aaaddac92 | ||
|
|
c3220dcb60 | ||
|
|
996d5989e7 | ||
|
|
7681ac2e5a | ||
|
|
87e7f00aef | ||
|
|
0ac87fe86d | ||
|
|
ce2f294a3d | ||
|
|
2b2a033b7e | ||
|
|
f796a5863c | ||
|
|
57e3f1b2ac | ||
|
|
8f17305710 | ||
|
|
4b67527bd5 | ||
|
|
4f119d081e | ||
|
|
2e71a0bef1 | ||
|
|
1f9f07ac56 | ||
|
|
c4fe1a2fb0 | ||
|
|
b987e258b5 | ||
|
|
bdb6a08274 | ||
|
|
b2730926c8 | ||
|
|
393267b919 | ||
|
|
35f8454db3 | ||
|
|
1837101083 | ||
|
|
aa80f52838 | ||
|
|
a5e1906196 | ||
|
|
9dc607e7ee | ||
|
|
1a79b489ab | ||
|
|
3bdacd4b52 | ||
|
|
f08506d690 | ||
|
|
1d29dd8df4 | ||
|
|
25b953cebd | ||
|
|
ff2f5c89da | ||
|
|
2cd35cccd1 | ||
|
|
da399601e1 | ||
|
|
4ceec26a0e | ||
|
|
b765830584 | ||
|
|
44bff55a88 | ||
|
|
84c9ec1300 | ||
|
|
f1c09a5fa9 | ||
|
|
d39f6f7a17 | ||
|
|
190d1567ca | ||
|
|
e71dc0b5e5 | ||
|
|
7d6ad6336c | ||
|
|
087b9aac7e | ||
|
|
d61573d8af | ||
|
|
c7885e8726 | ||
|
|
ebd0a419df | ||
|
|
c96aec7ba3 | ||
|
|
ddcd1d0772 | ||
|
|
bcd706f477 | ||
|
|
c17d29075e | ||
|
|
25b65b08d5 | ||
|
|
0981dd216d | ||
|
|
20b580b76f | ||
|
|
bc4cc3ccce | ||
|
|
21797f3901 | ||
|
|
91f6dbcb5b | ||
|
|
d9edb40cd5 | ||
|
|
c752b13732 | ||
|
|
bad4b8630b | ||
|
|
4f4a82c3c4 | ||
|
|
25307dc46b | ||
|
|
d873597ea2 | ||
|
|
f92a5549b5 | ||
|
|
69bf4e1ad5 | ||
|
|
9d1aaf95ed | ||
|
|
bb925ac0c8 | ||
|
|
74cda25c63 | ||
|
|
54dcbe452e | ||
|
|
946abd2e92 | ||
|
|
73d4cca615 | ||
|
|
846dd7e250 | ||
|
|
6f3e94cf24 | ||
|
|
3cbb517d64 | ||
|
|
5d945d729b | ||
|
|
cda842a6c7 | ||
|
|
480ed7d000 | ||
|
|
881a103051 | ||
|
|
4172b0b355 | ||
|
|
f6b7c41666 | ||
|
|
3d1874c69b | ||
|
|
ccfe7901c9 | ||
|
|
17e85196ae | ||
|
|
ae605d5f70 | ||
|
|
e57839e8de | ||
|
|
09bcac1c14 | ||
|
|
f5073b83ed | ||
|
|
41bfc80c4e | ||
|
|
3d2e138f50 | ||
|
|
717f024c42 | ||
|
|
a70abb3945 | ||
|
|
a755b0b281 | ||
|
|
434f6751d0 | ||
|
|
dfecf3645b | ||
|
|
62a000b631 | ||
|
|
2673f4ee98 | ||
|
|
a8d2e1d890 | ||
|
|
0511996b26 | ||
|
|
f29a29bf2f | ||
|
|
24d4107311 | ||
|
|
a46f9c37c6 | ||
|
|
2b1c68bad0 | ||
|
|
e2d23404ce | ||
|
|
db208ed55e | ||
|
|
b87a9f1e2f | ||
|
|
a1ac1e450d | ||
|
|
6764ea6c3b | ||
|
|
8a52020186 | ||
|
|
695b836852 | ||
|
|
71d7c30032 | ||
|
|
5ca4f036c7 | ||
|
|
1ffe61f01f | ||
|
|
5e331b9ffa | ||
|
|
09bdae90e2 | ||
|
|
37cc8f4fe1 | ||
|
|
925e083b8d | ||
|
|
6dc42278c4 | ||
|
|
12c227badb | ||
|
|
181a9f842c | ||
|
|
b79d801c0f | ||
|
|
fc3691336d | ||
|
|
bcd879ebc8 | ||
|
|
b646db4828 | ||
|
|
426d52e359 | ||
|
|
17199dd9c0 | ||
|
|
c680c2827b | ||
|
|
2dbf8d31f7 | ||
|
|
a3753e557c | ||
|
|
ec80abdc8e | ||
|
|
1ef7d24c22 | ||
|
|
4b6f6996ae | ||
|
|
c930ee94c5 | ||
|
|
e88edbef5a | ||
|
|
ac13ed3359 | ||
|
|
faae0d44e6 | ||
|
|
7d8ec04ad6 | ||
|
|
8629e6ae9e | ||
|
|
6e311d46a6 | ||
|
|
006e983c14 | ||
|
|
5db3e06a81 | ||
|
|
2ced7b7f91 | ||
|
|
042baa418b | ||
|
|
deb928da12 | ||
|
|
a7f5cc01d3 | ||
|
|
414b6a26d9 | ||
|
|
c069672e62 | ||
|
|
167d9dafa2 | ||
|
|
9302084f60 | ||
|
|
ac0199f596 | ||
|
|
8e8ab7ac6c | ||
|
|
f06c9ba44a | ||
|
|
6e593472d9 | ||
|
|
0bddbda36d | ||
|
|
23feb05fab | ||
|
|
a0eff4d96d | ||
|
|
b87b49d77b | ||
|
|
c05026aa15 | ||
|
|
883df63d2f | ||
|
|
da1d49b541 | ||
|
|
393ed5a210 | ||
|
|
54492b109a | ||
|
|
7eac88a31f | ||
|
|
8fec9639eb | ||
|
|
a15e1f98fa | ||
|
|
6604484765 | ||
|
|
c58f8a4058 | ||
|
|
8545016f1d | ||
|
|
9b1e84821e | ||
|
|
6505fad7bc | ||
|
|
d245904c0d | ||
|
|
0095ea1271 | ||
|
|
b41d10f514 | ||
|
|
8e3d6a0af6 | ||
|
|
1e4995c5ce | ||
|
|
710e3613a8 | ||
|
|
28331c1037 | ||
|
|
202c0718b7 | ||
|
|
a985963661 | ||
|
|
f673b325fd | ||
|
|
5f4a7a1e69 | ||
|
|
d54b2a73c8 | ||
|
|
8e7bb4ba3b | ||
|
|
d595de5786 | ||
|
|
31394fa98c | ||
|
|
af595d3df8 | ||
|
|
81377a2b38 | ||
|
|
35bdd1deeb | ||
|
|
a1ec53edb9 | ||
|
|
aa130d3fc9 | ||
|
|
0f0bf3a401 | ||
|
|
73b9c61080 | ||
|
|
501806909a | ||
|
|
77dd96b3b9 | ||
|
|
505b145bb3 | ||
|
|
ba5592015d | ||
|
|
10c90a01f2 | ||
|
|
abaa799628 | ||
|
|
9e148d1464 | ||
|
|
9fa646132d | ||
|
|
f98ba00551 | ||
|
|
bc1e0ea542 | ||
|
|
9ebb684d5c | ||
|
|
91713f1140 | ||
|
|
377676cda4 | ||
|
|
8e445bb80d | ||
|
|
f0bde1efc4 | ||
|
|
4be6f341da | ||
|
|
dd62f1a7b3 | ||
|
|
1cdd4d0e15 | ||
|
|
e4e1e67855 | ||
|
|
867d2394de | ||
|
|
eb54c2fda5 | ||
|
|
deacf5a49a |
@@ -1,61 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"project": {
|
||||
"name": "youtube-dl-material"
|
||||
},
|
||||
"apps": [
|
||||
{
|
||||
"root": "src",
|
||||
"outDir": "dist",
|
||||
"assets": [
|
||||
"assets",
|
||||
"favicon.ico",
|
||||
"backend/audio",
|
||||
"backend/video",
|
||||
"backend",
|
||||
{ "glob": "default.json", "input": "./", "output": "../backend/config/", "allowOutsideOutDir": true }
|
||||
],
|
||||
"index": "index.html",
|
||||
"main": "main.ts",
|
||||
"polyfills": "polyfills.ts",
|
||||
"test": "test.ts",
|
||||
"tsconfig": "tsconfig.app.json",
|
||||
"testTsconfig": "tsconfig.spec.json",
|
||||
"prefix": "app",
|
||||
"styles": [
|
||||
"styles.css"
|
||||
],
|
||||
"scripts": [],
|
||||
"environmentSource": "environments/environment.ts",
|
||||
"environments": {
|
||||
"dev": "environments/environment.ts",
|
||||
"prod": "environments/environment.prod.ts"
|
||||
}
|
||||
}
|
||||
],
|
||||
"e2e": {
|
||||
"protractor": {
|
||||
"config": "./protractor.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": [
|
||||
{
|
||||
"project": "src/tsconfig.app.json"
|
||||
},
|
||||
{
|
||||
"project": "src/tsconfig.spec.json"
|
||||
},
|
||||
{
|
||||
"project": "e2e/tsconfig.e2e.json"
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"karma": {
|
||||
"config": "./karma.conf.js"
|
||||
}
|
||||
},
|
||||
"defaults": {
|
||||
"styleExt": "css",
|
||||
"component": {}
|
||||
}
|
||||
}
|
||||
14
.gitignore
vendored
14
.gitignore
vendored
@@ -43,6 +43,18 @@ Thumbs.db
|
||||
|
||||
node_modules/*
|
||||
backend/node_modules/*
|
||||
backend/public/*
|
||||
YoutubeDL-Material/node_modules/*
|
||||
backend/video/*
|
||||
backend/audio/*
|
||||
backend/audio/*
|
||||
backend/public/*
|
||||
backend/subscriptions/archives/*
|
||||
backend/subscriptions/playlists/*
|
||||
backend/subscriptions/channels/*
|
||||
backend/db.json
|
||||
backend/subscriptions/channels/*
|
||||
backend/subscriptions/playlists/*
|
||||
backend/subscriptions/archives/*
|
||||
src/assets/default.json
|
||||
package-lock.json
|
||||
backend/package-lock.json
|
||||
|
||||
21
.vscode/launch.json
vendored
Normal file
21
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"name": "Attach",
|
||||
"port": 9229
|
||||
},
|
||||
{
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"name": "Launch chrome against localhost",
|
||||
"url": "http://localhost:4200",
|
||||
"webRoot": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
||||
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
FROM alpine:3.11
|
||||
|
||||
RUN apk add --update npm python ffmpeg
|
||||
|
||||
# Change directory so that our commands run inside this new directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy dependency definitions
|
||||
COPY ./ /app/
|
||||
|
||||
# Change directory to backend
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies on backend
|
||||
RUN npm install
|
||||
|
||||
# Expose the port the app runs in
|
||||
EXPOSE 17442
|
||||
|
||||
# Run the specified command within the container.
|
||||
CMD [ "node", "app.js" ]
|
||||
7
LICENSE.md
Normal file
7
LICENSE.md
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright 2018 Isaac Grynsztein
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
120
README.md
120
README.md
@@ -1,28 +1,118 @@
|
||||
# YoutubeDLMaterial
|
||||
# YoutubeDL-Material
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.1.2.
|
||||
YoutubeDL-Material is a Material Design frontend for [youtube-dl](https://rg3.github.io/youtube-dl/). It's coded using [Angular 9](https://angular.io/) for the frontend, and [Node.js](https://nodejs.org/) on the backend.
|
||||
|
||||
## Development server
|
||||
Now with [Docker](#Docker) support!
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
## Getting Started
|
||||
|
||||
## Code scaffolding
|
||||
Check out the prerequisites, and go to the installation section. Easy as pie!
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|module`.
|
||||
Here's an image of what it'll look like once you're done:
|
||||
|
||||
## Build
|
||||

|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
|
||||
With optional file management enabled (default):
|
||||
|
||||
## Running unit tests
|
||||

|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
Dark mode:
|
||||
|
||||
## Running end-to-end tests
|
||||

|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||
Before running the tests make sure you are serving the app via `ng serve`.
|
||||
### Prerequisites
|
||||
|
||||
## Further help
|
||||
NOTE: If you would like to use Docker, you can skip down to the [Docker](#Docker) section for a setup guide.
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||
Make sure you have these dependencies installed on your system: nodejs and youtube-dl. If you don't, run this command:
|
||||
|
||||
```
|
||||
sudo apt-get install nodejs youtube-dl
|
||||
```
|
||||
|
||||
### Installing
|
||||
|
||||
1. First, download the [latest release](https://github.com/Tzahi12345/YoutubeDL-Material/releases/latest)!
|
||||
|
||||
2. Drag the `youtubedl-material` directory to an easily accessible directory. Navigate to the `appdata` folder and edit the `default.json` file. If you're using SSL encryption, look at the `encrypted.json` file for a template.
|
||||
|
||||
NOTE: If you are intending to use a reverse proxy, this next step is not necessary
|
||||
|
||||
3. Port forward the port listed in `default.json`, which defaults to `17442`.
|
||||
|
||||
4. Once the configuration is done, run `npm install` to install all the backend dependencies. Once that is finished, type `nodejs app.js`. This will run the backend server, which serves the frontend as well. On your browser, navigate to to the server (url with the specified port). Try putting in a youtube link to see if it works. If it does, viola! YoutubeDL-Material is now up and running.
|
||||
|
||||
If you experience problems, know that it's usually caused by a configuration problem. The first thing you should do is check the console. To get there, right click anywhere on the page and click "Inspect element." Then on the menu that pops up, click console. Look at the error there, and try to investigate.
|
||||
|
||||
### Configuration
|
||||
|
||||
NOTE: If you are using YoutubeDL-Material v3.2 or lower, click [here](https://github.com/Tzahi12345/YoutubeDL-Material/blob/b87a9f1e2fd896b8e3b2f12429b7ffb15ea4521b/README.md#configuration) for the old README
|
||||
|
||||
Here is an explanation for the configuration entries. Check out the [default config](https://github.com/Tzahi12345/YoutubeDL-Material/blob/master/backend/config/default.json) for more context.
|
||||
|
||||
| Config item | Description | Default |
|
||||
| ------------- | ------------- | ------------- |
|
||||
| url | URL to the server hosting YoutubeDL-Material | "http://example.com" |
|
||||
| port | Desired port for YoutubeDL-Material | "17442" |
|
||||
| use-encryption | true if you intend to use SSL encryption (https) | false |
|
||||
| cert-file-path | Cert file path - required if using encryption | "/etc/letsencrypt/live/example.com/fullchain.pem" |
|
||||
| key-file-path | Private key file path - required if using encryption | "/etc/letsencrypt/live/example.com/privkey.pem" |
|
||||
| path-audio | Path to audio folder for saved mp3s | "audio/" |
|
||||
| path-video | Path to video folder for saved mp4s | "video/" |
|
||||
| title_top | Title shown on the top toolbar | "Youtube Downloader" |
|
||||
| file_manager_enabled | true if you want to use the file manager | true |
|
||||
| allow_quality_select | true if you want to select a videos quality level before downloading | true |
|
||||
| download_only_mode | true if you want files to directly download to the client with no media player | false |
|
||||
| allow_multi_download_mode | true if you want the ability to download multiple videos at the same time | true |
|
||||
| use_youtube_API | true if you want to use the Youtube API which is used for YT searches | false |
|
||||
| youtube_API_key | Youtube API key. Required if use_youtube_API is enabled | "" |
|
||||
| default_theme | Default theme to use. Options are "default" and "dark" | "default" |
|
||||
| allow_theme_change | true if you want the icon in the top toolbar that toggles dark mode | true |
|
||||
| use_default_downloading_agent | true if you want to use youtube-dl's default downloader | true |
|
||||
| custom_downloading_agent | If not using the default downloader, this is the downloader you want to use | "" |
|
||||
| allow_advanced_download | true if you want to use the Advanced download options | false |
|
||||
|
||||
## Build it yourself
|
||||
|
||||
If you'd like to install YoutubeDL-Material, go to the Installation section. If you want to build it yourself and/or develop the repository, then this section is for you.
|
||||
|
||||
To deploy, simply clone the repository, and go into the `youtubedl-material` directory. Type `npm install` and all the dependencies will install. Then type `cd backend` and again type `npm install` to install the dependencies for the backend.
|
||||
|
||||
Once you do that, you're almost up and running. All you need to do is edit the configuration in `youtubedl-material/appdata`, go back into the `youtubedl-material` directory, and type `ng build --prod`. This will build the app, and put the output files in the `youtubedl-material/dist` folder. Drag those files into the `public` directory in the `backend` folder.
|
||||
|
||||
The frontend is now complete. The backend is much easier. Just go into the `backend` folder, and type `nodejs app.js`.
|
||||
|
||||
Finally, port forward the port specified in the config (defaults to `17442`) and point it to the server's IP address. Make sure the port is also allowed through the server's firewall.
|
||||
|
||||
## Docker
|
||||
|
||||
If you are looking to setup YoutubeDL-Material with Docker, this section is for you. And you're in luck! Docker setup is quite simple.
|
||||
|
||||
1. Run `curl -L https://github.com/Tzahi12345/YoutubeDL-Material/releases/latest/download/docker-compose.yml -o docker-compose.yml` to download the latest release of `docker-compose.yml`, or go to the [releases](https://github.com/Tzahi12345/YoutubeDL-Material/releases/) page to grab the version you'd like.
|
||||
2. Modify the config items in the `environment` section of `docker-compose.yml` to your liking. The default options will work, however, and point to `http://localhost:8998`. You can find an explanation of these configuration items in [Configuration](#Configuration) section.
|
||||
3. Run `docker-compose pull`. This will download the official YoutubeDL-Material docker image.
|
||||
4. Run `docker-compose up` to start it up. If successful, it should say "HTTP(S): Started on port 8998" or something similar.
|
||||
5. Make sure you can connect to the specified URL + port, and if so, you are done!
|
||||
|
||||
## API
|
||||
|
||||
View how to use the backend API on the [API Wiki page](https://github.com/Tzahi12345/YoutubeDL-Material/wiki/API).
|
||||
|
||||
## Contributing
|
||||
|
||||
Feel free to submit a pull request! I have no guidelines as of yet, so no need to worry about that.
|
||||
|
||||
## Authors
|
||||
|
||||
* **Isaac Grynsztein** (me!) - *Initial work*
|
||||
|
||||
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
* youtube-dl
|
||||
* [AllTube](https://github.com/Rudloff/alltube) (for the inspiration)
|
||||
|
||||
204
angular.json
Normal file
204
angular.json
Normal file
@@ -0,0 +1,204 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"youtube-dl-material": {
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"projectType": "application",
|
||||
"i18n": {
|
||||
"sourceLocale": "en-US",
|
||||
"locales": {
|
||||
"es": "src/locale/messages.es.xlf"
|
||||
}
|
||||
},
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"aot": true,
|
||||
"outputPath": "dist",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"tsConfig": "src/tsconfig.app.json",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"assets": [
|
||||
"src/assets",
|
||||
"src/favicon.ico",
|
||||
"src/backend/audio",
|
||||
"src/backend/video",
|
||||
"src/backend"
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "6kb"
|
||||
}
|
||||
],
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"extractCss": true,
|
||||
"namedChunks": false,
|
||||
"aot": true,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false,
|
||||
"buildOptimizer": true,
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
]
|
||||
},
|
||||
"es": {
|
||||
"localize": ["es"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "youtube-dl-material:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "youtube-dl-material:build:production"
|
||||
},
|
||||
"es": {
|
||||
"browserTarget": "youtube-dl-material:build:es"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "youtube-dl-material:build"
|
||||
}
|
||||
},
|
||||
"serve-electron": {
|
||||
"builder": "@angular-guru/electron-builder:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "youtube-dl-material:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "youtube-dl-material:build:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"electron": {
|
||||
"builder": "@angular-guru/electron-builder:build",
|
||||
"options": {
|
||||
"outputPath": "dist",
|
||||
"index": "src/index.html",
|
||||
"main": "main.js",
|
||||
"tsConfig": "src/tsconfig.app.json",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"assets": [
|
||||
"src/assets",
|
||||
"src/favicon.ico",
|
||||
"src/backend/audio",
|
||||
"src/backend/video",
|
||||
"src/backend"
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"extractCss": true,
|
||||
"namedChunks": false,
|
||||
"aot": true,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false,
|
||||
"buildOptimizer": true,
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"karmaConfig": "./karma.conf.js",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "src/tsconfig.spec.json",
|
||||
"scripts": [],
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
],
|
||||
"assets": [
|
||||
"src/assets",
|
||||
"src/favicon.ico",
|
||||
"src/backend/audio",
|
||||
"src/backend/video",
|
||||
"src/backend"
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"src/tsconfig.app.json",
|
||||
"src/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"youtube-dl-material-e2e": {
|
||||
"root": "e2e",
|
||||
"sourceRoot": "e2e",
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"e2e": {
|
||||
"builder": "@angular-devkit/build-angular:protractor",
|
||||
"options": {
|
||||
"protractorConfig": "./protractor.conf.js",
|
||||
"devServerTarget": "youtube-dl-material:serve"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"e2e/tsconfig.e2e.json"
|
||||
],
|
||||
"exclude": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "youtube-dl-material",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"prefix": "app",
|
||||
"style": "scss"
|
||||
},
|
||||
"@schematics/angular:directive": {
|
||||
"prefix": "app"
|
||||
}
|
||||
}
|
||||
}
|
||||
1599
backend/app.js
1599
backend/app.js
File diff suppressed because it is too large
Load Diff
46
backend/appdata/default.json
Normal file
46
backend/appdata/default.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"YoutubeDLMaterial": {
|
||||
"Host": {
|
||||
"url": "http://example.com",
|
||||
"port": "17442"
|
||||
},
|
||||
"Encryption": {
|
||||
"use-encryption": false,
|
||||
"cert-file-path": "/etc/letsencrypt/live/example.com/fullchain.pem",
|
||||
"key-file-path": "/etc/letsencrypt/live/example.com/privkey.pem"
|
||||
},
|
||||
"Downloader": {
|
||||
"path-audio": "audio/",
|
||||
"path-video": "video/",
|
||||
"use_youtubedl_archive": false,
|
||||
"custom_args": ""
|
||||
},
|
||||
"Extra": {
|
||||
"title_top": "Youtube Downloader",
|
||||
"file_manager_enabled": true,
|
||||
"allow_quality_select": true,
|
||||
"download_only_mode": false,
|
||||
"allow_multi_download_mode": true,
|
||||
"settings_pin_required": false
|
||||
},
|
||||
"API": {
|
||||
"use_youtube_API": false,
|
||||
"youtube_API_key": ""
|
||||
},
|
||||
"Themes": {
|
||||
"default_theme": "default",
|
||||
"allow_theme_change": true
|
||||
},
|
||||
"Subscriptions": {
|
||||
"allow_subscriptions": true,
|
||||
"subscriptions_base_path": "subscriptions/",
|
||||
"subscriptions_check_interval": "300",
|
||||
"subscriptions_use_youtubedl_archive": true
|
||||
},
|
||||
"Advanced": {
|
||||
"use_default_downloading_agent": true,
|
||||
"custom_downloading_agent": "",
|
||||
"allow_advanced_download": false
|
||||
}
|
||||
}
|
||||
}
|
||||
46
backend/appdata/encrypted.json
Normal file
46
backend/appdata/encrypted.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"YoutubeDLMaterial": {
|
||||
"Host": {
|
||||
"url": "https://example.com",
|
||||
"port": "17442"
|
||||
},
|
||||
"Encryption": {
|
||||
"use-encryption": true,
|
||||
"cert-file-path": "/etc/letsencrypt/live/example.com/fullchain.pem",
|
||||
"key-file-path": "/etc/letsencrypt/live/example.com/privkey.pem"
|
||||
},
|
||||
"Downloader": {
|
||||
"path-audio": "audio/",
|
||||
"path-video": "video/",
|
||||
"use_youtubedl_archive": false,
|
||||
"custom_args": ""
|
||||
},
|
||||
"Extra": {
|
||||
"title_top": "Youtube Downloader",
|
||||
"file_manager_enabled": true,
|
||||
"allow_quality_select": true,
|
||||
"download_only_mode": false,
|
||||
"allow_multi_download_mode": true,
|
||||
"settings_pin_required": false
|
||||
},
|
||||
"API": {
|
||||
"use_youtube_API": false,
|
||||
"youtube_API_key": ""
|
||||
},
|
||||
"Themes": {
|
||||
"default_theme": "default",
|
||||
"allow_theme_change": true
|
||||
},
|
||||
"Subscriptions": {
|
||||
"allow_subscriptions": true,
|
||||
"subscriptions_base_path": "subscriptions/",
|
||||
"subscriptions_check_interval": "300",
|
||||
"subscriptions_use_youtubedl_archive": true
|
||||
},
|
||||
"Advanced": {
|
||||
"use_default_downloading_agent": true,
|
||||
"custom_downloading_agent": "",
|
||||
"allow_advanced_download": false
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
backend/aria2c.exe
Normal file
BIN
backend/aria2c.exe
Normal file
Binary file not shown.
118
backend/config.js
Normal file
118
backend/config.js
Normal file
@@ -0,0 +1,118 @@
|
||||
const fs = require('fs');
|
||||
|
||||
let CONFIG_ITEMS = require('./consts.js')['CONFIG_ITEMS'];
|
||||
const debugMode = process.env.YTDL_MODE === 'debug';
|
||||
|
||||
let configPath = debugMode ? '../src/assets/default.json' : 'appdata/default.json';
|
||||
|
||||
// https://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key
|
||||
Object.byString = function(o, s) {
|
||||
s = s.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
|
||||
s = s.replace(/^\./, ''); // strip a leading dot
|
||||
var a = s.split('.');
|
||||
for (var i = 0, n = a.length; i < n; ++i) {
|
||||
var k = a[i];
|
||||
if (k in o) {
|
||||
o = o[k];
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
function getParentPath(path) {
|
||||
let elements = path.split('.');
|
||||
elements.splice(elements.length - 1, 1);
|
||||
return elements.join('.');
|
||||
}
|
||||
|
||||
function getElementNameInConfig(path) {
|
||||
let elements = path.split('.');
|
||||
return elements[elements.length - 1];
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets config file and returns as a json
|
||||
*/
|
||||
function getConfigFile() {
|
||||
let raw_data = fs.readFileSync(configPath);
|
||||
try {
|
||||
let parsed_data = JSON.parse(raw_data);
|
||||
return parsed_data;
|
||||
} catch(e) {
|
||||
console.log('ERROR: Failed to get config file');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function setConfigFile(config) {
|
||||
try {
|
||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getConfigItem(key) {
|
||||
let config_json = getConfigFile();
|
||||
if (!CONFIG_ITEMS[key]) {
|
||||
console.log('cannot find config with key ' + key);
|
||||
return null;
|
||||
}
|
||||
let path = CONFIG_ITEMS[key]['path'];
|
||||
return Object.byString(config_json, path);
|
||||
};
|
||||
|
||||
function setConfigItem(key, value) {
|
||||
let success = false;
|
||||
let config_json = getConfigFile();
|
||||
let path = CONFIG_ITEMS[key]['path'];
|
||||
let parent_path = getParentPath(path);
|
||||
let element_name = getElementNameInConfig(path);
|
||||
|
||||
let parent_object = Object.byString(config_json, parent_path);
|
||||
if (value === 'false' || value === 'true') {
|
||||
parent_object[element_name] = (value === 'true');
|
||||
} else {
|
||||
parent_object[element_name] = value;
|
||||
}
|
||||
|
||||
success = setConfigFile(config_json);
|
||||
|
||||
return success;
|
||||
};
|
||||
|
||||
function setConfigItems(items) {
|
||||
let success = false;
|
||||
let config_json = getConfigFile();
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let key = items[i].key;
|
||||
let value = items[i].value;
|
||||
|
||||
// if boolean strings, set to booleans again
|
||||
if (value === 'false' || value === 'true') {
|
||||
value = (value === 'true');
|
||||
}
|
||||
|
||||
let item_path = CONFIG_ITEMS[key]['path'];
|
||||
let item_parent_path = getParentPath(item_path);
|
||||
let item_element_name = getElementNameInConfig(item_path);
|
||||
|
||||
let item_parent_object = Object.byString(config_json, item_parent_path);
|
||||
item_parent_object[item_element_name] = value;
|
||||
}
|
||||
|
||||
success = setConfigFile(config_json);
|
||||
return success;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getConfigItem: getConfigItem,
|
||||
setConfigItem: setConfigItem,
|
||||
setConfigItems: setConfigItems,
|
||||
getConfigFile: getConfigFile,
|
||||
setConfigFile: setConfigFile,
|
||||
CONFIG_ITEMS: CONFIG_ITEMS
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"YoutubeDL-Material": {
|
||||
"Host": {
|
||||
"frontend-url": "http://localhost:4200",
|
||||
"backend-url": "youtubedl.grynsztein.com",
|
||||
"backend-port": "8088"
|
||||
},
|
||||
"Encryption": {
|
||||
"use-encryption": false,
|
||||
"cert-file-path": "fullchain.pem",
|
||||
"key-file-path": "privkey.pem"
|
||||
},
|
||||
"Downloader": {
|
||||
"path-base": "http://localhost:8088/",
|
||||
"path-audio": "audio/",
|
||||
"path-video": "video/"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"YoutubeDLMaterial": {
|
||||
"Host": {
|
||||
"frontendurl": "http://localhost:4200",
|
||||
"backendurl": "https://youtubedl.grynsztein.com/"
|
||||
},
|
||||
"Encryption": {
|
||||
"use-encryption": false,
|
||||
"cert-file-path": "cert.pem",
|
||||
"key-file-path": "privkey.pem"
|
||||
},
|
||||
"Downloader": {
|
||||
"path-base": "http://localhost:8088/",
|
||||
"path-audio": "audio/",
|
||||
"path-video": "video/"
|
||||
},
|
||||
"Extra": {
|
||||
"title_top": "Youtube Downloader"
|
||||
}
|
||||
}
|
||||
}
|
||||
127
backend/consts.js
Normal file
127
backend/consts.js
Normal file
@@ -0,0 +1,127 @@
|
||||
let CONFIG_ITEMS = {
|
||||
// Host
|
||||
'ytdl_url': {
|
||||
'key': 'ytdl_url',
|
||||
'path': 'YoutubeDLMaterial.Host.url'
|
||||
},
|
||||
'ytdl_port': {
|
||||
'key': 'ytdl_port',
|
||||
'path': 'YoutubeDLMaterial.Host.port'
|
||||
},
|
||||
|
||||
// Encryption
|
||||
'ytdl_use_encryption': {
|
||||
'key': 'ytdl_use_encryption',
|
||||
'path': 'YoutubeDLMaterial.Encryption.use-encryption'
|
||||
},
|
||||
'ytdl_cert_file_path': {
|
||||
'key': 'ytdl_cert_file_path',
|
||||
'path': 'YoutubeDLMaterial.Encryption.cert-file-path'
|
||||
},
|
||||
'ytdl_key_file_path': {
|
||||
'key': 'ytdl_key_file_path',
|
||||
'path': 'YoutubeDLMaterial.Encryption.key-file-path'
|
||||
},
|
||||
|
||||
// Downloader
|
||||
'ytdl_audio_folder_path': {
|
||||
'key': 'ytdl_audio_folder_path',
|
||||
'path': 'YoutubeDLMaterial.Downloader.path-audio'
|
||||
},
|
||||
'ytdl_video_folder_path': {
|
||||
'key': 'ytdl_video_folder_path',
|
||||
'path': 'YoutubeDLMaterial.Downloader.path-video'
|
||||
},
|
||||
'ytdl_use_youtubedl_archive': {
|
||||
'key': 'ytdl_use_youtubedl_archive',
|
||||
'path': 'YoutubeDLMaterial.Downloader.use_youtubedl_archive'
|
||||
},
|
||||
'ytdl_custom_args': {
|
||||
'key': 'ytdl_custom_args',
|
||||
'path': 'YoutubeDLMaterial.Downloader.custom_args'
|
||||
},
|
||||
|
||||
// Extra
|
||||
'ytdl_title_top': {
|
||||
'key': 'ytdl_title_top',
|
||||
'path': 'YoutubeDLMaterial.Extra.title_top'
|
||||
},
|
||||
'ytdl_file_manager_enabled': {
|
||||
'key': 'ytdl_file_manager_enabled',
|
||||
'path': 'YoutubeDLMaterial.Extra.file_manager_enabled'
|
||||
},
|
||||
'ytdl_allow_quality_select': {
|
||||
'key': 'ytdl_allow_quality_select',
|
||||
'path': 'YoutubeDLMaterial.Extra.allow_quality_select'
|
||||
},
|
||||
'ytdl_download_only_mode': {
|
||||
'key': 'ytdl_download_only_mode',
|
||||
'path': 'YoutubeDLMaterial.Extra.download_only_mode'
|
||||
},
|
||||
'ytdl_allow_multi_download_mode': {
|
||||
'key': 'ytdl_allow_multi_download_mode',
|
||||
'path': 'YoutubeDLMaterial.Extra.allow_multi_download_mode'
|
||||
},
|
||||
'ytdl_settings_pin_required': {
|
||||
'key': 'ytdl_settings_pin_required',
|
||||
'path': 'YoutubeDLMaterial.Extra.settings_pin_required'
|
||||
},
|
||||
|
||||
// API
|
||||
'ytdl_use_youtube_api': {
|
||||
'key': 'ytdl_use_youtube_api',
|
||||
'path': 'YoutubeDLMaterial.API.use_youtube_API'
|
||||
},
|
||||
'ytdl_youtube_api_key': {
|
||||
'key': 'ytdl_youtube_api_key',
|
||||
'path': 'YoutubeDLMaterial.API.youtube_API_key'
|
||||
},
|
||||
|
||||
// Themes
|
||||
'ytdl_default_theme': {
|
||||
'key': 'ytdl_default_theme',
|
||||
'path': 'YoutubeDLMaterial.Themes.default_theme'
|
||||
},
|
||||
'ytdl_allow_theme_change': {
|
||||
'key': 'ytdl_allow_theme_change',
|
||||
'path': 'YoutubeDLMaterial.Themes.allow_theme_change'
|
||||
},
|
||||
|
||||
// Subscriptions
|
||||
'ytdl_allow_subscriptions': {
|
||||
'key': 'ytdl_allow_subscriptions',
|
||||
'path': 'YoutubeDLMaterial.Subscriptions.allow_subscriptions'
|
||||
},
|
||||
'ytdl_subscriptions_base_path': {
|
||||
'key': 'ytdl_subscriptions_base_path',
|
||||
'path': 'YoutubeDLMaterial.Subscriptions.subscriptions_base_path'
|
||||
},
|
||||
'ytdl_subscriptions_check_interval': {
|
||||
'key': 'ytdl_subscriptions_check_interval',
|
||||
'path': 'YoutubeDLMaterial.Subscriptions.subscriptions_check_interval'
|
||||
},
|
||||
'ytdl_subscriptions_check_interval': {
|
||||
'key': 'ytdl_subscriptions_check_interval',
|
||||
'path': 'YoutubeDLMaterial.Subscriptions.subscriptions_check_interval'
|
||||
},
|
||||
'ytdl_subscriptions_use_youtubedl_archive': {
|
||||
'key': 'ytdl_use_youtubedl_archive',
|
||||
'path': 'YoutubeDLMaterial.Subscriptions.subscriptions_use_youtubedl_archive'
|
||||
},
|
||||
|
||||
// Advanced
|
||||
'ytdl_use_default_downloading_agent': {
|
||||
'key': 'ytdl_use_default_downloading_agent',
|
||||
'path': 'YoutubeDLMaterial.Advanced.use_default_downloading_agent'
|
||||
},
|
||||
'ytdl_custom_downloading_agent': {
|
||||
'key': 'ytdl_custom_downloading_agent',
|
||||
'path': 'YoutubeDLMaterial.Advanced.custom_downloading_agent'
|
||||
},
|
||||
'ytdl_allow_advanced_download': {
|
||||
'key': 'ytdl_allow_advanced_download',
|
||||
'path': 'YoutubeDLMaterial.Advanced.allow_advanced_download'
|
||||
},
|
||||
};
|
||||
|
||||
module.exports.CONFIG_ITEMS = CONFIG_ITEMS;
|
||||
1345
backend/package-lock.json
generated
Normal file
1345
backend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,23 +1,36 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"version": "1.0.0",
|
||||
"description": "backend for hda",
|
||||
"description": "backend for YoutubeDL-Material",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node app.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Tzahi12345/hda-backend.git"
|
||||
"url": ""
|
||||
},
|
||||
"author": "Isaac Grynsztein",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Tzahi12345/hda-backend/issues"
|
||||
"url": ""
|
||||
},
|
||||
"homepage": "https://github.com/Tzahi12345/hda-backend#readme",
|
||||
"homepage": "",
|
||||
"dependencies": {
|
||||
"archiver": "^3.1.1",
|
||||
"async": "^3.1.0",
|
||||
"compression": "^1.7.4",
|
||||
"config": "^3.2.3",
|
||||
"exe": "^1.0.2",
|
||||
"youtube-dl": "1.11.1"
|
||||
"express": "^4.17.1",
|
||||
"lowdb": "^1.0.0",
|
||||
"md5": "^2.2.1",
|
||||
"node-id3": "^0.1.14",
|
||||
"merge-files": "^0.1.2",
|
||||
"node-fetch": "^2.6.0",
|
||||
"shortid": "^2.2.15",
|
||||
"uuidv4": "^6.0.6",
|
||||
"youtube-dl": "^3.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
316
backend/subscriptions.js
Normal file
316
backend/subscriptions.js
Normal file
@@ -0,0 +1,316 @@
|
||||
const low = require('lowdb')
|
||||
const FileSync = require('lowdb/adapters/FileSync')
|
||||
|
||||
var fs = require('fs');
|
||||
const { uuid } = require('uuidv4');
|
||||
var path = require('path');
|
||||
|
||||
var youtubedl = require('youtube-dl');
|
||||
const config_api = require('./config');
|
||||
|
||||
const adapter = new FileSync('./appdata/db.json');
|
||||
const db = low(adapter)
|
||||
|
||||
const debugMode = process.env.YTDL_MODE === 'debug';
|
||||
|
||||
async function subscribe(sub) {
|
||||
const result_obj = {
|
||||
success: false,
|
||||
error: ''
|
||||
};
|
||||
return new Promise(async resolve => {
|
||||
// sub should just have url and name. here we will get isPlaylist and path
|
||||
sub.isPlaylist = sub.url.includes('playlist');
|
||||
|
||||
if (db.get('subscriptions').find({url: sub.url}).value()) {
|
||||
console.log('Sub already exists');
|
||||
result_obj.error = 'Subcription with URL ' + sub.url + ' already exists!';
|
||||
resolve(result_obj);
|
||||
return;
|
||||
}
|
||||
|
||||
// add sub to db
|
||||
db.get('subscriptions').push(sub).write();
|
||||
|
||||
let success = await getSubscriptionInfo(sub);
|
||||
result_obj.success = success;
|
||||
result_obj.sub = sub;
|
||||
getVideosForSub(sub);
|
||||
resolve(result_obj);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async function getSubscriptionInfo(sub) {
|
||||
const basePath = config_api.getConfigItem('ytdl_subscriptions_base_path');
|
||||
return new Promise(resolve => {
|
||||
// get videos
|
||||
let downloadConfig = ['--dump-json', '--playlist-end', '1']
|
||||
youtubedl.exec(sub.url, downloadConfig, {}, function(err, output) {
|
||||
if (debugMode) {
|
||||
console.log('Subscribe: got info for subscription ' + sub.id);
|
||||
}
|
||||
if (err) {
|
||||
console.log(err.stderr);
|
||||
resolve(false);
|
||||
} else if (output) {
|
||||
if (output.length === 0 || (output.length === 1 && output[0] === '')) {
|
||||
if (debugMode) console.log('Could not get info for ' + sub.id);
|
||||
resolve(false);
|
||||
}
|
||||
for (let i = 0; i < output.length; i++) {
|
||||
let output_json = null;
|
||||
try {
|
||||
output_json = JSON.parse(output[i]);
|
||||
} catch(e) {
|
||||
output_json = null;
|
||||
}
|
||||
if (!output_json) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sub.name) {
|
||||
sub.name = sub.isPlaylist ? output_json.playlist_title : output_json.uploader;
|
||||
// if it's now valid, update
|
||||
if (sub.name) {
|
||||
db.get('subscriptions').find({id: sub.id}).assign({name: sub.name}).write();
|
||||
}
|
||||
}
|
||||
|
||||
if (!sub.archive) {
|
||||
// must create the archive
|
||||
const archive_dir = basePath + 'archives/' + sub.name;
|
||||
const archive_path = path.join(archive_dir, 'archive.txt');
|
||||
|
||||
// creates archive directory and text file if it doesn't exist
|
||||
if (!fs.existsSync(archive_dir)) {
|
||||
fs.mkdirSync(archive_dir);
|
||||
fs.closeSync(fs.openSync(archive_path, 'w'));
|
||||
} else if (!fs.existsSync(archive_path)) {
|
||||
fs.closeSync(fs.openSync(archive_path, 'w'));
|
||||
}
|
||||
|
||||
// updates subscription
|
||||
sub.archive = archive_dir;
|
||||
db.get('subscriptions').find({id: sub.id}).assign({archive: archive_dir}).write();
|
||||
}
|
||||
|
||||
// TODO: get even more info
|
||||
|
||||
resolve(true);
|
||||
}
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function unsubscribe(sub, deleteMode) {
|
||||
return new Promise(async resolve => {
|
||||
const basePath = config_api.getConfigItem('ytdl_subscriptions_base_path');
|
||||
let result_obj = { success: false, error: '' };
|
||||
|
||||
let id = sub.id;
|
||||
db.get('subscriptions').remove({id: id}).write();
|
||||
|
||||
const appendedBasePath = getAppendedBasePath(sub, basePath);
|
||||
if (deleteMode && fs.existsSync(appendedBasePath)) {
|
||||
if (sub.archive && fs.existsSync(sub.archive)) {
|
||||
const archive_file_path = path.join(sub.archive, 'archive.txt');
|
||||
// deletes archive if it exists
|
||||
if (fs.existsSync(archive_file_path)) {
|
||||
fs.unlinkSync(archive_file_path);
|
||||
}
|
||||
fs.rmdirSync(sub.archive);
|
||||
}
|
||||
deleteFolderRecursive(appendedBasePath);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async function deleteSubscriptionFile(sub, file, deleteForever) {
|
||||
const basePath = config_api.getConfigItem('ytdl_subscriptions_base_path');
|
||||
const useArchive = config_api.getConfigItem('ytdl_subscriptions_use_youtubedl_archive');
|
||||
const appendedBasePath = getAppendedBasePath(sub, basePath);
|
||||
const name = file;
|
||||
let retrievedID = null;
|
||||
return new Promise(resolve => {
|
||||
let filePath = appendedBasePath;
|
||||
var jsonPath = path.join(__dirname,filePath,name+'.info.json');
|
||||
var videoFilePath = path.join(__dirname,filePath,name+'.mp4');
|
||||
var imageFilePath = path.join(__dirname,filePath,name+'.jpg');
|
||||
|
||||
jsonExists = fs.existsSync(jsonPath);
|
||||
videoFileExists = fs.existsSync(videoFilePath);
|
||||
imageFileExists = fs.existsSync(imageFilePath);
|
||||
|
||||
if (jsonExists) {
|
||||
retrievedID = JSON.parse(fs.readFileSync(jsonPath, 'utf8'))['id'];
|
||||
fs.unlinkSync(jsonPath);
|
||||
}
|
||||
|
||||
if (imageFileExists) {
|
||||
fs.unlinkSync(imageFilePath);
|
||||
}
|
||||
|
||||
if (videoFileExists) {
|
||||
fs.unlink(videoFilePath, function(err) {
|
||||
if (fs.existsSync(jsonPath) || fs.existsSync(videoFilePath)) {
|
||||
resolve(false);
|
||||
} else {
|
||||
// check if the user wants the video to be redownloaded (deleteForever === false)
|
||||
if (!deleteForever && useArchive && sub.archive && retrievedID) {
|
||||
const archive_path = path.join(sub.archive, 'archive.txt')
|
||||
// if archive exists, remove line with video ID
|
||||
if (fs.existsSync(archive_path)) {
|
||||
removeIDFromArchive(archive_path, retrievedID);
|
||||
}
|
||||
}
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// TODO: tell user that the file didn't exist
|
||||
resolve(true);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async function getVideosForSub(sub) {
|
||||
return new Promise(resolve => {
|
||||
if (!subExists(sub.id)) {
|
||||
resolve(false);
|
||||
return;
|
||||
}
|
||||
const basePath = config_api.getConfigItem('ytdl_subscriptions_base_path');
|
||||
const useArchive = config_api.getConfigItem('ytdl_subscriptions_use_youtubedl_archive');
|
||||
|
||||
let appendedBasePath = null
|
||||
if (sub.name) {
|
||||
appendedBasePath = getAppendedBasePath(sub, basePath);
|
||||
} else {
|
||||
appendedBasePath = basePath + (sub.isPlaylist ? 'playlists/%(playlist_title)s' : 'channels/%(uploader)s');
|
||||
}
|
||||
|
||||
let downloadConfig = ['-o', appendedBasePath + '/%(title)s.mp4', '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4', '-ciw', '--write-annotations', '--write-thumbnail', '--write-info-json', '--print-json'];
|
||||
|
||||
if (sub.timerange) {
|
||||
downloadConfig.push('--dateafter', sub.timerange);
|
||||
}
|
||||
|
||||
let archive_dir = null;
|
||||
let archive_path = null;
|
||||
|
||||
if (useArchive) {
|
||||
if (sub.archive) {
|
||||
archive_dir = sub.archive;
|
||||
archive_path = path.join(archive_dir, 'archive.txt')
|
||||
}
|
||||
downloadConfig.push('--download-archive', archive_path);
|
||||
}
|
||||
|
||||
// get videos
|
||||
youtubedl.exec(sub.url, downloadConfig, {}, function(err, output) {
|
||||
if (debugMode) {
|
||||
console.log('Subscribe: got videos for subscription ' + sub.name);
|
||||
}
|
||||
if (err) {
|
||||
console.log(err.stderr);
|
||||
resolve(false);
|
||||
} else if (output) {
|
||||
if (output.length === 0 || (output.length === 1 && output[0] === '')) {
|
||||
if (debugMode) console.log('No additional videos to download for ' + sub.name);
|
||||
resolve(true);
|
||||
}
|
||||
for (let i = 0; i < output.length; i++) {
|
||||
let output_json = null;
|
||||
try {
|
||||
output_json = JSON.parse(output[i]);
|
||||
} catch(e) {
|
||||
output_json = null;
|
||||
}
|
||||
if (!output_json) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Potentially store downloaded files in db?
|
||||
|
||||
}
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getAllSubscriptions() {
|
||||
const subscriptions = db.get('subscriptions').value();
|
||||
return subscriptions;
|
||||
}
|
||||
|
||||
function getSubscription(subID) {
|
||||
return db.get('subscriptions').find({id: subID}).value();
|
||||
}
|
||||
|
||||
function subExists(subID) {
|
||||
return !!db.get('subscriptions').find({id: subID}).value();
|
||||
}
|
||||
|
||||
// helper functions
|
||||
|
||||
function getAppendedBasePath(sub, base_path) {
|
||||
return base_path + (sub.isPlaylist ? 'playlists/' : 'channels/') + sub.name;
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/32197381/8088021
|
||||
const deleteFolderRecursive = function(folder_to_delete) {
|
||||
if (fs.existsSync(folder_to_delete)) {
|
||||
fs.readdirSync(folder_to_delete).forEach((file, index) => {
|
||||
const curPath = path.join(folder_to_delete, file);
|
||||
if (fs.lstatSync(curPath).isDirectory()) { // recurse
|
||||
deleteFolderRecursive(curPath);
|
||||
} else { // delete file
|
||||
fs.unlinkSync(curPath);
|
||||
}
|
||||
});
|
||||
fs.rmdirSync(folder_to_delete);
|
||||
}
|
||||
};
|
||||
|
||||
function removeIDFromArchive(archive_path, id) {
|
||||
let data = fs.readFileSync(archive_path, {encoding: 'utf-8'});
|
||||
if (!data) {
|
||||
console.log('Archive could not be found.');
|
||||
return;
|
||||
}
|
||||
|
||||
let dataArray = data.split('\n'); // convert file data in an array
|
||||
const searchKeyword = id; // we are looking for a line, contains, key word id in the file
|
||||
let lastIndex = -1; // let say, we have not found the keyword
|
||||
|
||||
for (let index=0; index<dataArray.length; index++) {
|
||||
if (dataArray[index].includes(searchKeyword)) { // check if a line contains the id keyword
|
||||
lastIndex = index; // found a line includes a id keyword
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const line = dataArray.splice(lastIndex, 1); // remove the keyword id from the data Array
|
||||
|
||||
// UPDATE FILE WITH NEW DATA
|
||||
const updatedData = dataArray.join('\n');
|
||||
fs.writeFileSync(archive_path, updatedData);
|
||||
if (line) return line;
|
||||
if (err) throw err;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSubscription : getSubscription,
|
||||
getAllSubscriptions : getAllSubscriptions,
|
||||
subscribe : subscribe,
|
||||
unsubscribe : unsubscribe,
|
||||
deleteSubscriptionFile : deleteSubscriptionFile,
|
||||
getVideosForSub : getVideosForSub,
|
||||
removeIDFromArchive : removeIDFromArchive
|
||||
}
|
||||
Binary file not shown.
12
browserslist
Normal file
12
browserslist
Normal file
@@ -0,0 +1,12 @@
|
||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
|
||||
# You can see what browsers were selected by your queries by running:
|
||||
# npx browserslist
|
||||
|
||||
> 0.5%
|
||||
last 2 versions
|
||||
Firefox ESR
|
||||
not dead
|
||||
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
||||
28
chrome-extension.pem
Normal file
28
chrome-extension.pem
Normal file
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDMX9Wk5SM5cIfY
|
||||
6ReKX3ybY1rsbNbOzG8ceN7yyeXB0mor8pVsX1MOna2HewOyBuaaYNJRO4tJBxic
|
||||
7a8zQErfgHL/i/QrVvVCpfJ7xKvq6zij5NYoqd/FBUwawqjeH5/voIcAp9z5Vmsr
|
||||
kL0sxJUKy6b4IWNp3noU7Nvq2RwxnXQbKDhz8FrX6oQAnDC6gsG5a2OSPsaE4oqw
|
||||
6nmonORJypmpP5hqyHY8ffXBT2lAxjHT7OnYbaCBe2TQP8+rH6rDBOhjVNtUJ089
|
||||
ocTQL6LtQEPkcF4yKJmtcOwHl8OPGZs5l9i8xb4j9RuSPkm2lbzZX8sOsdGGoqJZ
|
||||
q68nYhsHAgMBAAECggEAXmtKEzfPObq88B/kAcgSk+FngMHZzcmR7bgD3GwdSxnQ
|
||||
dkRI9zvk7eQ35tcUwntAr4Lat6/ILjFqlBmVLxrdXHuF5Xz9jcZLYgKzz61xdYM9
|
||||
dC6FKF0u5eGIIvbauGAo7jaeGFX1F3Zu5b4lP9kEOGwU1B7sxF0FzsQM5+dtCJgv
|
||||
We/hWQeF+9gtoVnkCSS/Mq2p0UomXXHW0Bz4+HuHlTR9aiYbviYnotABiLUhZyzt
|
||||
v5yUaktb9qniBfdLpRlq8cp06xYlTEA9gJpa4Pnok8OWUsbAiW6EiXUSaZ/cchVa
|
||||
AnO8WWYvVOnnt6WHI3+QdFTnqVjE5TBX4N/7bVhHGQKBgQD0dtbFqp7vZK/jVYvE
|
||||
z0WPdySOg2ZDmoSfk5ZlR1+Y9zWToHv0qu8zqoOjL8Ubxrh9fGlOow+cCVdkEuaa
|
||||
jWC2AWetuRvW0Z5A3XMXr0/N/1fgOkTqtp3WNrUPjVJahEg3lN+90opgFoT8swSi
|
||||
s1oxW0oLcVIlrjhGBXAPCfsAuQKBgQDWBLRhHsRAvGcK5wGuVnxVApTIyBOermsW
|
||||
3bJt+7+UI+4sYrBAwkWdQG93IG0cQtn48TEPBgmR2fjRF5IFT9M4/u+QOeeByT7I
|
||||
we7nVtHgSY5ByC9N0mjWbcmSg8fktz/LonjldNC4kWdOFb75fxGf8kOGS5rUaMA4
|
||||
zHucfB6ZvwKBgQCPHJrysMXGY21MaqIeHzEboaX3ABl37hdBzAa5V6UxSVdGCydF
|
||||
vmO2HVZey/JaJmWOoKyNaowSzq0oWqBBTg6VvhDR9JHFmoVId9uOvAS+FYN+Mt5x
|
||||
gWK5KuGoLxVNBC+6yh6JY526TrSfsrU+Aj0Es+qO9FIg2PL8muZVB4S3kQKBgH/5
|
||||
CDMaxpc/EQ5/2413wZjDllwI51J3USm3Hz6Mzp2ybnSz/lh60k2Zfg1polTH1Lb6
|
||||
4i7tmUNRZ2sAARyUAuWN64n+VeRRhe1dqZFDZPQMh7fmEAMk0fOGaoXlrt2ghdEq
|
||||
Mchi9Xun1nHmpu9hgBR4NNBU3RwuFuLfwvprbZDZAoGAWa62QJChE86xQGP1MrL2
|
||||
SbIzw3cfeP5xdQ3MKldJiy5IkbMR7Z13WZ7FwvPTy0g/onLHD1rqlm1kUMsGRHpD
|
||||
5vH06PNpKXQ6x8BYaRGtE6P39jLycO/X+WK/lYTrWo1bR+mGCebDh4B5XrwT3gI6
|
||||
x4Gvz134pZCTyQCf5JCwbQs=
|
||||
-----END PRIVATE KEY-----
|
||||
20
chrome-extension/background.js
Normal file
20
chrome-extension/background.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// background.js
|
||||
|
||||
// Called when the user clicks on the browser action.
|
||||
chrome.browserAction.onClicked.addListener(function(tab) {
|
||||
// get the frontend_url
|
||||
chrome.storage.sync.get({
|
||||
frontend_url: 'http://localhost',
|
||||
audio_only: false
|
||||
}, function(items) {
|
||||
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
|
||||
var activeTab = tabs[0];
|
||||
var url = activeTab.url;
|
||||
if (url.includes('youtube.com')) {
|
||||
var new_url = items.frontend_url + '/#/home;url=' + encodeURIComponent(url) + ';audioOnly=' + items.audio_only;
|
||||
chrome.tabs.create({ url: new_url });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
7
chrome-extension/css/bootstrap.min.css
vendored
Normal file
7
chrome-extension/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
chrome-extension/favicon.png
Normal file
BIN
chrome-extension/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
7
chrome-extension/js/bootstrap.min.js
vendored
Normal file
7
chrome-extension/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
chrome-extension/js/jquery-3.4.1.min.js
vendored
Normal file
2
chrome-extension/js/jquery-3.4.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
chrome-extension/js/popper.min.js
vendored
Normal file
5
chrome-extension/js/popper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
26
chrome-extension/manifest.json
Normal file
26
chrome-extension/manifest.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "YoutubeDL-Material",
|
||||
"version": "0.3",
|
||||
"description": "The Official Firefox & Chrome Extension of YoutubeDL-Material, an open-source and self-hosted YouTube downloader.",
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
},
|
||||
"browser_action": {
|
||||
"default_icon": "favicon.png"
|
||||
},
|
||||
"permissions": [
|
||||
"tabs",
|
||||
"storage"
|
||||
],
|
||||
"options_ui": {
|
||||
"page": "options.html",
|
||||
"open_in_tab": false
|
||||
},
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "IsaacMGrynsztein@gmail.com",
|
||||
"strict_min_version": "57.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
42
chrome-extension/options.html
Normal file
42
chrome-extension/options.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>YoutubeDL-Material Extension Options</title>
|
||||
<!-- Scripts -->
|
||||
<script src="js/jquery-3.4.1.min.js"></script>
|
||||
<script src="js/popper.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Cascading Style Sheets -->
|
||||
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>Settings</h2>
|
||||
|
||||
<div style="width: 95%; margin: 0 auto;">
|
||||
<div class="form-group">
|
||||
<label for="frontend_url">Frontend URL:</label>
|
||||
<input class="form-control" type="text" id="frontend_url">
|
||||
</div>
|
||||
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="audio_only">
|
||||
Audio only
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="status"></div>
|
||||
<button style="margin-bottom: 10px;" class="btn btn-primary" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample" id="save">Save</button>
|
||||
|
||||
<div class="collapse" id="collapseExample">
|
||||
<div class="card card-body">
|
||||
Settings successfully saved!
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
30
chrome-extension/options.js
Normal file
30
chrome-extension/options.js
Normal file
@@ -0,0 +1,30 @@
|
||||
// Saves options to chrome.storage
|
||||
function save_options() {
|
||||
var frontend_url = document.getElementById('frontend_url').value;
|
||||
var audio_only = document.getElementById('audio_only').checked;
|
||||
chrome.storage.sync.set({
|
||||
frontend_url: frontend_url,
|
||||
audio_only: audio_only
|
||||
}, function() {
|
||||
// Update status to let user know options were saved.
|
||||
$('#collapseExample').collapse('show');
|
||||
setTimeout(function() {
|
||||
$('#collapseExample').collapse('hide');
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
// Restores select box and checkbox state using the preferences
|
||||
// stored in chrome.storage.
|
||||
function restore_options() {
|
||||
chrome.storage.sync.get({
|
||||
frontend_url: 'http://localhost',
|
||||
audio_only: false
|
||||
}, function(items) {
|
||||
document.getElementById('frontend_url').value = items.frontend_url;
|
||||
document.getElementById('audio_only').checked = items.audio_only;
|
||||
});
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', restore_options);
|
||||
document.getElementById('save').addEventListener('click',
|
||||
save_options);
|
||||
BIN
chrome-extension/youtubedl-material-chrome-extension.zip
Normal file
BIN
chrome-extension/youtubedl-material-chrome-extension.zip
Normal file
Binary file not shown.
BIN
chrome-extension/youtubedl-material-firefox-extension.zip
Normal file
BIN
chrome-extension/youtubedl-material-firefox-extension.zip
Normal file
Binary file not shown.
17
docker-compose.yml
Normal file
17
docker-compose.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
version: "2"
|
||||
services:
|
||||
ytdl_material:
|
||||
build: .
|
||||
environment:
|
||||
write_ytdl_config: 'true'
|
||||
ALLOW_CONFIG_MUTATIONS: 'true'
|
||||
restart: always
|
||||
volumes:
|
||||
- ./appdata:/app/appdata
|
||||
- ./audio:/app/audio
|
||||
- ./video:/app/video
|
||||
- ./subscriptions:/app/subscriptions
|
||||
ports:
|
||||
- "8998:17442"
|
||||
image: tzahi12345/youtubedl-material:experimental
|
||||
0
installer.py
Normal file
0
installer.py
Normal file
@@ -4,24 +4,22 @@
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular/cli'],
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular/cli/plugins/karma')
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client:{
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
reports: [ 'html', 'lcovonly' ],
|
||||
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
|
||||
fixWebpackSourcePaths: true
|
||||
},
|
||||
angularCli: {
|
||||
environment: 'dev'
|
||||
},
|
||||
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
|
||||
41
main.js
Normal file
41
main.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const { app, BrowserWindow } = require('electron');
|
||||
const path = require('path');
|
||||
const url = require('url');
|
||||
|
||||
let win;
|
||||
|
||||
function createWindow() {
|
||||
win = new BrowserWindow({ width: 800, height: 600 });
|
||||
|
||||
// load the dist folder from Angular
|
||||
win.loadURL(
|
||||
url.format({
|
||||
pathname: path.join(__dirname, `/dist/index.html`),
|
||||
protocol: 'file:',
|
||||
slashes: true
|
||||
})
|
||||
);
|
||||
|
||||
// The following is optional and will open the DevTools:
|
||||
// win.webContents.openDevTools()
|
||||
|
||||
win.on('closed', () => {
|
||||
win = null;
|
||||
});
|
||||
}
|
||||
|
||||
app.on('ready', createWindow);
|
||||
|
||||
// on macOS, closing the window doesn't quit the app
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
// initialize the app's main window
|
||||
app.on('activate', () => {
|
||||
if (win === null) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
65
package.json
65
package.json
@@ -8,44 +8,65 @@
|
||||
"build": "ng build",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e"
|
||||
"e2e": "ng e2e",
|
||||
"electron": "ng build --base-href ./ && electron ."
|
||||
},
|
||||
"engines": {
|
||||
"node": "12.3.1",
|
||||
"npm": "6.10.3"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^5.2.0",
|
||||
"@angular/cdk": "^5.0.4",
|
||||
"@angular/common": "^5.2.0",
|
||||
"@angular/compiler": "^5.2.0",
|
||||
"@angular/core": "^5.2.0",
|
||||
"@angular/forms": "^5.0.0",
|
||||
"@angular/http": "^5.0.0",
|
||||
"@angular/material": "^5.0.4",
|
||||
"@angular/platform-browser": "^5.0.0",
|
||||
"@angular/platform-browser-dynamic": "^5.0.0",
|
||||
"@angular/router": "^5.0.0",
|
||||
"@angular-devkit/core": "^9.0.6",
|
||||
"@angular/animations": "^9.0.6",
|
||||
"@angular/cdk": "^9.1.2",
|
||||
"@angular/common": "^9.0.6",
|
||||
"@angular/compiler": "^9.0.6",
|
||||
"@angular/core": "^9.0.6",
|
||||
"@angular/forms": "^9.0.6",
|
||||
"@angular/http": "^7.2.15",
|
||||
"@angular/localize": "^9.0.6",
|
||||
"@angular/material": "^9.1.2",
|
||||
"@angular/platform-browser": "^9.0.6",
|
||||
"@angular/platform-browser-dynamic": "^9.0.6",
|
||||
"@angular/router": "^9.0.6",
|
||||
"@locl/core": "0.0.1-beta.2",
|
||||
"core-js": "^2.4.1",
|
||||
"file-saver": "^2.0.2",
|
||||
"filesize": "^6.1.0",
|
||||
"ng-lazyload-image": "^7.0.1",
|
||||
"ng4-configure": "^0.1.7",
|
||||
"rxjs": "^5.5.3",
|
||||
"zone.js": "^0.8.4"
|
||||
"ngx-content-loading": "^0.1.3",
|
||||
"ngx-videogular": "^9.0.1",
|
||||
"rxjs": "^6.5.3",
|
||||
"rxjs-compat": "^6.0.0-rc.0",
|
||||
"tslib": "^1.10.0",
|
||||
"typescript": "~3.7.5",
|
||||
"web-animations-js": "^2.3.2",
|
||||
"zone.js": "~0.10.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/cli": "1.5.5",
|
||||
"@angular/compiler-cli": "^5.0.0",
|
||||
"@angular/language-service": "^4.0.0",
|
||||
"@angular-devkit/build-angular": "~0.900.6",
|
||||
"@angular/cli": "^9.0.6",
|
||||
"@angular/compiler-cli": "^9.0.6",
|
||||
"@angular/language-service": "^9.0.6",
|
||||
"@locl/cli": "0.0.1-beta.6",
|
||||
"@types/core-js": "^2.5.2",
|
||||
"@types/file-saver": "^2.0.1",
|
||||
"@types/jasmine": "2.5.45",
|
||||
"@types/node": "~6.0.60",
|
||||
"codelyzer": "~3.0.1",
|
||||
"@types/node": "^12.11.1",
|
||||
"codelyzer": "^5.1.2",
|
||||
"electron": "^8.0.1",
|
||||
"jasmine-core": "~2.6.2",
|
||||
"jasmine-spec-reporter": "~4.1.0",
|
||||
"karma": "~1.7.0",
|
||||
"karma-chrome-launcher": "~2.1.1",
|
||||
"karma-cli": "~1.0.1",
|
||||
"karma-coverage-istanbul-reporter": "^1.2.1",
|
||||
"karma-jasmine": "~1.1.0",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"karma-coverage-istanbul-reporter": "^1.2.1",
|
||||
"protractor": "~5.1.2",
|
||||
"ts-node": "~3.0.4",
|
||||
"tslint": "~5.3.2",
|
||||
"typescript": "~2.5.3"
|
||||
"tslint": "~5.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
BIN
releases/3.3/youtubedl-material-3.3-docker.zip
Normal file
BIN
releases/3.3/youtubedl-material-3.3-docker.zip
Normal file
Binary file not shown.
BIN
releases/3.3/youtubedl-material-3.3.zip
Normal file
BIN
releases/3.3/youtubedl-material-3.3.zip
Normal file
Binary file not shown.
15
src/_palette.scss
Normal file
15
src/_palette.scss
Normal file
@@ -0,0 +1,15 @@
|
||||
/* Coolors Exported Palette - coolors.co/e8aeb7-b8e1ff-a9fff7-94fbab-82aba1 */
|
||||
|
||||
/* HSL */
|
||||
$color1: hsla(351%, 56%, 80%, 1);
|
||||
$softblue: hsla(205%, 100%, 86%, 1);
|
||||
$color3: hsla(174%, 100%, 83%, 1);
|
||||
$color4: hsla(133%, 93%, 78%, 1);
|
||||
$color5: hsla(165%, 20%, 59%, 1);
|
||||
|
||||
/* RGB */
|
||||
$color1: rgba(232, 174, 183, 1);
|
||||
$softblue: rgba(184, 225, 255, 1);
|
||||
$color3: rgba(169, 255, 247, 1);
|
||||
$color4: rgba(148, 251, 171, 1);
|
||||
$color5: rgba(130, 171, 161, 1);
|
||||
19
src/app/app-routing.module.ts
Normal file
19
src/app/app-routing.module.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { MainComponent } from './main/main.component';
|
||||
import { PlayerComponent } from './player/player.component';
|
||||
import { SubscriptionsComponent } from './subscriptions/subscriptions.component';
|
||||
import { SubscriptionComponent } from './subscription/subscription/subscription.component';
|
||||
const routes: Routes = [
|
||||
{ path: 'home', component: MainComponent },
|
||||
{ path: 'player', component: PlayerComponent},
|
||||
{ path: 'subscriptions', component: SubscriptionsComponent },
|
||||
{ path: 'subscription', component: SubscriptionComponent },
|
||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes, { useHash: true })],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
@@ -1,41 +1,19 @@
|
||||
.demo-card {
|
||||
margin: 16px;
|
||||
}
|
||||
|
||||
.demo-basic {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.demo-basic .mat-card-content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
mat-toolbar.top {
|
||||
height: 60px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/*::ng-deep .mat-form-field-placeholder{
|
||||
|
||||
transform: scale(.75) translateY(20px) !important;
|
||||
}*/
|
||||
|
||||
.big {
|
||||
width: 60%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.centered {
|
||||
margin: 0 auto;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
.example-full-width {
|
||||
.flex-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.flex-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-basis: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
mat-form-field.mat-form-field {
|
||||
font-size: 24px;
|
||||
}
|
||||
.theme-slide-toggle {
|
||||
top: 2px;
|
||||
left: 10px;
|
||||
position: relative;
|
||||
}
|
||||
@@ -1,45 +1,46 @@
|
||||
<mat-toolbar color="primary" class="top">
|
||||
<table width="100%" height="100%">
|
||||
<td class="topbar" style="text-align: left; left:0px; font-size: 15px">
|
||||
</td>
|
||||
<td class="topbar" style="text-align: center">
|
||||
<div style="margin-top: 14px">{{topBarTitle}}</div>
|
||||
</td>
|
||||
<td class="topbar" style="text-align: right">
|
||||
|
||||
</td>
|
||||
</table>
|
||||
</mat-toolbar>
|
||||
|
||||
<br/>
|
||||
|
||||
<mat-card id="card" class="big demo-basic">
|
||||
<mat-card-title>
|
||||
<mat-toolbar color="primary">Youtube Downloader</mat-toolbar>
|
||||
</mat-card-title>
|
||||
<div style="width: 100%; height: 100%; padding-left: 24px; padding-right: 24px; position: relative">
|
||||
<mat-card-content>
|
||||
<form class="example-form">
|
||||
<mat-form-field class="example-full-width">
|
||||
<input matInput [(ngModel)]="url" placeholder="URL" type="url" name="url" [formControl]="urlForm" required>
|
||||
<mat-error *ngIf="urlError || urlForm.invalid">Please enter a valid URL!</mat-error>
|
||||
</mat-form-field>
|
||||
</form>
|
||||
<br/>
|
||||
<mat-checkbox [(ngModel)]="audioOnly" style="float: left; margin-top: -12px">Only Audio</mat-checkbox>
|
||||
<button style="float: right; margin-top: -16px" (click)="downloadClicked()" [disabled]="downloadingfile" type="submit" mat-raised-button color="primary">Download</button>
|
||||
</mat-card-content>
|
||||
<div [style.background]="postsService.theme ? postsService.theme.background_color : null" style="width: 100%; height: 100%;">
|
||||
<div>
|
||||
<mat-toolbar color="primary" class="top">
|
||||
<div class="flex-row" width="100%" height="100%">
|
||||
<div class="flex-column" style="text-align: left; margin-top: 1px;">
|
||||
<button #hamburgerMenu style="outline: none" *ngIf="router.url.split(';')[0] !== '/player' && allowSubscriptions" mat-icon-button aria-label="Toggle side navigation" (click)="toggleSidenav()"><mat-icon>menu</mat-icon></button>
|
||||
<button (click)="goBack()" *ngIf="router.url.split(';')[0] === '/player'" mat-icon-button><mat-icon>arrow_back</mat-icon></button>
|
||||
</div>
|
||||
<div class="flex-column" style="text-align: center; margin-top: 5px;">
|
||||
<div>{{topBarTitle}}</div>
|
||||
</div>
|
||||
<div class="flex-column" style="text-align: right; align-items: flex-end;">
|
||||
<button [matMenuTriggerFor]="menuSettings" mat-icon-button><mat-icon>more_vert</mat-icon></button>
|
||||
<mat-menu #menuSettings="matMenu">
|
||||
<button (click)="themeMenuItemClicked($event)" *ngIf="allowThemeChange" mat-menu-item>
|
||||
<mat-icon>{{(postsService.theme.key === 'default') ? 'brightness_5' : 'brightness_2'}}</mat-icon>
|
||||
<span i18n="Dark mode toggle label">Dark</span>
|
||||
<mat-slide-toggle class="theme-slide-toggle" [checked]="postsService.theme.key === 'dark'"></mat-slide-toggle>
|
||||
</button>
|
||||
<button (click)="openSettingsDialog()" mat-menu-item>
|
||||
<mat-icon>settings</mat-icon>
|
||||
<span i18n="Settings menu label">Settings</span>
|
||||
</button>
|
||||
<button (click)="openAboutDialog()" mat-menu-item>
|
||||
<mat-icon>info</mat-icon>
|
||||
<span i18n="About menu label">About</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
</mat-toolbar>
|
||||
</div>
|
||||
</mat-card>
|
||||
<br/>
|
||||
<div class="centered big" id="bar_div" *ngIf="downloadingfile;else nofile">
|
||||
<div *ngIf="determinateProgress;else indeterminateprogress">
|
||||
<mat-progress-bar mode="determinate" value="{{percentDownloaded}}"></mat-progress-bar>
|
||||
</div>
|
||||
<ng-template #indeterminateprogress>
|
||||
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
||||
</ng-template>
|
||||
</div>
|
||||
<ng-template #nofile>
|
||||
|
||||
</ng-template>
|
||||
<div style="height: calc(100% - 64px)">
|
||||
<mat-sidenav-container style="height: 100%">
|
||||
<mat-sidenav #sidenav>
|
||||
<mat-nav-list>
|
||||
<a mat-list-item (click)="sidenav.close()" routerLink='/home'><ng-container i18n="Navigation menu Home Page title">Home</ng-container></a>
|
||||
<a mat-list-item (click)="sidenav.close()" routerLink='/subscriptions'><ng-container i18n="Navigation menu Subscriptions Page title">Subscriptions</ng-container></a>
|
||||
</mat-nav-list>
|
||||
</mat-sidenav>
|
||||
<mat-sidenav-content [style.background]="postsService.theme ? postsService.theme.background_color : null">
|
||||
<router-outlet></router-outlet>
|
||||
</mat-sidenav-content>
|
||||
</mat-sidenav-container>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,176 +1,200 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, ElementRef, ViewChild, HostBinding } from '@angular/core';
|
||||
import {PostsService} from './posts.services';
|
||||
import {FileCardComponent} from './file-card/file-card.component';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import {FormControl, Validators} from '@angular/forms';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {MatSnackBar} from '@angular/material';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSidenav } from '@angular/material/sidenav';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { saveAs } from 'file-saver';
|
||||
import 'rxjs/add/observable/of';
|
||||
import 'rxjs/add/operator/mapTo';
|
||||
import 'rxjs/add/operator/toPromise';
|
||||
import 'rxjs/add/observable/fromEvent'
|
||||
import 'rxjs/add/operator/filter'
|
||||
import 'rxjs/add/operator/debounceTime'
|
||||
import 'rxjs/add/operator/do'
|
||||
import 'rxjs/add/operator/switch'
|
||||
import { YoutubeSearchService, Result } from './youtube-search.service';
|
||||
import { Router, NavigationStart, NavigationEnd } from '@angular/router';
|
||||
import { OverlayContainer } from '@angular/cdk/overlay';
|
||||
import { THEMES_CONFIG } from '../themes';
|
||||
import { SettingsComponent } from './settings/settings.component';
|
||||
import { CheckOrSetPinDialogComponent } from './dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component';
|
||||
import { AboutDialogComponent } from './dialogs/about-dialog/about-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.css']
|
||||
})
|
||||
export class AppComponent {
|
||||
determinateProgress: boolean = false;
|
||||
downloadingfile: boolean = false;
|
||||
audioOnly: boolean;
|
||||
urlError: boolean = false;
|
||||
path: string = '';
|
||||
url: string = '';
|
||||
exists: string = "";
|
||||
topBarTitle: string = "Youtube Downloader";
|
||||
percentDownloaded: number;
|
||||
constructor(private postsService: PostsService, public snackBar: MatSnackBar) {
|
||||
this.audioOnly = true;
|
||||
export class AppComponent implements OnInit {
|
||||
|
||||
|
||||
@HostBinding('class') componentCssClass;
|
||||
THEMES_CONFIG = THEMES_CONFIG;
|
||||
|
||||
this.postsService.loadNavItems().subscribe(result => { // loads settings
|
||||
var backendUrl = result.YoutubeDLMaterial.Host.backendurl;
|
||||
this.topBarTitle = result.YoutubeDLMaterial.Extra.title_top;
|
||||
// config items
|
||||
topBarTitle = 'Youtube Downloader';
|
||||
defaultTheme = null;
|
||||
allowThemeChange = null;
|
||||
allowSubscriptions = false;
|
||||
// defaults to true to prevent attack
|
||||
settingsPinRequired = true;
|
||||
|
||||
this.postsService.path = backendUrl;
|
||||
this.postsService.startPath = backendUrl;
|
||||
this.postsService.startPathSSL = backendUrl;
|
||||
},
|
||||
error => {
|
||||
@ViewChild('sidenav') sidenav: MatSidenav;
|
||||
@ViewChild('hamburgerMenu', { read: ElementRef }) hamburgerMenuButton: ElementRef;
|
||||
navigator: string = null;
|
||||
|
||||
constructor(public postsService: PostsService, public snackBar: MatSnackBar, private dialog: MatDialog,
|
||||
public router: Router, public overlayContainer: OverlayContainer, private elementRef: ElementRef) {
|
||||
|
||||
this.navigator = localStorage.getItem('player_navigator');
|
||||
// runs on navigate, captures the route that navigated to the player (if needed)
|
||||
this.router.events.subscribe((e) => { if (e instanceof NavigationStart) {
|
||||
this.navigator = localStorage.getItem('player_navigator');
|
||||
} else if (e instanceof NavigationEnd) {
|
||||
// blurs hamburger menu if it exists, as the sidenav likes to focus on it after closing
|
||||
if (this.hamburgerMenuButton && this.hamburgerMenuButton.nativeElement) {
|
||||
this.hamburgerMenuButton.nativeElement.blur();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.loadConfig();
|
||||
this.postsService.settings_changed.subscribe(changed => {
|
||||
if (changed) {
|
||||
this.loadConfig();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
toggleSidenav() {
|
||||
this.sidenav.toggle();
|
||||
}
|
||||
|
||||
loadConfig() {
|
||||
// loading config
|
||||
this.postsService.loadNavItems().subscribe(res => { // loads settings
|
||||
const result = !this.postsService.debugMode ? res['config_file'] : res;
|
||||
this.topBarTitle = result['YoutubeDLMaterial']['Extra']['title_top'];
|
||||
this.settingsPinRequired = result['YoutubeDLMaterial']['Extra']['settings_pin_required'];
|
||||
const themingExists = result['YoutubeDLMaterial']['Themes'];
|
||||
this.defaultTheme = themingExists ? result['YoutubeDLMaterial']['Themes']['default_theme'] : 'default';
|
||||
this.allowThemeChange = themingExists ? result['YoutubeDLMaterial']['Themes']['allow_theme_change'] : true;
|
||||
this.allowSubscriptions = result['YoutubeDLMaterial']['Subscriptions']['allow_subscriptions'];
|
||||
|
||||
// sets theme to config default if it doesn't exist
|
||||
if (!localStorage.getItem('theme')) {
|
||||
this.setTheme(themingExists ? this.defaultTheme : 'default');
|
||||
}
|
||||
}, error => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
urlForm = new FormControl('', [Validators.required]);
|
||||
// theme stuff
|
||||
|
||||
doHandshake(url: string) {
|
||||
this.postsService.startHandshake(url).subscribe(theurl => {
|
||||
this.postsService.path = theurl;
|
||||
this.postsService.handShakeComplete = true;
|
||||
console.log("Handshake complete!");
|
||||
},
|
||||
error => {
|
||||
console.log("Initial handshake failed on http.");
|
||||
this.doHandshakeSSL(url);
|
||||
});
|
||||
setTheme(theme) {
|
||||
// theme is registered, so set it to the stored cookie variable
|
||||
let old_theme = null;
|
||||
if (this.THEMES_CONFIG[theme]) {
|
||||
if (localStorage.getItem('theme')) {
|
||||
old_theme = localStorage.getItem('theme');
|
||||
if (!this.THEMES_CONFIG[old_theme]) {
|
||||
console.log('bad theme found, setting to default');
|
||||
if (this.defaultTheme === null) {
|
||||
// means it hasn't loaded yet
|
||||
console.error('No default theme detected');
|
||||
} else {
|
||||
localStorage.setItem('theme', this.defaultTheme);
|
||||
old_theme = localStorage.getItem('theme'); // updates old_theme
|
||||
}
|
||||
}
|
||||
}
|
||||
localStorage.setItem('theme', theme);
|
||||
this.elementRef.nativeElement.ownerDocument.body.style.backgroundColor = this.THEMES_CONFIG[theme]['background_color'];
|
||||
} else {
|
||||
console.error('Invalid theme: ' + theme);
|
||||
return;
|
||||
}
|
||||
|
||||
this.postsService.setTheme(theme);
|
||||
|
||||
this.onSetTheme(this.THEMES_CONFIG[theme]['css_label'], old_theme ? this.THEMES_CONFIG[old_theme]['css_label'] : old_theme);
|
||||
}
|
||||
|
||||
onSetTheme(theme, old_theme) {
|
||||
if (old_theme) {
|
||||
document.body.classList.remove(old_theme);
|
||||
this.overlayContainer.getContainerElement().classList.remove(old_theme);
|
||||
}
|
||||
this.overlayContainer.getContainerElement().classList.add(theme);
|
||||
this.componentCssClass = theme;
|
||||
}
|
||||
|
||||
doHandshakeSSL(url: string) {
|
||||
this.postsService.startHandshakeSSL(url).subscribe(theurl => {
|
||||
this.postsService.path = theurl;
|
||||
this.postsService.handShakeComplete = true;
|
||||
console.log("Handshake complete!");
|
||||
},
|
||||
error => {
|
||||
console.log("Initial handshake failed on https too! Make sure port 17442 is open.");
|
||||
this.postsService.handShakeComplete = false;
|
||||
});
|
||||
flipTheme() {
|
||||
if (this.postsService.theme.key === 'default') {
|
||||
this.setTheme('dark');
|
||||
} else if (this.postsService.theme.key === 'dark') {
|
||||
this.setTheme('default');
|
||||
}
|
||||
}
|
||||
|
||||
themeMenuItemClicked(event) {
|
||||
this.flipTheme();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
downloadHelperMp3(name: string)
|
||||
{
|
||||
this.postsService.getFileStatusMp3(name).subscribe(fileExists => {
|
||||
var exists = fileExists;
|
||||
this.exists = exists[0];
|
||||
if (exists[0] == "failed")
|
||||
{
|
||||
var percent = exists[2];
|
||||
console.log(percent);
|
||||
if (percent > 0.30)
|
||||
{
|
||||
this.determinateProgress = true;
|
||||
this.percentDownloaded = percent*100;
|
||||
}
|
||||
setTimeout(() => this.downloadHelperMp3(name), 500);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href = this.exists;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
downloadHelperMp4(name: string)
|
||||
{
|
||||
this.postsService.getFileStatusMp4(name).subscribe(fileExists => {
|
||||
var exists = fileExists;
|
||||
this.exists = exists[0];
|
||||
if (exists[0] == "failed")
|
||||
{
|
||||
var percent = exists[2];
|
||||
if (percent > 0.30)
|
||||
{
|
||||
this.determinateProgress = true;
|
||||
this.percentDownloaded = percent*100;
|
||||
}
|
||||
setTimeout(() => this.downloadHelperMp4(name), 500);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href = this.exists;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
downloadClicked()
|
||||
{
|
||||
if (this.ValidURL(this.url))
|
||||
{
|
||||
this.urlError = false;
|
||||
this.path = "";
|
||||
|
||||
if (this.audioOnly)
|
||||
{
|
||||
this.downloadingfile = true;
|
||||
this.postsService.makeMP3(this.url).subscribe(posts => {
|
||||
this.path = posts;
|
||||
if (this.path != "-1")
|
||||
{
|
||||
this.downloadHelperMp3(this.path);
|
||||
}
|
||||
},
|
||||
error => { // can't access server
|
||||
this.downloadingfile = false;
|
||||
this.openSnackBar("Download failed!", "OK.");
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
this.downloadingfile = true;
|
||||
this.postsService.makeMP4(this.url).subscribe(posts => {
|
||||
this.path = posts;
|
||||
if (this.path != "-1")
|
||||
{
|
||||
this.downloadHelperMp4(this.path);
|
||||
}
|
||||
},
|
||||
error => { // can't access server
|
||||
this.downloadingfile = false;
|
||||
this.openSnackBar("Download failed!", "OK.");
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.urlError = true;
|
||||
if (localStorage.getItem('theme')) {
|
||||
this.setTheme(localStorage.getItem('theme'));
|
||||
} else {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
ValidURL(str) {
|
||||
var strRegex = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/;
|
||||
var re=new RegExp(strRegex);
|
||||
return re.test(str);
|
||||
|
||||
goBack() {
|
||||
if (!this.navigator) {
|
||||
this.router.navigate(['/home']);
|
||||
} else {
|
||||
this.router.navigateByUrl(this.navigator);
|
||||
}
|
||||
}
|
||||
|
||||
openSnackBar(message: string, action: string) {
|
||||
this.snackBar.open(message, action, {
|
||||
duration: 2000,
|
||||
openSettingsDialog() {
|
||||
if (this.settingsPinRequired) {
|
||||
this.openPinDialog();
|
||||
} else {
|
||||
this.actuallyOpenSettingsDialog();
|
||||
}
|
||||
}
|
||||
|
||||
actuallyOpenSettingsDialog() {
|
||||
const dialogRef = this.dialog.open(SettingsComponent, {
|
||||
width: '80vw'
|
||||
});
|
||||
}
|
||||
|
||||
openPinDialog() {
|
||||
const dialogRef = this.dialog.open(CheckOrSetPinDialogComponent, {
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(res => {
|
||||
if (res) {
|
||||
this.actuallyOpenSettingsDialog();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
openAboutDialog() {
|
||||
const dialogRef = this.dialog.open(AboutDialogComponent, {
|
||||
width: '80vw'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,85 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
import {MatNativeDateModule, MatRadioModule, MatInputModule, MatButtonModule, MatSidenavModule, MatIconModule, MatListModule,
|
||||
MatSnackBarModule, MatCardModule, MatSelectModule, MatToolbarModule, MatCheckboxModule,
|
||||
MatProgressBarModule } from '@angular/material';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import { NgModule, LOCALE_ID } from '@angular/core';
|
||||
import { registerLocaleData } from '@angular/common';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatNativeDateModule, MatRippleModule } from '@angular/material/core';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { MatGridListModule } from '@angular/material/grid-list';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import {DragDropModule} from '@angular/cdk/drag-drop';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import { AppComponent } from './app.component';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { HttpClientModule, HttpClient } from '@angular/common/http';
|
||||
import { PostsService } from 'app/posts.services';
|
||||
import {APP_BASE_HREF} from '@angular/common';
|
||||
import { FileCardComponent } from './file-card/file-card.component';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { MainComponent } from './main/main.component';
|
||||
import { PlayerComponent } from './player/player.component';
|
||||
import {VgCoreModule, VgControlsModule, VgOverlayPlayModule, VgBufferingModule} from 'ngx-videogular';
|
||||
import { InputDialogComponent } from './input-dialog/input-dialog.component';
|
||||
import { LazyLoadImageModule, IsVisibleProps } from 'ng-lazyload-image';
|
||||
import { NgxContentLoadingModule } from 'ngx-content-loading';
|
||||
import { audioFilesMouseHovering, videoFilesMouseHovering, audioFilesOpened, videoFilesOpened } from './main/main.component';
|
||||
import { CreatePlaylistComponent } from './create-playlist/create-playlist.component';
|
||||
import { DownloadItemComponent } from './download-item/download-item.component';
|
||||
import { SubscriptionsComponent } from './subscriptions/subscriptions.component';
|
||||
import { SubscribeDialogComponent } from './dialogs/subscribe-dialog/subscribe-dialog.component';
|
||||
import { SubscriptionComponent } from './subscription//subscription/subscription.component';
|
||||
import { SubscriptionFileCardComponent } from './subscription/subscription-file-card/subscription-file-card.component';
|
||||
import { SubscriptionInfoDialogComponent } from './dialogs/subscription-info-dialog/subscription-info-dialog.component';
|
||||
import { SettingsComponent } from './settings/settings.component';
|
||||
import { CheckOrSetPinDialogComponent } from './dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component';
|
||||
|
||||
import es from '@angular/common/locales/es';
|
||||
import { AboutDialogComponent } from './dialogs/about-dialog/about-dialog.component';
|
||||
import { VideoInfoDialogComponent } from './dialogs/video-info-dialog/video-info-dialog.component';
|
||||
import { ArgModifierDialogComponent, HighlightPipe } from './dialogs/arg-modifier-dialog/arg-modifier-dialog.component';
|
||||
registerLocaleData(es, 'es');
|
||||
|
||||
export function isVisible({ event, element, scrollContainer, offset }: IsVisibleProps<any>) {
|
||||
return (element.id === 'video' ? videoFilesMouseHovering || videoFilesOpened : audioFilesMouseHovering || audioFilesOpened);
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
AppComponent,
|
||||
FileCardComponent,
|
||||
MainComponent,
|
||||
PlayerComponent,
|
||||
InputDialogComponent,
|
||||
CreatePlaylistComponent,
|
||||
DownloadItemComponent,
|
||||
SubscriptionsComponent,
|
||||
SubscribeDialogComponent,
|
||||
SubscriptionComponent,
|
||||
SubscriptionFileCardComponent,
|
||||
SubscriptionInfoDialogComponent,
|
||||
SettingsComponent,
|
||||
CheckOrSetPinDialogComponent,
|
||||
AboutDialogComponent,
|
||||
VideoInfoDialogComponent,
|
||||
ArgModifierDialogComponent,
|
||||
HighlightPipe
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@@ -34,9 +100,43 @@ import {APP_BASE_HREF} from '@angular/common';
|
||||
MatSidenavModule,
|
||||
MatIconModule,
|
||||
MatListModule,
|
||||
MatProgressBarModule
|
||||
MatGridListModule,
|
||||
MatExpansionModule,
|
||||
MatProgressBarModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatButtonToggleModule,
|
||||
MatRippleModule,
|
||||
MatMenuModule,
|
||||
MatDialogModule,
|
||||
MatSlideToggleModule,
|
||||
MatMenuModule,
|
||||
MatAutocompleteModule,
|
||||
MatTooltipModule,
|
||||
DragDropModule,
|
||||
VgCoreModule,
|
||||
VgControlsModule,
|
||||
VgOverlayPlayModule,
|
||||
VgBufferingModule,
|
||||
LazyLoadImageModule.forRoot({ isVisible }),
|
||||
NgxContentLoadingModule,
|
||||
RouterModule,
|
||||
AppRoutingModule,
|
||||
],
|
||||
entryComponents: [
|
||||
InputDialogComponent,
|
||||
CreatePlaylistComponent,
|
||||
SubscribeDialogComponent,
|
||||
SubscriptionInfoDialogComponent,
|
||||
SettingsComponent,
|
||||
CheckOrSetPinDialogComponent
|
||||
],
|
||||
providers: [
|
||||
PostsService
|
||||
],
|
||||
exports: [
|
||||
HighlightPipe
|
||||
],
|
||||
providers: [PostsService],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
|
||||
export class AppModule { }
|
||||
|
||||
20
src/app/create-playlist/create-playlist.component.html
Normal file
20
src/app/create-playlist/create-playlist.component.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<h4 mat-dialog-title i18n="Create a playlist dialog title">Create a playlist</h4>
|
||||
<form>
|
||||
<div>
|
||||
<mat-form-field color="accent">
|
||||
<input [(ngModel)]="name" matInput placeholder="Name" i18n-placeholder="Playlist name placeholder" type="text" required aria-required [ngModelOptions]="{standalone: true}">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
<mat-form-field color="accent">
|
||||
<mat-label *ngIf="type === 'audio'"><ng-container i18n="Audio files title">Audio files</ng-container></mat-label>
|
||||
<mat-label *ngIf="type === 'video'"><ng-container i18n="Videos title">Videos</ng-container></mat-label>
|
||||
<mat-select [formControl]="filesSelect" multiple required aria-required>
|
||||
<mat-option *ngFor="let file of filesToSelectFrom" [value]="file.id">{{file.id}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div *ngIf="create_in_progress" style="float: left"><mat-spinner [diameter]="25"></mat-spinner></div>
|
||||
<button (click)="createPlaylist()" [disabled]="!name || !filesSelect.value || filesSelect.value.length === 0" color="primary" style="float: right" mat-flat-button>Create</button>
|
||||
25
src/app/create-playlist/create-playlist.component.spec.ts
Normal file
25
src/app/create-playlist/create-playlist.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CreatePlaylistComponent } from './create-playlist.component';
|
||||
|
||||
describe('CreatePlaylistComponent', () => {
|
||||
let component: CreatePlaylistComponent;
|
||||
let fixture: ComponentFixture<CreatePlaylistComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreatePlaylistComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CreatePlaylistComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
58
src/app/create-playlist/create-playlist.component.ts
Normal file
58
src/app/create-playlist/create-playlist.component.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { PostsService } from 'app/posts.services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-create-playlist',
|
||||
templateUrl: './create-playlist.component.html',
|
||||
styleUrls: ['./create-playlist.component.scss']
|
||||
})
|
||||
export class CreatePlaylistComponent implements OnInit {
|
||||
// really "createPlaylistDialogComponent"
|
||||
|
||||
filesToSelectFrom = null;
|
||||
type = null;
|
||||
filesSelect = new FormControl();
|
||||
name = '';
|
||||
|
||||
create_in_progress = false;
|
||||
|
||||
constructor(@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private postsService: PostsService,
|
||||
public dialogRef: MatDialogRef<CreatePlaylistComponent>) { }
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
if (this.data) {
|
||||
this.filesToSelectFrom = this.data.filesToSelectFrom;
|
||||
this.type = this.data.type;
|
||||
}
|
||||
}
|
||||
|
||||
createPlaylist() {
|
||||
const thumbnailURL = this.getThumbnailURL();
|
||||
this.create_in_progress = true;
|
||||
this.postsService.createPlaylist(this.name, this.filesSelect.value, this.type, thumbnailURL).subscribe(res => {
|
||||
this.create_in_progress = false;
|
||||
if (res['success']) {
|
||||
this.dialogRef.close(true);
|
||||
} else {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getThumbnailURL() {
|
||||
for (let i = 0; i < this.filesToSelectFrom.length; i++) {
|
||||
const file = this.filesToSelectFrom[i];
|
||||
if (file.id === this.filesSelect.value[0]) {
|
||||
// different services store the thumbnail in different places
|
||||
if (file.thumbnailURL) { return file.thumbnailURL };
|
||||
if (file.thumbnail) { return file.thumbnail };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
23
src/app/dialogs/about-dialog/about-dialog.component.html
Normal file
23
src/app/dialogs/about-dialog/about-dialog.component.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<h4 mat-dialog-title i18n="About dialog title">About YoutubeDL-Material</h4>
|
||||
|
||||
<mat-dialog-content>
|
||||
<div style="margin-bottom: 5px;">
|
||||
<p>
|
||||
<i>YoutubeDL-Material</i> <ng-container i18n="About first paragraph">is an open-source YouTube downloader built under Google's Material Design specifications. You can seamlessly download your favorite videos as video or audio files, and even subscribe to your favorite channels and playlists to keep updated with their new videos.</ng-container>
|
||||
</p>
|
||||
<p>
|
||||
<i>YoutubeDL-Material</i> <ng-container i18n="About second paragraph">has some awesome features included! An extensive API, Docker support, and localization (translation) support. Read up on all the supported features by clicking on the GitHub icon below.</ng-container>
|
||||
</p>
|
||||
<p>
|
||||
<ng-container i18n="About bug prefix">Found a bug or have a suggestion?</ng-container> <a [href]="issuesLink" target="_blank"><ng-container i18n="About bug click here">Click here</ng-container></a> <ng-container i18n="About bug suffix">to create an issue!</ng-container>
|
||||
</p>
|
||||
<a [href]="projectLink" target="_blank">
|
||||
<img style="width: 32px; margin-bottom: 10px;" src="assets/images/GitHub-64px.png">
|
||||
</a>
|
||||
<p><ng-container i18n="Version label">Installed version:</ng-container> {{version}} - <a [href]="latestUpdateLink" target="_blank"><ng-container i18n="View latest update">View latest update</ng-container></a></p>
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions>
|
||||
<button mat-button mat-dialog-close>Close</button>
|
||||
</mat-dialog-actions>
|
||||
3
src/app/dialogs/about-dialog/about-dialog.component.scss
Normal file
3
src/app/dialogs/about-dialog/about-dialog.component.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
i {
|
||||
margin-right: 1px;
|
||||
}
|
||||
25
src/app/dialogs/about-dialog/about-dialog.component.spec.ts
Normal file
25
src/app/dialogs/about-dialog/about-dialog.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AboutDialogComponent } from './about-dialog.component';
|
||||
|
||||
describe('AboutDialogComponent', () => {
|
||||
let component: AboutDialogComponent;
|
||||
let fixture: ComponentFixture<AboutDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AboutDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AboutDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
21
src/app/dialogs/about-dialog/about-dialog.component.ts
Normal file
21
src/app/dialogs/about-dialog/about-dialog.component.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-about-dialog',
|
||||
templateUrl: './about-dialog.component.html',
|
||||
styleUrls: ['./about-dialog.component.scss']
|
||||
})
|
||||
export class AboutDialogComponent implements OnInit {
|
||||
|
||||
projectLink = 'https://github.com/Tzahi12345/YoutubeDL-Material';
|
||||
issuesLink = 'https://github.com/Tzahi12345/YoutubeDL-Material/issues';
|
||||
latestUpdateLink = 'https://github.com/Tzahi12345/YoutubeDL-Material/releases/latest'
|
||||
|
||||
version = 'v3.5';
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<h4 i18n="Modify args title" mat-dialog-title>Modify youtube-dl args</h4>
|
||||
|
||||
<mat-dialog-content>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-card class="mat-elevation-z6">
|
||||
<h6 i18n="Simulated args title">Simulated new args</h6>
|
||||
<mat-form-field style="width: 100%" color="accent">
|
||||
<textarea [disabled]="true" matInput>{{modified_args}}</textarea>
|
||||
</mat-form-field>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<mat-card class="mat-elevation-z6 my-2">
|
||||
<h6 i18n="Add arg card title">Add an arg</h6>
|
||||
<form >
|
||||
<div>
|
||||
<mat-form-field style="width: 75%" color="accent">
|
||||
<input matInput placeholder="Arg" [matAutocomplete]="auto" [formControl]="stateCtrl">
|
||||
</mat-form-field>
|
||||
<mat-autocomplete #auto="matAutocomplete">
|
||||
<mat-option *ngFor="let arg of filteredOptions | async" [value]="arg.key">
|
||||
<span [innerHTML]="arg.key | highlight : stateCtrl.value"></span>
|
||||
<button style="float: right" [matTooltip]="arg.description" mat-icon-button><mat-icon>info</mat-icon></button>
|
||||
</mat-option>
|
||||
</mat-autocomplete>
|
||||
|
||||
<div>
|
||||
<mat-menu #argsByCategoryMenu="matMenu">
|
||||
<ng-container *ngFor="let argsInCategory of argsByCategory | keyvalue">
|
||||
<button mat-menu-item [matMenuTriggerFor]="subMenu">{{argsInfo[argsInCategory.key].label}}</button>
|
||||
<mat-menu #subMenu="matMenu">
|
||||
<button mat-menu-item *ngFor="let arg of argsInCategory.value" (click)="setFirstArg(arg.key)"><div style="display: inline-block;">{{arg.key}}</div> <div class="info-menu-icon"><mat-icon [matTooltip]="arg.description">info</mat-icon></div></button>
|
||||
</mat-menu>
|
||||
</ng-container>
|
||||
|
||||
</mat-menu>
|
||||
|
||||
|
||||
|
||||
<button style="margin-bottom: 15px" mat-stroked-button [matMenuTriggerFor]="argsByCategoryMenu"><ng-container i18n="Search args by category button">Search by category</ng-container></button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<mat-checkbox color="accent" [ngModelOptions]="{standalone: true}" [(ngModel)]="secondArgEnabled"><ng-container i18n="Use arg value checkbox">Use arg value</ng-container></mat-checkbox>
|
||||
</div>
|
||||
<div *ngIf="secondArgEnabled">
|
||||
<mat-form-field style="width: 75%" color="accent">
|
||||
<input [ngModelOptions]="{standalone: true}" matInput [disabled]="!secondArgEnabled" placeholder="Arg value" i18n-placeholder="Arg value placeholder" [(ngModel)]="secondArg">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</form>
|
||||
<div>
|
||||
<button (click)="addArg()" [disabled]="!canAddArg()" mat-stroked-button color="accent"><ng-container i18n="Search args by category button">Add arg</ng-container></button>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions>
|
||||
<button mat-button mat-dialog-close><ng-container i18n="Arg modifier cancel button">Cancel</ng-container></button>
|
||||
<button mat-button color="accent" [mat-dialog-close]="modified_args"><ng-container i18n="Arg modifier modify button">Modify</ng-container></button>
|
||||
</mat-dialog-actions>
|
||||
@@ -0,0 +1,3 @@
|
||||
.info-menu-icon {
|
||||
float: right;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ArgModifierDialogComponent } from './arg-modifier-dialog.component';
|
||||
|
||||
describe('ArgModifierDialogComponent', () => {
|
||||
let component: ArgModifierDialogComponent;
|
||||
let fixture: ComponentFixture<ArgModifierDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ArgModifierDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ArgModifierDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,117 @@
|
||||
import { Component, OnInit, Inject, Pipe, PipeTransform, NgModule } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef, MatDialog } from '@angular/material/dialog';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { args, args_info } from './youtubedl_args';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators/map';
|
||||
import { startWith } from 'rxjs/operators/startWith';
|
||||
|
||||
@Pipe({ name: 'highlight' })
|
||||
export class HighlightPipe implements PipeTransform {
|
||||
transform(text: string, search): string {
|
||||
const pattern = search ? search
|
||||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
|
||||
.split(' ')
|
||||
.filter(t => t.length > 0)
|
||||
.join('|') : undefined;
|
||||
const regex = new RegExp(pattern, 'gi');
|
||||
|
||||
return search ? text.replace(regex, match => `<b>${match}</b>`) : text;
|
||||
}
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-arg-modifier-dialog',
|
||||
templateUrl: './arg-modifier-dialog.component.html',
|
||||
providers: [HighlightPipe],
|
||||
styleUrls: ['./arg-modifier-dialog.component.scss'],
|
||||
})
|
||||
export class ArgModifierDialogComponent implements OnInit {
|
||||
myGroup = new FormControl();
|
||||
firstArg = '';
|
||||
secondArg = '';
|
||||
secondArgEnabled = false;
|
||||
modified_args = '';
|
||||
stateCtrl = new FormControl();
|
||||
availableArgs = null;
|
||||
argsByCategory = null;
|
||||
argsInfo = null;
|
||||
filteredOptions: Observable<any>;
|
||||
|
||||
static forRoot() {
|
||||
return {
|
||||
ngModule: ArgModifierDialogComponent,
|
||||
providers: [],
|
||||
};
|
||||
}
|
||||
|
||||
constructor(@Inject(MAT_DIALOG_DATA) public data: any, public dialogRef: MatDialogRef<ArgModifierDialogComponent>,
|
||||
private dialog: MatDialog) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.data) {
|
||||
this.modified_args = this.data.initial_args;
|
||||
}
|
||||
|
||||
this.getAllPossibleArgs();
|
||||
|
||||
// autocomplete setup
|
||||
this.filteredOptions = this.stateCtrl.valueChanges
|
||||
.pipe(
|
||||
startWith(''),
|
||||
map(val => this.filter(val))
|
||||
);
|
||||
}
|
||||
|
||||
// autocomplete filter
|
||||
filter(val) {
|
||||
if (this.availableArgs) {
|
||||
return this.availableArgs.filter(option =>
|
||||
option.key.toLowerCase().includes(val.toLowerCase()));
|
||||
}
|
||||
}
|
||||
|
||||
addArg() {
|
||||
// adds space
|
||||
if (this.modified_args !== '') {
|
||||
this.modified_args += ' ';
|
||||
}
|
||||
|
||||
this.modified_args += this.stateCtrl.value + ' ' + (this.secondArgEnabled ? this.secondArg : '');
|
||||
}
|
||||
|
||||
canAddArg() {
|
||||
return this.stateCtrl.value && this.stateCtrl.value !== '' && (!this.secondArgEnabled || (this.secondArg && this.secondArg !== ''));
|
||||
}
|
||||
|
||||
getFirstArg() {
|
||||
return new Promise(resolve => {
|
||||
resolve(this.stateCtrl.value);
|
||||
});
|
||||
}
|
||||
|
||||
getValueAsync(val) {
|
||||
return new Promise(resolve => {
|
||||
resolve(val);
|
||||
});
|
||||
}
|
||||
|
||||
getAllPossibleArgs() {
|
||||
const all_args = args;
|
||||
const arg_arrays = Object.keys(all_args).map(function(key) {
|
||||
return all_args[key];
|
||||
});
|
||||
|
||||
// converts array of arrays to one array
|
||||
const singular_arg_array = [].concat.apply([], arg_arrays);
|
||||
|
||||
this.availableArgs = singular_arg_array;
|
||||
this.argsByCategory = all_args;
|
||||
this.argsInfo = args_info;
|
||||
}
|
||||
|
||||
setFirstArg(arg_key) {
|
||||
this.stateCtrl.setValue(arg_key);
|
||||
}
|
||||
|
||||
}
|
||||
230
src/app/dialogs/arg-modifier-dialog/youtubedl_args.ts
Normal file
230
src/app/dialogs/arg-modifier-dialog/youtubedl_args.ts
Normal file
@@ -0,0 +1,230 @@
|
||||
const uncategorized = [
|
||||
{'key': '-h', 'alt': '--help', 'description': 'Print this help text and exit'},
|
||||
{'key': '--version', 'description': 'Print program version and exit'},
|
||||
{'key': '-U', 'alt': '--update', 'description': 'Update this program to latest version. Make sure that you have sufficient permissions (run with sudo if needed)'},
|
||||
{'key': '-i', 'alt': '--ignore-errors', 'description': 'Continue on download errors, for example to skip unavailable videos in a playlist'},
|
||||
{'key': '--abort-on-error', 'description': 'Abort downloading of further videos (in the playlist or the command line) if an error occurs'},
|
||||
{'key': '--dump-user-agent', 'description': 'Display the current browser identification'},
|
||||
{'key': '--list-extractors', 'description': 'List all supported extractors'},
|
||||
{'key': '--extractor-descriptions', 'description': 'Output descriptions of all supported extractors'},
|
||||
{'key': '--force-generic-extractor', 'description': 'Force extraction to use the generic extractor'},
|
||||
{'key': '--default-search', 'description': 'Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos from google videos for youtube-dl "large apple". Use the value "auto" to let youtube-dl guess ("auto_warning" to emit awarning when guessing). "error" just throws an error. The default value "fixup_error" repairs broken URLs, but emits an error if this is not possible instead of searching.'},
|
||||
{'key': '--ignore-config', 'description': 'Do not read configuration files. When given in the global configuration file /etc/youtube-dl.conf: Do not read the user configuration in ~/.config/youtube-dl/config (%APPDATA%/youtube-dl/config.txt on Windows)'},
|
||||
{'key': '--config-location', 'description': 'Location of the configuration file; either the path to the config or its containing directory.'},
|
||||
{'key': '--flat-playlist', 'description': 'Do not extract the videos of a playlist, only list them.'},
|
||||
{'key': '--mark-watched', 'description': 'Mark videos watched (YouTube only)'},
|
||||
{'key': '--no-mark-watched', 'description': 'Do not mark videos watched (YouTube only)'},
|
||||
{'key': '--no-color', 'description': 'Do not emit color codes in output'}
|
||||
];
|
||||
|
||||
const network = [
|
||||
{'key': '--proxy', 'description': 'Use the specified HTTP/HTTPS/SOCKS proxy.To enable SOCKS proxy, specify a proper scheme. For example socks5://127.0.0.1:1080/. Pass in an empty string (--proxy "") for direct connection.'},
|
||||
{'key': '--socket-timeout', 'description': 'Time to wait before giving up, in seconds'},
|
||||
{'key': '--source-address', 'description': 'Client-side IP address to bind to'},
|
||||
{'key': '-4', 'alt': '--force-ipv4', 'description': 'Make all connections via IPv4'},
|
||||
{'key': '-6', 'alt': '--force-ipv6', 'description': 'Make all connections via IPv6'}
|
||||
];
|
||||
|
||||
const geo_restriction = [
|
||||
{'key': '--geo-verification-proxy', 'description': 'Use this proxy to verify the IP address for some geo-restricted sites. The default proxy specified by --proxy\', if the option is not present) is used for the actual downloading.'},
|
||||
{'key': '--geo-bypass', 'description': 'Bypass geographic restriction via faking X-Forwarded-For HTTP header'},
|
||||
{'key': '--no-geo-bypass', 'description': 'Do not bypass geographic restriction via faking X-Forwarded-For HTTP header'},
|
||||
{'key': '--geo-bypass-country', 'description': 'Force bypass geographic restriction with explicitly provided two-letter ISO 3166-2 country code'},
|
||||
{'key': '--geo-bypass-ip-block', 'description': 'Force bypass geographic restriction with explicitly provided IP block in CIDR notation'}
|
||||
];
|
||||
|
||||
const video_selection = [
|
||||
{'key': '--playlist-start', 'description': 'Playlist video to start at (default is 1)'},
|
||||
{'key': '--playlist-end', 'description': 'Playlist video to end at (default is last)'},
|
||||
{'key': '--playlist-items', 'description': 'Playlist video items to download. Specify indices of the videos in the playlist separated by commas like: "--playlist-items 1,2,5,8" if you want to download videos indexed 1, 2, 5, 8 in the playlist. You can specify range: "--playlist-items 1-3,7,10-13", it will download the videos at index 1, 2, 3, 7, 10, 11, 12 and 13.'},
|
||||
{'key': '--match-title', 'description': 'Download only matching titles (regex orcaseless sub-string)'},
|
||||
{'key': '--reject-title', 'description': 'Skip download for matching titles (regex orcaseless sub-string)'},
|
||||
{'key': '--max-downloads', 'description': 'Abort after downloading NUMBER files'},
|
||||
{'key': '--min-filesize', 'description': 'Do not download any videos smaller than SIZE (e.g. 50k or 44.6m)'},
|
||||
{'key': '--max-filesize', 'description': 'Do not download any videos larger than SIZE (e.g. 50k or 44.6m)'},
|
||||
{'key': '--date', 'description': 'Download only videos uploaded in this date'},
|
||||
{'key': '--datebefore', 'description': 'Download only videos uploaded on or before this date (i.e. inclusive)'},
|
||||
{'key': '--dateafter', 'description': 'Download only videos uploaded on or after this date (i.e. inclusive)'},
|
||||
{'key': '--min-views', 'description': 'Do not download any videos with less than COUNT views'},
|
||||
{'key': '--max-views', 'description': 'Do not download any videos with more than COUNT views'},
|
||||
{'key': '--match-filter', 'description': 'Generic video filter. Specify any key (seethe "OUTPUT TEMPLATE" for a list of available keys) to match if the key is present, !key to check if the key is not present, key > NUMBER (like "comment_count > 12", also works with >=, <, <=, !=, =) to compare against a number, key = \'LITERAL\' (like "uploader = \'Mike Smith\'", also works with !=) to match against a string literal and & to require multiple matches. Values which are not known are excluded unless you put a question mark (?) after the operator. For example, to only match videos that have been liked more than 100 times and disliked less than 50 times (or the dislike functionality is not available at the given service), but who also have a description, use --match-filter'},
|
||||
{'key': '--no-playlist', 'description': 'Download only the video, if the URL refers to a video and a playlist.'},
|
||||
{'key': '--yes-playlist', 'description': 'Download the playlist, if the URL refers to a video and a playlist.'},
|
||||
{'key': '--age-limit', 'description': 'Download only videos suitable for the given age'},
|
||||
{'key': '--download-archive', 'description': 'Download only videos not listed in the archive file. Record the IDs of all downloaded videos in it.'},
|
||||
{'key': '--include-ads', 'description': 'Download advertisements as well (experimental)'}
|
||||
];
|
||||
|
||||
const download = [
|
||||
{'key': '-r', 'alt': '--limit-rate', 'description': 'Maximum download rate in bytes per second(e.g. 50K or 4.2M)'},
|
||||
{'key': '-R', 'alt': '--retries', 'description': 'Number of retries (default is 10), or "infinite".'},
|
||||
{'key': '--fragment-retries', 'description': 'Number of retries for a fragment (default is 10), or "infinite" (DASH, hlsnative and ISM)'},
|
||||
{'key': '--skip-unavailable-fragments', 'description': 'Skip unavailable fragments (DASH, hlsnative and ISM)'},
|
||||
{'key': '--abort-on-unavailable-fragment', 'description': 'Abort downloading when some fragment is not available'},
|
||||
{'key': '--keep-fragments', 'description': 'Keep downloaded fragments on disk after downloading is finished; fragments are erased by default'},
|
||||
{'key': '--buffer-size', 'description': 'Size of download buffer (e.g. 1024 or 16K) (default is 1024)'},
|
||||
{'key': '--no-resize-buffer', 'description': 'Do not automatically adjust the buffer size. By default, the buffer size is automatically resized from an initial value of SIZE.'},
|
||||
{'key': '--http-chunk-size', 'description': 'Size of a chunk for chunk-based HTTP downloading (e.g. 10485760 or 10M) (default is disabled). May be useful for bypassing bandwidth throttling imposed by a webserver (experimental)'},
|
||||
{'key': '--playlist-reverse', 'description': 'Download playlist videos in reverse order'},
|
||||
{'key': '--playlist-random', 'description': 'Download playlist videos in random order'},
|
||||
{'key': '--xattr-set-filesize', 'description': 'Set file xattribute ytdl.filesize with expected file size'},
|
||||
{'key': '--hls-prefer-native', 'description': 'Use the native HLS downloader instead of ffmpeg'},
|
||||
{'key': '--hls-prefer-ffmpeg', 'description': 'Use ffmpeg instead of the native HLS downloader'},
|
||||
{'key': '--hls-use-mpegts', 'description': 'Use the mpegts container for HLS videos, allowing to play the video while downloading (some players may not be able to play it)'},
|
||||
{'key': '--external-downloader', 'description': 'Use the specified external downloader. Currently supports aria2c,avconv,axel,curl,ffmpeg,httpie,wget'},
|
||||
{'key': '--external-downloader-args'}
|
||||
];
|
||||
|
||||
const filesystem = [
|
||||
{'key': '-a', 'alt': '--batch-file', 'description': 'File containing URLs to download (\'-\' for stdin), one URL per line. Lines starting with \'#\', \';\' or \']\' are considered as comments and ignored.'},
|
||||
{'key': '--id', 'description': 'Use only video ID in file name'},
|
||||
{'key': '-o', 'alt': '--output', 'description': 'Output filename template, see the "OUTPUT TEMPLATE" for all the info'},
|
||||
{'key': '--autonumber-start', 'description': 'Specify the start value for %(autonumber)s (default is 1)'},
|
||||
{'key': '--restrict-filenames', 'description': 'Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames'},
|
||||
{'key': '-w', 'alt': '--no-overwrites', 'description': 'Do not overwrite files'},
|
||||
{'key': '-c', 'alt': '--continue', 'description': 'Force resume of partially downloaded files. By default, youtube-dl will resume downloads if possible.'},
|
||||
{'key': '--no-continue', 'description': 'Do not resume partially downloaded files (restart from beginning)'},
|
||||
{'key': '--no-part', 'description': 'Do not use .part files - write directlyinto output file'},
|
||||
{'key': '--no-mtime', 'description': 'Do not use the Last-modified header to set the file modification time'},
|
||||
{'key': '--write-description', 'description': 'Write video description to a .description file'},
|
||||
{'key': '--write-info-json', 'description': 'Write video metadata to a .info.json file'},
|
||||
{'key': '--write-annotations', 'description': 'Write video annotations to a.annotations.xml file'},
|
||||
{'key': '--load-info-json', 'description': 'JSON file containing the video information (created with the "--write-info-json" option)'},
|
||||
{'key': '--cookies', 'description': 'File to read cookies from and dump cookie jar in'},
|
||||
{'key': '--cache-dir', 'description': 'Location in the file system where youtube-dl can store some downloaded information permanently. By default $XDG_CACHE_HOME/youtube-dl or ~/.cache/youtube-dl . At the moment, only YouTube player files (for videos with obfuscated signatures) are cached, but that may change.'},
|
||||
{'key': '--no-cache-dir', 'description': 'Disable filesystem caching'},
|
||||
{'key': '--rm-cache-dir', 'description': 'Delete all filesystem cache files'}
|
||||
];
|
||||
|
||||
const thumbnail = [
|
||||
{'key': '--write-thumbnail', 'description': 'Write thumbnail image to disk'},
|
||||
{'key': '--write-all-thumbnails', 'description': 'Write all thumbnail image formats to disk'},
|
||||
{'key': '--list-thumbnails', 'description': 'Simulate and list all available thumbnail formats'}
|
||||
];
|
||||
|
||||
const verbosity = [
|
||||
{'key': '-q', 'alt': '--quiet', 'description': 'Activate quiet mode'},
|
||||
{'key': '--no-warnings', 'description': 'Ignore warnings'},
|
||||
{'key': '-s', 'alt': '--simulate', 'description': 'Do not download the video and do not writeanything to disk'},
|
||||
{'key': '--skip-download', 'description': 'Do not download the video'},
|
||||
{'key': '-g', 'alt': '--get-url', 'description': 'Simulate, quiet but print URL'},
|
||||
{'key': '-e', 'alt': '--get-title', 'description': 'Simulate, quiet but print title'},
|
||||
{'key': '--get-id', 'description': 'Simulate, quiet but print id'},
|
||||
{'key': '--get-thumbnail', 'description': 'Simulate, quiet but print thumbnail URL'},
|
||||
{'key': '--get-description', 'description': 'Simulate, quiet but print video description'},
|
||||
{'key': '--get-duration', 'description': 'Simulate, quiet but print video length'},
|
||||
{'key': '--get-filename', 'description': 'Simulate, quiet but print output filename'},
|
||||
{'key': '--get-format', 'description': 'Simulate, quiet but print output format'},
|
||||
{'key': '-j', 'alt': '--dump-json', 'description': 'Simulate, quiet but print JSON information. See the "OUTPUT TEMPLATE" for a description of available keys.'},
|
||||
{'key': '-J', 'alt': '--dump-single-json', 'description': 'Simulate, quiet but print JSON information for each command-line argument. If the URL refers to a playlist, dump the whole playlist information in a single line.'},
|
||||
{'key': '--print-json', 'description': 'Be quiet and print the video information as JSON (video is still being downloaded).'},
|
||||
{'key': '--newline', 'description': 'Output progress bar as new lines'},
|
||||
{'key': '--no-progress', 'description': 'Do not print progress bar'},
|
||||
{'key': '--console-title', 'description': 'Display progress in console title bar'},
|
||||
{'key': '-v', 'alt': '--verbose', 'description': 'Print various debugging information'},
|
||||
{'key': '--dump-pages', 'description': 'Print downloaded pages encoded using base64 to debug problems (very verbose)'},
|
||||
{'key': '--write-pages', 'description': 'Write downloaded intermediary pages to files in the current directory to debug problems'},
|
||||
{'key': '--print-traffic', 'description': 'Display sent and read HTTP traffic'},
|
||||
{'key': '-C', 'alt': '--call-home', 'description': 'Contact the youtube-dl server for debugging'},
|
||||
{'key': '--no-call-home', 'description': 'Do NOT contact the youtube-dl server for debugging'}
|
||||
];
|
||||
|
||||
const workarounds = [
|
||||
{'key': '--encoding', 'description': 'Force the specified encoding (experimental)'},
|
||||
{'key': '--no-check-certificate', 'description': 'Suppress HTTPS certificate validation'},
|
||||
{'key': '--prefer-insecure', 'description': 'Use an unencrypted connection to retrieve information about the video. (Currently supported only for YouTube)'},
|
||||
{'key': '--user-agent', 'description': 'Specify a custom user agent'},
|
||||
{'key': '--referer', 'description': 'Specify a custom referer, use if the video access is restricted to one domain'},
|
||||
{'key': '--add-header', 'description': 'Specify a custom HTTP header and its value, separated by a colon \':\'. You can use this option multiple times'},
|
||||
{'key': '--bidi-workaround', 'description': 'Work around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH'},
|
||||
{'key': '--sleep-interval', 'description': 'Number of seconds to sleep before each download when used alone or a lower boundof a range for randomized sleep before each download (minimum possible number of seconds to sleep) when used along with --max-sleep-interval'},
|
||||
{'key': '--max-sleep-interval', 'description': 'Upper bound of a range for randomized sleep before each download (maximum possible number of seconds to sleep). Must only beused along with --min-sleep-interval'}
|
||||
]
|
||||
|
||||
const video_format = [
|
||||
{'key': '-f', 'alt': '--format', 'description': 'Video format code, see the "FORMAT SELECTION" for all the info'},
|
||||
{'key': '--all-formats', 'description': 'Download all available video formats'},
|
||||
{'key': '--prefer-free-formats', 'description': 'Prefer free video formats unless a specific one is requested'},
|
||||
{'key': '-F', 'alt': '--list-formats', 'description': 'List all available formats of requested videos'},
|
||||
{'key': '--youtube-skip-dash-manifest', 'description': 'Do not download the DASH manifests and related data on YouTube videos'},
|
||||
{'key': '--merge-output-format', 'description': 'If a merge is required (e.g. bestvideo+bestaudio), output to given container format. One of mkv, mp4, ogg, webm, flv. Ignored if no merge is required'}
|
||||
];
|
||||
|
||||
const subtitle = [
|
||||
{'key': '--write-sub', 'description': 'Write subtitle file'},
|
||||
{'key': '--write-auto-sub', 'description': 'Write automatically generated subtitle file (YouTube only)'},
|
||||
{'key': '--all-subs', 'description': 'Download all the available subtitles of the video'},
|
||||
{'key': '--list-subs', 'description': 'List all available subtitles for the video'},
|
||||
{'key': '--sub-format', 'description': 'Subtitle format, accepts formats preference, for example: "srt" or "ass/srt/best"'},
|
||||
{'key': '--sub-lang', 'description': 'Languages of the subtitles to download (optional) separated by commas, use --list-subs'}
|
||||
];
|
||||
|
||||
const authentication = [
|
||||
{'key': '-u', 'alt': '--username', 'description': 'Login with this account ID'},
|
||||
{'key': '-p', 'alt': '--password', 'description': 'Account password. If this option is left out, youtube-dl will ask interactively.'},
|
||||
{'key': '-2', 'alt': '--twofactor', 'description': 'Two-factor authentication code'},
|
||||
{'key': '-n', 'alt': '--netrc', 'description': 'Use .netrc authentication data'},
|
||||
{'key': '--video-password', 'description': 'Video password (vimeo, smotri, youku)'}
|
||||
];
|
||||
|
||||
const adobe_pass = [
|
||||
{'key': '--ap-mso', 'description': 'Adobe Pass multiple-system operator (TV provider) identifier, use --ap-list-mso'},
|
||||
{'key': '--ap-username', 'description': 'Multiple-system operator account login'},
|
||||
{'key': '--ap-password', 'description': 'Multiple-system operator account password. If this option is left out, youtube-dl will ask interactively.'},
|
||||
{'key': '--ap-list-mso', 'description': 'List all supported multiple-system operators'}
|
||||
];
|
||||
|
||||
const post_processing = [
|
||||
{'key': '-x', 'alt': '--extract-audio', 'description': 'Convert video files to audio-only files (requires ffmpeg or avconv and ffprobe or avprobe)'},
|
||||
{'key': '--audio-format', 'description': 'Specify audio format: "best", "aac", "flac", "mp3", "m4a", "opus", "vorbis", or "wav"; "best" by default; No effect without -x'},
|
||||
{'key': '--audio-quality', 'description': 'Specify ffmpeg/avconv audio quality, insert a value between 0 (better) and 9 (worse)for VBR or a specific bitrate like 128K (default 5)'},
|
||||
{'key': '--recode-video', 'description': 'Encode the video to another format if necessary (currently supported:mp4|flv|ogg|webm|mkv|avi)'},
|
||||
{'key': '--postprocessor-args', 'description': 'Give these arguments to the postprocessor'},
|
||||
{'key': '-k', 'alt': '--keep-video', 'description': 'Keep the video file on disk after the post-processing; the video is erased by default'},
|
||||
{'key': '--no-post-overwrites', 'description': 'Do not overwrite post-processed files; the post-processed files are overwritten by default'},
|
||||
{'key': '--embed-subs', 'description': 'Embed subtitles in the video (only for mp4,webm and mkv videos)'},
|
||||
{'key': '--embed-thumbnail', 'description': 'Embed thumbnail in the audio as cover art'},
|
||||
{'key': '--add-metadata', 'description': 'Write metadata to the video file'},
|
||||
{'key': '--metadata-from-title', 'description': 'Parse additional metadata like song title/artist from the video title. The format syntax is the same as --output'},
|
||||
{'key': '--xattrs', 'description': 'Write metadata to the video file\'s xattrs (using dublin core and xdg standards)'},
|
||||
{'key': '--fixup', 'description': 'Automatically correct known faults of the file. One of never (do nothing), warn (only emit a warning), detect_or_warn (the default; fix file if we can, warn otherwise)'},
|
||||
{'key': '--prefer-avconv', 'description': 'Prefer avconv over ffmpeg for running the postprocessors'},
|
||||
{'key': '--prefer-ffmpeg', 'description': 'Prefer ffmpeg over avconv for running the postprocessors (default)'},
|
||||
{'key': '--ffmpeg-location', 'description': 'Location of the ffmpeg/avconv binary; either the path to the binary or its containing directory.'},
|
||||
{'key': '--exec', 'description': 'Execute a command on the file after downloading, similar to find\'s -exec syntax. Example: --exec'},
|
||||
{'key': '--convert-subs', 'description': 'Convert the subtitles to other format (currently supported: srt|ass|vtt|lrc)'}
|
||||
];
|
||||
|
||||
export const args_info = {
|
||||
'uncategorized' : {'label': 'Main'},
|
||||
'network' : {'label': 'Network'},
|
||||
'geo_restriction': {'label': 'Geo Restriction'},
|
||||
'video_selection': {'label': 'Video Selection'},
|
||||
'download' : {'label': 'Download'},
|
||||
'filesystem' : {'label': 'Filesystem'},
|
||||
'thumbnail' : {'label': 'Thumbnail'},
|
||||
'verbosity' : {'label': 'Verbosity'},
|
||||
'workarounds' : {'label': 'Workarounds'},
|
||||
'video_format' : {'label': 'Video Format'},
|
||||
'subtitle' : {'label': 'Subtitle'},
|
||||
'authentication' : {'label': 'Authentication'},
|
||||
'adobe_pass' : {'label': 'Adobe Pass'},
|
||||
'post_processing': {'label': 'Post Processing'},
|
||||
};
|
||||
|
||||
export const args = {
|
||||
'uncategorized' : uncategorized,
|
||||
'network' : network,
|
||||
'geo_restriction': geo_restriction,
|
||||
'video_selection': video_selection,
|
||||
'download' : download,
|
||||
'filesystem' : filesystem,
|
||||
'thumbnail' : thumbnail,
|
||||
'verbosity' : verbosity,
|
||||
'workarounds' : workarounds,
|
||||
'video_format' : video_format,
|
||||
'subtitle' : subtitle,
|
||||
'authentication' : authentication,
|
||||
'adobe_pass' : adobe_pass,
|
||||
'post_processing': post_processing
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<h4 *ngIf="pinSetChecked" mat-dialog-title>{{dialog_title}}</h4>
|
||||
|
||||
<mat-dialog-content>
|
||||
<div style="position: relative">
|
||||
<div *ngIf="pinSetChecked">
|
||||
<mat-form-field color="accent">
|
||||
<input type="password" (keyup.enter)="doAction()" matInput [(ngModel)]="input" [placeholder]="input_placeholder">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="spinner-div" *ngIf="!pinSetChecked">
|
||||
<mat-spinner [diameter]="25"></mat-spinner>
|
||||
</div>
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions>
|
||||
<button [disabled]="input.length === 0" color="accent" style="margin-bottom: 12px;" (click)="doAction()" mat-raised-button>{{button_label}}</button>
|
||||
</mat-dialog-actions>
|
||||
@@ -0,0 +1,6 @@
|
||||
.spinner-div {
|
||||
position: absolute;
|
||||
margin: 0 auto;
|
||||
top: 30%;
|
||||
left: 42%;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CheckOrSetPinDialogComponent } from './check-or-set-pin-dialog.component';
|
||||
|
||||
describe('CheckOrSetPinDialogComponent', () => {
|
||||
let component: CheckOrSetPinDialogComponent;
|
||||
let fixture: ComponentFixture<CheckOrSetPinDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CheckOrSetPinDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CheckOrSetPinDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,96 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { PostsService } from 'app/posts.services';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
|
||||
@Component({
|
||||
selector: 'app-check-or-set-pin-dialog',
|
||||
templateUrl: './check-or-set-pin-dialog.component.html',
|
||||
styleUrls: ['./check-or-set-pin-dialog.component.scss']
|
||||
})
|
||||
export class CheckOrSetPinDialogComponent implements OnInit {
|
||||
|
||||
pinSetChecked = false;
|
||||
pinSet = true;
|
||||
resetMode = false;
|
||||
dialog_title = '';
|
||||
input_placeholder = null;
|
||||
input = '';
|
||||
button_label = '';
|
||||
|
||||
constructor(private postsService: PostsService, @Inject(MAT_DIALOG_DATA) public data: any,
|
||||
public dialogRef: MatDialogRef<CheckOrSetPinDialogComponent>, private snackBar: MatSnackBar) { }
|
||||
|
||||
ngOnInit() {
|
||||
if (this.data) {
|
||||
this.resetMode = this.data.resetMode;
|
||||
}
|
||||
|
||||
if (this.resetMode) {
|
||||
this.pinSetChecked = true;
|
||||
this.notSetLogic();
|
||||
} else {
|
||||
this.isPinSet();
|
||||
}
|
||||
}
|
||||
|
||||
isPinSet() {
|
||||
this.postsService.isPinSet().subscribe(res => {
|
||||
this.pinSetChecked = true;
|
||||
if (res['is_set']) {
|
||||
this.isSetLogic();
|
||||
} else {
|
||||
this.notSetLogic();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isSetLogic() {
|
||||
this.pinSet = true;
|
||||
this.dialog_title = 'Pin Required';
|
||||
this.input_placeholder = 'Pin';
|
||||
this.button_label = 'Submit'
|
||||
}
|
||||
|
||||
notSetLogic() {
|
||||
this.pinSet = false;
|
||||
this.dialog_title = 'Set your pin';
|
||||
this.input_placeholder = 'New pin';
|
||||
this.button_label = 'Set Pin'
|
||||
}
|
||||
|
||||
doAction() {
|
||||
// pin set must have been checked, and input must not be empty
|
||||
if (!this.pinSetChecked || this.input.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.pinSet) {
|
||||
this.postsService.checkPin(this.input).subscribe(res => {
|
||||
if (res['success']) {
|
||||
this.dialogRef.close(true);
|
||||
} else {
|
||||
this.dialogRef.close(false);
|
||||
this.openSnackBar('Pin is incorrect!');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.postsService.setPin(this.input).subscribe(res => {
|
||||
if (res['success']) {
|
||||
this.dialogRef.close(true);
|
||||
this.openSnackBar('Pin successfully set!');
|
||||
} else {
|
||||
this.dialogRef.close(false);
|
||||
this.openSnackBar('Failed to set pin!');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public openSnackBar(message: string, action: string = '') {
|
||||
this.snackBar.open(message, action, {
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<h4 mat-dialog-title i18n="Subscribe dialog title">Subscribe to playlist or channel</h4>
|
||||
|
||||
<mat-dialog-content>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-form-field color="accent">
|
||||
<input [(ngModel)]="url" matInput placeholder="URL" i18n-placeholder="Subscription URL input placeholder" required aria-required="true">
|
||||
<mat-hint><ng-container i18n="Subscription URL input hint">The playlist or channel URL</ng-container></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<mat-form-field color="accent">
|
||||
<input [(ngModel)]="name" matInput placeholder="Custom name" i18n-placeholder="Subscription custom name placeholder">
|
||||
<mat-hint><ng-container i18n="Custom name input hint">This is optional</ng-container></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-12 mt-3">
|
||||
<mat-checkbox [(ngModel)]="download_all"><ng-container i18n="Download all uploads subscription setting">Download all uploads</ng-container></mat-checkbox>
|
||||
</div>
|
||||
<div class="col-12" *ngIf="!download_all">
|
||||
<ng-container i18n="Download time range prefix">Download videos uploaded in the last</ng-container>
|
||||
<mat-form-field color="accent" style="width: 50px; text-align: center">
|
||||
<input type="number" matInput [(ngModel)]="timerange_amount">
|
||||
</mat-form-field>
|
||||
<mat-select color="accent" class="unit-select" [(ngModel)]="timerange_unit">
|
||||
<mat-option *ngFor="let time_unit of time_units" [value]="time_unit + (timerange_amount === 1 ? '' : 's')">
|
||||
{{time_unit + (timerange_amount === 1 ? '' : 's')}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions>
|
||||
<button mat-button mat-dialog-close><ng-container i18n="Subscribe cancel button">Cancel</ng-container></button>
|
||||
<!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->
|
||||
<button mat-button [disabled]="!url" type="submit" (click)="subscribeClicked()">Subscribe</button>
|
||||
<div class="mat-spinner" *ngIf="subscribing">
|
||||
<mat-spinner [diameter]="25"></mat-spinner>
|
||||
</div>
|
||||
</mat-dialog-actions>
|
||||
@@ -0,0 +1,8 @@
|
||||
.unit-select {
|
||||
width: 75px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.mat-spinner {
|
||||
margin-left: 5%;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SubscribeDialogComponent } from './subscribe-dialog.component';
|
||||
|
||||
describe('SubscribeDialogComponent', () => {
|
||||
let component: SubscribeDialogComponent;
|
||||
let fixture: ComponentFixture<SubscribeDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SubscribeDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SubscribeDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MatDialogRef } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { PostsService } from 'app/posts.services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-subscribe-dialog',
|
||||
templateUrl: './subscribe-dialog.component.html',
|
||||
styleUrls: ['./subscribe-dialog.component.scss']
|
||||
})
|
||||
export class SubscribeDialogComponent implements OnInit {
|
||||
// inputs
|
||||
timerange_amount;
|
||||
timerange_unit = 'days';
|
||||
download_all = true;
|
||||
url = null;
|
||||
name = null;
|
||||
|
||||
// state
|
||||
subscribing = false;
|
||||
|
||||
time_units = [
|
||||
'day',
|
||||
'week',
|
||||
'month',
|
||||
'year'
|
||||
]
|
||||
|
||||
constructor(private postsService: PostsService,
|
||||
private snackBar: MatSnackBar,
|
||||
public dialogRef: MatDialogRef<SubscribeDialogComponent>) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
subscribeClicked() {
|
||||
if (this.url && this.url !== '') {
|
||||
// timerange must be specified if download_all is false
|
||||
if (!this.download_all && !this.timerange_amount) {
|
||||
this.openSnackBar('You must specify an amount of time');
|
||||
return;
|
||||
}
|
||||
this.subscribing = true;
|
||||
|
||||
let timerange = null;
|
||||
if (!this.download_all) {
|
||||
timerange = 'now-' + this.timerange_amount.toString() + this.timerange_unit;
|
||||
}
|
||||
|
||||
this.postsService.createSubscription(this.url, this.name, timerange).subscribe(res => {
|
||||
this.subscribing = false;
|
||||
if (res['new_sub']) {
|
||||
this.dialogRef.close(res['new_sub']);
|
||||
} else {
|
||||
if (res['error']) {
|
||||
this.openSnackBar('ERROR: ' + res['error']);
|
||||
}
|
||||
this.dialogRef.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public openSnackBar(message: string, action = '') {
|
||||
this.snackBar.open(message, action, {
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<h4 mat-dialog-title>{{sub.name}}</h4>
|
||||
|
||||
<mat-dialog-content>
|
||||
<div class="info-item">
|
||||
<strong><ng-container i18n="Subscription type property">Type:</ng-container> </strong>
|
||||
<span class="info-item-value">{{(sub.isPlaylist ? 'Playlist' : 'Channel')}}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<strong><ng-container i18n="Subscription URL property">URL:</ng-container> </strong>
|
||||
<span class="info-item-value">{{sub.url}}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<strong><ng-container i18n="Subscription ID property">ID:</ng-container> </strong>
|
||||
<span class="info-item-value">{{sub.id}}</span>
|
||||
</div>
|
||||
<div class="info-item" *ngIf="sub.archive">
|
||||
<strong><ng-container i18n="Subscription ID property">Archive:</ng-container> </strong>
|
||||
<span class="info-item-value">{{sub.archive}}</span>
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions>
|
||||
<button mat-button mat-dialog-close><ng-container i18n="Close subscription info button">Close</ng-container></button>
|
||||
<button mat-stroked-button (click)="downloadArchive()" color="accent"><ng-container i18n="Export Archive button">Export Archive</ng-container></button>
|
||||
<span class="spacer"></span>
|
||||
<button mat-button (click)="unsubscribe()" color="warn"><ng-container i18n="Unsubscribe button">Unsubscribe</ng-container></button>
|
||||
</mat-dialog-actions>
|
||||
@@ -0,0 +1,9 @@
|
||||
.info-item {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.info-item-value {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.spacer {flex: 1 1 auto;}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SubscriptionInfoDialogComponent } from './subscription-info-dialog.component';
|
||||
|
||||
describe('SubscriptionInfoDialogComponent', () => {
|
||||
let component: SubscriptionInfoDialogComponent;
|
||||
let fixture: ComponentFixture<SubscriptionInfoDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SubscriptionInfoDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SubscriptionInfoDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { PostsService } from 'app/posts.services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-subscription-info-dialog',
|
||||
templateUrl: './subscription-info-dialog.component.html',
|
||||
styleUrls: ['./subscription-info-dialog.component.scss']
|
||||
})
|
||||
export class SubscriptionInfoDialogComponent implements OnInit {
|
||||
|
||||
sub = null;
|
||||
unsubbedEmitter = null;
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<SubscriptionInfoDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any, private postsService: PostsService) { }
|
||||
|
||||
ngOnInit() {
|
||||
if (this.data) {
|
||||
this.sub = this.data.sub;
|
||||
this.unsubbedEmitter = this.data.unsubbedEmitter;
|
||||
}
|
||||
}
|
||||
|
||||
unsubscribe() {
|
||||
this.postsService.unsubscribe(this.sub, true).subscribe(res => {
|
||||
this.unsubbedEmitter.emit(true);
|
||||
this.dialogRef.close();
|
||||
});
|
||||
}
|
||||
|
||||
downloadArchive() {
|
||||
this.postsService.downloadArchive(this.sub).subscribe(res => {
|
||||
const blob: Blob = res;
|
||||
saveAs(blob, 'archive.txt');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<h4 mat-dialog-title>{{file.title}}</h4>
|
||||
|
||||
<mat-dialog-content>
|
||||
<div class="info-item">
|
||||
<div class="info-item-label"><strong><ng-container i18n="Video name property">Name:</ng-container> </strong></div>
|
||||
<div class="info-item-value">{{file.title}}</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-item-label"><strong><ng-container i18n="Video URL property">URL:</ng-container> </strong></div>
|
||||
<div class="info-item-value"><a target="_blank" [href]="file.url">{{file.url}}</a></div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-item-label"><strong><ng-container i18n="Video ID property">Uploader:</ng-container> </strong></div>
|
||||
<div class="info-item-value">{{file.uploader ? file.uploader : 'N/A'}}</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-item-label"><strong><ng-container i18n="Video file size property">File size:</ng-container> </strong></div>
|
||||
<div class="info-item-value">{{filesize(file.size)}}</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-item-label"><strong><ng-container i18n="Video path property">Path:</ng-container> </strong></div>
|
||||
<div class="info-item-value">{{file.path}}</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-item-label"><strong><ng-container i18n="Video upload date property">Upload Date:</ng-container> </strong></div>
|
||||
<div class="info-item-value">{{file.upload_date}}</div>
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions>
|
||||
<button mat-button mat-dialog-close><ng-container i18n="Close subscription info button">Close</ng-container></button>
|
||||
</mat-dialog-actions>
|
||||
@@ -0,0 +1,18 @@
|
||||
.info-item {
|
||||
margin-bottom: 12px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.info-item-value {
|
||||
font-size: 13px;
|
||||
display: inline-block;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.spacer {flex: 1 1 auto;}
|
||||
|
||||
.info-item-label {
|
||||
display: inline-block;
|
||||
width: 30%;
|
||||
vertical-align: top;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { VideoInfoDialogComponent } from './video-info-dialog.component';
|
||||
|
||||
describe('VideoInfoDialogComponent', () => {
|
||||
let component: VideoInfoDialogComponent;
|
||||
let fixture: ComponentFixture<VideoInfoDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ VideoInfoDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(VideoInfoDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import filesize from 'filesize';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-video-info-dialog',
|
||||
templateUrl: './video-info-dialog.component.html',
|
||||
styleUrls: ['./video-info-dialog.component.scss']
|
||||
})
|
||||
export class VideoInfoDialogComponent implements OnInit {
|
||||
file: any;
|
||||
filesize;
|
||||
constructor(@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.filesize = filesize;
|
||||
if (this.data) {
|
||||
this.file = this.data.file;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
16
src/app/download-item/download-item.component.html
Normal file
16
src/app/download-item/download-item.component.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<div>
|
||||
<mat-grid-list [rowHeight]="50" [cols]="24">
|
||||
<mat-grid-tile [colspan]="2">
|
||||
<h5 style="display: inline-block; margin-right: 5px; position: relative; top: 5px;">{{queueNumber}}.</h5>
|
||||
</mat-grid-tile>
|
||||
<mat-grid-tile [colspan]="6">
|
||||
<div style="display: inline-block; text-align: center;"><ng-container i18n="Download ID">ID:</ng-container> {{url_id}}</div>
|
||||
</mat-grid-tile>
|
||||
<mat-grid-tile [colspan]="13">
|
||||
<mat-progress-bar style="width: 80%" [value]="download.percent_complete" [mode]="(download.percent_complete === 0) ? 'indeterminate' : 'determinate'"></mat-progress-bar>
|
||||
</mat-grid-tile>
|
||||
<mat-grid-tile [colspan]="3">
|
||||
<button (click)="cancelTheDownload()" mat-icon-button color="warn"><mat-icon fontSet="material-icons-outlined">cancel</mat-icon></button>
|
||||
</mat-grid-tile>
|
||||
</mat-grid-list>
|
||||
</div>
|
||||
0
src/app/download-item/download-item.component.scss
Normal file
0
src/app/download-item/download-item.component.scss
Normal file
25
src/app/download-item/download-item.component.spec.ts
Normal file
25
src/app/download-item/download-item.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DownloadItemComponent } from './download-item.component';
|
||||
|
||||
describe('DownloadItemComponent', () => {
|
||||
let component: DownloadItemComponent;
|
||||
let fixture: ComponentFixture<DownloadItemComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DownloadItemComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DownloadItemComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
41
src/app/download-item/download-item.component.ts
Normal file
41
src/app/download-item/download-item.component.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
|
||||
import { Download } from 'app/main/main.component';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-download-item',
|
||||
templateUrl: './download-item.component.html',
|
||||
styleUrls: ['./download-item.component.scss']
|
||||
})
|
||||
export class DownloadItemComponent implements OnInit {
|
||||
|
||||
@Input() download: Download = {
|
||||
uid: null,
|
||||
type: 'audio',
|
||||
percent_complete: 0,
|
||||
url: 'http://youtube.com/watch?v=17848rufj',
|
||||
downloading: true,
|
||||
is_playlist: false
|
||||
};
|
||||
@Output() cancelDownload = new EventEmitter<Download>();
|
||||
|
||||
@Input() queueNumber = null;
|
||||
|
||||
url_id = null;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
if (this.download && this.download.url && this.download.url.includes('youtube')) {
|
||||
const string_id = (this.download.is_playlist ? '?list=' : '?v=')
|
||||
const index_offset = (this.download.is_playlist ? 6 : 3);
|
||||
const end_index = this.download.url.indexOf(string_id) + index_offset;
|
||||
this.url_id = this.download.url.substring(end_index, this.download.url.length);
|
||||
}
|
||||
}
|
||||
|
||||
cancelTheDownload() {
|
||||
this.cancelDownload.emit(this.download);
|
||||
}
|
||||
|
||||
}
|
||||
68
src/app/file-card/file-card.component.css
Normal file
68
src/app/file-card/file-card.component.css
Normal file
@@ -0,0 +1,68 @@
|
||||
.example-card {
|
||||
width: 150px;
|
||||
height: 125px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.deleteButton {
|
||||
top:-5px;
|
||||
right:-5px;
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
/* Coerce the <span> icon container away from display:inline */
|
||||
.mat-icon-button .mat-button-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.example-full-width-height {
|
||||
width: 100%;
|
||||
height: 100%
|
||||
}
|
||||
|
||||
.centered {
|
||||
margin: 0 auto;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
.img-div {
|
||||
height: 60px;
|
||||
padding: 0px;
|
||||
margin: 8px 0px 0px -5px;
|
||||
width: calc(100% + 5px + 5px);
|
||||
overflow: hidden;
|
||||
border-radius: 0px 0px 4px 4px;
|
||||
}
|
||||
|
||||
.max-two-lines {
|
||||
display: -webkit-box;
|
||||
display: -moz-box;
|
||||
max-height: 2.4em;
|
||||
line-height: 1.2em;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.file-link {
|
||||
width: 80%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: block;
|
||||
}
|
||||
|
||||
@media (max-width: 576px){
|
||||
|
||||
.example-card {
|
||||
width: 125px !important;
|
||||
}
|
||||
|
||||
}
|
||||
26
src/app/file-card/file-card.component.html
Normal file
26
src/app/file-card/file-card.component.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<mat-card class="example-card mat-elevation-z6">
|
||||
<div style="padding:5px">
|
||||
<div style="height: 52px;">
|
||||
<div>
|
||||
<b><a class="file-link" href="javascript:void(0)" (click)="!isPlaylist ? mainComponent.goToFile(name, isAudio) : mainComponent.goToPlaylist(name, type)">{{title}}</a></b>
|
||||
</div>
|
||||
<span class="max-two-lines"><ng-container i18n="File or playlist ID">ID:</ng-container> {{name}}</span>
|
||||
<div *ngIf="isPlaylist"><ng-container i18n="Playlist video count">Count:</ng-container> {{count}}</div>
|
||||
</div>
|
||||
<div *ngIf="!image_errored && thumbnailURL" class="img-div">
|
||||
<img class="image" (error) ="onImgError($event)" [id]="type" [lazyLoad]="thumbnailURL" [customObservable]="scrollAndLoad" (onLoad)="imageLoaded($event)" alt="Thumbnail">
|
||||
<span *ngIf="!image_loaded">
|
||||
<ngx-content-loading [width]="500" [height]="360">
|
||||
<svg:g ngx-rect width="500" height="360" y="0" x="0" rx="4" ry="4"></svg:g>
|
||||
</ngx-content-loading>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<button *ngIf="isPlaylist" (click)="deleteFile()" class="deleteButton" mat-icon-button><mat-icon>delete_forever</mat-icon></button>
|
||||
<button [matMenuTriggerFor]="action_menu" *ngIf="!isPlaylist" class="deleteButton" mat-icon-button><mat-icon>more_vert</mat-icon></button>
|
||||
<mat-menu #action_menu="matMenu">
|
||||
<button (click)="openVideoInfoDialog()" mat-menu-item><mat-icon>info</mat-icon><ng-container i18n="Video info button">Info</ng-container></button>
|
||||
<button (click)="deleteFile()" mat-menu-item><mat-icon>delete</mat-icon><ng-container i18n="Delete video button">Delete</ng-container></button>
|
||||
<button *ngIf="use_youtubedl_archive" (click)="deleteFile(true)" mat-menu-item><mat-icon>delete_forever</mat-icon><ng-container i18n="Delete and blacklist video button">Delete and blacklist</ng-container></button>
|
||||
</mat-menu>
|
||||
</mat-card>
|
||||
25
src/app/file-card/file-card.component.spec.ts
Normal file
25
src/app/file-card/file-card.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FileCardComponent } from './file-card.component';
|
||||
|
||||
describe('FileCardComponent', () => {
|
||||
let component: FileCardComponent;
|
||||
let fixture: ComponentFixture<FileCardComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FileCardComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FileCardComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
91
src/app/file-card/file-card.component.ts
Normal file
91
src/app/file-card/file-card.component.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import { Component, OnInit, Input, Output } from '@angular/core';
|
||||
import {PostsService} from '../posts.services';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import {EventEmitter} from '@angular/core';
|
||||
import { MainComponent } from 'app/main/main.component';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import 'rxjs/add/observable/merge';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { VideoInfoDialogComponent } from 'app/dialogs/video-info-dialog/video-info-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-file-card',
|
||||
templateUrl: './file-card.component.html',
|
||||
styleUrls: ['./file-card.component.css']
|
||||
})
|
||||
export class FileCardComponent implements OnInit {
|
||||
@Input() file: any;
|
||||
@Input() title: string;
|
||||
@Input() length: string;
|
||||
@Input() name: string;
|
||||
@Input() thumbnailURL: string;
|
||||
@Input() isAudio = true;
|
||||
@Output() removeFile: EventEmitter<string> = new EventEmitter<string>();
|
||||
@Input() isPlaylist = false;
|
||||
@Input() count = null;
|
||||
@Input() use_youtubedl_archive = false;
|
||||
type;
|
||||
image_loaded = false;
|
||||
image_errored = false;
|
||||
|
||||
scrollSubject;
|
||||
scrollAndLoad;
|
||||
|
||||
constructor(private postsService: PostsService, public snackBar: MatSnackBar, public mainComponent: MainComponent,
|
||||
private dialog: MatDialog) {
|
||||
|
||||
this.scrollSubject = new Subject();
|
||||
this.scrollAndLoad = Observable.merge(
|
||||
Observable.fromEvent(window, 'scroll'),
|
||||
this.scrollSubject
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.type = this.isAudio ? 'audio' : 'video';
|
||||
}
|
||||
|
||||
deleteFile(blacklistMode = false) {
|
||||
if (!this.isPlaylist) {
|
||||
this.postsService.deleteFile(this.name, this.isAudio, blacklistMode).subscribe(result => {
|
||||
if (result === true) {
|
||||
this.openSnackBar('Delete success!', 'OK.');
|
||||
this.removeFile.emit(this.name);
|
||||
} else {
|
||||
this.openSnackBar('Delete failed!', 'OK.');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.removeFile.emit(this.name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
openVideoInfoDialog() {
|
||||
const dialogRef = this.dialog.open(VideoInfoDialogComponent, {
|
||||
data: {
|
||||
file: this.file,
|
||||
},
|
||||
minWidth: '50vw'
|
||||
});
|
||||
}
|
||||
|
||||
onImgError(event) {
|
||||
this.image_errored = true;
|
||||
}
|
||||
|
||||
onHoverResponse() {
|
||||
this.scrollSubject.next();
|
||||
}
|
||||
|
||||
imageLoaded(loaded) {
|
||||
this.image_loaded = true;
|
||||
}
|
||||
|
||||
public openSnackBar(message: string, action: string) {
|
||||
this.snackBar.open(message, action, {
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
3
src/app/input-dialog/input-dialog.component.css
Normal file
3
src/app/input-dialog/input-dialog.component.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.mat-spinner {
|
||||
margin-left: 5%;
|
||||
}
|
||||
17
src/app/input-dialog/input-dialog.component.html
Normal file
17
src/app/input-dialog/input-dialog.component.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<h4 mat-dialog-title>{{inputTitle}}</h4>
|
||||
<mat-dialog-content>
|
||||
<div>
|
||||
<mat-form-field color="accent">
|
||||
<input matInput (keyup.enter)="enterPressed()" [(ngModel)]="inputText" [placeholder]="inputPlaceholder">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<!-- TODO: Internationalize these buttons -->
|
||||
<button mat-button mat-dialog-close>Cancel</button>
|
||||
<!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->
|
||||
<button mat-button [disabled]="!inputText" type="submit" (click)="enterPressed()">{{submitText}}</button>
|
||||
<div class="mat-spinner" *ngIf="inputSubmitted">
|
||||
<mat-spinner [diameter]="25"></mat-spinner>
|
||||
</div>
|
||||
</mat-dialog-actions>
|
||||
25
src/app/input-dialog/input-dialog.component.spec.ts
Normal file
25
src/app/input-dialog/input-dialog.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { InputDialogComponent } from './input-dialog.component';
|
||||
|
||||
describe('InputDialogComponent', () => {
|
||||
let component: InputDialogComponent;
|
||||
let fixture: ComponentFixture<InputDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ InputDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(InputDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
50
src/app/input-dialog/input-dialog.component.ts
Normal file
50
src/app/input-dialog/input-dialog.component.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { Component, OnInit, Input, Inject, EventEmitter } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-input-dialog',
|
||||
templateUrl: './input-dialog.component.html',
|
||||
styleUrls: ['./input-dialog.component.css']
|
||||
})
|
||||
export class InputDialogComponent implements OnInit {
|
||||
|
||||
inputTitle: string;
|
||||
inputPlaceholder: string;
|
||||
submitText: string;
|
||||
|
||||
inputText = '';
|
||||
|
||||
inputSubmitted = false;
|
||||
|
||||
doneEmitter: EventEmitter<any> = null;
|
||||
onlyEmitOnDone = false;
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<InputDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.inputTitle = this.data.inputTitle;
|
||||
this.inputPlaceholder = this.data.inputPlaceholder;
|
||||
this.submitText = this.data.submitText;
|
||||
|
||||
// checks if emitter exists, if so don't autoclose as it should be handled by caller
|
||||
if (this.data.doneEmitter) {
|
||||
this.doneEmitter = this.data.doneEmitter;
|
||||
this.onlyEmitOnDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
enterPressed() {
|
||||
// validates input -- TODO: add custom validator
|
||||
if (this.inputText) {
|
||||
// only emit if emitter is passed
|
||||
if (this.onlyEmitOnDone) {
|
||||
this.doneEmitter.emit(this.inputText);
|
||||
this.inputSubmitted = true;
|
||||
} else {
|
||||
this.dialogRef.close(this.inputText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
127
src/app/main/main.component.css
Normal file
127
src/app/main/main.component.css
Normal file
@@ -0,0 +1,127 @@
|
||||
.demo-card {
|
||||
margin: 16px;
|
||||
}
|
||||
|
||||
.demo-basic {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.demo-basic .mat-card-content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
mat-toolbar.top {
|
||||
height: 60px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/*::ng-deep .mat-form-field-placeholder{
|
||||
|
||||
transform: scale(.75) translateY(20px) !important;
|
||||
}*/
|
||||
|
||||
.big {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.centered {
|
||||
margin: 0 auto;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
.example-full-width {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.example-80-width {
|
||||
width: 80%
|
||||
}
|
||||
|
||||
mat-form-field.mat-form-field {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
margin-left: -28px;
|
||||
margin-top: -10px;
|
||||
}
|
||||
|
||||
.make-room-for-spinner {
|
||||
padding-right: 40px;
|
||||
}
|
||||
|
||||
.equal-sizes {
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.search-card-title {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.input-clear-button {
|
||||
position: absolute;
|
||||
right: -10px;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
.spinner-div {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
right: -40px;
|
||||
}
|
||||
|
||||
.margined {
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.results-div {
|
||||
position: relative;
|
||||
top: -15px;
|
||||
}
|
||||
|
||||
.first-result-card {
|
||||
border-radius: 4px 4px 0px 0px !important;
|
||||
}
|
||||
|
||||
.last-result-card {
|
||||
border-radius: 0px 0px 4px 4px !important;
|
||||
}
|
||||
|
||||
.only-result-card {
|
||||
border-radius: 4px !important;
|
||||
}
|
||||
|
||||
.result-card {
|
||||
height: 120px;
|
||||
border-radius: 0px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.download-progress-bar {
|
||||
z-index: 999;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.add-playlist-button {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.advanced-input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.edit-button {
|
||||
margin-left: 10px;
|
||||
top: -5px;
|
||||
}
|
||||
284
src/app/main/main.component.html
Normal file
284
src/app/main/main.component.html
Normal file
@@ -0,0 +1,284 @@
|
||||
<br/>
|
||||
<div class="big demo-basic">
|
||||
<mat-card id="card" style="margin-right: 20px; margin-left: 20px;">
|
||||
<mat-card-title>
|
||||
<ng-container i18n="Youtube downloader home page label">Youtube Downloader</ng-container>
|
||||
</mat-card-title>
|
||||
<mat-card-content>
|
||||
<div style="position: relative;">
|
||||
<form class="example-form">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div [ngClass]="allowQualitySelect ? 'col-sm-9' : null" class="col-12">
|
||||
<mat-form-field color="accent" class="example-full-width">
|
||||
<input style="padding-right: 25px;" matInput (ngModelChange)="inputChanged($event)" [(ngModel)]="url" [placeholder]="'URL' + (youtubeSearchEnabled ? ' or search' : '')" type="url" name="url" [formControl]="urlForm" required #urlinput>
|
||||
<mat-error *ngIf="urlError || urlForm.invalid">
|
||||
<ng-container i18n="Enter valid URL error">Please enter a valid URL!</ng-container>
|
||||
</mat-error>
|
||||
<button class="input-clear-button" mat-icon-button (click)="clearInput()"><mat-icon>clear</mat-icon></button>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="allowQualitySelect" class="col-7 col-sm-3">
|
||||
<mat-form-field color="accent" style="display: inline-block; width: inherit; min-width: 120px;">
|
||||
<mat-label>
|
||||
<ng-container i18n="Quality select label">
|
||||
Quality
|
||||
</ng-container>
|
||||
</mat-label>
|
||||
<mat-select [ngModelOptions]="{standalone: true}" [(ngModel)]="selectedQuality">
|
||||
<ng-container *ngFor="let option of qualityOptions[(audioOnly) ? 'audio' : 'video']">
|
||||
<mat-option *ngIf="option.value === '' || url && cachedAvailableFormats[url] && cachedAvailableFormats[url]['formats'] && cachedAvailableFormats[url]['formats'][(audioOnly) ? 'audio' : 'video'][option.value]" [value]="option.value">
|
||||
{{option.label}}
|
||||
</mat-option>
|
||||
</ng-container>
|
||||
</mat-select>
|
||||
<div class="spinner-div" *ngIf="url !== '' && cachedAvailableFormats[url] && cachedAvailableFormats[url]['formats_loading']">
|
||||
<mat-spinner [diameter]="25"></mat-spinner>
|
||||
</div>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="results-div" *ngIf="results_showing">
|
||||
<span *ngFor="let result of results; let i = index">
|
||||
<mat-card class="result-card mat-elevation-z7" [ngClass]="[(i === 0 && results.length > 1) ? 'first-result-card' : '', ((i === results.length-1) && results.length > 1) ? 'last-result-card' : '', (results.length === 1) ? 'only-result-card' : '']">
|
||||
<div class="search-card-title">
|
||||
{{result.title}}
|
||||
</div>
|
||||
<div style="font-size: 12px; margin-bottom: 10px;">
|
||||
{{result.uploaded}}
|
||||
</div>
|
||||
<button mat-flat-button color="primary" style="float: left;" (click)="useURL(result.videoUrl)">
|
||||
<ng-container i18n="YT search Use URL button for searched video">Use URL</ng-container>
|
||||
</button>
|
||||
<button mat-stroked-button color="primary" (click)="visitURL(result.videoUrl)" style="float: right">
|
||||
<ng-container i18n="YT search View button for searched video">
|
||||
View
|
||||
</ng-container>
|
||||
</button>
|
||||
</mat-card>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<br/>
|
||||
<mat-checkbox [disabled]="current_download" (change)="videoModeChanged($event)" [(ngModel)]="audioOnly" style="float: left; margin-top: -12px">
|
||||
<ng-container i18n="Only Audio checkbox">
|
||||
Only Audio
|
||||
</ng-container>
|
||||
</mat-checkbox>
|
||||
<mat-checkbox *ngIf="allowMultiDownloadMode" [disabled]="current_download" (change)="multiDownloadModeChanged($event)" [(ngModel)]="multiDownloadMode" style="float: right; margin-top: -12px">
|
||||
<ng-container i18n="Multi-download Mode checkbox">
|
||||
Multi-download Mode
|
||||
</ng-container>
|
||||
</mat-checkbox>
|
||||
|
||||
</div>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button style="margin-left: 8px; margin-bottom: 8px" (click)="downloadClicked()" [disabled]="downloadingfile" type="submit" mat-stroked-button color="accent">
|
||||
<ng-container i18n="Main download button">
|
||||
Download
|
||||
</ng-container>
|
||||
</button>
|
||||
<button (click)="cancelDownload()" style="float: right" *ngIf="!!current_download" mat-stroked-button color="warn">
|
||||
<ng-container i18n="Cancel download button">
|
||||
Cancel
|
||||
</ng-container>
|
||||
</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div *ngIf="allowAdvancedDownload" class="big demo-basic">
|
||||
<form style="margin-left: 20px; margin-right: 20px;">
|
||||
<mat-expansion-panel class="big">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Advanced download mode panel">
|
||||
Advanced
|
||||
</ng-container>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<p *ngIf="this.simulatedOutput">
|
||||
<ng-container i18n="Simulated command label">
|
||||
Simulated command:
|
||||
</ng-container>
|
||||
<i>{{this.simulatedOutput}}</i></p>
|
||||
<div class="container" style="padding-bottom: 20px;">
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-6">
|
||||
<mat-checkbox color="accent" [disabled]="current_download" (change)="customArgsEnabledChanged($event)" [(ngModel)]="customArgsEnabled" style="z-index: 999" [ngModelOptions]="{standalone: true}">
|
||||
<ng-container i18n="Use custom args checkbox">
|
||||
Use custom args
|
||||
</ng-container>
|
||||
</mat-checkbox>
|
||||
<button class="edit-button" (click)="openArgsModifierDialog()" mat-icon-button><mat-icon>edit</mat-icon></button>
|
||||
<mat-form-field color="accent" style="margin-bottom: 42px;" class="advanced-input">
|
||||
<input [(ngModel)]="customArgs" [ngModelOptions]="{standalone: true}" [disabled]="!customArgsEnabled" matInput placeholder="Custom args" i18n-placeholder="Custom args placeholder">
|
||||
<mat-hint>
|
||||
<ng-container i18n="Custom Args input hint">
|
||||
No need to include URL, just everything after.
|
||||
</ng-container>
|
||||
</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-12 col-sm-6">
|
||||
<mat-checkbox color="accent" [disabled]="current_download" (change)="customOutputEnabledChanged($event)" [(ngModel)]="customOutputEnabled" style="z-index: 999" [ngModelOptions]="{standalone: true}">
|
||||
<ng-container i18n="Use custom output checkbox">
|
||||
Use custom output
|
||||
</ng-container>
|
||||
</mat-checkbox>
|
||||
<mat-form-field style="margin-bottom: 42px;" color="accent" class="advanced-input">
|
||||
<input [(ngModel)]="customOutput" [ngModelOptions]="{standalone: true}" [disabled]="!customOutputEnabled" matInput placeholder="Custom output" i18n-placeholder="Custom output placeholder">
|
||||
<mat-hint><a target="_blank" href="https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template">
|
||||
<ng-container i18n="Youtube-dl output template documentation link">Documentation</ng-container></a>.
|
||||
<ng-container i18n="Custom Output input hint">Path is relative to the config download path. Don't include extension.</ng-container>
|
||||
</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="!youtubeAuthDisabledOverride" class="col-12 col-sm-6 mt-2">
|
||||
<mat-checkbox color="accent" [disabled]="current_download" (change)="youtubeAuthEnabledChanged($event)" [(ngModel)]="youtubeAuthEnabled" style="z-index: 999" [ngModelOptions]="{standalone: true}">
|
||||
<ng-container i18n="Use authentication checkbox">
|
||||
Use authentication
|
||||
</ng-container>
|
||||
</mat-checkbox>
|
||||
<mat-form-field color="accent" class="advanced-input">
|
||||
<input [(ngModel)]="youtubeUsername" [ngModelOptions]="{standalone: true}" [disabled]="!youtubeAuthEnabled" matInput placeholder="Username" i18n-placeholder="YT Username placeholder">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="!youtubeAuthDisabledOverride" class="col-12 col-sm-6 mt-2">
|
||||
<mat-form-field style="margin-top: 31px;" color="accent" class="advanced-input">
|
||||
<input [(ngModel)]="youtubePassword" type="password" [ngModelOptions]="{standalone: true}" [disabled]="!youtubeAuthEnabled" matInput placeholder="Password" i18n-placeholder="YT Password placeholder">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</form>
|
||||
</div>
|
||||
<div *ngIf="multiDownloadMode && downloads.length > 0 && !current_download" style="margin-top: 15px;" class="big demo-basic">
|
||||
<mat-card id="card" style="margin-right: 20px; margin-left: 20px;">
|
||||
<div class="container">
|
||||
<div *ngFor="let download of downloads; let i = index;" class="row">
|
||||
<ng-container *ngIf="current_download !== download">
|
||||
<app-download-item style="width: 100%" [download]="download" [queueNumber]="i+1" (cancelDownload)="cancelDownload($event)"></app-download-item>
|
||||
<mat-divider style="position: relative" *ngIf="i !== downloads.length - 1"></mat-divider>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="centered big" id="bar_div" *ngIf="current_download && current_download.downloading; else nofile">
|
||||
<div class="margined">
|
||||
<div [ngClass]="(determinateProgress && percentDownloaded === 100)?'make-room-for-spinner':'equal-sizes'" style="display: inline-block; width: 100%; padding-left: 20px" *ngIf="determinateProgress;else indeterminateprogress">
|
||||
<mat-progress-bar mode="determinate" value="{{percentDownloaded}}"></mat-progress-bar>
|
||||
<br/>
|
||||
</div>
|
||||
<div *ngIf="determinateProgress && percentDownloaded === 100" class="spinner">
|
||||
<mat-spinner [diameter]="25"></mat-spinner>
|
||||
</div>
|
||||
<ng-template #indeterminateprogress>
|
||||
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
||||
</ng-template>
|
||||
</div>
|
||||
<br/>
|
||||
</div>
|
||||
<ng-template #nofile>
|
||||
|
||||
</ng-template>
|
||||
<div style="margin: 20px" *ngIf="fileManagerEnabled">
|
||||
<mat-accordion>
|
||||
<mat-expansion-panel (opened)="accordionOpened('audio')" (closed)="accordionClosed('audio')" (mouseleave)="accordionLeft('audio')" (mouseenter)="accordionEntered('audio')" class="big">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Audio files title">
|
||||
Audio
|
||||
</ng-container>
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
<ng-container i18n="Audio files description">
|
||||
Your audio files are here
|
||||
</ng-container>
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="mp3s.length > 0;else nomp3s">
|
||||
<mat-grid-list style="margin-bottom: 15px;" (window:resize)="onResize($event)" [cols]="files_cols" rowHeight="150px">
|
||||
<mat-grid-tile *ngFor="let file of mp3s; index as i;">
|
||||
<app-file-card #audiofilecard (removeFile)="removeFromMp3($event)" [file]="file" [title]="file.title" [name]="file.id" [thumbnailURL]="file.thumbnailURL"
|
||||
[length]="file.duration" [isAudio]="true" [use_youtubedl_archive]="use_youtubedl_archive"></app-file-card>
|
||||
<mat-progress-bar *ngIf="downloading_content['audio'][file.id]" class="download-progress-bar" mode="indeterminate"></mat-progress-bar>
|
||||
</mat-grid-tile>
|
||||
</mat-grid-list>
|
||||
<mat-divider></mat-divider>
|
||||
<div style="width: 100%; text-align: center; margin-top: 10px;">
|
||||
<h6 i18n="Playlists title">Playlists</h6>
|
||||
</div>
|
||||
<mat-grid-list *ngIf="playlists.audio.length > 0" (window:resize)="onResize($event)" [cols]="files_cols" rowHeight="150px">
|
||||
<mat-grid-tile *ngFor="let playlist of playlists.audio; let i = index;">
|
||||
<app-file-card #audiofilecard (removeFile)="removePlaylistMp3(playlist.id, i)" [title]="playlist.name" [name]="playlist.id" [thumbnailURL]="playlist_thumbnails[playlist.id]"
|
||||
[length]="null" [isAudio]="true" [isPlaylist]="true" [count]="playlist.fileNames.length" [use_youtubedl_archive]="use_youtubedl_archive"></app-file-card>
|
||||
<mat-progress-bar *ngIf="downloading_content['audio'][playlist.id]" class="download-progress-bar" mode="indeterminate"></mat-progress-bar>
|
||||
</mat-grid-tile>
|
||||
</mat-grid-list>
|
||||
<div class="add-playlist-button"><button (click)="openCreatePlaylistDialog('audio')" mat-fab><mat-icon>add</mat-icon></button></div>
|
||||
<div *ngIf="playlists.audio.length === 0">
|
||||
<ng-container i18n="No video playlists available text">
|
||||
No playlists available. Create one from your downloading audio files by clicking the blue plus button.
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel (opened)="accordionOpened('video')" (closed)="accordionClosed('video')" (mouseleave)="accordionLeft('video')" (mouseenter)="accordionEntered('video')" class="big">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Video files title">
|
||||
Video
|
||||
</ng-container>
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
<ng-container i18n="Video files description">
|
||||
Your video files are here
|
||||
</ng-container>
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="mp4s.length > 0;else nomp4s">
|
||||
<mat-grid-list style="margin-bottom: 15px;" (window:resize)="onResize($event)" [cols]="files_cols" rowHeight="150px">
|
||||
<mat-grid-tile *ngFor="let file of mp4s; index as i;">
|
||||
<app-file-card #videofilecard (removeFile)="removeFromMp4($event)" [file]="file" [title]="file.title" [name]="file.id" [thumbnailURL]="file.thumbnailURL"
|
||||
[length]="file.duration" [isAudio]="false" [use_youtubedl_archive]="use_youtubedl_archive"></app-file-card>
|
||||
<mat-progress-bar *ngIf="downloading_content['video'][file.id]" class="download-progress-bar" mode="indeterminate"></mat-progress-bar>
|
||||
</mat-grid-tile>
|
||||
</mat-grid-list>
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
<div style="width: 100%; text-align: center; margin-top: 10px;">
|
||||
<h6 i18n="Playlists title">Playlists</h6>
|
||||
</div>
|
||||
<mat-grid-list *ngIf="playlists.video.length > 0" (window:resize)="onResize($event)" [cols]="files_cols" rowHeight="150px">
|
||||
<mat-grid-tile *ngFor="let playlist of playlists.video; let i = index;">
|
||||
<app-file-card #videofilecard (removeFile)="removePlaylistMp4(playlist.id, i)" [title]="playlist.name" [name]="playlist.id" [thumbnailURL]="playlist_thumbnails[playlist.id]"
|
||||
[length]="null" [isAudio]="false" [isPlaylist]="true" [count]="playlist.fileNames.length" [use_youtubedl_archive]="use_youtubedl_archive"></app-file-card>
|
||||
<mat-progress-bar *ngIf="downloading_content['video'][playlist.id]" class="download-progress-bar" mode="indeterminate"></mat-progress-bar>
|
||||
</mat-grid-tile>
|
||||
</mat-grid-list>
|
||||
|
||||
<!-- Add video playlist button -->
|
||||
<div class="add-playlist-button"><button (click)="openCreatePlaylistDialog('video')" mat-fab><mat-icon>add</mat-icon></button></div>
|
||||
<div *ngIf="playlists.video.length === 0">
|
||||
<ng-container i18n="No video playlists available text">
|
||||
No playlists available. Create one from your downloading video files by clicking the blue plus button.
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
</div>
|
||||
|
||||
<ng-template #nomp3s>
|
||||
|
||||
</ng-template>
|
||||
|
||||
<ng-template #nomp4s>
|
||||
|
||||
</ng-template>
|
||||
25
src/app/main/main.component.spec.ts
Normal file
25
src/app/main/main.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MainComponent } from './main.component';
|
||||
|
||||
describe('MainComponent', () => {
|
||||
let component: MainComponent;
|
||||
let fixture: ComponentFixture<MainComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MainComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MainComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
1106
src/app/main/main.component.ts
Normal file
1106
src/app/main/main.component.ts
Normal file
File diff suppressed because it is too large
Load Diff
80
src/app/player/player.component.css
Normal file
80
src/app/player/player.component.css
Normal file
@@ -0,0 +1,80 @@
|
||||
.video-player {
|
||||
margin: 0 auto;
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
.video-player:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.audio-styles {
|
||||
height: 50px;
|
||||
background-color: transparent;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.video-styles {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
::ng-deep .mat-button-toggle-label-content {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.container-video {
|
||||
max-width: 100%;
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
bottom: -1px;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
bottom: 3px;
|
||||
left: 3px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.save-button {
|
||||
right: 25px;
|
||||
position: absolute;
|
||||
bottom: 25px;
|
||||
}
|
||||
|
||||
.favorite-button {
|
||||
left: 25px;
|
||||
position: absolute;
|
||||
bottom: 25px;
|
||||
}
|
||||
|
||||
.video-col {
|
||||
padding-right: 0px;
|
||||
padding-left: 0.01px;
|
||||
}
|
||||
|
||||
.save-icon {
|
||||
bottom: 1px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.update-playlist-button-div {
|
||||
float: right;
|
||||
margin-right: 30px;
|
||||
margin-top: 25px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.spinner-div {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
margin-right: 12px;
|
||||
top: 8px;
|
||||
}
|
||||
33
src/app/player/player.component.html
Normal file
33
src/app/player/player.component.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<div *ngIf="playlist.length > 0">
|
||||
<div [ngClass]="(type === 'audio') ? null : 'container-video'" class="container">
|
||||
<div style="max-width: 100%; margin-left: 0px;" class="row">
|
||||
<div [ngClass]="(type === 'audio') ? 'my-2 px-1' : 'video-col'" class="col">
|
||||
<vg-player (onPlayerReady)="onPlayerReady($event)" [style.background-color]="(type === 'audio') ? 'transparent' : 'black'">
|
||||
<video [ngClass]="(type === 'audio') ? 'audio-styles' : 'video-styles'" #media class="video-player" [vgMedia]="media" [src]="currentItem.src" id="singleVideo" preload="auto" controls>
|
||||
</video>
|
||||
</vg-player>
|
||||
</div>
|
||||
<div class="col-12 my-2">
|
||||
<mat-button-toggle-group cdkDropList [cdkDropListSortingDisabled]="!id" (cdkDropListDropped)="drop($event)" style="width: 80%; left: 9%" vertical name="videoSelect" aria-label="Video Select" #group="matButtonToggleGroup">
|
||||
<mat-button-toggle cdkDrag *ngFor="let playlist_item of playlist; let i = index" [checked]="currentItem.title === playlist_item.title" (click)="onClickPlaylistItem(playlist_item, i)" class="toggle-button" [value]="playlist_item.title">{{playlist_item.label}}</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="update-playlist-button-div" *ngIf="id && playlistChanged()">
|
||||
<div class="spinner-div">
|
||||
<mat-spinner *ngIf="playlist_updating" [diameter]="25"></mat-spinner>
|
||||
</div>
|
||||
<button color="primary" [disabled]="playlist_updating" (click)="updatePlaylist()" mat-raised-button><ng-container i18n="Playlist save changes button">Save changes</ng-container> <mat-icon>update</mat-icon></button>
|
||||
|
||||
</div>
|
||||
|
||||
<div *ngIf="playlist.length > 1">
|
||||
<button class="save-button" color="primary" (click)="downloadContent()" [disabled]="downloading" mat-fab><mat-icon class="save-icon">save</mat-icon><mat-spinner *ngIf="downloading" class="spinner" [diameter]="50"></mat-spinner></button>
|
||||
<button *ngIf="!id" color="accent" class="favorite-button" color="primary" (click)="namePlaylistDialog()" mat-fab><mat-icon class="save-icon">favorite</mat-icon></button>
|
||||
</div>
|
||||
<div *ngIf="playlist.length === 1">
|
||||
<button class="save-button" color="primary" (click)="downloadFile()" [disabled]="downloading" mat-fab><mat-icon class="save-icon">save</mat-icon><mat-spinner *ngIf="downloading" class="spinner" [diameter]="50"></mat-spinner></button>
|
||||
</div>
|
||||
</div>
|
||||
25
src/app/player/player.component.spec.ts
Normal file
25
src/app/player/player.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PlayerComponent } from './player.component';
|
||||
|
||||
describe('PlayerComponent', () => {
|
||||
let component: PlayerComponent;
|
||||
let fixture: ComponentFixture<PlayerComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PlayerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PlayerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
283
src/app/player/player.component.ts
Normal file
283
src/app/player/player.component.ts
Normal file
@@ -0,0 +1,283 @@
|
||||
import { Component, OnInit, HostListener, EventEmitter } from '@angular/core';
|
||||
import { VgAPI } from 'ngx-videogular';
|
||||
import { PostsService } from 'app/posts.services';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { InputDialogComponent } from 'app/input-dialog/input-dialog.component';
|
||||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||
|
||||
export interface IMedia {
|
||||
title: string;
|
||||
src: string;
|
||||
type: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-player',
|
||||
templateUrl: './player.component.html',
|
||||
styleUrls: ['./player.component.css']
|
||||
})
|
||||
export class PlayerComponent implements OnInit {
|
||||
|
||||
playlist: Array<IMedia> = [];
|
||||
original_playlist: string = null;
|
||||
playlist_updating = false;
|
||||
|
||||
currentIndex = 0;
|
||||
currentItem: IMedia = null;
|
||||
api: VgAPI;
|
||||
|
||||
// params
|
||||
fileNames: string[];
|
||||
type: string;
|
||||
id = null; // used for playlists (not subscription)
|
||||
subscriptionName = null;
|
||||
subPlaylist = null;
|
||||
|
||||
baseStreamPath = null;
|
||||
audioFolderPath = null;
|
||||
videoFolderPath = null;
|
||||
subscriptionFolderPath = null;
|
||||
|
||||
innerWidth: number;
|
||||
|
||||
downloading = false;
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
onResize(event) {
|
||||
this.innerWidth = window.innerWidth;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.innerWidth = window.innerWidth;
|
||||
|
||||
this.fileNames = this.route.snapshot.paramMap.get('fileNames').split('|nvr|');
|
||||
this.type = this.route.snapshot.paramMap.get('type');
|
||||
this.id = this.route.snapshot.paramMap.get('id');
|
||||
this.subscriptionName = this.route.snapshot.paramMap.get('subscriptionName');
|
||||
this.subPlaylist = this.route.snapshot.paramMap.get('subPlaylist');
|
||||
|
||||
// loading config
|
||||
this.postsService.loadNavItems().subscribe(res => { // loads settings
|
||||
const result = !this.postsService.debugMode ? res['config_file'] : res;
|
||||
this.baseStreamPath = this.postsService.path;
|
||||
this.audioFolderPath = result['YoutubeDLMaterial']['Downloader']['path-audio'];
|
||||
this.videoFolderPath = result['YoutubeDLMaterial']['Downloader']['path-video'];
|
||||
this.subscriptionFolderPath = result['YoutubeDLMaterial']['Subscriptions']['subscriptions_base_path'];
|
||||
|
||||
|
||||
let fileType = null;
|
||||
if (this.type === 'audio') {
|
||||
fileType = 'audio/mp3';
|
||||
} else if (this.type === 'video') {
|
||||
fileType = 'video/mp4';
|
||||
} else if (this.type === 'subscription') {
|
||||
// only supports mp4 for now
|
||||
fileType = 'video/mp4';
|
||||
} else {
|
||||
// error
|
||||
console.error('Must have valid file type! Use \'audio\', \'video\', or \'subscription\'.');
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.fileNames.length; i++) {
|
||||
const fileName = this.fileNames[i];
|
||||
let baseLocation = null;
|
||||
let fullLocation = null;
|
||||
if (!this.subscriptionName) {
|
||||
baseLocation = this.type + '/';
|
||||
fullLocation = this.baseStreamPath + baseLocation + encodeURIComponent(fileName);
|
||||
} else {
|
||||
// default to video but include subscription name param
|
||||
baseLocation = 'video/';
|
||||
fullLocation = this.baseStreamPath + baseLocation + encodeURIComponent(fileName) + '?subName=' + this.subscriptionName +
|
||||
'&subPlaylist=' + this.subPlaylist;
|
||||
}
|
||||
// if it has a slash (meaning it's in a directory), only get the file name for the label
|
||||
let label = null;
|
||||
const decodedName = decodeURIComponent(fileName);
|
||||
const hasSlash = decodedName.includes('/') || decodedName.includes('\\');
|
||||
if (hasSlash) {
|
||||
label = decodedName.replace(/^.*[\\\/]/, '');
|
||||
} else {
|
||||
label = decodedName;
|
||||
}
|
||||
const mediaObject: IMedia = {
|
||||
title: fileName,
|
||||
src: fullLocation,
|
||||
type: fileType,
|
||||
label: label
|
||||
}
|
||||
this.playlist.push(mediaObject);
|
||||
}
|
||||
this.currentItem = this.playlist[this.currentIndex];
|
||||
this.original_playlist = JSON.stringify(this.playlist);
|
||||
});
|
||||
|
||||
// this.getFileInfos();
|
||||
|
||||
}
|
||||
|
||||
constructor(private postsService: PostsService, private route: ActivatedRoute, private dialog: MatDialog, private router: Router,
|
||||
public snackBar: MatSnackBar) {
|
||||
|
||||
}
|
||||
|
||||
onPlayerReady(api: VgAPI) {
|
||||
this.api = api;
|
||||
|
||||
this.api.getDefaultMedia().subscriptions.loadedMetadata.subscribe(this.playVideo.bind(this));
|
||||
this.api.getDefaultMedia().subscriptions.ended.subscribe(this.nextVideo.bind(this));
|
||||
}
|
||||
|
||||
nextVideo() {
|
||||
if (this.currentIndex === this.playlist.length - 1) {
|
||||
// dont continue playing
|
||||
// this.currentIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
this.currentIndex++;
|
||||
this.currentItem = this.playlist[ this.currentIndex ];
|
||||
}
|
||||
|
||||
playVideo() {
|
||||
this.api.play();
|
||||
}
|
||||
|
||||
onClickPlaylistItem(item: IMedia, index: number) {
|
||||
// console.log('new current item is ' + item.title + ' at index ' + index);
|
||||
this.currentIndex = index;
|
||||
this.currentItem = item;
|
||||
}
|
||||
|
||||
getFileInfos() {
|
||||
const fileNames = this.getFileNames();
|
||||
this.postsService.getFileInfo(fileNames, this.type, false).subscribe(res => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
getFileNames() {
|
||||
const fileNames = [];
|
||||
for (let i = 0; i < this.playlist.length; i++) {
|
||||
fileNames.push(this.playlist[i].title);
|
||||
}
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
decodeURI(string) {
|
||||
return decodeURI(string);
|
||||
}
|
||||
|
||||
downloadContent() {
|
||||
const fileNames = [];
|
||||
for (let i = 0; i < this.playlist.length; i++) {
|
||||
fileNames.push(this.playlist[i].title);
|
||||
}
|
||||
|
||||
const zipName = fileNames[0].split(' ')[0] + fileNames[1].split(' ')[0];
|
||||
this.downloading = true;
|
||||
this.postsService.downloadFileFromServer(fileNames, this.type, zipName).subscribe(res => {
|
||||
this.downloading = false;
|
||||
const blob: Blob = res;
|
||||
saveAs(blob, zipName + '.zip');
|
||||
}, err => {
|
||||
console.log(err);
|
||||
this.downloading = false;
|
||||
});
|
||||
}
|
||||
|
||||
downloadFile() {
|
||||
const ext = (this.type === 'audio') ? '.mp3' : '.mp4';
|
||||
const filename = this.playlist[0].title;
|
||||
this.downloading = true;
|
||||
this.postsService.downloadFileFromServer(filename, this.type).subscribe(res => {
|
||||
this.downloading = false;
|
||||
const blob: Blob = res;
|
||||
saveAs(blob, filename + ext);
|
||||
}, err => {
|
||||
console.log(err);
|
||||
this.downloading = false;
|
||||
});
|
||||
}
|
||||
|
||||
namePlaylistDialog() {
|
||||
const done = new EventEmitter<any>();
|
||||
const dialogRef = this.dialog.open(InputDialogComponent, {
|
||||
width: '300px',
|
||||
data: {
|
||||
inputTitle: 'Name the playlist',
|
||||
inputPlaceholder: 'Name',
|
||||
submitText: 'Favorite',
|
||||
doneEmitter: done
|
||||
}
|
||||
});
|
||||
|
||||
done.subscribe(name => {
|
||||
|
||||
// Eventually do additional checks on name
|
||||
if (name) {
|
||||
const fileNames = this.getFileNames();
|
||||
this.postsService.createPlaylist(name, fileNames, this.type, null).subscribe(res => {
|
||||
if (res['success']) {
|
||||
dialogRef.close();
|
||||
const new_playlist = res['new_playlist'];
|
||||
this.openSnackBar('Playlist \'' + name + '\' successfully created!', '')
|
||||
this.playlistPostCreationHandler(new_playlist.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
createPlaylist(name) {
|
||||
this.postsService.createPlaylist(name, this.fileNames, this.type, null).subscribe(res => {
|
||||
if (res['success']) {
|
||||
console.log('Success!');
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
playlistPostCreationHandler(playlistID) {
|
||||
// changes the route without moving from the current view or
|
||||
// triggering a navigation event
|
||||
this.id = playlistID;
|
||||
this.router.navigateByUrl(this.router.url + ';id=' + playlistID);
|
||||
}
|
||||
|
||||
drop(event: CdkDragDrop<string[]>) {
|
||||
moveItemInArray(this.playlist, event.previousIndex, event.currentIndex);
|
||||
}
|
||||
|
||||
playlistChanged() {
|
||||
return JSON.stringify(this.playlist) !== this.original_playlist;
|
||||
}
|
||||
|
||||
updatePlaylist() {
|
||||
const fileNames = this.getFileNames();
|
||||
this.playlist_updating = true;
|
||||
this.postsService.updatePlaylist(this.id, fileNames, this.type).subscribe(res => {
|
||||
this.playlist_updating = false;
|
||||
if (res['success']) {
|
||||
const fileNamesEncoded = fileNames.join('|nvr|');
|
||||
this.router.navigate(['/player', {fileNames: fileNamesEncoded, type: 'video', id: this.id}]);
|
||||
this.openSnackBar('Successfully updated playlist.', '');
|
||||
this.original_playlist = JSON.stringify(this.playlist);
|
||||
} else {
|
||||
this.openSnackBar('ERROR: Failed to update playlist.', '');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// snackbar helper
|
||||
public openSnackBar(message: string, action: string) {
|
||||
this.snackBar.open(message, action, {
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +1,183 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Http} from '@angular/http';
|
||||
import {Injectable, isDevMode, Inject} from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpRequest, HttpResponseBase } from '@angular/common/http';
|
||||
import config from '../assets/default.json';
|
||||
import 'rxjs/add/operator/map';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/operator/map';
|
||||
import 'rxjs/add/operator/catch';
|
||||
import 'rxjs/add/observable/throw';
|
||||
import { THEMES_CONFIG } from '../themes';
|
||||
import { Router } from '@angular/router';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class PostsService {
|
||||
path: string = "";
|
||||
audioFolder: string = "";
|
||||
videoFolder: string = "";
|
||||
startPath: string = "http://localhost:17442/";
|
||||
startPathSSL: string = "https://localhost:17442/"
|
||||
handShakeComplete: boolean = false;
|
||||
path = '';
|
||||
audioFolder = '';
|
||||
videoFolder = '';
|
||||
startPath = null; // 'http://localhost:17442/';
|
||||
startPathSSL = null; // 'https://localhost:17442/'
|
||||
handShakeComplete = false;
|
||||
THEMES_CONFIG = THEMES_CONFIG;
|
||||
theme;
|
||||
settings_changed = new BehaviorSubject<boolean>(false);
|
||||
|
||||
constructor(private http: Http){
|
||||
debugMode = false;
|
||||
constructor(private http: HttpClient, private router: Router, @Inject(DOCUMENT) private document: Document) {
|
||||
console.log('PostsService Initialized...');
|
||||
// this.startPath = window.location.href + '/api/';
|
||||
// this.startPathSSL = window.location.href + '/api/';
|
||||
this.path = this.document.location.origin + '/api/';
|
||||
|
||||
if (isDevMode()) {
|
||||
this.debugMode = true;
|
||||
this.path = 'http://localhost:17442/api/';
|
||||
}
|
||||
}
|
||||
|
||||
startHandshake(url: string): Observable<string>
|
||||
{
|
||||
return this.http.get(url + "geturl")
|
||||
.map(res => res.json());
|
||||
setTheme(theme) {
|
||||
this.theme = this.THEMES_CONFIG[theme];
|
||||
}
|
||||
|
||||
startHandshakeSSL(url: string): Observable<string>
|
||||
{
|
||||
return this.http.get(url + "geturl")
|
||||
.map(res => res.json());
|
||||
startHandshake(url: string) {
|
||||
return this.http.get(url + 'geturl');
|
||||
}
|
||||
|
||||
getVideoFolder(): Observable<string>
|
||||
{
|
||||
return this.http.get(this.startPath + "videofolder")
|
||||
.map(res => res.json());
|
||||
startHandshakeSSL(url: string) {
|
||||
return this.http.get(url + 'geturl');
|
||||
}
|
||||
|
||||
getAudioFolder(): Observable<string>
|
||||
{
|
||||
return this.http.get(this.startPath + "audiofolder")
|
||||
.map(res => res.json());
|
||||
getVideoFolder() {
|
||||
return this.http.get(this.startPath + 'videofolder');
|
||||
}
|
||||
|
||||
makeMP3(url: string): Observable<string>
|
||||
{
|
||||
return this.http.post(this.path + "tomp3",{url: url})
|
||||
.map(res => res.json());
|
||||
getAudioFolder() {
|
||||
return this.http.get(this.startPath + 'audiofolder');
|
||||
}
|
||||
|
||||
makeMP4(url: string): Observable<string>
|
||||
{
|
||||
return this.http.post(this.path + "tomp4",{url: url})
|
||||
.map(res => res.json());
|
||||
// tslint:disable-next-line: max-line-length
|
||||
makeMP3(url: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null) {
|
||||
return this.http.post(this.path + 'tomp3', {url: url,
|
||||
maxBitrate: selectedQuality,
|
||||
customQualityConfiguration: customQualityConfiguration,
|
||||
customArgs: customArgs,
|
||||
customOutput: customOutput,
|
||||
youtubeUsername: youtubeUsername,
|
||||
youtubePassword: youtubePassword});
|
||||
}
|
||||
|
||||
getFileStatusMp3(name: string): Observable<any> {
|
||||
return this.http.post(this.path + "mp3fileexists",{name: name})
|
||||
.map(res => res.json());
|
||||
// tslint:disable-next-line: max-line-length
|
||||
makeMP4(url: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null) {
|
||||
return this.http.post(this.path + 'tomp4', {url: url,
|
||||
selectedHeight: selectedQuality,
|
||||
customQualityConfiguration: customQualityConfiguration,
|
||||
customArgs: customArgs,
|
||||
customOutput: customOutput,
|
||||
youtubeUsername: youtubeUsername,
|
||||
youtubePassword: youtubePassword});
|
||||
}
|
||||
|
||||
getFileStatusMp4(name: string): Observable<any> {
|
||||
return this.http.post(this.path + "mp4fileexists",{name: name})
|
||||
.map(res => res.json());
|
||||
getFileStatusMp3(name: string) {
|
||||
return this.http.post(this.path + 'fileStatusMp3', {name: name});
|
||||
}
|
||||
|
||||
getFileStatusMp4(name: string) {
|
||||
return this.http.post(this.path + 'fileStatusMp4', {name: name});
|
||||
}
|
||||
|
||||
loadNavItems() {
|
||||
console.log("Config location: " + window.location.href + "backend/config/default.json");
|
||||
return this.http.get(window.location.href + "backend/config/default.json")
|
||||
.map(res => res.json());
|
||||
if (isDevMode()) {
|
||||
return this.http.get('./assets/default.json');
|
||||
} else {
|
||||
return this.http.get(this.path + 'config');
|
||||
}
|
||||
}
|
||||
|
||||
setConfig(config) {
|
||||
return this.http.post(this.path + 'setConfig', {new_config_file: config});
|
||||
}
|
||||
|
||||
deleteFile(name: string, isAudio: boolean, blacklistMode = false) {
|
||||
if (isAudio) {
|
||||
return this.http.post(this.path + 'deleteMp3', {name: name, blacklistMode: blacklistMode});
|
||||
} else {
|
||||
return this.http.post(this.path + 'deleteMp4', {name: name, blacklistMode: blacklistMode});
|
||||
}
|
||||
}
|
||||
|
||||
getMp3s() {
|
||||
return this.http.post(this.path + 'getMp3s', {});
|
||||
}
|
||||
|
||||
getMp4s() {
|
||||
return this.http.post(this.path + 'getMp4s', {});
|
||||
}
|
||||
|
||||
downloadFileFromServer(fileName, type, outputName = null, fullPathProvided = null) {
|
||||
return this.http.post(this.path + 'downloadFile', {fileNames: fileName,
|
||||
type: type,
|
||||
zip_mode: Array.isArray(fileName),
|
||||
outputName: outputName,
|
||||
fullPathProvided: fullPathProvided},
|
||||
{responseType: 'blob'});
|
||||
}
|
||||
|
||||
downloadArchive(sub) {
|
||||
return this.http.post(this.path + 'downloadArchive', {sub: sub}, {responseType: 'blob'});
|
||||
}
|
||||
|
||||
getFileInfo(fileNames, type, urlMode) {
|
||||
return this.http.post(this.path + 'getVideoInfos', {fileNames: fileNames, type: type, urlMode: urlMode});
|
||||
}
|
||||
|
||||
isPinSet() {
|
||||
return this.http.post(this.path + 'isPinSet', {});
|
||||
}
|
||||
|
||||
setPin(unhashed_pin) {
|
||||
return this.http.post(this.path + 'setPin', {pin: unhashed_pin});
|
||||
}
|
||||
|
||||
checkPin(unhashed_pin) {
|
||||
return this.http.post(this.path + 'checkPin', {input_pin: unhashed_pin});
|
||||
}
|
||||
|
||||
createPlaylist(playlistName, fileNames, type, thumbnailURL) {
|
||||
return this.http.post(this.path + 'createPlaylist', {playlistName: playlistName,
|
||||
fileNames: fileNames,
|
||||
type: type,
|
||||
thumbnailURL: thumbnailURL});
|
||||
}
|
||||
|
||||
updatePlaylist(playlistID, fileNames, type) {
|
||||
return this.http.post(this.path + 'updatePlaylist', {playlistID: playlistID,
|
||||
fileNames: fileNames,
|
||||
type: type});
|
||||
}
|
||||
|
||||
removePlaylist(playlistID, type) {
|
||||
return this.http.post(this.path + 'deletePlaylist', {playlistID: playlistID, type: type});
|
||||
}
|
||||
|
||||
createSubscription(url, name, timerange = null) {
|
||||
return this.http.post(this.path + 'subscribe', {url: url, name: name, timerange: timerange})
|
||||
}
|
||||
|
||||
unsubscribe(sub, deleteMode = false) {
|
||||
return this.http.post(this.path + 'unsubscribe', {sub: sub, deleteMode: deleteMode})
|
||||
}
|
||||
|
||||
deleteSubscriptionFile(sub, file, deleteForever) {
|
||||
return this.http.post(this.path + 'deleteSubscriptionFile', {sub: sub, file: file, deleteForever: deleteForever})
|
||||
}
|
||||
|
||||
getSubscription(id) {
|
||||
return this.http.post(this.path + 'getSubscription', {id: id});
|
||||
}
|
||||
|
||||
getAllSubscriptions() {
|
||||
return this.http.post(this.path + 'getAllSubscriptions', {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
735
src/app/settings/locales_list.ts
Normal file
735
src/app/settings/locales_list.ts
Normal file
@@ -0,0 +1,735 @@
|
||||
/**
|
||||
* @author Phil Teare
|
||||
* using wikipedia data
|
||||
* Link: https://stackoverflow.com/a/4900304
|
||||
*/
|
||||
export const isoLangs = {
|
||||
'ab': {
|
||||
'name': 'Abkhaz',
|
||||
'nativeName': 'аҧсуа'
|
||||
},
|
||||
'aa': {
|
||||
'name': 'Afar',
|
||||
'nativeName': 'Afaraf'
|
||||
},
|
||||
'af': {
|
||||
'name': 'Afrikaans',
|
||||
'nativeName': 'Afrikaans'
|
||||
},
|
||||
'ak': {
|
||||
'name': 'Akan',
|
||||
'nativeName': 'Akan'
|
||||
},
|
||||
'sq': {
|
||||
'name': 'Albanian',
|
||||
'nativeName': 'Shqip'
|
||||
},
|
||||
'am': {
|
||||
'name': 'Amharic',
|
||||
'nativeName': 'አማርኛ'
|
||||
},
|
||||
'ar': {
|
||||
'name': 'Arabic',
|
||||
'nativeName': 'العربية'
|
||||
},
|
||||
'an': {
|
||||
'name': 'Aragonese',
|
||||
'nativeName': 'Aragonés'
|
||||
},
|
||||
'hy': {
|
||||
'name': 'Armenian',
|
||||
'nativeName': 'Հայերեն'
|
||||
},
|
||||
'as': {
|
||||
'name': 'Assamese',
|
||||
'nativeName': 'অসমীয়া'
|
||||
},
|
||||
'av': {
|
||||
'name': 'Avaric',
|
||||
'nativeName': 'авар мацӀ, магӀарул мацӀ'
|
||||
},
|
||||
'ae': {
|
||||
'name': 'Avestan',
|
||||
'nativeName': 'avesta'
|
||||
},
|
||||
'ay': {
|
||||
'name': 'Aymara',
|
||||
'nativeName': 'aymar aru'
|
||||
},
|
||||
'az': {
|
||||
'name': 'Azerbaijani',
|
||||
'nativeName': 'azərbaycan dili'
|
||||
},
|
||||
'bm': {
|
||||
'name': 'Bambara',
|
||||
'nativeName': 'bamanankan'
|
||||
},
|
||||
'ba': {
|
||||
'name': 'Bashkir',
|
||||
'nativeName': 'башҡорт теле'
|
||||
},
|
||||
'eu': {
|
||||
'name': 'Basque',
|
||||
'nativeName': 'euskara, euskera'
|
||||
},
|
||||
'be': {
|
||||
'name': 'Belarusian',
|
||||
'nativeName': 'Беларуская'
|
||||
},
|
||||
'bn': {
|
||||
'name': 'Bengali',
|
||||
'nativeName': 'বাংলা'
|
||||
},
|
||||
'bh': {
|
||||
'name': 'Bihari',
|
||||
'nativeName': 'भोजपुरी'
|
||||
},
|
||||
'bi': {
|
||||
'name': 'Bislama',
|
||||
'nativeName': 'Bislama'
|
||||
},
|
||||
'bs': {
|
||||
'name': 'Bosnian',
|
||||
'nativeName': 'bosanski jezik'
|
||||
},
|
||||
'br': {
|
||||
'name': 'Breton',
|
||||
'nativeName': 'brezhoneg'
|
||||
},
|
||||
'bg': {
|
||||
'name': 'Bulgarian',
|
||||
'nativeName': 'български език'
|
||||
},
|
||||
'my': {
|
||||
'name': 'Burmese',
|
||||
'nativeName': 'ဗမာစာ'
|
||||
},
|
||||
'ca': {
|
||||
'name': 'Catalan; Valencian',
|
||||
'nativeName': 'Català'
|
||||
},
|
||||
'ch': {
|
||||
'name': 'Chamorro',
|
||||
'nativeName': 'Chamoru'
|
||||
},
|
||||
'ce': {
|
||||
'name': 'Chechen',
|
||||
'nativeName': 'нохчийн мотт'
|
||||
},
|
||||
'ny': {
|
||||
'name': 'Chichewa; Chewa; Nyanja',
|
||||
'nativeName': 'chiCheŵa, chinyanja'
|
||||
},
|
||||
'zh': {
|
||||
'name': 'Chinese',
|
||||
'nativeName': '中文 (Zhōngwén), 汉语, 漢語'
|
||||
},
|
||||
'cv': {
|
||||
'name': 'Chuvash',
|
||||
'nativeName': 'чӑваш чӗлхи'
|
||||
},
|
||||
'kw': {
|
||||
'name': 'Cornish',
|
||||
'nativeName': 'Kernewek'
|
||||
},
|
||||
'co': {
|
||||
'name': 'Corsican',
|
||||
'nativeName': 'corsu, lingua corsa'
|
||||
},
|
||||
'cr': {
|
||||
'name': 'Cree',
|
||||
'nativeName': 'ᓀᐦᐃᔭᐍᐏᐣ'
|
||||
},
|
||||
'hr': {
|
||||
'name': 'Croatian',
|
||||
'nativeName': 'hrvatski'
|
||||
},
|
||||
'cs': {
|
||||
'name': 'Czech',
|
||||
'nativeName': 'česky, čeština'
|
||||
},
|
||||
'da': {
|
||||
'name': 'Danish',
|
||||
'nativeName': 'dansk'
|
||||
},
|
||||
'dv': {
|
||||
'name': 'Divehi; Dhivehi; Maldivian;',
|
||||
'nativeName': 'ދިވެހި'
|
||||
},
|
||||
'nl': {
|
||||
'name': 'Dutch',
|
||||
'nativeName': 'Nederlands, Vlaams'
|
||||
},
|
||||
'en': {
|
||||
'name': 'English',
|
||||
'nativeName': 'English'
|
||||
},
|
||||
'eo': {
|
||||
'name': 'Esperanto',
|
||||
'nativeName': 'Esperanto'
|
||||
},
|
||||
'et': {
|
||||
'name': 'Estonian',
|
||||
'nativeName': 'eesti, eesti keel'
|
||||
},
|
||||
'ee': {
|
||||
'name': 'Ewe',
|
||||
'nativeName': 'Eʋegbe'
|
||||
},
|
||||
'fo': {
|
||||
'name': 'Faroese',
|
||||
'nativeName': 'føroyskt'
|
||||
},
|
||||
'fj': {
|
||||
'name': 'Fijian',
|
||||
'nativeName': 'vosa Vakaviti'
|
||||
},
|
||||
'fi': {
|
||||
'name': 'Finnish',
|
||||
'nativeName': 'suomi, suomen kieli'
|
||||
},
|
||||
'fr': {
|
||||
'name': 'French',
|
||||
'nativeName': 'français, langue française'
|
||||
},
|
||||
'ff': {
|
||||
'name': 'Fula; Fulah; Pulaar; Pular',
|
||||
'nativeName': 'Fulfulde, Pulaar, Pular'
|
||||
},
|
||||
'gl': {
|
||||
'name': 'Galician',
|
||||
'nativeName': 'Galego'
|
||||
},
|
||||
'ka': {
|
||||
'name': 'Georgian',
|
||||
'nativeName': 'ქართული'
|
||||
},
|
||||
'de': {
|
||||
'name': 'German',
|
||||
'nativeName': 'Deutsch'
|
||||
},
|
||||
'el': {
|
||||
'name': 'Greek, Modern',
|
||||
'nativeName': 'Ελληνικά'
|
||||
},
|
||||
'gn': {
|
||||
'name': 'Guaraní',
|
||||
'nativeName': 'Avañeẽ'
|
||||
},
|
||||
'gu': {
|
||||
'name': 'Gujarati',
|
||||
'nativeName': 'ગુજરાતી'
|
||||
},
|
||||
'ht': {
|
||||
'name': 'Haitian; Haitian Creole',
|
||||
'nativeName': 'Kreyòl ayisyen'
|
||||
},
|
||||
'ha': {
|
||||
'name': 'Hausa',
|
||||
'nativeName': 'Hausa, هَوُسَ'
|
||||
},
|
||||
'he': {
|
||||
'name': 'Hebrew (modern)',
|
||||
'nativeName': 'עברית'
|
||||
},
|
||||
'hz': {
|
||||
'name': 'Herero',
|
||||
'nativeName': 'Otjiherero'
|
||||
},
|
||||
'hi': {
|
||||
'name': 'Hindi',
|
||||
'nativeName': 'हिन्दी, हिंदी'
|
||||
},
|
||||
'ho': {
|
||||
'name': 'Hiri Motu',
|
||||
'nativeName': 'Hiri Motu'
|
||||
},
|
||||
'hu': {
|
||||
'name': 'Hungarian',
|
||||
'nativeName': 'Magyar'
|
||||
},
|
||||
'ia': {
|
||||
'name': 'Interlingua',
|
||||
'nativeName': 'Interlingua'
|
||||
},
|
||||
'id': {
|
||||
'name': 'Indonesian',
|
||||
'nativeName': 'Bahasa Indonesia'
|
||||
},
|
||||
'ie': {
|
||||
'name': 'Interlingue',
|
||||
'nativeName': 'Originally called Occidental; then Interlingue after WWII'
|
||||
},
|
||||
'ga': {
|
||||
'name': 'Irish',
|
||||
'nativeName': 'Gaeilge'
|
||||
},
|
||||
'ig': {
|
||||
'name': 'Igbo',
|
||||
'nativeName': 'Asụsụ Igbo'
|
||||
},
|
||||
'ik': {
|
||||
'name': 'Inupiaq',
|
||||
'nativeName': 'Iñupiaq, Iñupiatun'
|
||||
},
|
||||
'io': {
|
||||
'name': 'Ido',
|
||||
'nativeName': 'Ido'
|
||||
},
|
||||
'is': {
|
||||
'name': 'Icelandic',
|
||||
'nativeName': 'Íslenska'
|
||||
},
|
||||
'it': {
|
||||
'name': 'Italian',
|
||||
'nativeName': 'Italiano'
|
||||
},
|
||||
'iu': {
|
||||
'name': 'Inuktitut',
|
||||
'nativeName': 'ᐃᓄᒃᑎᑐᑦ'
|
||||
},
|
||||
'ja': {
|
||||
'name': 'Japanese',
|
||||
'nativeName': '日本語 (にほんご/にっぽんご)'
|
||||
},
|
||||
'jv': {
|
||||
'name': 'Javanese',
|
||||
'nativeName': 'basa Jawa'
|
||||
},
|
||||
'kl': {
|
||||
'name': 'Kalaallisut, Greenlandic',
|
||||
'nativeName': 'kalaallisut, kalaallit oqaasii'
|
||||
},
|
||||
'kn': {
|
||||
'name': 'Kannada',
|
||||
'nativeName': 'ಕನ್ನಡ'
|
||||
},
|
||||
'kr': {
|
||||
'name': 'Kanuri',
|
||||
'nativeName': 'Kanuri'
|
||||
},
|
||||
'ks': {
|
||||
'name': 'Kashmiri',
|
||||
'nativeName': 'कश्मीरी, كشميري'
|
||||
},
|
||||
'kk': {
|
||||
'name': 'Kazakh',
|
||||
'nativeName': 'Қазақ тілі'
|
||||
},
|
||||
'km': {
|
||||
'name': 'Khmer',
|
||||
'nativeName': 'ភាសាខ្មែរ'
|
||||
},
|
||||
'ki': {
|
||||
'name': 'Kikuyu, Gikuyu',
|
||||
'nativeName': 'Gĩkũyũ'
|
||||
},
|
||||
'rw': {
|
||||
'name': 'Kinyarwanda',
|
||||
'nativeName': 'Ikinyarwanda'
|
||||
},
|
||||
'ky': {
|
||||
'name': 'Kirghiz, Kyrgyz',
|
||||
'nativeName': 'кыргыз тили'
|
||||
},
|
||||
'kv': {
|
||||
'name': 'Komi',
|
||||
'nativeName': 'коми кыв'
|
||||
},
|
||||
'kg': {
|
||||
'name': 'Kongo',
|
||||
'nativeName': 'KiKongo'
|
||||
},
|
||||
'ko': {
|
||||
'name': 'Korean',
|
||||
'nativeName': '한국어 (韓國語), 조선말 (朝鮮語)'
|
||||
},
|
||||
'ku': {
|
||||
'name': 'Kurdish',
|
||||
'nativeName': 'Kurdî, كوردی'
|
||||
},
|
||||
'kj': {
|
||||
'name': 'Kwanyama, Kuanyama',
|
||||
'nativeName': 'Kuanyama'
|
||||
},
|
||||
'la': {
|
||||
'name': 'Latin',
|
||||
'nativeName': 'latine, lingua latina'
|
||||
},
|
||||
'lb': {
|
||||
'name': 'Luxembourgish, Letzeburgesch',
|
||||
'nativeName': 'Lëtzebuergesch'
|
||||
},
|
||||
'lg': {
|
||||
'name': 'Luganda',
|
||||
'nativeName': 'Luganda'
|
||||
},
|
||||
'li': {
|
||||
'name': 'Limburgish, Limburgan, Limburger',
|
||||
'nativeName': 'Limburgs'
|
||||
},
|
||||
'ln': {
|
||||
'name': 'Lingala',
|
||||
'nativeName': 'Lingála'
|
||||
},
|
||||
'lo': {
|
||||
'name': 'Lao',
|
||||
'nativeName': 'ພາສາລາວ'
|
||||
},
|
||||
'lt': {
|
||||
'name': 'Lithuanian',
|
||||
'nativeName': 'lietuvių kalba'
|
||||
},
|
||||
'lu': {
|
||||
'name': 'Luba-Katanga',
|
||||
'nativeName': ''
|
||||
},
|
||||
'lv': {
|
||||
'name': 'Latvian',
|
||||
'nativeName': 'latviešu valoda'
|
||||
},
|
||||
'gv': {
|
||||
'name': 'Manx',
|
||||
'nativeName': 'Gaelg, Gailck'
|
||||
},
|
||||
'mk': {
|
||||
'name': 'Macedonian',
|
||||
'nativeName': 'македонски јазик'
|
||||
},
|
||||
'mg': {
|
||||
'name': 'Malagasy',
|
||||
'nativeName': 'Malagasy fiteny'
|
||||
},
|
||||
'ms': {
|
||||
'name': 'Malay',
|
||||
'nativeName': 'bahasa Melayu, بهاس ملايو'
|
||||
},
|
||||
'ml': {
|
||||
'name': 'Malayalam',
|
||||
'nativeName': 'മലയാളം'
|
||||
},
|
||||
'mt': {
|
||||
'name': 'Maltese',
|
||||
'nativeName': 'Malti'
|
||||
},
|
||||
'mi': {
|
||||
'name': 'Māori',
|
||||
'nativeName': 'te reo Māori'
|
||||
},
|
||||
'mr': {
|
||||
'name': 'Marathi (Marāṭhī)',
|
||||
'nativeName': 'मराठी'
|
||||
},
|
||||
'mh': {
|
||||
'name': 'Marshallese',
|
||||
'nativeName': 'Kajin M̧ajeļ'
|
||||
},
|
||||
'mn': {
|
||||
'name': 'Mongolian',
|
||||
'nativeName': 'монгол'
|
||||
},
|
||||
'na': {
|
||||
'name': 'Nauru',
|
||||
'nativeName': 'Ekakairũ Naoero'
|
||||
},
|
||||
'nv': {
|
||||
'name': 'Navajo, Navaho',
|
||||
'nativeName': 'Diné bizaad, Dinékʼehǰí'
|
||||
},
|
||||
'nb': {
|
||||
'name': 'Norwegian Bokmål',
|
||||
'nativeName': 'Norsk bokmål'
|
||||
},
|
||||
'nd': {
|
||||
'name': 'North Ndebele',
|
||||
'nativeName': 'isiNdebele'
|
||||
},
|
||||
'ne': {
|
||||
'name': 'Nepali',
|
||||
'nativeName': 'नेपाली'
|
||||
},
|
||||
'ng': {
|
||||
'name': 'Ndonga',
|
||||
'nativeName': 'Owambo'
|
||||
},
|
||||
'nn': {
|
||||
'name': 'Norwegian Nynorsk',
|
||||
'nativeName': 'Norsk nynorsk'
|
||||
},
|
||||
'no': {
|
||||
'name': 'Norwegian',
|
||||
'nativeName': 'Norsk'
|
||||
},
|
||||
'ii': {
|
||||
'name': 'Nuosu',
|
||||
'nativeName': 'ꆈꌠ꒿ Nuosuhxop'
|
||||
},
|
||||
'nr': {
|
||||
'name': 'South Ndebele',
|
||||
'nativeName': 'isiNdebele'
|
||||
},
|
||||
'oc': {
|
||||
'name': 'Occitan',
|
||||
'nativeName': 'Occitan'
|
||||
},
|
||||
'oj': {
|
||||
'name': 'Ojibwe, Ojibwa',
|
||||
'nativeName': 'ᐊᓂᔑᓈᐯᒧᐎᓐ'
|
||||
},
|
||||
'cu': {
|
||||
'name': 'Old Church Slavonic, Church Slavic, Church Slavonic, Old Bulgarian, Old Slavonic',
|
||||
'nativeName': 'ѩзыкъ словѣньскъ'
|
||||
},
|
||||
'om': {
|
||||
'name': 'Oromo',
|
||||
'nativeName': 'Afaan Oromoo'
|
||||
},
|
||||
'or': {
|
||||
'name': 'Oriya',
|
||||
'nativeName': 'ଓଡ଼ିଆ'
|
||||
},
|
||||
'os': {
|
||||
'name': 'Ossetian, Ossetic',
|
||||
'nativeName': 'ирон æвзаг'
|
||||
},
|
||||
'pa': {
|
||||
'name': 'Panjabi, Punjabi',
|
||||
'nativeName': 'ਪੰਜਾਬੀ, پنجابی'
|
||||
},
|
||||
'pi': {
|
||||
'name': 'Pāli',
|
||||
'nativeName': 'पाऴि'
|
||||
},
|
||||
'fa': {
|
||||
'name': 'Persian',
|
||||
'nativeName': 'فارسی'
|
||||
},
|
||||
'pl': {
|
||||
'name': 'Polish',
|
||||
'nativeName': 'polski'
|
||||
},
|
||||
'ps': {
|
||||
'name': 'Pashto, Pushto',
|
||||
'nativeName': 'پښتو'
|
||||
},
|
||||
'pt': {
|
||||
'name': 'Portuguese',
|
||||
'nativeName': 'Português'
|
||||
},
|
||||
'qu': {
|
||||
'name': 'Quechua',
|
||||
'nativeName': 'Runa Simi, Kichwa'
|
||||
},
|
||||
'rm': {
|
||||
'name': 'Romansh',
|
||||
'nativeName': 'rumantsch grischun'
|
||||
},
|
||||
'rn': {
|
||||
'name': 'Kirundi',
|
||||
'nativeName': 'kiRundi'
|
||||
},
|
||||
'ro': {
|
||||
'name': 'Romanian, Moldavian, Moldovan',
|
||||
'nativeName': 'română'
|
||||
},
|
||||
'ru': {
|
||||
'name': 'Russian',
|
||||
'nativeName': 'русский язык'
|
||||
},
|
||||
'sa': {
|
||||
'name': 'Sanskrit (Saṁskṛta)',
|
||||
'nativeName': 'संस्कृतम्'
|
||||
},
|
||||
'sc': {
|
||||
'name': 'Sardinian',
|
||||
'nativeName': 'sardu'
|
||||
},
|
||||
'sd': {
|
||||
'name': 'Sindhi',
|
||||
'nativeName': 'सिन्धी, سنڌي، سندھی'
|
||||
},
|
||||
'se': {
|
||||
'name': 'Northern Sami',
|
||||
'nativeName': 'Davvisámegiella'
|
||||
},
|
||||
'sm': {
|
||||
'name': 'Samoan',
|
||||
'nativeName': 'gagana faa Samoa'
|
||||
},
|
||||
'sg': {
|
||||
'name': 'Sango',
|
||||
'nativeName': 'yângâ tî sängö'
|
||||
},
|
||||
'sr': {
|
||||
'name': 'Serbian',
|
||||
'nativeName': 'српски језик'
|
||||
},
|
||||
'gd': {
|
||||
'name': 'Scottish Gaelic; Gaelic',
|
||||
'nativeName': 'Gàidhlig'
|
||||
},
|
||||
'sn': {
|
||||
'name': 'Shona',
|
||||
'nativeName': 'chiShona'
|
||||
},
|
||||
'si': {
|
||||
'name': 'Sinhala, Sinhalese',
|
||||
'nativeName': 'සිංහල'
|
||||
},
|
||||
'sk': {
|
||||
'name': 'Slovak',
|
||||
'nativeName': 'slovenčina'
|
||||
},
|
||||
'sl': {
|
||||
'name': 'Slovene',
|
||||
'nativeName': 'slovenščina'
|
||||
},
|
||||
'so': {
|
||||
'name': 'Somali',
|
||||
'nativeName': 'Soomaaliga, af Soomaali'
|
||||
},
|
||||
'st': {
|
||||
'name': 'Southern Sotho',
|
||||
'nativeName': 'Sesotho'
|
||||
},
|
||||
'es': {
|
||||
'name': 'Spanish; Castilian',
|
||||
'nativeName': 'español'
|
||||
},
|
||||
'su': {
|
||||
'name': 'Sundanese',
|
||||
'nativeName': 'Basa Sunda'
|
||||
},
|
||||
'sw': {
|
||||
'name': 'Swahili',
|
||||
'nativeName': 'Kiswahili'
|
||||
},
|
||||
'ss': {
|
||||
'name': 'Swati',
|
||||
'nativeName': 'SiSwati'
|
||||
},
|
||||
'sv': {
|
||||
'name': 'Swedish',
|
||||
'nativeName': 'svenska'
|
||||
},
|
||||
'ta': {
|
||||
'name': 'Tamil',
|
||||
'nativeName': 'தமிழ்'
|
||||
},
|
||||
'te': {
|
||||
'name': 'Telugu',
|
||||
'nativeName': 'తెలుగు'
|
||||
},
|
||||
'tg': {
|
||||
'name': 'Tajik',
|
||||
'nativeName': 'тоҷикӣ, toğikī, تاجیکی'
|
||||
},
|
||||
'th': {
|
||||
'name': 'Thai',
|
||||
'nativeName': 'ไทย'
|
||||
},
|
||||
'ti': {
|
||||
'name': 'Tigrinya',
|
||||
'nativeName': 'ትግርኛ'
|
||||
},
|
||||
'bo': {
|
||||
'name': 'Tibetan Standard, Tibetan, Central',
|
||||
'nativeName': 'བོད་ཡིག'
|
||||
},
|
||||
'tk': {
|
||||
'name': 'Turkmen',
|
||||
'nativeName': 'Türkmen, Түркмен'
|
||||
},
|
||||
'tl': {
|
||||
'name': 'Tagalog',
|
||||
'nativeName': 'Wikang Tagalog, ᜏᜒᜃᜅ᜔ ᜆᜄᜎᜓᜄ᜔'
|
||||
},
|
||||
'tn': {
|
||||
'name': 'Tswana',
|
||||
'nativeName': 'Setswana'
|
||||
},
|
||||
'to': {
|
||||
'name': 'Tonga (Tonga Islands)',
|
||||
'nativeName': 'faka Tonga'
|
||||
},
|
||||
'tr': {
|
||||
'name': 'Turkish',
|
||||
'nativeName': 'Türkçe'
|
||||
},
|
||||
'ts': {
|
||||
'name': 'Tsonga',
|
||||
'nativeName': 'Xitsonga'
|
||||
},
|
||||
'tt': {
|
||||
'name': 'Tatar',
|
||||
'nativeName': 'татарча, tatarça, تاتارچا'
|
||||
},
|
||||
'tw': {
|
||||
'name': 'Twi',
|
||||
'nativeName': 'Twi'
|
||||
},
|
||||
'ty': {
|
||||
'name': 'Tahitian',
|
||||
'nativeName': 'Reo Tahiti'
|
||||
},
|
||||
'ug': {
|
||||
'name': 'Uighur, Uyghur',
|
||||
'nativeName': 'Uyƣurqə, ئۇيغۇرچە'
|
||||
},
|
||||
'uk': {
|
||||
'name': 'Ukrainian',
|
||||
'nativeName': 'українська'
|
||||
},
|
||||
'ur': {
|
||||
'name': 'Urdu',
|
||||
'nativeName': 'اردو'
|
||||
},
|
||||
'uz': {
|
||||
'name': 'Uzbek',
|
||||
'nativeName': 'zbek, Ўзбек, أۇزبېك'
|
||||
},
|
||||
've': {
|
||||
'name': 'Venda',
|
||||
'nativeName': 'Tshivenḓa'
|
||||
},
|
||||
'vi': {
|
||||
'name': 'Vietnamese',
|
||||
'nativeName': 'Tiếng Việt'
|
||||
},
|
||||
'vo': {
|
||||
'name': 'Volapük',
|
||||
'nativeName': 'Volapük'
|
||||
},
|
||||
'wa': {
|
||||
'name': 'Walloon',
|
||||
'nativeName': 'Walon'
|
||||
},
|
||||
'cy': {
|
||||
'name': 'Welsh',
|
||||
'nativeName': 'Cymraeg'
|
||||
},
|
||||
'wo': {
|
||||
'name': 'Wolof',
|
||||
'nativeName': 'Wollof'
|
||||
},
|
||||
'fy': {
|
||||
'name': 'Western Frisian',
|
||||
'nativeName': 'Frysk'
|
||||
},
|
||||
'xh': {
|
||||
'name': 'Xhosa',
|
||||
'nativeName': 'isiXhosa'
|
||||
},
|
||||
'yi': {
|
||||
'name': 'Yiddish',
|
||||
'nativeName': 'ייִדיש'
|
||||
},
|
||||
'yo': {
|
||||
'name': 'Yoruba',
|
||||
'nativeName': 'Yorùbá'
|
||||
},
|
||||
'za': {
|
||||
'name': 'Zhuang, Chuang',
|
||||
'nativeName': 'Saɯ cueŋƅ, Saw cuengh'
|
||||
}
|
||||
};
|
||||
292
src/app/settings/settings.component.html
Normal file
292
src/app/settings/settings.component.html
Normal file
@@ -0,0 +1,292 @@
|
||||
<h4 i18n="Settings title" mat-dialog-title>Settings</h4>
|
||||
<!-- <ng-container i18n="Allow subscriptions setting"></ng-container> -->
|
||||
<mat-dialog-content>
|
||||
<!-- Language -->
|
||||
<div>
|
||||
Language: <mat-select class="locale-select" (selectionChange)="localeSelectChanged($event.value)" [(value)]="initialLocale">
|
||||
<mat-option *ngFor="let locale of supported_locales" [value]="locale">
|
||||
{{all_locales[locale]['nativeName']}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
|
||||
<!-- Host -->
|
||||
<mat-expansion-panel class="settings-expansion-panel">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Host settings title">Host</ng-container>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-form-field color="accent">
|
||||
<input [(ngModel)]="new_config['Host']['url']" matInput placeholder="URL" i18n-placeholder="URL input placeholder" required>
|
||||
<mat-hint><ng-container i18n="URL setting input hint">URL this app will be accessed from, without the port.</ng-container></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-12 mt-4">
|
||||
<mat-form-field color="accent">
|
||||
<input [(ngModel)]="new_config['Host']['port']" matInput placeholder="Port" i18n-placeholder="Port input placeholder" required>
|
||||
<mat-hint><ng-container i18n="Port setting input hint">The desired port. Default is 17442.</ng-container></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<!-- Encryption -->
|
||||
<mat-expansion-panel class="settings-expansion-panel">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Encryption settings title">Encryption</ng-container>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Encryption']['use-encryption']"><ng-container i18n="Use encryption setting">Use encryption</ng-container></mat-checkbox>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<mat-form-field color="accent">
|
||||
<input [disabled]="!new_config['Encryption']['use-encryption']" [(ngModel)]="new_config['Encryption']['cert-file-path']" matInput placeholder="Cert file path" i18n-placeholder="Cert file path input placeholder">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<mat-form-field color="accent">
|
||||
<input [disabled]="!new_config['Encryption']['use-encryption']" [(ngModel)]="new_config['Encryption']['key-file-path']" matInput placeholder="Key file path" i18n-placeholder="Key file path input placeholder">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<!-- Downloader -->
|
||||
<mat-expansion-panel class="settings-expansion-panel">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Downloader settings title">Downloader</ng-container>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-form-field color="accent">
|
||||
<input matInput [(ngModel)]="new_config['Downloader']['path-audio']" placeholder="Audio folder path" i18n-placeholder="Audio folder path input placeholder" required>
|
||||
<mat-hint><ng-container i18n="Aduio path setting input hint">Path for audio only downloads. It is relative to YTDL-Material's root folder.</ng-container></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="col-12 mt-4">
|
||||
<mat-form-field color="accent">
|
||||
<input matInput [(ngModel)]="new_config['Downloader']['path-video']" placeholder="Video folder path" i18n-placeholder="Video folder path input placeholder" required>
|
||||
<mat-hint><ng-container i18n="Video path setting input hint">Path for video downloads. It is relative to YTDL-Material's root folder.</ng-container></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="col-12 mt-4">
|
||||
<mat-form-field color="accent">
|
||||
<textarea matInput [(ngModel)]="new_config['Downloader']['custom_args']" placeholder="Custom args" i18n-placeholder="Custom args input placeholder"></textarea>
|
||||
<mat-hint><ng-container i18n="Custom args setting input hint">Global custom args for downloads on the home page.</ng-container></mat-hint>
|
||||
</mat-form-field>
|
||||
<button style="margin-left: 12px;" (click)="openArgsModifierDialog()" mat-stroked-button>Modify args</button>
|
||||
</div>
|
||||
|
||||
<div class="col-12 mt-4">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Downloader']['use_youtubedl_archive']"><ng-container i18n="Use youtubedl archive setting">Use youtube-dl archive</ng-container></mat-checkbox>
|
||||
<p>Note: This setting only applies to downloads on the Home page. If you would like to use youtube-dl archive functionality in subscriptions, head down to the Subscriptions section.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<!-- Extra -->
|
||||
<mat-expansion-panel class="settings-expansion-panel">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Extra settings title">Extra</ng-container>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-form-field color="accent">
|
||||
<input [(ngModel)]="new_config['Extra']['title_top']" matInput placeholder="Top title" i18n-placeholder="Top title input placeholder" required>
|
||||
<mat-hint></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Extra']['file_manager_enabled']"><ng-container i18n="File manager enabled setting">File manager enabled</ng-container></mat-checkbox>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Extra']['allow_quality_select']"><ng-container i18n="Allow quality seelct setting">Allow quality select</ng-container></mat-checkbox>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Extra']['download_only_mode']"><ng-container i18n="Download only mode setting">Download only mode</ng-container></mat-checkbox>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Extra']['allow_multi_download_mode']"><ng-container i18n="Allow multi-downloade mode setting">Allow multi-download mode</ng-container></mat-checkbox>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Extra']['settings_pin_required']"><ng-container i18n="Require pin for settings setting">Require pin for settings</ng-container></mat-checkbox>
|
||||
<button style="margin-left: 15px;" mat-stroked-button (click)="setNewPin()" [disabled]="!new_config['Extra']['settings_pin_required']"><ng-container i18n="Set new pin button">Set New Pin</ng-container></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<!-- API -->
|
||||
<mat-expansion-panel class="settings-expansion-panel">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="API settings title">API</ng-container>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['API']['use_youtube_API']"><ng-container i18n="Use YouTube API setting">Use YouTube API</ng-container></mat-checkbox>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<mat-form-field color="accent">
|
||||
<input [disabled]="!new_config['API']['use_youtube_API']" [(ngModel)]="new_config['API']['youtube_API_key']" matInput placeholder="Youtube API Key" i18n-placeholder="Youtube API Key setting placeholder" required>
|
||||
<mat-hint><a target="_blank" href="https://developers.google.com/youtube/v3/getting-started"><ng-container i18n="Youtube API Key setting hint">Generating a key is easy!</ng-container></a></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<!-- Themes -->
|
||||
<mat-expansion-panel class="settings-expansion-panel">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Themes settings title">Themes</ng-container>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-select color="accent" style="width: 100px" [(ngModel)]="new_config['Themes']['default_theme']">
|
||||
<mat-option value="default"><ng-container i18n="Default theme label">Default</ng-container></mat-option>
|
||||
<mat-option value="dark"><ng-container i18n="Dark theme label">Dark</ng-container></mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
|
||||
<div class="col-12 mt-4">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Themes']['allow_theme_change']"><ng-container i18n="Allow theme change setting">Allow theme change</ng-container></mat-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<!-- Subscriptions -->
|
||||
<mat-expansion-panel class="settings-expansion-panel">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Subscriptions settings title">Subscriptions</ng-container>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Subscriptions']['allow_subscriptions']"><ng-container i18n="Allow subscriptions setting">Allow subscriptions</ng-container></mat-checkbox>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<mat-form-field color="accent">
|
||||
<input [disabled]="!new_config['Subscriptions']['allow_subscriptions']" [(ngModel)]="new_config['Subscriptions']['subscriptions_base_path']" matInput placeholder="Subscriptions base path" i18n-placeholder="Subscriptions base path input setting placeholder">
|
||||
<mat-hint><ng-container i18n="Subscriptions base path setting input hint">Base path for videos from your subscribed channels and playlists. It is relative to YTDL-Material's root folder.</ng-container></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-12 mt-5">
|
||||
<mat-form-field color="accent">
|
||||
<input [disabled]="!new_config['Subscriptions']['allow_subscriptions']" [(ngModel)]="new_config['Subscriptions']['subscriptions_check_interval']" matInput placeholder="Check interval" i18n-placeholder="Check interval input setting placeholder">
|
||||
<mat-hint><ng-container i18n="Check interval setting input hint">Unit is seconds, only include numbers.</ng-container></mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-12 mt-4">
|
||||
<mat-checkbox color="accent" [disabled]="!new_config['Subscriptions']['allow_subscriptions']" [(ngModel)]="new_config['Subscriptions']['subscriptions_use_youtubedl_archive']"><ng-container i18n="Use youtube-dl archive setting">Use youtube-dl archive</ng-container></mat-checkbox>
|
||||
<p><a target="_blank" href="https://github.com/ytdl-org/youtube-dl/blob/master/README.md#how-do-i-download-only-new-videos-from-a-playlist"><ng-container i18n="youtube-dl archive explanation prefix link">With youtube-dl's archive</ng-container></a> <ng-container i18n="youtube-dl archive explanation middle">feature, downloaded videos from your subscriptions get recorded in a text file in the subscriptions archive sub-directory.</ng-container></p>
|
||||
<p><ng-container i18n="youtube-dl archive explanation suffix">This enables the ability to permanently delete videos from your subscriptions without unsubscribing, and allows you to record which videos you downloaded in case of data loss.</ng-container></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<!-- Extensions -->
|
||||
<mat-expansion-panel class="settings-expansion-panel">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Extensions settings title">Extensions</ng-container>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h6>Chrome</h6>
|
||||
<p><a href="https://github.com/Tzahi12345/YoutubeDL-Material/blob/master/chrome-extension/youtubedl-material-chrome-extension.zip?raw=true"><ng-container i18n="Chrome ext click here">Click here</ng-container></a> <ng-container i18n="Chrome click here suffix">to download the official YoutubeDL-Material Chrome extension manually.</ng-container></p>
|
||||
<p><ng-container i18n="Chrome setup suffix">You must manually load the extension and modify the extension's settings to set the frontend URL.</ng-container></p>
|
||||
<mat-divider class="ext-divider"></mat-divider>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<h6>Firefox</h6>
|
||||
<p><a href="https://addons.mozilla.org/en-US/firefox/addon/youtubedl-material/" target="_blank"><ng-container i18n="Firefox ext click here">Click here</ng-container></a> <ng-container i18n="Firefox click here suffix">to install the official YoutubeDL-Material Firefox extension right off the Firefox extensions page.</ng-container></p>
|
||||
<p><a href="https://github.com/Tzahi12345/YoutubeDL-Material/wiki/Firefox-Extension" target="_blank"><ng-container i18n="Firefox setup prefix link">Detailed setup instructions.</ng-container></a> <ng-container i18n="Firefox setup suffix">Not much is required other than changing the extension's settings to set the frontend URL.</ng-container></p>
|
||||
<mat-divider class="ext-divider"></mat-divider>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<h6>Bookmarklet</h6>
|
||||
<p><ng-container i18n="Bookmarklet instructions">Drag the link below to your bookmarks, and you're good to go! Just navigate to the YouTube video you'd like to download, and click the bookmark.</ng-container></p>
|
||||
<!--<button style="margin-bottom: 5px;" mat-stroked-button color="accent" (click)="generateBookmarklet()">Generate bookmarklet</button>-->
|
||||
<p><a [href]="generated_bookmarklet_code" target="_blank">YTDL-Bookmarklet</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
|
||||
|
||||
<!-- Advanced -->
|
||||
<mat-expansion-panel class="settings-expansion-panel">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<ng-container i18n="Advanced settings title">Advanced</ng-container>
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="new_config" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Advanced']['use_default_downloading_agent']"><ng-container i18n="Use default downloading agent setting">Use default downloading agent</ng-container></mat-checkbox>
|
||||
</div>
|
||||
<div class="col-12 my-2">
|
||||
<mat-select [disabled]="new_config['Advanced']['use_default_downloading_agent']" color="accent" style="width: 200px" [(ngModel)]="new_config['Advanced']['custom_downloading_agent']">
|
||||
<mat-option value="">Select a downloader</mat-option>
|
||||
<mat-option value="aria2c">aria2c</mat-option>
|
||||
<mat-option value="avconv">avconv</mat-option>
|
||||
<mat-option value="axel">axel</mat-option>
|
||||
<mat-option value="curl">curl</mat-option>
|
||||
<mat-option value="ffmpeg">ffmpeg</mat-option>
|
||||
<mat-option value="httpie">httpie</mat-option>
|
||||
<mat-option value="wget">wget</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
<div class="col-12 mt-2">
|
||||
<mat-checkbox color="accent" [(ngModel)]="new_config['Advanced']['allow_advanced_download']"><ng-container i18n="Allow advanced downloading setting">Allow advanced download</ng-container></mat-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions>
|
||||
<div style="margin-bottom: 10px;">
|
||||
<button color="accent" (click)="saveSettings()" [disabled]="settingsSame()" mat-raised-button><mat-icon>done</mat-icon>
|
||||
<ng-container i18n="Settings save button">Save</ng-container>
|
||||
</button>
|
||||
<button mat-flat-button [mat-dialog-close]="false"><mat-icon>cancel</mat-icon>
|
||||
<ng-container i18n="Settings cancel button">Cancel</ng-container>
|
||||
</button>
|
||||
</div>
|
||||
</mat-dialog-actions>
|
||||
12
src/app/settings/settings.component.scss
Normal file
12
src/app/settings/settings.component.scss
Normal file
@@ -0,0 +1,12 @@
|
||||
.settings-expansion-panel {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.locale-select {
|
||||
margin-bottom: 10px;
|
||||
width: 130px;
|
||||
}
|
||||
|
||||
.ext-divider {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user