Why Would we Build a QlikView Music Player?
This is a “just because I can” post. I use QlikView in all sorts of personal applications from reviewing my investment accounts to analyzing my workout performance. I thought it would be clever to create a QlikView Music Player app that sorts through my music collection and even plays tracks.
One obvious limitation of this app is that we can only look at music stored in accessible folders so as most of us move to cloud solutions for music, this becomes less usable. I have mostly switched to Amazon Prime and Pandora, but I still have local digital copies of most of my music. Either way, this is a fun little app and illustrates a few tips we might use to create other use cases.
You can download this app here: Music Player.qvw
To load your own collection into it, simply change the path in line 121 and reload.[qlikview]CallScanFolder(‘\\HOME_MEDIA\Users\Aaron\Music’);[/qlikview]
How Can You Do It?
There are a few simple tricks to create this app that are probably worth mentioning for those of you that want to know…
Firstly, most of us with local digital music would store it in folders by artist and then by album. Because of that, we need to direct QlikView to a root folder and then have it go through all of the subdirectories looking for mp3 files. To do that, you can refer to an earlier post regarding Looping Through Files.
Next, there is a neat trick in the QlikView script that is already built in to pull the metadata from mp3 files. Go to the script editor, hold Ctrl and then press Q, M, P, 3 in sequence (Ctrl+Q,M,P,3). This will create script automatically that pulls metadata from mp3 files. Just for reference, there is a shortcut for jpg files (Ctrl+Q,J,P,G) and a shortcut for wma files (Ctrl+Q,W,M,A).
The final trick is to create the mechanism to get a file to play. We use the info prefix on a resident load to attach the path and file name to the corresponding key field in the QlikView data model. Then we can use a list box on the front end to initiate. When only 1 possible track is associated or selected, the info icon appears in the caption, allowing us to execute (play) the track. This technique could be also used to open pdf’s or images.
I did not bother creating an extensive front end on this. We could have created something very fancy that counts tracks by genre, for example. I took a look at some of the genres and it looks like there are lots of corrections to make in the data so this at least is useful for locating metadata issues.
- As mentioned above, this can currently only be used on music where you have directory visibility. Until some of these cloud services publish API’s we cannot apply to our online collections.
- You must have either Windows Media Player or another music player loaded on your machine and set up as the default program to open MP3 files.
- If you publish this app on a server, the playing of tracks can only be done with the IePlugin. The info icon we use to execute the playing of a track will not function with the AJAX client.
I tried to migrate this script to Sense and did not have luck getting it to run. I didn’t spend too much time on it but it appeared that it was not looping through the directories. I am also not sure what it would take to get Sense to play a track (execute a file). Maybe somebody wants to take this on as a project? –> Have discovered that this is due to inability to process variables in the connection paths. Can be resolved by disabling standard mode.
I hope you enjoy the QlikView Music Player. Do you have ideas on this topic? I would love to hear them.