Update of /cvsroot/freevo/freevo/src/audio/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv16156

Added Files:
        sqlmusic_view.py 
Log Message:
Just a quick plugin to look at the contents of the database. 


--- NEW FILE: sqlmusic_view.py ---
# -----------------------------------------------------------------------
# sqlmusic_view.py - Plugin for displaying information stored in sqlite
# -----------------------------------------------------------------------
#
# Notes: Info plugin.
#        You can show music information from the sqlite database.
#        Activate with: plugin.activate('audio.sqlmusic_view')
#        You can also bind it to a key (in this case key 2):
#        EVENTS['menu']['2'] = Event(MENU_CALL_ITEM_ACTION, arg='sqlmusic_view')
#
# Currently, this serves little purpose unless you want to work on the sql
# music stuff, in which case it's a convenient way to make sure stuff is working.
#
# -----------------------------------------------------------------------

import os

import menu
import config
import plugin
import re
import time
import sqlite

from gui.AlertBox import AlertBox


class PluginInterface(plugin.ItemPlugin):        

    def actions(self, item):
        self.item = item
        if item.type == 'audio':
            return [ ( self.info_show, 'Show database information for this file',
                           'info_showdata') ]
        return []


            
    def info_show(self, arg=None, menuw=None):
        """
        show info for this item
        """

        file = self.item.filename
        db = sqlite.connect('%s/freevo.sqlite' % (config.FREEVO_CACHEDIR))
        cursor = db.cursor() 

        sql = 'SELECT md5, last_play,play_count,rating FROM music' + \
               ' WHERE path = \'%s\' and filename = \'%s\'' % (os.path.dirname(file), 
               os.path.basename(file))
        print sql
        cursor.execute(sql)
        md5,last_play,play_count,rating = cursor.fetchone()
       
        box = AlertBox(width=550, height=400, text='MD5: %s\nLast Play: %s\nPlay 
Count: %s\nRating: %s\n' 
            % (str(md5),str(last_play),str(play_count),str(rating)))
        box.show()
        db.close()
        return





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to