egd;226028 Wrote: 
> When tagging my library I have in most cases added Styles, Moods &
> Themes tags to all tracks in an album.  These tags take the form of a
> comma separated string eg the Styles tag may for the sake of argument
> contain "Album Rock, Rock & Roll, Heartland Rock, Pop/Rock, Bar Band,
> Hard Rock"
> 
> Would it be feasible for me to use your Custom Scan and Database Query
> plugins to in effect build custom playlists whereby I can build a
> search based on the multiple criteria.  Something along the lines of:
> Select all or [x=?] random files where:
> genre contains any of "a, b and/or c";
> styles contains any of "d, e and/or f";
> themes contains any of "g,h and/or i"; and
> moods contains any of "x, y and/or z.
> 

Yes, that would be possible. 
You will need the Custom Scan plugin to get the information into the
SlimServer database.

There are at least two possible ways to do the playlists:
1. By using SQLPlayList plugin: This will give you a dynamic playlist
that will be updated automatically if you change a tag value and
perform a SlimServer rescan.
2. By using Database Query plugin: This will give you a static saved
playlist that won't be updated unless you execute the query in Database
Query plugin again and update the m3u file with the new query result.

To use the Custom Scan plugin to scan the extra tag information into
SlimServer database you will need to:
1. Goto Custom Scan in the web interface
2. Click the Custom Tag scanning module to change it settings as
* Enable in automatic and full scans: Selected
* Tags to scan: STYLE,THEME,MOOD 
3. Click Save and then click the Scan link beside the Custom Tag
scanning module 
4. Click the Mixed Tag scanning module to change it settings as
* Enable in automatic and full scans: Selected
5. Click Save and then click the Scan link beside the Mixed Tag
scanning module 

The extra tag information not normally handled by SlimServer is now
available in the SlimServer database and can be use by different
plugins such as:
- For creating browse menus for Moods, Styles and Themes: Custom Browse
plugin
- For creating dynamic playlists: SQL PlayList plugin
- For creating reports and static saved playlists: Database Query
plugin

Now, to create dynamic playlists with the SQLPlayList plugin you would
do as follows:
1. Goto SQL Playlist in web interface
2. Select the "Create new playlist" link at the bottom
3. Select the playlist type "Simple"
4. Change the playlist name to something you like and mark the
"Customize SQL" radio button and click Next
5. Change the SQL query one of the sample configuration as listed below

6. Click Test to verify that you get what you like and then click Save
to save the playlist.
7. The playlist is now available under the "Dynamic Playlists" menu in
both SlimServer web interface and SqueezeBox interface.

Sample SQL Query that that plays everything in genre "Pop" or "Rock"
that also is within the style "Adult Contemporary":

Code:
--------------------
    
  -- PlaylistName:My custom tag playlist
  -- PlaylistGroups:
  select tracks.url from tracks
        join customscan_track_attributes attr1 on
                tracks.id=attr1.track and attr1.module='mixedtag' and 
attr1.attr='GENRE' and attr1.value in ('Pop','Rock')
        join customscan_track_attributes attr2 on
                tracks.id=attr1.track and attr2.module='mixedtag' and 
attr2.attr='STYLE' and attr2.value in ('Adult Contemporary')
  where
        tracks.audio=1
  order by rand()
  limit 10;
  
--------------------


Sample SQL Query that plays everything in the genre "Pop" that also
belongs to both mood "Romantic" AND mood "Sleep".

Code:
--------------------
    
  -- PlaylistName:My custom tag playlist
  -- PlaylistGroups:
  select tracks.url from tracks
        join customscan_track_attributes attr1 on
                tracks.id=attr1.track and attr1.module='mixedtag' and 
attr1.attr='GENRE' and attr1.value in ('Pop')
        join customscan_track_attributes attr2 on
                tracks.id=attr1.track and attr2.module='mixedtag' and 
attr2.attr='MOOD' and attr2.value in ('Romantic')
        join customscan_track_attributes attr3 on
                tracks.id=attr3.track and attr3.module='mixedtag' and 
attr3.attr='MOOD' and attr3.value in ('Sleep')
  where
        tracks.audio=1
  order by rand()
  limit 10;
--------------------


Sample SQL Query that that plays everything in genre "Pop" that also is
within the mood "Romantic" and the theme "Summer":

Code:
--------------------
    
  -- PlaylistName:My custom tag playlist
  -- PlaylistGroups:
  select tracks.url from tracks
        join customscan_track_attributes attr1 on
                tracks.id=attr1.track and attr1.module='mixedtag' and 
attr1.attr='GENRE' and attr1.value in ('Pop')
        join customscan_track_attributes attr2 on
                tracks.id=attr1.track and attr2.module='mixedtag' and 
attr2.attr='MOOD' and attr2.value in ('Romantic')
        join customscan_track_attributes attr3 on
                tracks.id=attr3.track and attr3.module='mixedtag' and 
attr3.attr='THEME' and attr3.value in ('Summer')
  where
        tracks.audio=1
  order by rand()
  limit 10;
  
--------------------


If you don't want a track to be repeated in a playlist, you would
instead enter a query like this:

Code:
--------------------
    
  -- PlaylistName:My custom tag playlist
  -- PlaylistGroups:
  select tracks.url from tracks
        join customscan_track_attributes attr1 on
                tracks.id=attr1.track and attr1.module='mixedtag' and 
attr1.attr='GENRE' and attr1.value in ('Pop')
        join customscan_track_attributes attr2 on
                tracks.id=attr1.track and attr2.module='mixedtag' and 
attr2.attr='MOOD' and attr2.value in ('Romantic')
        join customscan_track_attributes attr3 on
                tracks.id=attr3.track and attr3.module='mixedtag' and 
attr3.attr='THEME' and attr3.value in ('Summer')
        left join dynamicplaylist_history on
                tracks.id=dynamicplaylist_history.id
  where
        tracks.audio=1 and
        dynamicplaylist_history.id is null
  order by rand()
  limit 10;
  
--------------------


It would be possible for me to create a template with a little bit more
user friendly user interface than this if I know the exact tag names you
are using. The above way to do it probably works if you just have a few
playlists you want to create which you don't need to change the
criteras on very often. If you like to create many playlists or change
them often it would probably be better if I made a template for your
specific setup where it was possible to select the genres, themes,
styles and moods from list boxes instead of writing them in text as
done in the above samples.


Anyway, if you want to get static saved playlists instead of a dynamic
playlist, you can use the Database Query plugin instead of the SQL
PlayList plugin. You will need at least version 1.1.1 of the Database
Query plugin.

1. Goto the Database Query in the web interface
2. Choose to create a new data query and select the type "Free form
query"
3. Enter a data query name and enter the SQL statement of your choice.
You can use the same SQL statements as for the SQL Playlist plugin
listed above, just remove the rows starting with --. The number after
"limit" on the last row in the SQL statement specifies how many songs
you like it to return.
4. Save the query and then click on it to execute it.
5. If it returns what you like, click on the CSV like to save it to a
text file. Open the text file in a text editor and remove the first
line which contains the column headers and then save the file with the
extension .m3u. You should save it inside the playlist directory you
have specified in the SlimServer settings.
6. Perform a SlimServer rescan the get SlimServer to pickup your new
playlist.


-- 
erland

Erland Isaksson
'My homepage' (http://erland.homeip.net) 'My download page'
(http://erland.homeip.net/download)
(Developer of 'TrackStat, SQLPlayList, DynamicPlayList, Custom Browse,
Custom Scan,  Custom Skip, Multi Library and RandomPlayList plugins'
(http://wiki.erland.homeip.net/index.php/Category:SlimServer))
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=38256

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to