unoconv / unoserver

MIT License
496 stars 69 forks source link

feature req: restore wildcards, empty [outfile]= reuse filename with new extension #53

Closed rcrath closed 1 year ago

rcrath commented 1 year ago

Hi, thanks for modernizing unoconv. I have a script that I need for my work that I used to be able to run on unoconv. unoconv no longer works because of deprecation of distutils. unoconverter does not yet have the features I need to keep my work up to date.

I can get unoconvert to run, but I lose the ability to input wildcards for infile and output the same names to outfile with a new extension. The command in unoconv:

unoconv -f pdf -e SelectPdfVersion=1 -e ExportNotes=false '*.odt' 

gives error

/usr/bin/unoconv:860: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if product.ooName not in ('LibreOffice', 'LOdev') or LooseVersion(product.ooSetupVersion) <= LooseVersion('3.3'):

Thanks for your consideration. Using Manjaro 21.3 Cinnamon, 5.42, libreoffice fresh 7.4.2-2

rcrath commented 1 year ago

This is my workaround which I might just keep and retire the uno* apps. I'm only doing a few dozen files at a time, so the efficiency is not really a factor.

#!/bin/bash 
#this set of commenting is all relevant to the broken unoconv command.
#echo "If you recieve \"Error: Unable to connect or start own listener\"  Just 
#run the command again. If you get pyuno bridge error try running \"pip 
#install unotools\""

#put this bash script in the same folder as the odt files 
# you want to make pdf from. it will safely convert all of them
#create a folder in current directory with current date
mkdir -p $(date +%y%m%d)
# copy all odt files from current directory to the dated one just created and enter the folder
cp *.odt $(date +%y%m%d)
cd $(date +%y%m%d)

These are just the unoconv* commands, ignore.
#unoconv -f pdf -e SelectPdfVersion=1 -e ExportNotes=false '*.odt' 
# unoserver --daemon
# unoconvert --convert-to pdf *.odt -

# loop through all the odt files in the dated folder and 
# cconvert them to pdf, leaving the originals intact. 
for f in .*.odt
do
    echo "converting $f to pdf"
    soffice --headless --convert-to pdf *.odt
done

# go up to the folder the script is in, create a folder called pdf if 
# it is not already there, and copy the pdf files into a subfolder 
# of the pdf named with the current date.  
mkdir -p ../pdf/$(date +%y%m%d)
mv *.pdf ../pdf/$(date +%y%m%d)
cd ..
# delete the temprorary dated folder 
rm -R $(date +%y%m%d)
regebro commented 1 year ago

Yes, Unoconv/unoserver is really only useful when you need a server to do the conversion. If you can do it in a batch job with soffice, you should.

On Mon, Dec 5, 2022 at 7:52 AM Rich Rath @.***> wrote:

This is my workaround which I might just keep and retire the uno* apps. I'm only doing a few dozen files at a time, so the efficiency is not really a factor.

!/bin/bash

this set of commenting is all relevant to the broken unoconv command.

echo "If you recieve \"Error: Unable to connect or start own listener\" Just

run the command again. If you get pyuno bridge error try running \"pip

install unotools\""

put this bash script in the same folder as the odt files

you want to make pdf from. it will safely convert all of them

create a folder in current directory with current date

mkdir -p $(date +%y%m%d)

copy all odt files from current directory to the dated one just created and enter the folder

cp *.odt $(date +%y%m%d) cd $(date +%y%m%d)

These are just the unoconv* commands, ignore.

unoconv -f pdf -e SelectPdfVersion=1 -e ExportNotes=false '*.odt'

unoserver --daemon

unoconvert --convert-to pdf *.odt -

loop through all the odt files in the dated folder and

cconvert them to pdf, leaving the originals intact.

for f in ..odt do echo "converting $f to pdf" soffice --headless --convert-to pdf .odt done

go up to the folder the script is in, create a folder called pdf if

it is not already there, and copy the pdf files into a subfolder

of the pdf named with the current date.

mkdir -p ../pdf/$(date +%y%m%d) mv *.pdf ../pdf/$(date +%y%m%d) cd ..

delete the temprorary dated folder

rm -R $(date +%y%m%d)

— Reply to this email directly, view it on GitHub https://github.com/unoconv/unoserver/issues/53#issuecomment-1336826827, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGIK5DG3L7ZRZHVL6EASKLWLWGJZANCNFSM6AAAAAAST2XMAU . You are receiving this because you are subscribed to this thread.Message ID: @.***>