2006-12-03, 13:44
Hi folks,
As I often watch bits of a movie over several days, I was getting tired of sifting to my directory structure to find that last movie- what was its title again?
I've now made two scripts to solve that- one is mapped to the stop button and saves filename and position, the other one (started from the menu) resumes that file. Simple but effective.
Hope this will help out others as lazy as I am!
ezd
savelast.py
playlast.py
As I often watch bits of a movie over several days, I was getting tired of sifting to my directory structure to find that last movie- what was its title again?
I've now made two scripts to solve that- one is mapped to the stop button and saves filename and position, the other one (started from the menu) resumes that file. Simple but effective.
Hope this will help out others as lazy as I am!
ezd
savelast.py
Code:
# SaveLast script 1.0 by ezd
# Saves last played movie name and pos to instantly resume without browsing for the file.
# Add the <stop> tag to the full-screen video part of keymap.xml:
# In <FullscreenVideo>, part <remote>:
# <stop>XBMC.RunScript(Q:\Scripts\savelast.py)</stop>
import xbmc
fn = xbmc.Player().getPlayingFile()
t=xbmc.Player().getTime()
f = open('Q:\\scripts\\last.txt', 'w')
f.write(fn+'|'+str(t))
f.close()
xbmc.Player().stop()
playlast.py
Code:
# PlayLast script 1.0 by ezd
# Resumes last played movie instantly from reading savelast's last.txt.
# Many possible ways to start this script, for example by using the
# Submenu Editor within the scripts folder, or mapping a key. RTFM :)
# To resume gently, the -5 below sets the time 5 secs before the stopping time.
import xbmc
f = open('Q:\\scripts\\last.txt', 'r')
fn,p = f.readline().split('|')
f.close()
pl=xbmc.Player()
pl.play(fn)
pl.seekTime(float(p)-5)