1 commit 6d396db9931e940fbc3435266ace23327b978575
2 Author: hschang <chang@dev3>
3 Date: Thu Aug 10 15:22:42 2017 +0900
7 diff --git a/RecordTimer.py b/RecordTimer.py
8 index 32fb923..5a13d7f 100755
11 @@ -410,6 +410,15 @@ class RecordTimerEntry(timer.TimerEntry, object):
13 record_service = property(lambda self: self.__record_service, setRecordService)
15 + def checkRecordingPath(self):
16 + old_Filename = self.Filename
17 + self.calculateFilename()
18 + filename = self.Filename
19 + self.Filename = old_Filename
21 + from Components import Harddisk
22 + return not Harddisk.isUsbStorage(filename)
25 begin = int(xml.get("begin"))
26 end = int(xml.get("end"))
27 @@ -466,6 +475,16 @@ class RecordTimer(timer.Timer):
28 print "unable to load timers from file!"
30 def doActivate(self, w):
31 + if w.state == RecordTimerEntry.StateWaiting and w.checkRecordingPath() is False:
32 + service_name = w.service_ref.getServiceName()
33 + self.timer_list.remove(w)
34 + if w.dontSave is False:
37 + self.addTimerEntry(w)
38 + Notifications.AddNotification(MessageBox, _("Can not recording on a USB storage.\nService name : %s"% service_name), MessageBox.TYPE_ERROR)
41 # when activating a timer which has already passed,
42 # simply abort the timer. don't run trough all the stages.
44 diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py
45 index 1221f8f..c455e5f 100755
46 --- a/lib/python/Components/Harddisk.py
47 +++ b/lib/python/Components/Harddisk.py
48 @@ -6,6 +6,8 @@ from Tools.CList import CList
49 from SystemInfo import SystemInfo
51 from Components.Console import Console
56 rdev = stat(path).st_rdev
57 @@ -56,6 +58,30 @@ def enableUdevEvent(enable = True):
61 +def getDeviceFile(dev_path):
62 + for parts in getProcMounts():
63 + if os.path.realpath(parts[1]).startswith(dev_path):
66 +def isUsbStorage(filename):
67 + _dirname = os.path.dirname(filename)
68 + _dirname = os.path.realpath(_dirname)
69 + while not os.path.ismount(_dirname):
70 + _dirname = os.path.dirname(_dirname)
75 + dev = getDeviceFile(_dirname)
77 + dev = os.path.basename(dev)
78 + phyPath = os.path.realpath('/sys/block/' + dev[:3])
79 + for x in glob.glob("/sys/bus/usb/devices/usb*"):
80 + if phyPath.find(os.path.realpath(x)) != -1:
88 diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py
89 index ea75301..9b04238 100755
90 --- a/lib/python/Screens/InfoBarGenerics.py
91 +++ b/lib/python/Screens/InfoBarGenerics.py
92 @@ -1223,6 +1223,11 @@ class InfoBarTimeshift:
93 if self.timeshift_enabled:
94 print "hu, timeshift already enabled?"
96 + from Components import Harddisk
97 + if Harddisk.isUsbStorage(config.usage.timeshift_path.value):
98 + self.session.open(MessageBox, _("Timeshift not possible on a USB storage."), MessageBox.TYPE_ERROR)
101 if not ts.startTimeshift():
102 self.timeshift_enabled = 1
104 diff --git a/timer.py b/timer.py
107 index aaae0b2..d58a83e
110 @@ -232,6 +232,10 @@ class Timer:
111 self.setNextActivation(min)
113 def timeChanged(self, timer):
114 + if timer not in (self.processed_timers + self.timer_list):
115 + print "timer not found"
120 if timer.state == TimerEntry.StateEnded: