From 17d59452e9cfcc26d3f73e67f9250586bd82ddd8 Mon Sep 17 00:00:00 2001 From: B Stack Date: Mon, 3 Sep 2018 12:34:45 +0000 Subject: Add irfanview --- irfanview/i_view32.ini | 167 +++++++++++++++++++++++++++ irfanview/irfanview | 103 +++++++++++++++++ irfanview/irfanview-icons.tgz | Bin 0 -> 20907 bytes irfanview/irfanview-vlc | 16 +++ irfanview/irfanview.default | 5 + irfanview/irfanview.desktop | 13 +++ irfanview/irfanview.spec | 258 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 562 insertions(+) create mode 100644 irfanview/i_view32.ini create mode 100755 irfanview/irfanview create mode 100644 irfanview/irfanview-icons.tgz create mode 100755 irfanview/irfanview-vlc create mode 100644 irfanview/irfanview.default create mode 100644 irfanview/irfanview.desktop create mode 100644 irfanview/irfanview.spec (limited to 'irfanview') diff --git a/irfanview/i_view32.ini b/irfanview/i_view32.ini new file mode 100644 index 0000000..04b4e54 --- /dev/null +++ b/irfanview/i_view32.ini @@ -0,0 +1,167 @@ +[Others] +Test=1 +StartOption=0 +StartFolder= +OneInstance=0 +ESCThumbs=1 +ESCExit=0 +SaveChanges=0 +ShowPNGAlpha=1 +ShowTIFAnnot=0 +ShowFullPath=1 +CenterWindow=0 +RememberWinPos=1 +LoopCurDir=1 +BeepOnLoop=1 +JumpOnPageKey=0 +UseUndo=1 +PasteSel=0 +SpecialPasteFit=1 +PaletteNearest=1 +VideoSize=100 +UseInternalPlayer=1 +VideoDS=1 +VideoLoop=0 +VideoHidePlaybar=0 +UseMCIforFlash=0 +UseQTforMOV=0 +UseQTforPICT=1 +AskDelete=1 +DelToRecycle=1 +JumpAfterDelete=0 +CloseOnDelete=0 +DelSideCars=0 +SideCarExts=THM|XMP| +NotUpdateDirIndex=0 +RenameExtension=1 +AskOverwriteSave=1 +DisplaySaveDialog=1 +Unicode=0 +UseMRUDs=1 +UseMRUFs=1 +SaveSlideDir=1 +SaveBatchDir=0 +ExternalViewer=Z:\usr\bin\irfanview-vlc +ExternalViewer2= +ExternalViewer3=Z:\usr\share\irfanview\i_view32.exe +ShortExtViewer=0 +ExtViewerFullLine=1 +PropPage=12 +[Viewing] +FullScreen=0 +Dither24BPP=0 +BackColor=0 +EnableGamma=0 +GammaValue=1.00 +EnableBWGamma=1 +BWGamma=0.5 +ContextMenu=0 +ZoomFactor=10 +ZoomOption=0 +ZoomTable=3;10;14;16;19;21;25;28;33;38;43;50;57;66;76;87;100;115;132;150;174;200;230;260;300;350;400;450;500;600;700;800;900;1000;1200;1400;1600;2000;3000; +UseICM=0 +ICMOption=0 +ICMFile= +UseICMAlways=0 +InICMFile=sRGB +ViewAll=1 +ShowHiddenFiles=1 +MultipageScroll=1 +GridSize=75 +SelColor=-1 +ShowFullScreen=1 +WMult=100 +HMult=100 +TxtPos=0 +TxtAlign=0 +TxtLayer=1 +FSCenter=1 +FSResample=1 +FSZoomResample=0 +FSAlpha=0 +FS_LMouse=0 +FS_RMouse=0 +MultimonStretch=0 +ShowFullScreenName=1 +FullBackColor=0 +HideCursor=0 +FullText=$D$F $X +TranspText=1 +FontColor=65280 +TxtBgkr=16777215 +FontParam=-13|0|0|0|400|0|0|0|0|1|2|4|49| +Font=Courier New +[JPEG] +Load Grayscale=0 +ExifRotate=1 +[PhotoCD] +Loading Size=3 +[MultiGIF] +PlayAnimation=1 +UseSingleTrans=0 +[Extensions] +AllUsers=0 +UseOtherExt=0 +AllExtensions= +UseAssociatedOnly=0 +CustomExtensions=JPG|JPEG|JPE|GIF|BMP|TIF|TIFF|PNG|PCX|ICO|PSD|CUR|ANI|TXT|PS|PDF|AI|SVG| +UseThumbBMP=0 +[Edit] +ColorChannel=0 +CutColor=0 +[StatusBar] +Text=$M +[Effects] +AutoCropTol=0 +[TXT] +TXTFileFont=0 +TranspText=1 +FontColor=65280 +TxtBgkr=16777215 +FontParam=-13|0|0|0|400|0|0|0|0|1|2|4|49| +Font=Courier New +[Copy-Move] +AskCopy=1 +AskMove=1 +CopyDir= +MoveDir= +[Language] +DLL=ENGLISH +Lang=English +[Toolbar] +Skin= +Size= +Flag=1966075 +[Plugins] +CRW_Preview=1 +CRW_Canon=0 +CRW_HALF=1 +CRW_AWB=0 +CRW_CWB=1 +CRW_NoBright=0 +CRW_Bright=1.00 +CRW_Highlight=0 +TTF_text=!"#$%&'()*+,-./0123456789:;<=>?@§ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`§abcdefghijklmnopqrstuvwxyz{|}~ +8BFPath= +[WinPosition] +xKoord=22 +yKoord=49 +Width=484 +Height=354 +Maximized=0 +[RecentFiles] +File0= +File1= +File2= +File3= +File4= +File5= +File6= +File7= +File8= +File9= +File10= +File11= +File12= +File13= +File14= diff --git a/irfanview/irfanview b/irfanview/irfanview new file mode 100755 index 0000000..bb2af33 --- /dev/null +++ b/irfanview/irfanview @@ -0,0 +1,103 @@ +#!/bin/sh +# File: /usr/bin/irfanview +# Author: bgstack15@gmail.com +# Startdate: 2016-01-29 +# Title: Wrapper script for passing files to Irfanview +# Purpose: Converts file paths to a wine format and also handles compressed files +# History: 2016-01-29 Initial quick script written. It used a bunch of sed commands to transform paths to a wine format. +# Usage: irfan /path/to/image /another/image/file +# Reference: +# Ideas for zip expansion and winepath https://github.com/Zykr/IrfanViewLinux/blob/master/irfanview +# Improve: + +IV_DEFAULT_FILE=/etc/sysconfig/irfanview +# prepend IV_ to variables from defaults file and apply them +if test -r "${IV_DEFAULT_FILE}" ; +then + IV_tmpfile="$( mktemp )" + sed -r -e 's/^\s*(.*=.*)/IV_\1/;' < "${IV_DEFAULT_FILE}" > "${IV_tmpfile}" + source "${IV_tmpfile}" + rm -f "${IV_tmpfile}" +fi + +# load variables +test -z "${IV_WINEPREFIX}" && export IV_WINEPREFIX="$HOME/.wine" +test -n "${IV_WINEPREFIX}" && export WINEPREFIX="${IV_WINEPREFIX}" || export WINEPREFIX=$HOME/.wine +test -z "${IV_DEVTTY}" && export IV_DEVTTY=/dev/null +test -z "${IV_EXEC_NAME}" && export IV_EXEC_NAME="i_view32.exe" +test -z "${IV_EXEC_PATH}" && export IV_EXEC_PATH="/usr/share/irfanview/i_view32.exe" + +IV_VERSION="2018-09-02a" + +# Define functions +expandword() { + # call: expandword "${word}" + # if file, add it + # if directory, expand it + # if tarball, extract it and operate on the directory like normal + local _word="$( echo "${@}" | sed -e 'sF\/\/F\/Fg;' )" + if test -d "${_word}"; + then + # loop through all files in the directory + for _newword in "${_word}"/*; + do + expandword "${_newword}"; + done + elif test -f "${_word}"; + then + # file exists so check if tarball + case "${_word}" in + *.tgz|*.tar.gz) + # extract it and expand the temporary directory + _tmpdir="$( mktemp -d )"; alltempdirs="${alltempdirs} ${_tmpdir}" + echo "tmpdir ${_tmpdir}" 1>${IV_DEVTTY} + tar -zx -C "${_tmpdir}" -f "${_word}" 1>${IV_DEVTTY} 2>&1 + expandword "${_tmpdir}" + ;; + *.zip) + _tmpdir="$( mktemp -d )"; alltempdirs="${alltempdirs} ${_tmpdir}" + echo "tmpdir ${_tmpdir}" 1>${IV_DEVTTY} + echo "7za e -w${_tmpdir} ${_word}" 1>${IV_DEVTTY} 2>&1 + ( cd "${_tmpdir}"; 7za e "${_word}" 1>${IV_DEVTTY} 2>&1; ) + expandword "${_tmpdir}" + ;; + *) + # assume it is readable and add it to list of files to open + echo "File ${_word}" 1>${IV_DEVTTY} + thisfile="$( getwinepath "${_word}" )" + irfanfiles="${irfanfiles} \"${thisfile}\"" + ;; + esac + fi +} + +getwinepath() { + # call: getwinepath "$foo" + winepath -w "${@}" +} + +# Define variables +alltempdirs="" + +# prepare files +irfanargs= +irfanfiles= + +for word in "${@}"; +do + expandword "${word}" +done +irfanfiles="${irfanfiles## }" + +# run wine +cd $WINEPREFIX +echo "${irfanfiles}" | xargs echo wine "${IV_EXEC_PATH}" ${irfanargs} > ${IV_DEVTTY} +echo "${irfanfiles}" | xargs wine "${IV_EXEC_PATH}" ${irfanargs} & + +#wait $( pgrep -P $$ ${IV_EXEC_NAME} ) +# WORKHERE try wait with: +wait %1 +for thistempdir in ${alltempdirs}; +do + rm -rf "${thistempdir}" 1>${IV_DEVTTY} +done diff --git a/irfanview/irfanview-icons.tgz b/irfanview/irfanview-icons.tgz new file mode 100644 index 0000000..c9ce5af Binary files /dev/null and b/irfanview/irfanview-icons.tgz differ diff --git a/irfanview/irfanview-vlc b/irfanview/irfanview-vlc new file mode 100755 index 0000000..a108c71 --- /dev/null +++ b/irfanview/irfanview-vlc @@ -0,0 +1,16 @@ +#!/bin/sh +# file: /usr/share/irfan/inc/irfan-vlc.sh +# purpose: to correct filenames if passed to an external editor from wine-irfan. +devtty=/dev/null +a="$@" +vlcargs= +{ +for word in "$@"; +do + newword=$( echo "${word##Z:}" | sed 's!\\!\/!g;' ) + vlcargs="${vlcargs} ${newword}" + #echo "vlcargs=${vlcargs}" +done +vlcargs="${vlcargs## }" +/usr/bin/vlc "${vlcargs}" +} > ${devtty} diff --git a/irfanview/irfanview.default b/irfanview/irfanview.default new file mode 100644 index 0000000..e972fb9 --- /dev/null +++ b/irfanview/irfanview.default @@ -0,0 +1,5 @@ +# File: /etc/sysconfig/irfanview +WINEARCH=win32 +WINEPREFIX=$HOME/.wine +EXEC_NAME="i_view32.exe" +EXEC_PATH="/usr/share/irfanview/i_view32.exe" diff --git a/irfanview/irfanview.desktop b/irfanview/irfanview.desktop new file mode 100644 index 0000000..4a4fcfc --- /dev/null +++ b/irfanview/irfanview.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Version=1.0 +Name=Irfanview +GenericName=Graphics Viewer +Comment=View graphics +Exec=/usr/bin/irfanview %F +Icon=irfanview +Terminal=false +Type=Application +MimeType=x-content/image-dcf;image/png;image/gif;image/jpeg;image/jpg;image/bmp;image/tiff;image/ico;image/vnd.adobe.photoshop; +StartupNotify=true +Categories=Graphics;Viewer; +Keywords=irfan;graphics;image;viewer;batch; diff --git a/irfanview/irfanview.spec b/irfanview/irfanview.spec new file mode 100644 index 0000000..8721cba --- /dev/null +++ b/irfanview/irfanview.spec @@ -0,0 +1,258 @@ +%global dummy_package 0 +%global include_plugins 1 +%global devtty /dev/null +# select irfanview binary build: 32 or 64 +%global arch 32 + +Name: irfanview +Version: 4.51 +Release: 2 +Summary: Irfanview graphic viewer +%define version_num %( echo %version | tr -d '\.' ) + +Group: Applications/Graphics +License: Freeware +URL: http://bgstack15.wordpress.com +# must download like: curl 'https://www.irfanview.info/files/iview451_x64.zip' --compressed -H 'Referer: https://www.irfanview.info/files/iview451_x64.zip' iview451_x64.zip +%if 0%{?arch} == 64 +Source0: http://www.irfanview.info/files/iview%{version_num}_x64.zip +Source1: http://www.irfanview.info/files/iview%{version_num}_plugins_x64.zip +%else +Source0: http://www.irfanview.info/files/iview%{version_num}.zip +Source1: http://www.irfanview.info/files/iview%{version_num}_plugins.zip +%endif +Source2: %{name}.desktop +Source3: %{name} +Source4: %{name}.default +Source5: %{name}-vlc +Source6: i_view32.ini +Source7: %{name}-icons.tgz + +Packager: Bgstack15 +Buildarch: noarch +BuildRequires: desktop-file-utils +BuildRequires: ImageMagick +Requires(pre): bgscripts-core >= 1.1-20 +# WORKHERE: this requires will depend on if this is i686 or x86_64 package +%if 0%{?arch} == 64 +Requires: /usr/bin/wine64 +%else +Requires: /usr/bin/wine32 +%endif +Obsoletes: irfan < 4.51-2 +Provides: application(irfanview.desktop) +Provides: mimehandler(image/bmp) +Provides: mimehandler(image/gif) +Provides: mimehandler(image/ico) +Provides: mimehandler(image/jpeg) +Provides: mimehandler(image/jpg) +Provides: mimehandler(image/png) +Provides: mimehandler(image/tiff) +Provides: mimehandler(vnd.adobe.photoshop) +Provides: mimehandler(x-content/image-dcf) + +%description +Irfanview is an amazing graphics application for a different platform. Irfanview is ported to GNU/Linux using wine. + +%prep +# main +export UNZIP=-o || : +%setup -q -c + +# plugins +%if 0%{?include_plugins} +pushd Plugins +%{__unzip} -o %{SOURCE1} +popd +%endif + +# icons +%{__tar} -zxvf %{SOURCE7} +for shape in square clear lubuntu circle ; +do + for s in 16 22 24 32 48 64 96 128 256 ; + do + convert %{name}-${shape}.svg -filter Lanczos -resize ${s}x${s} %{name}-${shape}-${s}.png + done +done + +%build +# the upstream source is the binaries; nothing to do here +: + +%install +# main files +%if 0%{?arch} == 64 +%{__install} -p -D -m0755 -t %{buildroot}%{_datadir}/%{name} i_view64.exe +%else +%{__install} -p -D -m0755 -t %{buildroot}%{_datadir}/%{name} i_view32.exe +%endif +# skipped iv_uninstall.exe + +%if 0%{?include_plugins} +#%{__install} -p -D -m0644 -t %{buildroot}%{_datadir}/%{name}/Plugins Plugins/* +%{__cp} -pr Plugins %{buildroot}%{_datadir}/%{name}/ +%{__chmod} -R u=rwX,g=rX,o=rX %{buildroot}%{_datadir}/%{name}/Plugins +%endif + +%{__install} -p -D -m0644 -t %{buildroot}%{_datadir}/%{name}/Toolbars Toolbars/* +%{__install} -p -D -m0644 -t %{buildroot}%{_datadir}/%{name}/Languages Languages/* + +# desktop files +%{__mkdir_p} %{buildroot}%{_datadir}/applications +desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE2} + +# application start and default scripts +%{__install} -p -D -m0755 %{SOURCE3} %{buildroot}%{_bindir}/%{name} +%{__install} -p -D -m0666 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/%{name} +%{__install} -p -D -m0755 %{SOURCE5} %{buildroot}%{_bindir}/%{name}-vlc + +# select architecture +%if 0%{?arch} == 64 + %{__sed} -i -r -e 's/32/64/g;' -e 's/\.wine$/\.wine64/;' \ + %{buildroot}%{_sysconfdir}/sysconfig/%{name} +%endif + +# application default config +%{__install} -p -D -m0666 %{SOURCE6} %{buildroot}%{_sysconfdir}/i_view32.ini +%{__ln_s} ../../..%{_sysconfdir}/i_view32.ini %{buildroot}%{_datadir}/%{name}/i_view32.ini + +# man pages +%{__install} -p -D -m0644 -t %{buildroot}%{_docdir}/%{name} *.txt *.chm +%{__install} -p -D -m0644 -t %{buildroot}%{_docdir}/%{name}/Html Html/* + +# icons +%{__install} -p -D -m0644 -t %{buildroot}%{_datadir}/%{name}/icons *.svg *.png +%{__install} -p -D -m0644 %{name}-square.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg + +# system services +# none + +%clean +rm -rf %{buildroot} || : + +%post +# Deploy theme icons +which xdg-icon-resource 1>%{devtty} 2>&1 && { + + # Deploy default apps icons + for theme in locolor Numix-Circle Lubuntu ; + do + shape=square + case "${theme}" in Numix-Circle) shape=circle;; Lubuntu) shape=lubuntu;; esac + # Deploy scalable application icons + %{__cp} -p %{_datadir}/%{name}/icons/%{name}-${shape}.svg %{_datadir}/icons/${theme}/scalable/apps/%{name}.svg + done + + # Deploy custom apps icons + # custom: Numix-Circle apps 48 uses svg + cp -p %{_datadir}/%{name}/icons/%{name}-circle.svg %{_datadir}/icons/Numix-Circle/48/apps/%{name}.svg & + # custom: Lubuntu apps 48 uses svg + cp -p %{_datadir}/%{name}/icons/%{name}-lubuntu.svg %{_datadir}/icons/Lubuntu/apps/48/%{name}.svg & + # default + cp -p %{_datadir}/%{name}/icons/%{name}-square-48.png %{_datadir}/icons/hicolor/48x48/apps/%{name}.png + +} 1>%{devtty} 2>&1 + +# Mimetypes and default applications +which xdg-mime 1>/dev/null 2>&1 && +{ + for user in $( /usr/share/bgscripts/enumerate-users.sh || : ) ; + do + + # Skip non-user objects + ! getent passwd "${user}" && continue + + # Add new mimetypes + #su "${user}" -c "xdg-mime install %{_datadir}/%{name}/inc/nonedefined.xml &" + + # Assign default applications + while read line; + do + echo "${user} ${line}" + # Assign mimetype a default application + su "${user}" -c "test -f ~/.config/mimeapps.list && xdg-mime default irfanview.desktop ${line} &" & + + done <<'EOW' +image/bmp +image/gif +image/ico +image/jpeg +image/png +image/tiff +image/vnd.adobe.photoshop +x-content/image-dcf +EOW + done +} 1>%{devtty} 2>&1 + +# Update icon caches +for word in hicolor locolor Numix-Circle Numix Lubuntu elementary-xfce ; +do + touch --no-create %{_datadir}/icons/${word} || : +done +/usr/bin/update-mime-database "%{_datadir}/mime" &> /dev/null || : +update-desktop-database &> /dev/null || : +/sbin/ldconfig || : + +%preun +if test "$1" = "0" ; # total uninstall +then +{ + + # Remove theme icons + which xdg-icon-resource 1>%{devtty} 2>&1 && { + + # Remove default apps icons + for theme in locolor Numix-Circle Lubuntu ; + do + + # Remove scalable apps icons + %{__rm} -f %{_datadir}/icons/${theme}/scalable/apps/%{name}.svg + + # Remove custom apps icons + # custom: Numix-Circle apps 48 uses svg + rm -f %{_datadir}/icons/Numix-Circle/48/apps/%{name}.svg + # custom: Lubuntu apps 48 uses svg + rm -f %{_datadir}/icons/Lubuntu/apps/48/%{name}.svg + # default + rm -f %{_datadir}/icons/hicolor/48x48/apps/%{name}.png + + done + + } +} 1>%{devtty} 2>&1 +fi + +%postun +update-desktop-database &> /dev/null || : +if test "$1" = "0" ; +then + + for word in hicolor locolor Numix-Circle Numix Lubuntu elementary-xfce ; + do + touch --no-create %{_datadir}/icons/${word} &>/dev/null + gtk-update-icon-cache %{_datadir}/icons/${word} &>/dev/null || : + done + + /usr/bin/update-mime-database "%{_datadir}/mime" &>/dev/null || : + +fi +/sbin/ldconfig || : + +%posttrans +/usr/bin/gtk-update-icon-cache "%{_datadir}/icons/hicolor" &>/dev/null || : +/usr/bin/update-mime-database "%{_datadir}/mime" &>/dev/null || : + +%files +%{_datadir}/%{name} +%{_docdir}/%{name} +%{_datadir}/applications/* +%{_datadir}/icons/hicolor/*/*/* +%attr(755, -, -) %{_bindir}/* +%config %{_sysconfdir}/sysconfig/%{name} +%config %attr(666, -, -) %{_sysconfdir}/i_view32.ini + +%changelog +* Tue Nov 29 2016 B Stack +- initial package built -- cgit