The forum

[SCRIPT] Spotify 0.3.x

My first script! =D

Author Replies
Dr Phil Monday 7 December 2009 at 1:21
Dr Phil

Hi!

I am very new to POL, but I already like the idea!
But I must say I am a little mad when you wrote the entire application with python but forces us to write the scripts with bash! :@ ;-)

However, I found that the Spotify-script in the repo didn't work for me.
There seemed to be a problem with PulseAudio and ALSA, which seems to be kind of usual. =(
It was an easy fix though, so I thought I should update the old script with it so I could learn a little about scripting for bash. Now I am done, and this is the result:

[THE CODE WAS HERE BEFORE]

It is not a very big improvement, just uses the settings Spotify recommends and allows the user to easily change between using ALSA and OSS. I would really enjoy comments and constructive critics on it, so I can learn and become a better scripter. With some luck I'll be able to write some better scripts for more difficult programs in the future. =)

So, what can I improve, what is bad and what should I rewrite from scratch?


KNOWN BUGS:
* The Spotifyinstall-process might don't end if you uncheck "Start Spotify when installation has finished" in the main Spotify-installer. I don't know if this is just me or something in my script, I couldn't find anything about it on Spotify's AppDB-page.
* I am not a native English-speaker, and therefor not very fluent in the language. Spellingmistakes exists most likely.

Edited by Dr Phil

Dr Phil Wednesday 9 December 2009 at 3:18
Dr Phil

Hi all!
I have updated my script a bit. :)
It's uploaded to pastebin, http://pastebin.com/f3f5bf873.

I think it is better than the one in the repository right now, so it would be good if some of you could try it so I could upload it after that. :D

Good things:
* It uses the settings recommended by Spotify itself at http://www.spotify.com/en/help/faq/wine/
* It is an easy installation, and remembers if it has downloaded the installer before.
* When the installation is done you can use the "configurator" (pressing "Configure this application"-->"Use PlayOnLinux's configurator for Spotify") if you have problems with sound or graphics. (Allows you to change audiodriver and Wine-version)
* It is using language variables, so a new language can be added easily.

Bad things:
* The Spotify installationprocess might not terminate if you uncheck "Launch Spotify when installation is done". (Winebug?"
* Not very easy to find the configurator, am I able to change its name somehow?

I would love to hear what you think of the script, since I'm very new to POL. :D
NSLW Wednesday 9 December 2009 at 13:45
NSLW

I think it is better than the one in the repository right now, so it would be good if some of you could try it so I could upload it after that. :D

Quote from Dr Phil

I tried you script. It installs fine but I haven't got account to log me in. Everything seems to be OK, for me at least.
There is only one small thing. I've got errors in terminal on conditionals like this

["$PLAYONLINUX"=""] && exit 0
I think you should correct most of the conditionals to look like this
[ "$PLAYONLINUX" = "" ] && exit 0
because then errors disappear.

Oh... and pure formality. Some time ago Tinou announced how headings in scripts should look like. You may wan't to copy that heading from actual Spotify script, modify it and place it in your script.

* The Spotify installationprocess might not terminate if you uncheck "Launch Spotify when installation is done". (Winebug?"

Quote from Dr Phil

It hasn't happened to me.

* When the installation is done you can use the "configurator" (pressing "Configure this application"-->"Use PlayOnLinux's configurator for Spotify")

Quote from Dr Phil

Wow, I didn't know this functionality :^^: It's nice to learn something new from you.

Notify me when you correct your script then I will include it in POL's database.
Dr Phil Wednesday 9 December 2009 at 16:25
Dr Phil

Hi, thanks for your quick response!
The script has been updated with your corrections (http://pastebin.com/f332e33c7), thank you very much!

Also, thanks for teaching me about opening POL from the terminal.
I got some really helpful errors in another script I am working on. :D

You may now update POL's repository. =D
NSLW Thursday 10 December 2009 at 18:29
NSLW

POL repository updated with your Spotify script. Thanks for contribution to PlayOnLinux.
Dr Phil Saturday 1 May 2010 at 23:54
Dr Phil

I think it is still (approxomately) the same script in the repository as this one.
However, a lot of functions will NOT work with the new update (0.4.x).

For example, Spotify has blocked the buggy mp3-player in Wine, so you are required to do some work-arounds to even get a buggy version. However, there seems to be some resolutions, for thos of you who are eager to try out the new version: Link. There also seems to be some problems with connecting your facebook account, but you should be able to do that from Spotify's website, instead of trying to do it from the application.

Hopefully I (or someone else) will get the time to update the script soon.