i've modified my copy of the startupmp3 script ( mp3.py ) to save the current playing state every 10 seconds and use that on bootup to resume to the last song & approximate position.
its a quick and nasty script but it works
it sounds like what you need :
[code]import xbmc
import os
from time import *
try:
lastfh = open( 'q:\\scripts\\currentfile.txt', 'r' )
lines = lastfh.readlines()
trackfile = lines[0].rstrip(" \n")
trackpos = lines[1].rstrip(" \n")
lastfh.close()
xbmc.player().play(trackfile)
xbmc.player().seektime(float(trackpos))
except:
file = 'q:\\scripts\\startupmp3\\startup.mp3'
xbmc.player().play(file)
sleeptime = time()+10
while true:
if time() < sleeptime:
sleep(1)
else:
if xbmc.player().isplaying():
filehandle = open( 'q:\\scripts\\currentfile.txt', 'w' )
filehandle.write( xbmc.player().getplayingfile() + "\n" )
filehandle.write( str(xbmc.player().gettime()) )
filehandle.flush()
filehandle.close()
else:
try:
os.remove('q:\\scripts\\currentfile.txt')
except oserror:
sleep(1)
sleeptime = time()+10
/code]