Jelajahi Sumber

add configurable port and readme

biblius 10 bulan lalu
induk
melakukan
90c6f0dc5f
4 mengubah file dengan 16 tambahan dan 2 penghapusan
  1. 2 1
      .env.example
  2. 10 0
      README.md
  3. 0 0
      response.json
  4. 4 1
      src/main.rs

+ 2 - 1
.env.example

@@ -2,4 +2,5 @@ JWT =
 API_KEY = 
 USERNAME = 
 PASSWORD = 
-BASE_PATH = 
+BASE_PATH = 
+PORT = 

+ 10 - 0
README.md

@@ -0,0 +1,10 @@
+# Ntitled
+
+Simple tool for downloading subtitles from opensubtitles. Useful for minimal Upnp setups in combination with TVs.
+
+## How it works
+
+It works by scanning the `BASE_PATH` from the env and displays all files from the directory. Whenever a file is encountered, ntitled will attempt
+to find a file of the same name with a `.srt` extension. Any files that have a matching `.srt` file will be considered checked by ntitled.
+
+To search for subtitles, click on any file. A bullseye means the subtitles match the movie hash as per opensubtitles. To download subtitles, click the download button and the corresponding srt file will be placed in the same directory with the same name as the video file.

File diff ditekan karena terlalu besar
+ 0 - 0
response.json


+ 4 - 1
src/main.rs

@@ -43,6 +43,7 @@ async fn main() {
     info!("Successfully loaded client");
 
     let base_path = std::env::var("BASE_PATH").expect("base path not configured");
+    let port = std::env::var("PORT").unwrap_or(String::from("3001"));
 
     let mut env = Environment::new();
 
@@ -68,7 +69,9 @@ async fn main() {
 
     let router_static = Router::new().fallback(get_service(ServeDir::new("assets")));
 
-    let listener = tokio::net::TcpListener::bind("0.0.0.0:3001").await.unwrap();
+    let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{port}"))
+        .await
+        .unwrap();
 
     axum::serve(listener, router.merge(router_static))
         .await

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini