Archive

Posts Tagged ‘linux’

Using Spotify Links in Linux

I’ve yet to officially start my tutorials on Linux, but I’ve been playing around with Spotify recently and I’ve been annoyed by the problem of getting Spotify playlists to load from my web browser directly into Spotify. For those who don’t know about Spotify, I suggest you read my previous post, and if you still want invites, I am getting them on a daily basis, so please apply. Spotify playlists can be shared easily in the form of a link, and there have been several websites set up to publish these links. The problem of using these links in Linux consists of two issues:

  1. Getting the browser to recognize a Spotify link (in the form: spotify:user:jacken:playlist:5CUB76CWjf2vFxZymgO3cW).
  2. Getting the browser to execute the link as an argument on a program running through wine, the Linux windows compatibility layer.

The first problem can be solved quite easily in Firefox, but it does involve messing around with the configuration a bit. Open a new tab, type “about:config” (without the quotes) and press enter. If you are running a recent version of Firefox, you should click the button accepting the “this might void your warranty” message. Right click anywhere on the page (which should have filled with a table of options) and create a new boolean. In the preference name box, type “network.protocol-handler.external.spotify” (again without quotes), and then choose the value true for the option. This has now enabled the spotify protocol in Firefox, meaning that whenever the browser is sent a request to open something with the prefix spotify: it will ask the user what to do with the request. Of course, the 2nd problem is getting Firefox to communicate to a program that does not run natively within Linux. To bypass this, we can create a simple script that Firefox can execute. The script will then do all the complicated bits that Firefox can’t do. Open up a terminal, and execute this command:

cd ~/.wine/drive_c/Program\ Files/Spotify/

If you have installed wine with default settings, this is where all the Spotify files are located. Otherwise, you will have to modify the command to cd you into the correct Program Files directory. Once in the directory, you should find two files, spotify.exe and Uninstall.exe (use the ls command to check). Create a file called “spotify.sh” in this directory, and edit it with your favourite text editor. Copy and paste the following into the file:

1
2
#!/bin/bash
wine "$HOME/.wine/drive_c/Program Files/Spotify/spotify.exe" /uri "$1"

Save the file and exit the text editor. What does this code mean? Well, the first line (known as a sha-bang!) tells the system what type of file our script is, and which interpreter to use when executing it. In this case, we want to run the script through the bash shell, so we give it the location of bash on the system (which is 99.9999% always /bin/bash, but you can find out by typing which bash into a terminal and alter accordingly). The next line is the command we want the script to execute, which calls on wine to run spotify.exe file with the argument /uri and the link url given by Firefox when executing ($1). $HOME is simply a shell variable that stores your home directory location (usually in the form: /home/username). Now all you have to do is make the file executable:

chmod +x spotify.sh

Now try it out on a spotify link! If spotify is already open, the playlist should appear on the left, otherwise spotify will open up and display the playlist for you. When you click on the link, Firefox should ask you what you want to do with it, and all you have to do is select the spotify.sh file we just wrote. If it doesn’t ask when you click on a link, you will need to go into Edit -> Preferences -> Applications and find “spotify” in the list, then select the file using the “use other” action.

Categories: linux, personal Tags: , , , ,

Linux Tutorials?

Regular blog readers will know that I use Gentoo Linux as my main operating system, and people who stalk me on facebook will know that I am an Open Source advocate. So I’ve been throwing this idea around in my head for a while, because I know that some of my fellow bloggers use Linux or at least have tried it out. The idea is for me to write a series of blog posts about Linux, how you can get it, set it up, make it suited to your tastes, etc.

In addition to the tutorials, I would offer support to people who are following along and run into problems (it’s bound to happen with any OS change). The main gist of the posts would be to inform, perhaps dispel a few myths, and generally help people out on certain issues. The reason I want to do this now is because obviously I am very passionate about Linux and the free software community, but also because I am approaching the end of term, and I’ll have free time on my hands.

I’m not promising the learning curve won’t still be steep, but my hopes are that people will respond a bit better if they have posts aimed at the average user, without all the techobabble. There are also no promises that everything I say will be entirely accurate, or the “best way” to go about things. The beauty of Linux is that nobody can ever learn everything there is to know about it; it’s a group effort. Naturally when I am corrected on something I will hasten to edit the post. The same goes for when people ask questions about the tutorials; I want to make the posts as accurate and understandable as possible.

Ubuntu logo
Image via Wikipedia

The tutorials will cover the Ubuntu operating system (which is what I started out with) due to its ease and stability in comparison with others. However for the most part, people should be able to follow along using any of the major distros, such as Fedora or OpenSuse. For the first few tutorials I will be covering installation and how to set up your system to work for you. I will then move onto the more complex areas, including how (and when) to effectively use the command line.

So all I really need now is feedback on the idea. How many of my readership would be interested in learning about Linux? I’m not going to stop posting about atheism / religion, but it wouldn’t be a personal blog if I didn’t share my hobbies with everyone :D.

Happy Birthday Google & GNU & Chicken Girl

Google apparently turned 10 today, and GNU (Gnu Is Not Unix) turned 25. Google is of course the future of the web, and GNU is the future of computing. Steven Fry has this to say of GNU:

For those who want to try the world of GNU, I suggest Ubuntu as a first choice.

Update: Chicken Girl is also 25! Go read her blog and wish her a happy birthday :D

Categories: general, personal Tags: , , ,

Why I Love Wine

No, not the kind of wine that makes you tipsy, but the kind that allows Windows programs to run on non-windows operating systems. With the release of Google Chrome, the new browser from Google, I was disappointed that they had failed to make a beta version for other operating systems. However, I tried running the installer in wine, only to get the following result:

fixme:advapi:CheckTokenMembership ((nil) 0×13fba0 0×33f930) stub!
fixme:process:SetProcessShutdownParameters (00000280, 00000001): partial stub.
fixme:ole:CoInitializeSecurity ((nil),-1,(nil),(nil),6,2,(nil),64,(nil)) – stub!
fixme:winhttp:WinHttpOpen ((null), 1, (null), (null), 0×0): stub

A few people managed to get it working through a few tweaks.

First, make sure you are running the latest version of wine (1.1.3 currently).

Download the offline installer of Google Chrome.

Then get the native riched20 and riched30:

wget http://kegel.com/wine/winetricks

sh ./winetricks riched20 riched30

To run Google Chrome simply execute the following command:

wine “$HOME/.wine/drive_c/windows/profiles/$USER/Local Settings/Application Data/Google/Chrome/Application/chrome.exe” –new-http –in-process-plugins

It should also run from your Wine program directory (Applications -> Wine -> Programs -> Google Chrome) if you are running Gnome.

Just to prove it works, here is a screenshot.

It works!

It works!

Oh yeah, and I wrote this post in Google Chrome :D

It is a bit laggy and the anti-aliasing doesn’t work, but that is expected with a compatibility layer such as wine. All the main features are fast and impressive though. It gets a thumbs up from me!

Categories: personal Tags: , , , ,

Get A Move On Google!

A load of tech-based blogs (and some atheist ones) have been going on about the new Google browser “Chrome”. It looks good (nice and basic), and it is built on the best rendering engine: WebKit. I’ve often wished Mozilla just used WebKit, or at least had a function to switch rendering engines. There has been a bit of idle chatter about possibly using WebKit with Firefox, but it never leads anywhere.

There is one problem with Chrome though; it doesn’t work on Linux. That might not come as a surprise to most people, since a load of you probably use Windows (eurgh), or Mac OSX (eurgh eurgh). However, given Google’s commitments to Linux it is rather odd that they wouldn’t develop the version for Linux at the same time as the Windows release. Every Google server currently runs Linux, all their company computers run Linux, and it is no secret that the company itself hates Microsoft.

So why have they committed to a Windows Beta, and then promised a Linux version after the release of version 1.0? They don’t understand that I have to restart my computer, boot into the miserable NTFS partition, wait 5 minutes for XP to load, fiddle about with the wireless network which never manages to start properly, and then wait a further minute for my web browser to load, all just to download and install a copy of the beta.

Seeing as I don’t use Windows for anything other than gaming, I usually wouldn’t have much time to play around with it. Luckily, in two days time, Spore comes out, and my ext3 partition won’t see the light of day for several weeks. Of course my laptop will still provide me with my daily fix of Gentoo for good measure. So Chrome will become my browser for browsing Spore forums, looking at creatures other people have created, and of course, downloading copious amounts of “Spornography”.

The Atheist Blogger