SQL and playlists

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

botijo
Posts: 415
Joined: Fri Dec 07, 2007 3:20 am
Location: Ireland

SQL and playlists

Post by botijo »

I suppose somebody else knows. I am working on a UPNP server based on Intel wizard, and well, I suppose it would be a great idea if I got Playlist sorted out. It is better for me to work with SQL because that way I can use the LIMIT statements directly (UPNP messages were meant for SQL statements, I believe). The alternative of iterating everytime through lots of unnecessary items is something I want to avoid.

So, first question. It looks basic, but with the SQL script I could not make this work. Well, I want to split AutoPlaylists and Playlists because both are store differently. So for AutoPlaylists I use

Code: Select all

SELECT COUNT(*) FROM Playlists WHERE isAutoPlaylist=1
Where for non AutoPlaylists I tried

Code: Select all

SELECT COUNT(*) FROM Playlists WHERE isAutoPlaylist!=1
But that did reply to me with a big 0. And I know I have some Playlists around. So any ideas are welcome.

Second question. As stated before it would be best if I could do some SQL statement, but I could not find an SQL statement that gives me an AutoPlaylist song list. I know there is the Code field in the Playlists table, but instead of reworking it from scratch, I want to know if somebody has some sort of script for translation or knows a better way to do it. There are some tricky parts that I really do not want to do, like size limit. It really looks time consuming if I cannot make it work via SQL.

That is all. Thanks for your time.

PS: Do not ask me for the UPNP server yet, it is causing me more trouble than what it is worth. I am learning C# Express and .NET while coding, and I just begun in coding on monday. So it is really crappy at the time being. If anyone experienced wants to review the code and send in suggestions, please send me a PM. A simple threaded HTTP server is also welcome.
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Re: SQL and playlists

Post by MoDementia »

botijo wrote:

Code: Select all

SELECT COUNT(*) FROM Playlists WHERE isAutoPlaylist!=1

Code: Select all

SELECT COUNT(*) FROM Playlists WHERE isAutoPlaylist<>1
botijo wrote: SQL statement that gives me an AutoPlaylist song list.
See here :(

PS I tried to put <> in my javascript yesterday, it didn't work :evil: :x
botijo
Posts: 415
Joined: Fri Dec 07, 2007 3:20 am
Location: Ireland

Re: SQL and playlists

Post by botijo »

Thanks, MoDementia. I tried that, but still, no luck. What happens is that anything that is NULL is returned as false. So, knowing that, the good code is:

Code: Select all

SELECT PlaylistName,IDPlaylist,isAutoPlaylist FROM Playlists WHERE isAutoPlaylist ISNULL
Also, thanks for the link to the wishlist! Now I know I better do it the other way around if I want AutoPlaylists.
Post Reply