Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # THIS WAS USED WHEN TESTING:
- # Wine version: -
- # Distribution: Ubuntu 9.10 Karmic Koala
- # PlayOnLinux: 3.7.2
- # Spotify: 0.3.22
- #
- # ABOUT THIS SCRIPT:
- # Author: Dr Phil
- # Licence: GPL 2
- # Licence-URL: http://www.gnu.org/licenses/gpl-2.0.txt
- # Lets make sure this is ran from POL.
- ["$PLAYONLINUX"=""] && exit 0
- source "$PLAYONLINUX/lib/sources"
- #### VARIABLES ####
- TITLE="Spotify"
- ORGANISATION="Spotify Ltd"
- SITE="http://www.spotify.com/"
- INSTALLURL="https://www.spotify.com/download/Spotify%20Installer.exe"
- INSTALLFILE="Spotify%20Installer.exe"
- PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"` #Lets get the "Program Files"-folder
- PROGRAMFILES=${PROGRAMFILES:3}
- PREFIX="$REPERTOIRE/wineprefix/$TITLE/"
- RESOURCES="$REPERTOIRE/ressources/"
- #### LANG-VARS ####
- if ["$POL_LANG"=="sv"] #If someone wants a Swedish version. ;)
- then
- LANG_DL="Laddar ned"
- LANG_INSTALLATION="Installerar..."
- LANG_FINISH="Installationen är nu färdig.\nHar du problem med ljudet i Spotify kan välja att konfigurera\ninstallationen ifrån PlayOnLinuxfönstret."
- else #Lets use English as default
- LANG_DL="Downloading"
- LANG_INSTALLATION="Installing..."
- LANG_FINISH="The installation is now done.\nIf there is any problems with the sound you can easily configure\nthe settings from PlayOnLinux."
- fi
- #### THE REAL START ####
- POL_SetupWindow_Init
- # Start the window.
- POL_SetupWindow_presentation "$TITLE" "$ORGANISATION" "$SITE" "Dr Phil" "$TITLE"
- # Give the user a boring first screen. ;)
- select_prefix "$PREFIX"
- POL_SetupWindow_prefixcreate
- fonts_to_prefix
- # Create the wineprefix.
- cd "$RESOURCES"
- if [ ! -f "$INSTALLFILE" ]
- then
- POL_SetupWindow_download "$LANG_DL $TITLE..." "$TITLE" "$INSTALLURL"
- # Lets download the installer.
- fi
- # http://www.spotify.com/en/help/faq/wine/ tells us to use this settings to get the best sound:
- #
- # Sound-driver: ALSA
- # Hardware Acceleration: Emulation
- # Default Sample Rate: 44100
- # Default Bits Per Sample: 16
- # Driver Emulation: Unchecked
- Set_SoundDriver "alsa"
- Set_SoundHardwareAcceleration "Emulation"
- Set_SoundSampleRate "44100" #This is the default wine setting
- Set_SoundBitsPerSample "16" #This is the default wine setting
- Set_SoundEmulDriver "N" #This is the default wine setting
- POL_SetupWindow_wait_next_signal "$LANG_INSTALLATION" "$TITLE"
- wine "$INSTALLFILE"
- POL_SetupWindow_detect_exit
- # Start up the installer.
- POL_SetupWindow_make_shortcut "$TITLE" "$PROGRAMFILES/$TITLE" "spotify.exe" "" "$TITLE"
- # Make a shortcut.
- POL_SetupWindow_message "$LANG_FINISH" "$TITLE"
- #
- # Lets add a configurator, so it is easy to cofigure the application after the installation.
- cat << _EOF_ > $REPERTOIRE/configurations/configurators/$TITLE
- #!/bin/bash
- # Licence : GPL 2
- # Licence-URL: http://www.gnu.org/licenses/gpl-2.0.txt
- ["$PLAYONLINUX"=""] && exit 0
- source "$PLAYONLINUX/lib/sources"
- #### VARIABLES ####
- TITLE="Spotify"
- ORGANISATION="Spotify Ltd"
- #### FUNCTIONS ####
- Switch_Wine () # Gives the option to use another version of wine.
- {
- POL_SetupWindow_question "\$LANG_WINE" "\$TITLE"
- # Give the option to try Spotify with another Wine-version.
- if [ "\$APP_ANSWER" = "TRUE" ]
- then
- POL_SetupWindow_menu "\$LANG_CHOOSE_WINE" "\$TITLE" "1.1.34~1.1.33~1.1.32~1.1.31~1.1.27~1.1.19~1.0.1" "~"
- WINE_VER="\$APP_ANSWER"
- POL_SetupWindow_install_wine "\$WINE_VER"
- Set_WineVersion_Assign "\$WINE_VER" "\$TITLE"
- POL_SetupWindow_message "\$LANG_CHANGED_WINE" "\$TITLE"
- fi
- }
- #### LANG-VARS ####
- if ["\$POL_LANG"=="sv"]
- then
- LANG_PROBLEM="Vad är ditt problem?"
- LANG_AUDIODRIVER="Vill du använda ALSA eller OSS?"
- LANG_DRIVERINFO="\${ORGANISATION} rekommenderar att man använder ALSA.\n\nVissa användare kan tyvärr inte använda ALSA, så har du problem\nkan det vara värt att testa OSS."
- LANG_AUDIO="Dåligt/inget ljud"
- LANG_VIDEO="Visuella fel"
- LANG_HWACC="Om problemet kvarstår så kan du vilja öppna Spotify och trycka\\nctrl+p, vilket öppnar dina inställningar. Att kryssa ur \\"Enable harwware accelaration\\"\\n kan förbättra din ljudkvalité."
- LANG_WINE="Ditt problem kanske kan lösas genom att öppna programmet med en annan version av Wine.\\nVill du ändra version?"
- LANG_CHOOSE_WINE="Vilken version vill du använda?"
- LANG_CHANGED_WINE="Du har nu bytt Wine-version. Testa att starta Spotify igen."
- else
- LANG_PROBLEM="What is your problem?"
- LANG_AUDIODRIVER="Do you want to use ALSA or OSS?"
- LANG_DRIVERINFO="\${ORGANISATION} recommends you to use ALSA.\n\nUnfortunately, some users can't use ALSA, so if you have soundproblems\nit may be good to give OSS a try."
- LANG_AUDIO="Bad/no sound"
- LANG_VIDEO="Visual artifacts"
- LANG_HWACC="If the problem still persists you might want to open Spotify\\nand press ctrl+p which opens your preferences. Unticking the box \\"Enable hardware\\nacceleration\\" might improve your soundquality."
- LANG_WINE="Your problem might be solved by opening the program with another version of Wine.\\nDo you want to change version?"
- LANG_CHOOSE_WINE="Which version do you want to use?"
- LANG_CHANGED_WINE="You have now changed Wine-version. Try to start Spotify again."
- fi
- select_prefix "$PREFIX"
- POL_SetupWindow_Init
- # Lets initiate the window.
- POL_SetupWindow_menu_num "\$LANG_PROBLEM" "\$TITLE" "\${LANG_AUDIO}-\${LANG_VIDEO}" "-"
- # What problem does the user have?
- if [ "\$APP_ANSWER" = "0" ]
- then
- POL_SetupWindow_message "\$LANG_DRIVERINFO" "\$TITLE"
- POL_SetupWindow_menu "\$LANG_AUDIODRIVER" "\$TITLE" "ALSA~OSS" "~"
- DRIVER="\$APP_ANSWER"
- # Let the user change audiodriver.
- if [ "\$DRIVER" = "ALSA" ]
- then
- Set_SoundDriver "alsa"
- else
- Set_SoundDriver "oss"
- fi
- Switch_Wine
- POL_SetupWindow_message "\$LANG_HWACC" "\$TITLE"
- # Tell the user changing Spotify-settings might help.
- else
- Switch_Wine
- fi
- POL_SetupWindow_Close
- _EOF_
- POL_SetupWindow_Close
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement