소스 검색

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

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.