antangelo / xdvdfs

Original Xbox DVD Filesystem library and management tool
https://xiso.antangelo.com/
MIT License
73 stars 8 forks source link

Batch convert isos and naming #93

Open Rebislori opened 1 month ago

Rebislori commented 1 month ago

Hi everyone, and thank you for this project. I must say that i know my way around computers, i have my linux basics, but templating and scripting are well over my possibilities.

I'm setting up pegasus with metadata and whatnot, but all my xbox games are in iso format, not xiso.

I solved this with sdvdgs-cli: "./xdvdfs pack /dir/to/the/image.iso /dir/to/the/converted/image.iso

I have 2 questions:

1)is there a way i can automatically create the xiso with the same name as the original iso? 2)Is there a way to batch convert isos? Or, at least, could anyone point me in the right direction?

Thanks again!

astarivi commented 1 month ago

To answer both of your questions:

  1. By omitting the output path, the output image will be created in the same folder as the source, with a ".xiso.iso" extension.
  2. There is no current way to do this natively. A script would help with this.

Batch processing sounds like a good idea, I propose creating a new CLI command "batch" that takes an extra parameter, "pack" or "unpack", then two paths, input and output folder.

antangelo commented 1 month ago

Some additional notes:

  1. When an output path is not provided, the output will be in the current working directory. We first try <filename>.iso, and if that already exists and is equal to the input path, then we use <filename>.xiso.iso. If your output directory is different from the source directory, you can achieve output with the same filename by running xdvdfs pack from inside the output directory, with no output argument.
  2. You don't necessarily need a script to perform batching, you can use the find command with -exec to execute a command on every file in a directory that matches some criteria given in the arguments.

I'm open to the idea of adding some sort of native batching support but it needs to offer some benefit over find -exec or similar. At minimum it should run operations in parallel, which requires changing the current async executor (probably to tokio).

gmipf commented 2 weeks ago

I have written 2 bash scripts for batch processing, input is your folder where all ISOs resides, output is the folder where to extract or repack. Don't forget to add the "/" at the end of the path or the script will break. Repack script will output with your filename.xiso.iso. Extract script will output to a directory with you filename without the .iso extension.

Batch repack:

#!/bin/bash

input="_OGISO/"
output="_OGXISO/"

shopt -s nullglob # enable nullglob
for file in "$input"*.iso; do
    noniso=${file%.iso} # remove .iso extension
    filename=${noniso/#$input} # remove input prefix from filename
    xdvdfs pack "$file" "$output""$filename".xiso.iso
done
shopt -u nullglob # disable nullglob

echo ""
echo "...done"

Batch extract:

#!/bin/bash

input="_OGISO/"
output="_OG/"

shopt -s nullglob # enable nullglob
for file in "$input"*.iso; do
    noniso=${file%.iso} # remove .iso extension
    folder=${noniso/#$input} # remove input prefix from foldername
    xdvdfs unpack "$file" "$output""$folder"
done
shopt -u nullglob # disable nullglob

echo ""
echo "...done"