El Foro

[script]AndreaMosaic

Autor Respuestas
andreaplanet Thursday 11 June 2015 at 1:59
andreaplanetAnonymous

Description:

With AndreaMosaic you can create your own photographic mosaics made with your own pictures. A photo mosaic is an image composed of many tiled photos.

Notes:

- Free to Play
- Only PlayOnLinux (no PlayOnMac)
- Graphics Program
- Program is downloaded from official website or can be submited manually

I tested on Ubuntu 15.04 with default installation, PlayOnLinux 4.2.5 and Wine 1.6.2.

Script:

 

#!/usr/bin/env playonlinux-bash
# Date : 2015-06-10
# Last revision : 2015-10-07
# Wine version used : 1.6.2
# Distribution used to test : Ubuntu 15.04 x86_64, Linux kernel 3.19.0-18.18 generic
# Author : Andrea Denzler
# Note: This script should be used only for PlayOnLinux since there is a specific release for Mac available on the Official web site
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TITLE="AndreaMosaic"
PREFIX="AndreaMosaic"
AUTHOR="Andrea Denzler"
APP_URL="http://www.andreaplanet.com/andreamosaic"
EDITOR="Andrea Denzler"

# Initialization
POL_GetSetupImages "http://files.playonlinux.com/resources/setups/$PREFIX/top.jpg" "http://files.playonlinux.com/resources/setups/$PREFIX/left.jpg" "$TITLE"
POL_SetupWindow_Init
POL_Debug_Init
 
# Presentation
POL_SetupWindow_presentation "$TITLE" "$AUTHOR" "$APP_URL" "$EDITOR" "$PREFIX"

# Create Prefix
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate

# Installation - Determine if user wants to download or use a local copy.
POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"
if [ "$INSTALL_METHOD" = "LOCAL" ]
then
    POL_SetupWindow_message "$(eval_gettext 'Please be sure to use the Portable version of AndreaMosaic!')" "$TITLE"
    POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE"
    INSTALLER="$APP_ANSWER"
elif [ "$INSTALL_METHOD" = "DOWNLOAD" ]
then
    POL_System_TmpCreate "$PREFIX" # Create temp folder
    cd "$POL_System_TmpDir"
    # Ask if Beta ora Stable version
    POL_SetupWindow_question "$(eval_gettext 'Do you want to try the Beta version?')" "$TITLE"
    if [ "$APP_ANSWER" = "TRUE" ]
    then
       DOWNLOAD_URL="http://www.andreaplanet.com/andreamosaic/download.php?version=portablebeta"
       DOWNLOAD_FILE="download.php?version=portablebeta"
    else
       DOWNLOAD_URL="http://www.andreaplanet.com/andreamosaic/download.php?version=portable"
       DOWNLOAD_FILE="download.php?version=portable"
    fi
    POL_Debug_Message "Download URL is $DOWNLOAD_URL"
    POL_Debug_Message "Download File is $DOWNLOAD_FILE"
    POL_Download "$DOWNLOAD_URL"
    # Sometimes you get a feature transfer error or wine doesn't start if you do not rename this file to an .exe
    mv "$DOWNLOAD_FILE" AndreaMosaicPortable.exe
    INSTALLER="$POL_System_TmpDir/AndreaMosaicPortable.exe"
fi

# Extract files from Portable version in silent mode. License is not shown.
POL_Debug_Message "Installer file is $INSTALLER"
POL_Wine_WaitBefore "$TITLE"
POL_Wine "$INSTALLER" -s -dC:\\AndreaMosaic\\
POL_Wine_WaitExit "$TITLE"

# Free downloaded file
POL_System_TmpDelete

# I need to show the license here because we installed the downloaded file in silent mode
LICENSE_FILE=$(find "$WINEPREFIX/drive_c/AndreaMosaic/" -name "license*.txt" | head -n 1)
POL_Debug_Message "License file is $LICENSE_FILE"
if [ -e "$LICENSE_FILE" ]; then
   POL_SetupWindow_licence "$(eval_gettext 'License')" "$TITLE" "$LICENSE_FILE"
fi

# Create Shortcut
POL_Shortcut "AndreaMosaicMenu.exe" "$TITLE" "" "" "Graphics"

# Exit
POL_SetupWindow_Close
exit

Screenshots
[img]http://www.andreaplanet.com/andreamosaic/image/AndreaMosaicScreenshotLinux.jpg[/img]
[img]http://www.andreaplanet.com/andreamosaic/image/AndreaMosaicScreenShot.png[/img]
[img]http://www.andreaplanet.com/andreamosaic/image/AndreaMosaicScreenShotToolTip.png[/img]
[img]http://www.andreaplanet.com/andreamosaic/image/AndreaMosaicScreenShotSelectTiles.png[/img]

Left Image
[img]http://www.andreaplanet.com/andreamosaic/image/AndreaMosaicLogo150x356.png[/img]

Top Image
[img]http://www.andreaplanet.com/andreamosaic/image/AndreaMosaicIcon64x64.png[/img]

48x48
[img]http://www.andreaplanet.com/andreamosaic/image/AndreaMosaicIcon48x48.png[/img]

22x22
[img]http://www.andreaplanet.com/andreamosaic/image/AndreaMosaicIcon22x22.png[/img]

 

--------------------------------------------------------------------------

Below the initial error messages I got that where fixed:

Wine didn't started due to Audio driver problem that disappeared after adding

Set_SoundDriver "alsa"
Set_SoundEmulDriver "Y"

Not sure if this is the correct approach. The software doesn't use audio at all and it was tested with older versions of Wine too. Only basic Wine installation is required. No .NET, no Browser.

Errors:

The software runs very well. PDF File (user manual), Hyperlink, Drag & Drop. No errors. Only two minor issues:

1) When installing an error message is shown while trying to show the license (because it isn't a UTF-8 file). It will be fixed soon in the next release of the software. So it's not an issue.

2) When initially starting the program an error message is shown.

Error in main
AndreaMosaic crashed.
Click on debug link to get more details.

I have no idea why, there is no real crash, and with debug +all I didn't found anything useful. If the program is closed and I start the Configure->Wine->Command Prompt and then try to start the program from the command line then no error is shown. I would like to fix that.

 

 

 

Editado por: andreaplanet

petch Friday 12 June 2015 at 19:50
petch
Developer

Hi Andreaplanet,

 

Set_SoundDriver "alsa"
Set_SoundEmulDriver "Y"

Setting to "alsa" shouldn't do anything for PlayOnLinux-packaged Wine versions (it's the default), but you're using your system Wine version, so maybe it has some effect.

Emulation however is supported to be an obsolete setting since late 1.3.* versions (it's now the default), so that's weird if you really need it.


POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"
POL_Debug_Message "Install Method is $INSTALL_METHOD"

The POL_Debug_Message is redundant, since interactive functions already log what has been selected

    POL_SetupWindow_question "$(eval_gettext 'Do you want to try the Beta version?')" "$TITLE"
    POL_Debug_Message "Try Beta version? --> $APP_ANSWER"

Same thing

POL_SetupWindow_wait "$(eval_gettext 'Installation in progress.')" "$TITLE"

You can use POL_Wine_WaitBefore "$TITLE" instead, one less message to translate

I'm not sure what else to say about the script itself, the issues with the programs can be a bit more problematic, specially the initial crash isn't very clean :/

andreaplanet Saturday 13 June 2015 at 0:30
andreaplanetAnonymous

Hello Petch,

I updated the script. Also I don't know why, but on my system there is no need anymore to use the sounddriver emulation. Don't know what changed on my system, so I removed that reference too.

I also found the reason of the crash dialog. It was because the shortcut application exited quite soon returning ERRORLEVEL 1. The shortcut application is just a special launcher for the main application. I updated the launcher so that it returns ERRORLEVEL 0. No more crash dialog. Interesting feature of PlayOnLinux. In the next days I will release the updated version of the software so that both error messages are gone.

The application works well, In the past I fixed in the code a bit to solve the issues I had while running it with Wine. It works even with quite old versions of Wine.

I will update here after the new version is published and tested.

Thanks,
Andrea

Editado por: andreaplanet

deri82 Sunday 12 July 2015 at 13:00
deri82Anonymous

I cant take part of the audio related stuff...err actually I can. wine-staging version has pulseaudio patches included. Also when you publish your scripts, you should use up to date wine versions. Only use old versions if they are really needed. It's less maintaing for others in long run. I do know that 1.6.2 is called stable. But it isn really any more stable than the latest 1.7.47 is. There is no backporting fixes into stable relases.

petch Sunday 12 July 2015 at 14:40
petch
Developer

Until some version tracking feature is implemented, I recommend sticking to stable versions each time they're sufficient, to avoid littering PlayOnLinux installations with latest-Wine-version-of-the-day.

andreaplanet Wednesday 7 October 2015 at 19:23
andreaplanetAnonymous

AndreaMosaic was updated and the script is now ready to be used as is.

Do I have to do something to sign it and add it to the supported software list?

Editado por: andreaplanet

petch Wednesday 7 October 2015 at 20:33
petch
Developer

Hi,

Few things I noticed in this version (was it here already and I missed it?)

POL_Wine "$INSTALLER" -s -dC:\AndreaMosaic\ ;

\s and ;s won't make it if you don't quote them in some way (they'll be interpreted by Bash)

LICENSE_FILE=$(find "$WINEPREFIX/drive_c/AndreaMosaic/" -name "license*.txt" | head -n 1)

With PlayOnLinux 4.2.7+ you'll be able to use POL_System_find_file for that kind of need; But it's still too early, most distros provide 4.2.5, if not 4.2.2...

if [ -a "$LICENSE_FILE" ]; then

What is -a supported to test? I though it was used to "and" conditions

 

AndreaMosaic was updated and the script is now ready to be used as is.

Do I have to do something to sign it and add it to the supported software list?

http://wiki.playonlinux.com/index.php/How_to_Contribute_a_Script#What_to_do_after_you_have_tested_your_script

andreaplanet Wednesday 7 October 2015 at 21:31
andreaplanetAnonymous

Hello Petch,

I fixed the installer command line using double slash (; was unneccessary). Incidentally it worked also without slashes, installing to C:AndreaMosaic which gives the same result as installing to C:\AndreaMosaic\. I tried to escape with double quotes but then the installer freezed. Weird. So now we have in the script above:

POL_Wine "$INSTALLER" -s -dC:\\AndreaMosaic\\

 

Yes, the testing distro ubuntu 15.04 still has only PlayOnLinux 4.2.5 so the POL_System_find_file isn't suitable.

The if [ -a "$LICENSE_FILE" ]; will show the license if one was found (-a will return true if file $LICENSE_FILE exists). If no file was found then nothing is shown. It should never happen but a blank message box isn't nice either.

Thank you,
Andrea

 

 

Editado por: andreaplanet

petch Thursday 8 October 2015 at 3:26
petch
Developer

According to "test" manpage -f or -e should be used to check for file existence, again I'm surprized -a works for this purpose...

andreaplanet Friday 9 October 2015 at 11:51
andreaplanetAnonymous

I'm not using the test program but IF with a conditional expression. According to the man page also -a checks for file existence exactly as -e
See under CONDITIONAL EXPRESSIONS of "man bash" or here:

http://linux.die.net/man/1/bash

I suppose POL is using bash, can you confirm this?
In any case I replaced -a with -e since for me it's the same functionality anyway.

Editado por: andreaplanet

petch Friday 9 October 2015 at 12:05
petch
Developer

Ah right, so it works because it's Bash's builtin test, ok

andreaplanet Friday 9 October 2015 at 12:33
andreaplanetAnonymous

Ya, I just noticed now that you where referring to the test program and edited my previous answer too before reading your reply.

Editado por: andreaplanet

andreaplanet Sunday 11 October 2015 at 23:34
andreaplanetAnonymous

What do I have to do now to publish this script?
 

petch Sunday 11 October 2015 at 23:51
petch
Developer