"My Home Automation Projects"

Sources - MediaQuery

Please also read the Disclaimer

MediaNet - Source Modules - MediaQuery

Purpose: To allow selection of music using stored (in xml format) SQL queries

LOADER.xml

<loader>
    <instance>
        <source module="MEDIAQUERY" enabled="y" type="M" title="Queries" />
            set enabled="n" if this source is not required. title= can be changed to your preference
        <scan title="Reload" />
            the title for scanning can be amended here
        <settings database="" />
            you can override the default database here
        <settings menugui="n" menuext="jpg" itemgui="n" itemext="jpg" />
            set menugui="y" to present a graphical menu for each query xml file
            name the image the same as the query xml, and place in same folder
            menuext= is the file type of the images
            set itemgui="y" to present a graphical menu for each item in a query xml file
            name the image the same as the item, and place in a sub-folder of the same name as the query xml
            itemext= is the file type of the images

        <tags files="" helper="" />
            here you can override the medianet.xml music default tags settings
        <menus query="Query" />
        <titles main="Query Selection" query="Queries" />
            the above 2 title lines can be changed to your preference
        <module>
                this watcher enables automatic reload if query xml files are added/deleted/amended
            <load module="WATCHER" enabled="y" path="Support\WATCHER" />
            <buffers file="1" folder="0" />
            <watch exts="xml" />
        </module>
     </instance>
</loader>

The queries are held in xml files. The xml filename is the title of the query list, and you can have multiple lists

Sample entries are:

<queries>
    <query title="all tracks" sql="select * from music" />
        this query (called all tracks) selects all tracks
    <query title="Blondie" artist="Blondie%" order="Artist,Album,TrackNo" />
        this query (called blondie) selects all tracks by an artist with a name starting "blondie" and sorts
</queries>

<queries>
    <query title="Top 30 All" device="n" artist="*" album="*" track="*" genre="*" top="30" days="120" />
        this query (called top 30 all) selects the top 30 tracks of the last 120 days
    <query title="Top 30" device="y" artist="*" album="*" track="*" genre="*" top="30" days="120" />
        this query (called top 30) selects the top 30 tracks of the last 120 days played on the device it is played on
</queries>

A query line consists of:

title= this is a mandatory title for the query within the xml and must be unique within the xml

device=, top= and days= signifies the query is statistics based

artist=, album=, track=, genre= are used for narrowing down selections

sql= cannot be used with any option except title= and specifies a specific sql statement that must return the trackid