From: <ou...@us...> - 2003-06-30 22:38:45
|
Update of /cvsroot/freevo/freevo/WIP/Aubin In directory sc8-pr-cvs1:/tmp/cvs-serv26879/WIP/Aubin Modified Files: player.py Log Message: If the file has never been played, show "never" instead of some day in 1967 in the sqlmusic plugin, use escape in the player too. Index: player.py =================================================================== RCS file: /cvsroot/freevo/freevo/WIP/Aubin/player.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** player.py 30 Jun 2003 04:57:30 -0000 1.1 --- player.py 30 Jun 2003 22:38:40 -0000 1.2 *************** *** 10,33 **** # ----------------------------------------------------------------------- # $Log$ ! # Revision 1.1 2003/06/30 04:57:30 outlyer ! # My slightly hacked copy of the player.py from src/audio that increments ! # the playcount and puts in a last play date whenever a song is played. ! # ! # You can then view the data with the plugin I committed earlier. ! # ! # ! # FYI: This is all very rough and preliminary; when I've got things working ! # and tested, I will then begin to restructure some of this into a common ! # 'sql' library and work on abstracting some of this into some sort of plugin. ! # ! # I still want to make sure I can make dynamic playlists first. ! # ! # If you want to use any of this, you need to: ! # ! # 1) Install sqlite and pysqlite ! # 2) run ./helpers/musicsqlimport.py and wait for awhile. ! # 3) Enable this player and the plugin if you want. ! # ! # Then play music as normal and it should start tracking things. # # Revision 1.4 2003/04/24 19:56:01 dischi --- 10,16 ---- # ----------------------------------------------------------------------- # $Log$ ! # Revision 1.2 2003/06/30 22:38:40 outlyer ! # If the file has never been played, show "never" instead of some day in 1967 ! # in the sqlmusic plugin, use escape in the player too. # # Revision 1.4 2003/04/24 19:56:01 dischi *************** *** 71,75 **** import rc import plugin ! import sqlite,time,config,os skin = skin.get_singleton() --- 54,58 ---- import rc import plugin ! import sqlite,time,config,os,util skin = skin.get_singleton() *************** *** 103,108 **** db = sqlite.connect('%s/freevo.sqlite' % (config.FREEVO_CACHEDIR)) cursor = db.cursor() ! cursor.execute('UPDATE music SET play_count=play_count + 1 WHERE path = \'%s\' and filename = \'%s\'' % (os.path.dirname(self.item.filename), os.path.basename(self.item.filename))) ! cursor.execute('UPDATE music SET last_play=%f WHERE path = \'%s\' and filename = \'%s\'' % (time.time(),os.path.dirname(self.item.filename), os.path.basename(self.item.filename))) db.commit() db.close() --- 86,91 ---- db = sqlite.connect('%s/freevo.sqlite' % (config.FREEVO_CACHEDIR)) cursor = db.cursor() ! cursor.execute('UPDATE music SET play_count=play_count + 1 WHERE path = \'%s\' and filename = \'%s\'' % (util.escape(os.path.dirname(self.item.filename)), util.escape(os.path.basename(self.item.filename)))) ! cursor.execute('UPDATE music SET last_play=%f WHERE path = \'%s\' and filename = \'%s\'' % (time.time(),util.escape(os.path.dirname(self.item.filename)), util.escape(os.path.basename(self.item.filename)))) db.commit() db.close() |