# কমান্ড লাইন এবং অটোমেশন

VDM can be driven without its window in three ways:

- **অ্যাপের নিজস্ব কমান্ড লাইন**, IDM-এর মতো একই সুইচ: একটি স্ক্রিপ্ট, একটি ব্যাচ ফাইল বা অন্য প্রোগ্রাম থেকে চলমান অ্যাপে একটি ডাউনলোড হস্তান্তর করুন।
- **`voltdownloadmanager-cli`**, একটি পৃথক কমান্ড-লাইন টুল: অ্যাপ ছাড়া টার্মিনালে ফাইল, ভিডিও এবং টরেন্ট ডাউনলোড করুন, অগ্রগতি সহ।
- **The automation API**: other programs list the running app's downloads (as JSON) and pause, start, remove or delete them, over a local, token-protected channel. AI assistants use it through VDM's MCP server: see [AI assistants](https://vdm.mikaillab.com/bn/help/ai-assistants.html).

To run the whole app without a window, on a home server or a NAS, see [Run VDM on a server](https://vdm.mikaillab.com/bn/help/server.html) (`voltdownloadmanager --headless`); to control it from a phone, [Control VDM from your phone](https://vdm.mikaillab.com/bn/help/remote-control.html).

উদাহরণগুলিতে Windows-এর পাথ ব্যবহার করা হয়েছে; macOS এবং Linux-এ প্রোগ্রামগুলির একই নাম রয়েছে `.exe` ছাড়া।

## অ্যাপের কমান্ড লাইন

```
voltdownloadmanager.exe /d URL [/p folder] [/f name] [/a] [/n] [/s]
```

| সুইচ | এটি কী করে |
|---|---|
| `/d URL` | ডাউনলোড করার ঠিকানা। |
| `/p folder` | এই ফোল্ডারে সংরক্ষণ করুন (অন্যথায় **বিকল্প → এতে সংরক্ষণ করুন** থেকে ক্যাটাগরির ফোল্ডার)। |
| `/f name` | এই নামে সংরক্ষণ করুন। |
| `/a` | এটি শুরু না করে প্রধান ডাউনলোড কিউতে যোগ করুন। |
| `/n` | নীরব: কোনো **ফাইল তথ্য ডাউনলোড করুন** উইন্ডো নেই, ডাউনলোড অবিলম্বে শুরু হয় (বা `/a` সহ কিউতে রাখা হয়)। |
| `/s` | প্রধান ডাউনলোড কিউ শুরু করুন। |
| `/exit` | চলমান অ্যাপটি সংরক্ষণ করুন এবং বন্ধ করুন (আপগ্রেডের আগে ইনস্টলার এটি ব্যবহার করে)। |
| `/startup` | Start in the notification area, the window hidden: what **Launch Volt Download Manager on startup** starts VDM with when you sign in. Where no notification area shows VDM's icon (some Linux desktops), VDM starts minimized. A running VDM stays as it is. |
| *একটি `.torrent` ফাইল বা `magnet:` লিঙ্ক* | Open it in **Add torrent** (what Windows passes when VDM opens torrents). |

Switches can start with `/` or `-`, in any case. If VDM is running, the command goes to it; if not, VDM starts and carries it out. For example:

```
voltdownloadmanager.exe /d https://example.com/files/report.pdf /p D:\Reports /n
voltdownloadmanager.exe /d https://example.com/big.iso /a
voltdownloadmanager.exe /s
```

## voltdownloadmanager-cli

It comes with every download of VDM, next to the app (the installer puts it in VDM's folder). It works on its own: the app needn't run, except for `status` and `api`.

Its downloads leave the way the app's do: through **Options → Proxy / Socks** (no proxy, **Use system settings** with its `HTTPS_PROXY` / `HTTP_PROXY` / `ALL_PROXY` variables and the system's automatic configuration script, an automatic configuration script, fetched before the command starts, or a manual proxy with its login) and its **Network adapter**, with the DNS of **Options → Connection**. That covers `get`, `resume`, the video, playlist and gallery commands (yt-dlp and gallery-dl too), the `install-*` commands, and torrents when Torrent settings' **Use the proxy** is on. For one run, `--proxy` takes the place of Options' proxy: `none` (direct, yt-dlp and gallery-dl too, whatever the system's proxy), `system`, or a proxy's address, `http://127.0.0.1:7890`, `https://…`, `socks5://…`, `socks5h://…` (the proxy looks the sites' names up), `socks4://…`, `socks4a://…`. A password is never taken on the command line, where other programs can read it: write the user name in the address (`socks5://ann@127.0.0.1:1080`) and put the password in the `VDM_PROXY_PASSWORD` environment variable. `get` and `resume` also have `--dns` and `--adapter`, and `video-get` and `gallery-get` `--adapter` (`any` for none), for the same.

| কমান্ড | এটি কী করে |
|---|---|
| `get URL [-o folder\\|file] [-c connections] [-H "Header: value"]... [-r referer] [--user-agent agent] [--cookie cookie] [--checksum hash] [--dns choice] [--adapter name] [--proxy proxy]` | Download a file with up to 8 connections (`-c`, 1 to 128), showing progress. `Ctrl+C` pauses it; `resume` continues. `-r` sets the referring page address (Referer header), `--user-agent` sets the request's User-Agent (then the only one sent; without it, VDM speaks as your default browser, and, when a site's bot check refuses that and the way a browser connects too, once more under its own name), `--cookie` sets the Cookie header (a cookie on the command line ends up in the shell's history; `-` reads it from standard input instead). `--checksum` checks the finished file: hex MD5, SHA-1, SHA-256, SHA-512 or CRC32, optionally named (`sha256:…`); a file that doesn't match fails. Without it, a checksum the server sends is checked, and a file that doesn't match it is kept with a `warning:` line (see [Verify checksum](https://vdm.mikaillab.com/bn/help/download-list.html#verify-checksum)). `--dns` picks the DNS instead of Options': `system`; a service and how to ask it, `cloudflare-https`, `quad9-tls`, `google-plain`, `adguard-https`, `nextdns-tls`; DNS servers' addresses, `9.9.9.9,149.112.112.112`; or a DNS-over-HTTPS address. It never falls back to the system's DNS. `--adapter` sends every connection through one network adapter instead of Options' (`any` for none), by its name (`Ethernet`, `wg0`) or one of its addresses; when it isn't connected, nothing is sent and the download fails. `--proxy` takes the place of Options' proxy for this run (see above). The app's [site rules](https://vdm.mikaillab.com/bn/help/connections-and-speed.html#site-rules) for the address apply too (their headers, User-Agent, browser-like connection, number of connections and proxy), where the command line gives none of the same: `--proxy` goes before every rule's proxy. A link from a file host that one of your debrid accounts (**Options → Accounts**) supports goes through that account, as in the app, and `get` says `through Real-Debrid`; `--direct` downloads the address itself ([Debrid service accounts](https://vdm.mikaillab.com/bn/help/debrid.html)). |
| `resume file.vdm.json [-c connections] [-H ...] [-r referer] [--user-agent agent] [--cookie cookie] [--checksum hash] [--dns choice] [--adapter name] [--proxy proxy] [--direct]` | এর পাশের `.vdm.json` ফাইল থেকে একটি বিরতি দেওয়া বা ভাঙা ডাউনলোড পুনরায় শুরু করুন। `-r`, `--user-agent` এবং `--cookie` অতিরিক্ত হেডার সেট করে (`-` স্ট্যান্ডার্ড ইনপুট থেকে কুকি পড়ে)। `--checksum` সেই রানের জন্য শেষ হওয়া ফাইলটি যাচাই করে। `--dns`, `--adapter` এবং `--proxy` সংযোগের DNS, নেটওয়ার্ক অ্যাডাপ্টার এবং প্রক্সি সেট করে, যেমন `get`-এর জন্য, এবং অ্যাপের সাইট নিয়ম `get`-এর জন্য প্রযোজ্য। একটি ডিব্রিড অ্যাকাউন্টের মাধ্যমে, যেমন `get`: পরিষেবাটি একটি নতুন লিংক দেয় যখন পুরোনোটি মেয়াদোত্তীর্ণ হয়; `--direct` ঠিকানাটি নিজেই থেকে চালিয়ে যায়। |
| `install-gallery-dl` | ছবি গ্যালারির জন্য gallery-dl ইনস্টল বা আপডেট করুন: এর চেকবুক তালিকা এর লেখকের স্বাক্ষর করা কী-এর সাথে যাচাই করা হয়, প্রোগ্রামটি সেই তালিকার সাথে যাচাই করা হয় (Windows এবং Linux x86-64; অন্য কোথাও এটি নিজে ইনস্টল করুন)। |
| `gallery-get URL [-o folder] [--limit N] [--adapter name]` | Download a gallery's pictures (a Wikimedia Commons category, a Flickr album, ...) into a folder named after it inside `-o`; `--limit` takes at most that many, the first the site lists. Started again, it fetches only the new ones. VDM's own downloader brings the pictures gallery-dl lists, 4 at a time. `--adapter` sends the connections, VDM's and gallery-dl's, through one network adapter, as for `get`. |
| `video-info URL` | একটি পৃষ্ঠায় কী ভিডিও আছে (YouTube, Vimeo, ...), এবং বেছে নেওয়ার জন্য গুণমানগুলি। |
| `playlist-info URL [--from N] [--count N]` | একটি প্লেলিস্ট বা চ্যানেলের ভিডিও, প্রতিটি এক লাইনে যেমন তালিকাভুক্ত আছে: এর স্থান, দৈর্ঘ্য, শিরোনাম এবং ঠিকানা। |
| `playlist-get URL [-f selector] [-o folder] [-c pieces] [--split-chapters] [--from N] [--count N]` | একটি প্লেলিস্ট বা চ্যানেলের ভিডিওগুলো `-o`-এর ভেতরে তালিকার নামে একটি ফোল্ডারে একের পর এক ডাউনলোড করুন। `-f` সবগুলোর জন্য একটি গুণমান, যেমন `video-get`-এর জন্য (ডিফল্টরূপে প্রতিটি ভিডিওর সেরা; `bv*[height<=720]+ba/b[height<=720]` = 720পি পর্যন্ত; `bv[vcodec^=avc]+ba[acodec^=mp4a]/b[vcodec^=avc][acodec^=mp4a]` = সর্বাধিক সামঞ্জস্যপূর্ণ, AAC সহ H.264; `ba` = আসল শব্দ; `mp3:320`, `opus:`, `flac:` যেমন `video-get`-এর জন্য)। `-c` এবং `--split-chapters` যেমন `video-get`-এর জন্য। |
| `video-get URL [-f selector \\| -q height\\|compatible] [-o folder] [-c pieces] [--subs langs] [--auto-subs] [--embed-subs] [--split-chapters] [--adapter name]` | Download a video. Without `-f` or `-q`, the best quality, the one the Download video window starts on: with ffmpeg the best picture with the best sound joined to it (a site whose pictures and sounds come apart, such as Bilibili, needs ffmpeg for a video), else the best file with both. `-q 1080` (or `720p`) takes that height, or the nearest below it the page offers (else the nearest above), and says so. `-q compatible` takes the most compatible quality, as the window's **Most compatible (H.264 + AAC)**: the best H.264 picture with AAC sound, in an MP4 that plays in every editor, TV and phone; a page without one says so (nothing is converted). `-f` takes a quality's selector from `video-info` (`b` = the best single file; `ba` = the sound alone as the site has it, not converted; `mp3:320`, `mp3:256`, `mp3:192` or `mp3:128` = the sound as an MP3 at that bitrate, `mp3:0` at its best variable one; `opus:` = as Opus; `flac:` = as FLAC, lossless but no better than the site's sound; conversions need ffmpeg). `-c`: VDM's own downloader brings each stream yt-dlp finds over this many connections (8 by default, 1 to 128), a stream in pieces (HLS, DASH) this many pieces at once. `--subs` saves subtitles beside it: language codes from `video-info` (`en,fr`), or `all` for every one the uploader gave; `--auto-subs` takes the site's automatic captions instead; `--embed-subs` puts them into the video (needs ffmpeg, MP4 or MKV). With ffmpeg, the video's chapters go into the file too, as Download video's **Embed chapters** does. `--split-chapters` splits the video into numbered chapter files without re-encoding, beside the main video. `--adapter` sends the downloads' connections, and yt-dlp's (and ffmpeg's), through one network adapter, as for `get`; when it isn't connected, nothing starts. When no format of the page matches, the error lists the ones it offers, as `video-info` does. |
| `update-helpers` | Check VDM's own helpers (yt-dlp, ffmpeg, gallery-dl, Node.js) for newer versions now, install them (each checked as its first install was), and print their versions. A helper a download is using switches to its new version once that download ends. Programs you chose in Helpers, and your system's, are yours to update. |
| `install-ytdlp`, `install-ffmpeg`,`install-js-runtime` | Install or update the helpers videos need: yt-dlp (checked against its signing key), ffmpeg (x64 and ARM64 Windows, a build in VDM's signed list of checked builds; on macOS and Linux VDM uses the system's, and on 32-bit Windows one you choose in Helpers) and VDM's own JavaScript runtime, which yt-dlp needs for YouTube's qualities: Node.js's newest LTS build (its checksum list checked against Node.js's releasers' keys; Windows, Linux and macOS). A runtime already on your computer, or one chosen in Helpers, is still used first, and the command says so. `install-deno`, its earlier name, does the same. |
| `torrent-info SOURCE` | টরেন্টের নাম, ফাইলের তালিকা (নম্বরসহ) এবং আকার; `SOURCE` হলো ম্যাগনেট লিঙ্ক অথবা `.torrent` ফাইল। |
| `torrent-get SOURCE [-o folder] [--files 0,2] [--use-existing]` | একটি টরেন্ট ডাউনলোড করুন, অথবা এর কিছু ফাইল। যদি এর কিছু ফাইল ইতোমধ্যে ফোল্ডারে থাকে, তবে এটি থেমে যায় এবং সেগুলোর নাম বলে; `--use-existing` সেগুলোর পরিবর্তে ব্যবহার করে (যা মেলে তা রাখা হয়, বাকিটা ডাউনলোড করা হয়)। টরেন্ট সেটিংস-এর **এই পাবলিক তালিকার ট্র্যাকারগুলো পাবলিক টরেন্টগুলোতে যোগ করুন** চালু থাকলে, একটি পাবলিক টরেন্ট অ্যাপের মতোই তালিকার ট্র্যাকারগুলোও পায়। |
| `torrent-create PATH -o file.torrent` | একটি ফাইল বা ফোল্ডারের `.torrent` তৈরি করুন, একটি ফোল্ডারের ফাইলগুলো নাম অনুসারে তালিকাভুক্ত করুন (পিয়াররা DHT-এর মাধ্যমে এটি খুঁজে পায়)। |
| `status [--id N] [-s status] [--search text] [-c category] [-q queue] [-l limit]`(বা `list`) | চলমান অ্যাপের ডাউনলোডগুলো, JSON হিসাবে, তাদের আইডি সহ (অটোমেশন API চালু থাকতে হবে)। ঐচ্ছিক ফ্ল্যাগগুলো আইডি, অবস্থা, অনুসন্ধান স্ট্রিং, শ্রেণি বা সারি দ্বারা ফিল্টার করে, অথবা সংখ্যা সীমিত করে। |
| `pause ID...`, `start ID...` | চলমান অ্যাপের ডাউনলোডে বিরতি দিন, অথবা থেমে থাকা, সারিতে থাকা বা ব্যর্থ ডাউনলোড শুরু করুন (পুনরায় চালু করুন)। |
| `remove ID...`, `delete ID...` | চলমান অ্যাপের তালিকা থেকে ডাউনলোড সরান: `remove` তাদের ফাইল রেখে দেয়, `delete` ফাইলও মুছে দেয়। চলমান ডাউনলোড সরানোর আগে বিরতি দেওয়া হয় (`pause`)। |
| `add URL [-o folder] [-f name] [-c category] [-q queue] [--checksum hash] [-r referer] [--user-agent agent] [--cookie cookie] [--private] [-l] [-s]` | চলমান অ্যাপে একটি ডাউনলোড হস্তান্তর করুন। `-o` ফোল্ডার সেট করে, `-f` ফাইলের নাম, `-c` শ্রেণি, `-q` সারি, `--checksum` প্রয়োজনীয় হ্যাশ সেট করে, `-r` রেফারিং পেজের ঠিকানা সেট করে (Referer হেডার), `--user-agent` অনুরোধের User-Agent সেট করে, `--cookie` Cookie হেডার সেট করে (কমান্ড লাইনে একটি কুকি শেল-এর ইতিহাসে শেষ হয়; `-` এর পরিবর্তে স্ট্যান্ডার্ড ইনপুট থেকে এটি পড়ে), `--private` এটিকে একটি ব্যক্তিগত উইন্ডোর ডাউনলোড হিসাবে চিহ্নিত করে (সাধারণ উইন্ডোগুলোর ডাউনলোড থেকে আলাদা রাখা হয়, তালিকায় সংরক্ষণ করা হয় শুধুমাত্র যখন **বিকল্প → সাধারণ → ব্যক্তিগত উইন্ডো থেকে ডাউনলোডগুলো তালিকায় রাখুন** চালু থাকে, যেমনটি ডিফল্টরূপে থাকে), `-l` শুরু না করেই এটিকে সারিতে রাখে, এবং `-s` ডাউনলোড ফাইলের তথ্য ডায়ালগটি এড়িয়ে যায়। সফল হলে `{"id": N}` প্রিন্ট করে। |
| `start-queue [name] [-q name]`, `stop-queue [name] [-q name]` | চলমান অ্যাপে একটি ডাউনলোড সারি শুরু বা থামান (অটোমেশন API)। বাদ দিলে প্রধান সারি শুরু বা থামায়। |
| `pair` | চলমান অ্যাপের রিমোট কন্ট্রোলের সাথে একটি ফোন বা রিমোট ব্রাউজার যুক্ত করার জন্য একটি নতুন কোড দেখান: এর ওয়েব ঠিকানা, পেয়ারিং কোড এবং একটি QR কোড। |
| `api on`, `api off` | চলমান অ্যাপের অটোমেশন API চালু বা বন্ধ করুন। |

`voltdownloadmanager-cli help <command>`সব বিকল্প দেখায়। কোনো কমান্ড ব্যর্থ হলে (অ্যাপটি চলছে না, এটি ত্রুটির উত্তর দেয়, বা কোনো ডাউনলোডে সমস্যা হয়), কোড 1 দিয়ে শেষ হয়। উদাহরণস্বরূপ:

```
voltdownloadmanager-cli get https://example.com/big.iso -o D:\Downloads -c 16 --checksum sha256:9f86d0…
voltdownloadmanager-cli video-get "https://www.youtube.com/watch?v=aqz-KE-bpKQ" -q 720
voltdownloadmanager-cli torrent-get "magnet:?xt=urn:btih:…" --files 0
```

### স্ক্রিপ্ট ও প্রোগ্রামের জন্য JSON

কমান্ডের আগে বা পরে `--json` যোগ করলে, প্রতিটি কমান্ড টেক্সটের বদলে JSON দেখায়—প্রতি লাইনে একটি অবজেক্ট—যা স্ক্রিপ্ট ও AI এজেন্ট পড়তে পারে:

| কমান্ড | যা দেখায় |
|---|---|
| `get`, `resume` | `{"event": "through", "service"}`প্রথমে যখন ডাউনলোড একটি ডিব্রিড অ্যাকাউন্টের মাধ্যমে যায়, তারপর প্রতি আধা সেকেন্ডে একটি `{"event": "progress", "downloaded", "size", "speed", "connections", "segments"}` লাইন, তারপর `{"event": "done", "path", "size", "seconds"}` (যখন ফাইলটি তার সার্ভার দ্বারা পাঠানো চেকসামের সাথে মেলেনি, এবং রাখা হয়েছিল তখন `"warning"` সহ), অথবা `{"event": "paused", "state"}` এর পরে `Ctrl+C` (`state` হল সেই ফাইল যা `resume` নেয়)। |
| `video-get` | `-f` ছাড়া, `{"event": "quality", "label", "format", "height", "asked", "nearest"}` প্রথমে: নেওয়া গুণমান, `asked` `-q`-এর উচ্চতা (`"compatible"` `-q compatible`-এর জন্য, অন্যথায় `null`) এবং `nearest` সেই উচ্চতাটি অফার করা হয়নি কিনা। তারপর `{"event": "progress", "downloaded", "size", "speed"}` লাইন, `{"event": "note", "text"}` ডাউনলোডের লগ কী বলে তার জন্য (সার্ভারগুলো যে গুণমান দেয় না, নিকটতম নিচেরটি নেওয়া হয়েছে), তারপর `{"event": "done", "path", "subtitles", "subtitle_problems"}`: এর পাশে সংরক্ষিত সাবটাইটেল ফাইলগুলো, এবং সাইট যে ভাষাগুলো প্রত্যাখ্যান করেছে (`{"code", "name", "reason", "beside"}`; `beside`: সেগুলো দ্বিতীয় প্রচেষ্টায় এসেছে, ভিডিওর ভেতরে না হয়ে পাশে)। |
| `torrent-get` | `{"event": "progress", "phase", "downloaded", "size", "speed", "peers", "peers_seen"}`লাইন, তারপর `{"event": "done", "path", "size"}`, অথবা `--seconds`-সহ `{"event": "stopped", "downloaded", "seconds"}`। |
| `video-info` | `{"title", "choices": [{"label", "format", "size", "approx", "height", "fps", "codec", "range"}], "subtitles": [{"code", "name", "automatic"}], "declared"}`; `declared` হল সেই ভিডিওর ঠিকানা যা পেজটি সম্পর্কে বলে, যখন HTML-এর প্রথম প্লেয়ারের পরিবর্তে সেটি খুঁজে বের করা হয়েছিল (একটি সাইটে yt-dlp-এর নিজস্ব কোনো রিডার নেই), অন্যথায় `null`; একটি পছন্দের `format` হল যা `video-get -f` নেয় (যে ফরম্যাটগুলো থেকে এটি আকার করা হয়েছিল, যেমন `401+251`, তারপর একই কোডেক এবং উচ্চতার নিকটতম যদি সেগুলো চলে যায়, তারপর যেকোনো কোডেক), `approx` বলে এর `size` একটি অনুমান, `codec` হল `AV1`, `VP9`, `H.264`…, `range` হল `HDR` (অথবা একটি HDR পছন্দের পাশে `SDR`); একটি সাবটাইটেলের `code` হল যা `--subs` নেয়। |
| `torrent-info` | `{"name", "info_hash", "size", "files": [{"index", "size", "path"}]}`. |
| `torrent-create` | `{"info_hash", "path"}`. |
| `install-ytdlp`, `install-ffmpeg`,`install-js-runtime` | `{"tool", "version", "path"}`; `install-js-runtime` যোগ করে `used`, yt-dlp যে রানটাইম ব্যবহার করে (`{"runtime", "version", "path"}`)। |
| `update-helpers` | প্রতিটি হেল্পারের জন্য একটি `{"tool", "status", "version"}`; `status` হল `up-to-date`, `updated`, `ready` (এর ডাউনলোড শেষ হলে ব্যবহার করা হয়), `skipped` (আপনি নতুনতম থেকে ফিরে গেছেন), `not-ours`, `busy` অথবা `failed` (`error` সহ)। |
| `status`, `pause`, `start`, `remove`, `delete`, `start-queue`, `stop-queue`, `add`, `pair`,`api` | অ্যাপের উত্তর, যা আগে থেকেই JSON (নিচে দেখুন)। |

আকার বাইটে (`null` যখন অজানা), গতি বাইট প্রতি সেকেন্ডে। একটি ব্যর্থতা `{"error": "…"}` প্রিন্ট করে এবং কোড 1 সহ প্রস্থান করে; যখন `video-get` পেজের কোনো ফরম্যাট ডাউনলোড করার জন্য খুঁজে পায় না, তখন ত্রুটিটি `"choices"` (যেমন `video-info`-এর) এবং `"formats"` (yt-dlp-এর নিজস্ব: `{"id", "ext", "height", "video", "audio"}`) সহ আসে। উদাহরণস্বরূপ:

```
voltdownloadmanager-cli --json get https://example.com/big.iso -o D:\Downloads
{"event":"progress","downloaded":4194304,"size":1073741824,"speed":52428800,"connections":8,"segments":8}
…
{"event":"done","path":"D:\\Downloads\\big.iso","size":1073741824,"seconds":20.4}
```

## অটোমেশন API

অন্যান্য প্রোগ্রাম চলমান অ্যাপকে জিজ্ঞাসা করতে পারে এটি কী ডাউনলোড করছে, এবং ডাউনলোডে বিরতি দিতে, শুরু করতে, তালিকা থেকে সরাতে বা মুছে ফেলতে পারে। API **ডিফল্টভাবে বন্ধ থাকে**; `voltdownloadmanager-cli api on` দিয়ে চালু করুন (এবং `api off` দিয়ে বন্ধ করুন)।

### How a program talks to VDM

1. While it runs, VDM listens on a port of `127.0.0.1` (this computer only) and writes the port and a secret token to `ipc.json` in its data folder: - Windows: `%APPDATA%\voltdownloadmanager\ipc.json` - macOS: `~/Library/Application Support/voltdownloadmanager/ipc.json` - Linux: `~/.local/share/voltdownloadmanager/ipc.json` - A [portable copy](https://vdm.mikaillab.com/bn/help/portable.html): `data\ipc.json` next to the program.

The token changes at every start; only programs that can read your data folder (yours) can use it. 2. Connect to that port and send one line of JSON: the token and the command's fields, e.g. `{"token": "<token>", "query": "list"}`. 3. VDM answers with one line: `ok` for a command, or a JSON object for a question.

### কী কী বোঝে

| ক্ষেত্র (`token` ছাড়া) | উত্তর |
|---|---|
| `{"query": "list"}` | প্রতিটি ডাউনলোড এবং মোট গতি: `{"downloads": [{"id", "file", "url", "path", "status", "size", "downloaded", "speed", "added", "category", "error"}], "speed": bytes per second, "queues": [{"name", "running", "ids"}], "categories": [{"key", "name"}], "free": bytes}`। `status` হলো `Queued`, `Downloading`, `Stopped`, `Complete` অথবা `Error`; `size` হলো `null` যখন অজানা; `error` (কেন এটি ব্যর্থ হয়েছে) শুধুমাত্র `Error`-এর ডাউনলোডের জন্য থাকে; `category` হলো একটি ক্যাটাগরির `key`; `free` হলো খালি স্থান যেখানে ডাউনলোডগুলি যায় (`null` যখন অজানা)। শুধুমাত্র API চালু থাকলে। |
| `{"action": "pause", "ids": [3, 4]}` | আইডি দিয়ে ডাউনলোডে কাজ করে: `"pause"`, `"start"`, `"remove"` (ফাইল রেখে দেয়) অথবা `"delete"` (ফাইলও মুছে দেয়)। উত্তর `{"done": [3], "skipped": [{"id": 4, "why": "not running"}]}`; কোনো চলমান ডাউনলোড তালিকা থেকে সরানোর বা মুছে ফেলার আগে বিরতি দিতে হবে। শুধু API চালু থাকলেই পাওয়া যায়। |
| `{"action": "start_queue", "queue": "Main download queue"}` | সেই নামের সারি শুরু করে (বা `"stop_queue"` সহ, থামায়) (তালিকার `queues` থেকে একটি নাম; ডিফল্ট: প্রধান ডাউনলোড সারি)। `{"done": [], "skipped": []}`, বা `{"error": …, "code": "unknown-queue"}` উত্তর দেয়। শুধুমাত্র যখন API চালু থাকে। |
| `{"api": true}` / `{"api": false}` | API চালু বা বন্ধ করে: `{"api": true}`। |
| `{"url": "https://…", "dir": "D:\\Files", "name": "a.zip", "silent": true}` | একটি ডাউনলোড যোগ করে, যেমন কমান্ড লাইনের `/d /p /f /n` করে (`"later": true` হলো `/a`); `ok`। `"category"` (তালিকার `categories` থেকে একটি কী) এটিকে তার প্রকারের পছন্দের ফোল্ডারের পরিবর্তে সেই ক্যাটাগরির ফোল্ডারে রাখে; `"queue"` (একটি কিউ-এর নাম) হলো সেই কিউ যেখানে এটি `"later"` সহ অপেক্ষা করে। API বন্ধ থাকলেও, কমান্ড লাইনের মতো। |
| `{"start_queue": true}` | প্রধান ডাউনলোড সারি শুরু করে; `ok`। |

An unknown question or action is answered `{"error": "…"}`, as is a question while the API is off (then with `"code": "api-off"`, for programs to check: the error text may change). A wrong token is answered `denied`. When VDM is already handling as many requests as it takes at once, it answers `busy`: nothing was done, and the line can be sent again a moment later.

A command (answered `ok`) may carry an `"id"` of your own: letters, digits and `-`, at most 64, different for each command. If its answer doesn't come back (the line closed, or a wait ran out), send the same line again with the same `id`: VDM does it once, however many of those lines reach it, and answers `ok` to each. Without an `id`, each line is a new command. A second launch of the program (`voltdownloadmanager.exe /d …`, `/exit`) does this by itself.

প্রতিটি অনুরোধ এবং উত্তর ক্ষেত্র অনুসারে একটি JSON স্কিমাতে বর্ণিত আছে: [automation-api.schema.json](https://vdm.mikaillab.com/automation-api.schema.json) ( `https://vdm.mikaillab.com/automation-api.schema.json` এও পাওয়া যায়)। এটি অ্যাপ যে কোড দিয়ে উত্তর দেয় তা থেকে তৈরি করা হয়েছে, তাই এটি সঠিক থাকে; প্রোগ্রামগুলি এটি ব্যবহার করে যা তারা পাঠায় এবং পড়ে তা পরীক্ষা করতে পারে, অথবা এটি থেকে তাদের প্রকারগুলি তৈরি করতে পারে।

### উদাহরণ

পাওয়ারশেল (Windows):

```
$ep = Get-Content "$env:APPDATA\voltdownloadmanager\ipc.json" | ConvertFrom-Json
$client = New-Object Net.Sockets.TcpClient("127.0.0.1", $ep.port)
$stream = $client.GetStream()
$writer = New-Object IO.StreamWriter($stream); $reader = New-Object IO.StreamReader($stream)
$writer.WriteLine((@{ token = $ep.token; query = "list" } | ConvertTo-Json -Compress))
$writer.Flush()
$reader.ReadLine() | ConvertFrom-Json | Select-Object -ExpandProperty downloads | Format-Table file, status, downloaded, size
$client.Close()
```

পাইথন:

```
import json, os, socket

ipc = os.path.join(os.environ["APPDATA"], "voltdownloadmanager", "ipc.json")  # see above elsewhere
ep = json.load(open(ipc))
with socket.create_connection(("127.0.0.1", ep["port"])) as s:
    s.sendall((json.dumps({"token": ep["token"], "query": "list"}) + "\n").encode())
    answer = json.loads(s.makefile().readline())
for d in answer["downloads"]:
    print(d["file"], d["status"], d["downloaded"], d["size"])
```

এর বদলে একটি ডাউনলোড যোগ করতে, `{"token": "…", "url": "https://example.com/a.zip", "silent": true}` পাঠান।

## সম্পর্কিত

- [সেটিংস](https://vdm.mikaillab.com/bn/help/options.html)
- [থিম](https://vdm.mikaillab.com/bn/help/themes.html)
- [ভাষা](https://vdm.mikaillab.com/bn/help/languages.html)
- [পোর্টেবল মোড](https://vdm.mikaillab.com/bn/help/portable.html)
- [কিবোর্ড শর্টকাট](https://vdm.mikaillab.com/bn/help/keyboard-shortcuts.html)

[GitHub-এ এই পৃষ্ঠাটি সম্পাদনা করুন](https://github.com/mikailhossenimran/voltdownloadmanager/edit/main/docs/command-line.md) [এই পৃষ্ঠা নিয়ে একটি সমস্যা রিপোর্ট করুন](https://github.com/mikailhossenimran/voltdownloadmanager/issues/new?template=website.yml&title=Website%3A%20Command%20line%20and%20automation&page=https%3A//vdm.mikaillab.com/help/command-line.html) [পৃষ্ঠার ইতিহাস](https://github.com/mikailhossenimran/voltdownloadmanager/commits/main/docs/command-line.md)

বিনামূল্যে, ওপেন সোর্স, কোনো বিজ্ঞাপন নেই, কোনো ট্রায়াল নেই।

[Download Volt Download Manager](https://vdm.mikaillab.com/bn/download.html)
