Author Topic: Comic book archive conversion script issues  (Read 969 times)

0 Members and 1 Guest are viewing this topic.

Offline Ermac

  • Neuling
  • *
  • Posts: 2
  • I'm new. Be nice!
  • Desktop: Xfce
  • Kernel: Linux 4.6rc3-1 (x64)
  • Skill: Intermediate
Comic book archive conversion script issues
« on: 14. April 2016, 12:16:56 »
Came across this script that is supposed to convert .CBR files to .CBZ - it's failing to work for me.  Scrolling back in terminal reveals that unrar is failing to open ComicBook.RAR instead of the ComicBook.CBR file it should be opening.  Any ideas how to get unrar to find the proper file (or file extension)?  Absolute beginner with this stuff, any help is appreciated.

CBR to CBZ script:
Code: [Select]
#!/bin/bash
# Author: Alon Ivtsan
# License: GPL3+

for FILE in *{.cbr,.CBR}
do
[ -e "$FILE" ] || continue
echo Converting $FILE to cbz format.
DIR="${FILE%.*}"
mkdir "$DIR";
unrar ./"$FILE" -o "$DIR";
zip -r "$DIR".cbz "$DIR";
rm -r "$DIR";
#Remove or comment out this line if you want to keep cbr files
#rm "$FILE";
echo Conversion of $FILE successful!
done

Offline Strit

  • Maintainer
  • ***
  • Posts: 746
  • Manjaro Torrent Maintainer
    • Strits.dk
  • Branch: Stable
  • Desktop: XFCE
  • GPU Card: GTX 760 OC
  • GPU driver: Non-free nvidia 361
  • Kernel: 4.4.8-1-MANJARO
  • Skill: Intermediate
Re: Comic book archive conversion script issues
« Reply #1 on: 14. April 2016, 12:21:16 »
To me it seems that the script only takes .cbr or .CBR files to convert.
Which means it would fail on a .RAR file if one of them is present.

Are you certain the folder does not contain any .RAR files?
Desktop PC: Manjaro XFCE 15.12 (stable, kernel 4.4)
Private Laptop: Manjaro Strit 16.03 (unstable, kernel 4.6)
Work Laptop: Manjaro Strit 16.03 (stable, kernel 4.4)
Netbook: Arch Linux XFCE/LXqt (i686, kernel 4.0)

Offline scachemaille

  • Held Mitglied
  • *****
  • Posts: 528
  • I'm new. Be nice!
  • Branch: Unstable
  • Desktop: Plasma 5
  • GPU Card: nVidia GT 330M
  • GPU driver: Nouveau
  • Kernel: 4.8_x64
  • Skill: Intermediate
Re: Comic book archive conversion script issues
« Reply #2 on: 14. April 2016, 12:36:24 »
To me it seems that the script only takes .cbr or .CBR files to convert.
Which means it would fail on a .RAR file if one of them is present.

Are you certain the folder does not contain any .RAR files?
I tried to rename a rar file with cbr extension. and it seems for a reason unrar don't like that.
let say I renamed test.rar to test.cbr
the command
Code: [Select]
unrar ./test.cbr -o xxxfailed saying that it can't open test.rar as no such file exist.

Edit:
the solution is to correct the command
Code: [Select]
unrar ./"$FILE" -o "$DIR";to
Code: [Select]
unrar  x ./"$FILE" -o "$DIR";
« Last Edit: 14. April 2016, 12:45:56 by scachemaille »

Offline Strit

  • Maintainer
  • ***
  • Posts: 746
  • Manjaro Torrent Maintainer
    • Strits.dk
  • Branch: Stable
  • Desktop: XFCE
  • GPU Card: GTX 760 OC
  • GPU driver: Non-free nvidia 361
  • Kernel: 4.4.8-1-MANJARO
  • Skill: Intermediate
Re: Comic book archive conversion script issues
« Reply #3 on: 14. April 2016, 12:37:19 »
File extensions are not that important on linux. It's all saved in the MIME type bits of the file it self.
Desktop PC: Manjaro XFCE 15.12 (stable, kernel 4.4)
Private Laptop: Manjaro Strit 16.03 (unstable, kernel 4.6)
Work Laptop: Manjaro Strit 16.03 (stable, kernel 4.4)
Netbook: Arch Linux XFCE/LXqt (i686, kernel 4.0)

Offline scachemaille

  • Held Mitglied
  • *****
  • Posts: 528
  • I'm new. Be nice!
  • Branch: Unstable
  • Desktop: Plasma 5
  • GPU Card: nVidia GT 330M
  • GPU driver: Nouveau
  • Kernel: 4.8_x64
  • Skill: Intermediate
Re: Comic book archive conversion script issues
« Reply #4 on: 14. April 2016, 12:52:25 »
File extensions are not that important on linux. It's all saved in the MIME type bits of the file it self.
yeah and it seems it's because it miss a command parameter and the error message isn't really helpfull. ;)
like as in my earlier post. it seems it miss the Commands parameter  "x" or "e" to extract files (with or without archived path).
maybe with an earlier version of unrar this parameter was not mandatory.
« Last Edit: 14. April 2016, 12:55:55 by scachemaille »

Offline Ermac

  • Neuling
  • *
  • Posts: 2
  • I'm new. Be nice!
  • Desktop: Xfce
  • Kernel: Linux 4.6rc3-1 (x64)
  • Skill: Intermediate
Re: Comic book archive conversion script issues
« Reply #5 on: 14. April 2016, 12:58:30 »
Quote from: scachemaille
the solution is to correct the command
Code: [Select]
unrar ./"$FILE" -o "$DIR";to
Code: [Select]
unrar  x ./"$FILE" -o "$DIR";

It works! Thank you both for the assistance.