do not attempt deletion of temporary file

fails on Windows
This commit is contained in:
desolat 2012-11-04 10:39:27 +01:00
parent ad4637f4cf
commit 1e29b5af9d

View file

@ -1,5 +1,9 @@
import subprocess, settings, brlog, tempfile, os, threading, xbmcgui, urllib, re, xbmc, xbmcplugin import subprocess, settings, tempfile, os, urllib, re
from functools import partial
import xbmcgui, xbmc, xbmcplugin
import brlog
class MakeMkvInteraction: class MakeMkvInteraction:
def __init__(self): def __init__(self):
@ -9,8 +13,13 @@ class MakeMkvInteraction:
def discList(self): def discList(self):
# First stop any old one # First stop any old one
self.killMkv() self.killMkv()
tmpf = tempfile.NamedTemporaryFile(delete=True) tmpf = tempfile.NamedTemporaryFile(delete=False)
sp = os.system(r'%s -r --cache=1 --messages=%s info disc:10' %(self.settings.mkvLocation, tmpf.name)) self.log.info('temporary file with disc info: %s' % tmpf.name)
sp = os.system(r'%s -r --cache=1 --messages=%s info disc:10'
% (self.settings.mkvLocation, tmpf.name))
self.log.info('Return code for disc info generation: %s' % str(sp))
if not os.path.isfile(tmpf.name):
self.log.error('Is no file: %s' % tmpf.name)
tmpf = open(tmpf.name) tmpf = open(tmpf.name)
content = tmpf.read() content = tmpf.read()