Advertisement
Guest User

Dr Phil

a guest
Dec 8th, 2009
1,866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.92 KB | None | 0 0
  1. #!/bin/bash
  2. # THIS WAS USED WHEN TESTING:
  3. #   Wine version: -
  4. #   Distribution: Ubuntu 9.10 Karmic Koala
  5. #   PlayOnLinux: 3.7.2
  6. #   Spotify: 0.3.22
  7. #
  8. # ABOUT THIS SCRIPT:
  9. #   Author: Dr Phil
  10. #   Licence: GPL 2
  11. #   Licence-URL: http://www.gnu.org/licenses/gpl-2.0.txt
  12.  
  13.  
  14. # Lets make sure this is ran from POL.
  15. ["$PLAYONLINUX"=""] && exit 0
  16. source "$PLAYONLINUX/lib/sources"
  17.  
  18.  
  19.  
  20. ####    VARIABLES   ####
  21.  
  22. TITLE="Spotify"
  23. ORGANISATION="Spotify Ltd"
  24. SITE="http://www.spotify.com/"
  25. INSTALLURL="https://www.spotify.com/download/Spotify%20Installer.exe"
  26. INSTALLFILE="Spotify%20Installer.exe"
  27.  
  28. PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"` #Lets get the "Program Files"-folder
  29. PROGRAMFILES=${PROGRAMFILES:3}
  30. PREFIX="$REPERTOIRE/wineprefix/$TITLE/"
  31. RESOURCES="$REPERTOIRE/ressources/"
  32.  
  33.  
  34.  
  35. ####    LANG-VARS   ####
  36.  
  37. if ["$POL_LANG"=="sv"] #If someone wants a Swedish version. ;)
  38. then
  39.     LANG_DL="Laddar ned"
  40.     LANG_INSTALLATION="Installerar..."
  41.     LANG_FINISH="Installationen är nu färdig.\nHar du problem med ljudet i Spotify kan välja att konfigurera\ninstallationen ifrån PlayOnLinuxfönstret."
  42. else #Lets use English as default
  43.     LANG_DL="Downloading"
  44.     LANG_INSTALLATION="Installing..."
  45.     LANG_FINISH="The installation is now done.\nIf there is any problems with the sound you can easily configure\nthe settings from PlayOnLinux."
  46. fi
  47.  
  48.  
  49.  
  50. ####    THE REAL START  ####
  51.  
  52. POL_SetupWindow_Init
  53. # Start the window.
  54.  
  55. POL_SetupWindow_presentation "$TITLE" "$ORGANISATION" "$SITE" "Dr Phil" "$TITLE"
  56. # Give the user a boring first screen. ;)
  57.  
  58. select_prefix "$PREFIX"
  59. POL_SetupWindow_prefixcreate
  60. fonts_to_prefix
  61. # Create the wineprefix.
  62.  
  63. cd "$RESOURCES"
  64. if [ ! -f "$INSTALLFILE" ]
  65. then
  66.     POL_SetupWindow_download "$LANG_DL $TITLE..."  "$TITLE" "$INSTALLURL"
  67.     # Lets download the installer.
  68. fi
  69.  
  70. # http://www.spotify.com/en/help/faq/wine/ tells us to use this settings to get the best sound:
  71. #
  72. # Sound-driver: ALSA
  73. # Hardware Acceleration: Emulation
  74. # Default Sample Rate: 44100
  75. # Default Bits Per Sample: 16
  76. # Driver Emulation: Unchecked
  77.  
  78. Set_SoundDriver "alsa"
  79. Set_SoundHardwareAcceleration "Emulation"
  80. Set_SoundSampleRate "44100" #This is the default wine setting
  81. Set_SoundBitsPerSample "16" #This is the default wine setting
  82. Set_SoundEmulDriver "N" #This is the default wine setting
  83.  
  84. POL_SetupWindow_wait_next_signal "$LANG_INSTALLATION" "$TITLE"
  85. wine "$INSTALLFILE"
  86. POL_SetupWindow_detect_exit
  87. # Start up the installer.
  88.  
  89. POL_SetupWindow_make_shortcut "$TITLE" "$PROGRAMFILES/$TITLE" "spotify.exe" "" "$TITLE"
  90. # Make a shortcut.
  91.  
  92. POL_SetupWindow_message "$LANG_FINISH" "$TITLE"
  93. #
  94.  
  95. # Lets add a configurator, so it is easy to cofigure the application after the installation.
  96. cat << _EOF_ > $REPERTOIRE/configurations/configurators/$TITLE
  97.     #!/bin/bash
  98.     # Licence : GPL 2
  99.     # Licence-URL: http://www.gnu.org/licenses/gpl-2.0.txt
  100.    
  101.     ["$PLAYONLINUX"=""] && exit 0
  102.     source "$PLAYONLINUX/lib/sources"
  103.    
  104.     ####    VARIABLES   ####
  105.     TITLE="Spotify"
  106.     ORGANISATION="Spotify Ltd"
  107.    
  108.    
  109.     ####    FUNCTIONS   ####
  110.    
  111.     Switch_Wine () # Gives the option to use another version of wine.
  112.     {
  113.         POL_SetupWindow_question "\$LANG_WINE" "\$TITLE"
  114.         # Give the option to try Spotify with another Wine-version.
  115.        
  116.         if [ "\$APP_ANSWER" = "TRUE" ]
  117.         then
  118.             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" "~"
  119.             WINE_VER="\$APP_ANSWER"
  120.             POL_SetupWindow_install_wine "\$WINE_VER"
  121.             Set_WineVersion_Assign "\$WINE_VER" "\$TITLE"
  122.             POL_SetupWindow_message "\$LANG_CHANGED_WINE" "\$TITLE"
  123.         fi
  124.     }
  125.        
  126.        
  127.     ####    LANG-VARS   ####
  128.     if ["\$POL_LANG"=="sv"]
  129.     then
  130.         LANG_PROBLEM="Vad är ditt problem?"
  131.         LANG_AUDIODRIVER="Vill du använda ALSA eller OSS?"
  132.         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."
  133.         LANG_AUDIO="Dåligt/inget ljud"
  134.         LANG_VIDEO="Visuella fel"
  135.         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é."
  136.         LANG_WINE="Ditt problem kanske kan lösas genom att öppna programmet med en annan version av Wine.\\nVill du ändra version?"
  137.         LANG_CHOOSE_WINE="Vilken version vill du använda?"
  138.         LANG_CHANGED_WINE="Du har nu bytt Wine-version. Testa att starta Spotify igen."
  139.     else
  140.         LANG_PROBLEM="What is your problem?"
  141.         LANG_AUDIODRIVER="Do you want to use ALSA or OSS?"
  142.         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."
  143.         LANG_AUDIO="Bad/no sound"
  144.         LANG_VIDEO="Visual artifacts"
  145.         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."
  146.         LANG_WINE="Your problem might be solved by opening the program with another version of Wine.\\nDo you want to change version?"
  147.         LANG_CHOOSE_WINE="Which version do you want to use?"
  148.         LANG_CHANGED_WINE="You have now changed Wine-version. Try to start Spotify again."
  149.     fi
  150.    
  151.     select_prefix "$PREFIX"
  152.    
  153.     POL_SetupWindow_Init
  154.     # Lets initiate the window.
  155.    
  156.     POL_SetupWindow_menu_num "\$LANG_PROBLEM" "\$TITLE" "\${LANG_AUDIO}-\${LANG_VIDEO}" "-"
  157.     # What problem does the user have?
  158.    
  159.     if [ "\$APP_ANSWER" = "0" ]
  160.     then
  161.         POL_SetupWindow_message "\$LANG_DRIVERINFO" "\$TITLE"
  162.         POL_SetupWindow_menu "\$LANG_AUDIODRIVER" "\$TITLE" "ALSA~OSS" "~"
  163.         DRIVER="\$APP_ANSWER"
  164.         # Let the user change audiodriver.
  165.  
  166.         if [ "\$DRIVER" = "ALSA" ]
  167.         then
  168.             Set_SoundDriver "alsa"
  169.         else
  170.             Set_SoundDriver "oss"
  171.         fi
  172.        
  173.         Switch_Wine
  174.        
  175.         POL_SetupWindow_message "\$LANG_HWACC" "\$TITLE"
  176.         # Tell the user changing Spotify-settings might help.
  177.        
  178.     else
  179.         Switch_Wine
  180.     fi
  181.    
  182.     POL_SetupWindow_Close
  183. _EOF_
  184.  
  185. POL_SetupWindow_Close
  186. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement