Skip to content

Commit

Permalink
Handle custom drive paths (#130)
Browse files Browse the repository at this point in the history
* Handle custom drive paths

* Update ripper.sh

* grep -E needed
  • Loading branch information
caraar12345 authored Nov 20, 2024
1 parent 105109b commit cc03e37
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions root/ripper/ripper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ BAD_RESPONSE=0
DISC_TYPE=""
# Define the drive types and patterns to match against the output of makemkvcon
declare -A DRIVE_TYPE_PATTERNS=(
[empty]='DRV:0,0,999,0,"'
[open]='DRV:0,1,999,0,"'
[loading]='DRV:0,3,999,0,"'
[bd1]='DRV:0,2,999,12,"'
[bd2]='DRV:0,2,999,28,"'
[dvd]='DRV:0,2,999,1,"'
[cd1]='DRV:0,2,999,0,"'
[empty]='DRV:[0-9]+,0,999,0,"'
[open]='DRV:[0-9]+,1,999,0,"'
[loading]='DRV:[0-9]+,3,999,0,"'
[bd1]='DRV:[0-9]+,2,999,12,"'
[bd2]='DRV:[0-9]+,2,999,28,"'
[dvd]='DRV:[0-9]+,2,999,1,"'
[cd1]='DRV:[0-9]+,2,999,0,"'
[cd2]='","","'$DRIVE'"'
)

Expand Down Expand Up @@ -97,13 +97,13 @@ cleanup_tmp_files() {

check_disc() {
debug_log "Checking disc."
INFO=$(makemkvcon -r --cache=1 info disc:9999 | grep DRV:0)
INFO=$(makemkvcon -r --cache=1 info disc:9999 | grep DRV:.*$DRIVE)
debug_log "INFO: $INFO"
DISC_TYPE="" # Clear previous disc type value

for TYPE in "${!DRIVE_TYPE_PATTERNS[@]}"; do
PATTERN=${DRIVE_TYPE_PATTERNS[$TYPE]}
if echo "$INFO" | grep -q "$PATTERN"; then
if echo "$INFO" | grep -E -q "$PATTERN"; then
DISC_TYPE=$TYPE
debug_log "Detected disc type: $DISC_TYPE"
break
Expand Down

0 comments on commit cc03e37

Please sign in to comment.