LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-01-2010, 02:06 AM   #1
dudeman41465
Member
 
Registered: Jun 2005
Location: Kentucky
Distribution: Debian
Posts: 794

Rep: Reputation: 56
New Version of my Lit2PDF Script for Use/Review


You guys may have seen a couple of topics lately about a little script I've been maintaining personally. I posted a completed version of it a while back and just wanted to post the latest stable version. I'm using it as a pet project to teach myself proper BASH scripting, but also to help my wife get .lit e-books onto her Sony E-Reader since it seems to do a better job of converting the files than Calibre(For some reason some of our books won't convert in Calibre and they will with this). I've added some zenity windows to make it just a little more friendly in regards to selecting the file you want to convert. You no longer have to drag it into the terminal window and make sure you've got quotes around it if there's a space. It's also now completely BASH instead of python. I'm a "beginner" programmer/scripter, so some review, comments, and constructive criticism are welcome because everything I know I've taught myself with Google and experimentation.

To install it, just grab the tarball, extract it, make the files executable if they aren't already when you download them, and then run the install.sh file in the terminal. I tried to be very descriptive and informative in the changelog.txt and Readme.txt files as well so I hope those suit their purposes well.

P.S. If you're wondering about the versioning, I just adopted the same philosophy as the Ubuntu community and just made the date the version number. 10.11.30 equals November 30th, 2010.
 
Old 12-01-2010, 06:02 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Thanks for creating something. In return a wee code contrib FWIW:
Code:
#Lit2PDF 10.11.30
#This is a script to automate converting a .lit
#file to a .pdf file using convlit, html2ps, and ps2pdf
#software packages.
#Marcus Dean Adams (marcusdean.adams@gmail.com)

# Whoami
APPNAME="Lit2PDF"

# Ensure we actually have required apps and bail out:
for APPNAME in zenity clit html2ps ps2pdf mktemp; do
 which ${APPNAME} >/dev/null 2>&1 || exit 1
 done

# A Rolling Stone:
if [ -d "/home/${LOGNAME}" ]; then exit 1; fi

# Either ensure we create the temp dir in the users home or
# in another reasonable place:
if [ -d "/dev/shm" ]; then TEMPBASE="/dev/shm"
elif [ -d "/home/${LOGNAME}/tmp" ]; then TEMPBASE="/home/${LOGNAME}/tmp"
else TEMPBASE="/tmp"; fi

# Use 'mktemp' instead of creating temp directories:
export TMPDIR="${TEMPBASE}"
MYTMPDIR=`mktemp -p "${TEMPBASE}" -d ${APPNAME}.XXXXXXXXXX` && {
 zenity --info --TITLE="Lit2PDF" --text="Please select the file you wish to convert."
 INFILE=$(zenity --file-selection --filename=/home --TITLE="Select a LIT file")
 if [ $? == 0 ]; then
  TITLE=$(zenity --entry --text "What is the TITLE of the book?")
  if [ $? == 0 ]; then
   zenity --info --TITLE="Please wait..." --text="Conversion may take a long time depending on the length of the book.  Click OK to begin."
   clit "${INFILE}" "${MYTMPDIR}/html/"
   html2ps "${MYTMPDIR}/html/*.htm" > "${MYTMPDIR}/temp.ps"
   if [ -d "$HOME/Desktop" ]; then ps2pdf "${MYTMPDIR}/temp.ps" "${HOME}/Desktop/${TITLE:=untitled}.pdf"
    else ps2pdf "${MYTMPDIR}/temp.ps" "/tmp/${TITLE:=untitled}.pdf"
   fi
  fi
 fi
 rm -rf "${MYTMPDIR}"
 } # End Mktemp

# Make proper use of exit status:
exit 0
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Development GIMP Version 2.7 Review LXer Syndicated Linux News 0 03-27-2010 02:41 PM
LXer: CrossOver Games Mac Version 7.0.0 Review LXer Syndicated Linux News 0 05-17-2008 03:12 AM
LXer: Mandriva 2007 Spring Version Review: Part 2 LXer Syndicated Linux News 0 07-26-2007 04:01 AM
LXer: Mandriva 2007 Spring Version Review: Part I LXer Syndicated Linux News 0 07-25-2007 09:01 AM
Version Control Systems -Quick Review frankie_DJ Programming 6 10-06-2005 03:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration