CjTUI update

This commit is contained in:
2026-02-17 11:30:59 -06:00
parent 046605797f
commit 12c69e5838
7 changed files with 34 additions and 19 deletions
+7 -7
View File
@@ -199,11 +199,11 @@ impl DownloadManager {
// ---------- directory helpers ----------
const DOWNLOAD_MARKER_EXT: &str = "cj-jftui.json";
const DOWNLOAD_MARKER_EXT: &str = "cjtui.json";
fn marker_path_for_media(media_path: &Path) -> PathBuf {
// Example:
// Movie.mkv -> Movie.mkv.cj-jftui.json
// Movie.mkv -> Movie.mkv.cjtui.json
let file_name = media_path
.file_name()
.and_then(|s| s.to_str())
@@ -247,7 +247,7 @@ fn scan_dir_for_markers(dir: &Path, out: &mut HashSet<String>) -> Result<(), Str
continue;
}
// Look for *.cj-jftui.json
// Look for *.cjtui.json
let name = p.file_name().and_then(|s| s.to_str()).unwrap_or("");
if !name.ends_with(DOWNLOAD_MARKER_EXT) {
continue;
@@ -1115,7 +1115,7 @@ fn aria2_http_post(body: &str) -> Result<String, String> {
fn aria2_rpc_call(method: &str, params: Value) -> Result<Value, String> {
let payload = json!({
"jsonrpc": "2.0",
"id": "cj-jftui",
"id": "cjtui",
"method": method,
"params": params,
});
@@ -1178,7 +1178,7 @@ fn aria2_front_status(state: &Arc<Mutex<DownloadState>>) -> Option<String> {
/// If this item_id has a local download marker, return the local media file path.
/// Marker files are written alongside the media file as:
/// <media_filename>.<DOWNLOAD_MARKER_EXT>
/// where DOWNLOAD_MARKER_EXT == "cj-jftui.json"
/// where DOWNLOAD_MARKER_EXT == "cjtui.json"
pub fn local_media_path_for_item_id(item_id: &str) -> Option<PathBuf> {
fn walk(dir: &Path, item_id: &str) -> Option<PathBuf> {
if !dir.exists() {
@@ -1229,7 +1229,7 @@ pub fn local_media_path_for_item_id(item_id: &str) -> Option<PathBuf> {
}
// Delete ALL local copies of an item by scanning *.cj-jftui.json markers recursively.
// Delete ALL local copies of an item by scanning *.cjtui.json markers recursively.
// Returns how many media files we attempted to remove (count of matched markers).
pub fn delete_local_by_item_id(item_id: &str) -> Result<usize, String> {
let root = downloads_root()?;
@@ -1314,7 +1314,7 @@ fn delete_in_dir_by_item_id(dir: &Path, item_id: &str, deleted: &mut usize) -> R
Ok(())
}
// Reads sibling marker "<mediafilename>.cj-jftui.json" and returns item_id if present.
// Reads sibling marker "<mediafilename>.cjtui.json" and returns item_id if present.
fn item_id_for_media_path(media_path: &Path) -> Result<Option<String>, String> {
let fname = match media_path.file_name().and_then(|s| s.to_str()) {
Some(s) => s,