瀏覽代碼

add configurable port and readme

biblius 10 月之前
父節點
當前提交
90c6f0dc5f
共有 4 個文件被更改,包括 16 次插入2 次删除
  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.

文件差異過大導致無法顯示
+ 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

部分文件因文件數量過多而無法顯示