the new hdd movie directory is /hdd/movie (for 7020 compatibility reasons)
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Fri, 30 Dec 2005 05:12:34 +0000 (05:12 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Fri, 30 Dec 2005 05:12:34 +0000 (05:12 +0000)
if /hdd/movies is found and /hdd/movie doesn't exist, /hdd/movies is moved to /hdd/movie

lib/python/Components/Harddisk.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/MovieSelection.py
lib/python/Tools/Directories.py
mytest.py
po/de.po

index ca77e56..37e957e 100644 (file)
@@ -1,5 +1,7 @@
 import os
 
+from Tools.Directories import *
+
 def tryOpen(filename):
        try:
                procFile = open(filename)
@@ -124,7 +126,7 @@ class Harddisk:
                return (res >> 8)
 
        def createMovieFolder(self):
-               res = os.system("mkdir /hdd/movies")
+               res = os.system("mkdir " + resolveFilename(SCOPE_HDD))
                return (res >> 8)
                
        errorList = [ _("Everything is fine"), _("Creating partition failed"), _("Mkfs failed"), _("Mount failed"), _("Create movie folder failed"), _("Unmount failed")]
index fa773d8..a659b5b 100644 (file)
@@ -25,6 +25,7 @@ from Screens.MinuteInput import MinuteInput
 from Components.Harddisk import harddiskmanager
 
 from Tools import Notifications
+from Tools.Directories import *
 
 #from enigma import eTimer, eDVBVolumecontrol, quitMainloop
 from enigma import *
@@ -719,9 +720,9 @@ class InfoBarInstantRecord:
 
        def instantRecord(self):
                try:
-                       stat = os.stat("/hdd/movies")
+                       stat = os.stat(resolveFilename(SCOPE_HDD))
                except:
-                       self.session.open(MessageBox, "No HDD found!", MessageBox.TYPE_ERROR)
+                       self.session.open(MessageBox, _("No HDD found or HDD not initialized!"), MessageBox.TYPE_ERROR)
                        return
        
                if self.isInstantRecordRunning():
index 2ba2d05..6bb1872 100644 (file)
@@ -8,6 +8,8 @@ from Components.DiskInfo import DiskInfo
 from Screens.MessageBox import MessageBox
 from Screens.FixedMenu import FixedMenu
 
+from Tools.Directories import *
+
 from enigma import eServiceReference, eServiceCenter
 
 class ChannelContextMenu(FixedMenu):
@@ -65,13 +67,13 @@ class MovieSelection(Screen):
                self.movemode = False
                self.bouquet_mark_edit = False
                
-               self["list"] = MovieList(eServiceReference("2:0:1:0:0:0:0:0:0:0:/hdd/movies/"))
+               self["list"] = MovieList(eServiceReference("2:0:1:0:0:0:0:0:0:0:" + resolveFilename(SCOPE_HDD)))
                if (selectedmovie is not None):
                        self.onShown.append(self.moveTo)
                        self.selectedmovie = selectedmovie
                
                #self["okbutton"] = Button("ok", [self.channelSelected])
-               self["freeDiskSpace"] = DiskInfo("/hdd/movies", DiskInfo.FREE)
+               self["freeDiskSpace"] = DiskInfo(resolveFilename(SCOPE_HDD), DiskInfo.FREE)
                
                self["actions"] = ActionMap(["OkCancelActions", "ContextMenuActions"],
                        {
index a192298..64c44cb 100644 (file)
@@ -8,6 +8,7 @@ SCOPE_SKIN_IMAGE = 4
 SCOPE_USERETC = 5
 SCOPE_CONFIG = 6
 SCOPE_LANGUAGE = 7
+SCOPE_HDD = 8
 
 PATH_CREATE = 0
 PATH_DONTCREATE = 1
@@ -22,23 +23,28 @@ defaultPaths = {
 
                SCOPE_SKIN: ("/usr/share/enigma2/", PATH_DONTCREATE),
                SCOPE_SKIN_IMAGE: ("/usr/share/enigma2/", PATH_DONTCREATE),
+               SCOPE_HDD: ("/hdd/movie/", PATH_DONTCREATE),
                
                SCOPE_USERETC: ("", PATH_DONTCREATE) # user home directory
        }
 
-def resolveFilename(scope, base):
+def resolveFilename(scope, base = ""):
        # in future, we would check for file existence here,
        # so we can provide default/fallbacks.
        
        path = defaultPaths[scope]
        if path[1] == PATH_CREATE:
-               if (not os.path.exists(path[0])):
+               if (not pathExists(scope)):
                        os.mkdir(path[0])
        
        # FIXME: we also have to handle DATADIR etc. here.
        return path[0] + base
 
        # this is only the BASE - an extension must be added later.
+       
+def pathExists(scope):
+       return os.path.exists(defaultPaths[scope][0])
+
 def getRecordingFilename(basename):
        
                # filter out non-allowed characters
@@ -52,7 +58,7 @@ def getRecordingFilename(basename):
        
        i = 0
        while True:
-               path = "/hdd/movies/" + filename
+               path = resolveFilename(SCOPE_HDD, filename)
                if i > 0:
                        path += "_%03d" % i
                try:
@@ -60,3 +66,9 @@ def getRecordingFilename(basename):
                        i += 1
                except IOError:
                        return path
+               
+# this fixes paths or files when changed in a new enigma2 version
+def fixOldDirectoryEntries():
+       if (os.path.exists("/hdd/movies")):
+               if (not os.path.exists(resolveFilename(SCOPE_HDD))):
+                       os.system("mv /hdd/movies " + resolveFilename(SCOPE_HDD))
index c94993b..f67c199 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -20,6 +20,8 @@ from Screens.Wizard import wizardManager
 from Screens.StartWizard import *
 from Screens.TutorialWizard import *
 from Tools.BoundFunction import boundFunction
+from Tools.Directories import fixOldDirectoryEntries
+fixOldDirectoryEntries()
 
 had = dict()
 
index a163dfa..e421c62 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: tuxbox-enigma 0.0.1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-12-28 21:02+0100\n"
+"POT-Creation-Date: 2005-12-30 06:00+0100\n"
 "PO-Revision-Date: 2005-12-14 03:29+0100\n"
 "Last-Translator: Stefan Pluecken <stefan.pluecken@multimedia-labs.de>\n"
 "Language-Team: none\n"
@@ -98,7 +98,7 @@ msgstr "Kanal"
 msgid "Channel Selection"
 msgstr "Kanalliste"
 
-#: ../lib/python/Screens/InfoBarGenerics.py:180
+#: ../lib/python/Screens/InfoBarGenerics.py:181
 msgid "Channel:"
 msgstr "Kanal:"
 
@@ -126,7 +126,7 @@ msgstr "Standard"
 msgid "Delete"
 msgstr "Löschen"
 
-#: ../lib/python/Screens/MovieSelection.py:50
+#: ../lib/python/Screens/MovieSelection.py:52
 msgid "Delete failed!"
 msgstr "Löschen fehlgeschlagen."
 
@@ -166,11 +166,11 @@ msgstr "DiSEqC-Modus"
 msgid "Disable"
 msgstr "Aus"
 
-#: ../lib/python/Screens/MovieSelection.py:33
+#: ../lib/python/Screens/MovieSelection.py:35
 msgid "Do you really want to delete this recording?"
 msgstr "Wollen Sie diese Aufnahme wirklich löschen?"
 
-#: ../lib/python/Screens/InfoBarGenerics.py:728
+#: ../lib/python/Screens/InfoBarGenerics.py:729
 msgid ""
 "Do you want to stop the current\n"
 "(instant) recording?"
@@ -319,7 +319,7 @@ msgstr "Montag bis Freitag"
 msgid "Monday"
 msgstr "Montag"
 
-#: ../lib/python/Screens/MovieSelection.py:20
+#: ../lib/python/Screens/MovieSelection.py:22
 msgid "Movie Menu"
 msgstr "Filmauswahl"
 
@@ -339,6 +339,11 @@ msgstr ""
 msgid "Netmask"
 msgstr "Netzmaske"
 
+#: ../lib/python/Screens/InfoBarGenerics.py:725
+msgid "No HDD found or HDD not initialized!"
+msgstr "Keine Festplatte gefunden oder\nFestplatte nicht initialisiert."
+
+
 #: ../lib/python/Screens/ScanSetup.py:173
 #: ../lib/python/Screens/ScanSetup.py:179
 #: ../lib/python/Screens/ScanSetup.py:186
@@ -411,7 +416,7 @@ msgstr "Provider"
 msgid "Providers"
 msgstr "Anbieter"
 
-#: ../lib/python/Screens/InfoBarGenerics.py:777
+#: ../lib/python/Screens/InfoBarGenerics.py:778
 msgid "Record"
 msgstr "Aufnahme"
 
@@ -465,7 +470,7 @@ msgstr "Süd"
 msgid "Start"
 msgstr ""
 
-#: ../lib/python/Screens/InfoBarGenerics.py:730
+#: ../lib/python/Screens/InfoBarGenerics.py:731
 msgid "Start recording?"
 msgstr "Aufnahme beginnen?"
 
@@ -481,7 +486,7 @@ msgstr "Schritt "
 msgid "Stop playing this movie?"
 msgstr "Das Abspielen dieses Films beenden?"
 
-#: ../lib/python/Screens/InfoBarGenerics.py:782 ../data/
+#: ../lib/python/Screens/InfoBarGenerics.py:783 ../data/
 msgid "Subservices"
 msgstr "Unterkanäle"
 
@@ -571,7 +576,7 @@ msgstr "Wochentag"
 msgid "West"
 msgstr ""
 
-#: ../lib/python/Screens/MovieSelection.py:35
+#: ../lib/python/Screens/MovieSelection.py:37
 msgid "You cannot delete this!"
 msgstr "Sie können dies nicht löschen."
 
@@ -603,7 +608,7 @@ msgstr "Zu Bouquet hinzufügen"
 msgid "add service to favourites"
 msgstr "Kanal zu Favoriten hinzufügen"
 
-#: ../lib/python/Screens/MovieSelection.py:18
+#: ../lib/python/Screens/MovieSelection.py:20
 #: ../lib/python/Screens/ChannelSelection.py:65
 msgid "back"
 msgstr "zurück"
@@ -620,7 +625,7 @@ msgstr ""
 msgid "daily"
 msgstr "täglich"
 
-#: ../lib/python/Screens/MovieSelection.py:18
+#: ../lib/python/Screens/MovieSelection.py:20
 msgid "delete..."
 msgstr "löschen..."
 
@@ -672,7 +677,7 @@ msgstr "Abspielmodus verlassen..."
 msgid "manual"
 msgstr "manuell"
 
-#: ../lib/python/Screens/InfoBarGenerics.py:317
+#: ../lib/python/Screens/InfoBarGenerics.py:318
 msgid "next channel"
 msgstr "nächster Kanal"
 
@@ -711,7 +716,7 @@ msgstr "an"
 msgid "once"
 msgstr "einmalig"
 
-#: ../lib/python/Screens/InfoBarGenerics.py:318
+#: ../lib/python/Screens/InfoBarGenerics.py:319
 msgid "previous channel"
 msgstr "vorheriger Kanal"
 
@@ -761,7 +766,7 @@ msgstr ""
 msgid "scan state"
 msgstr "Status"
 
-#: ../lib/python/Screens/InfoBarGenerics.py:360
+#: ../lib/python/Screens/InfoBarGenerics.py:361
 msgid "show EPG..."
 msgstr "zeige EPG..."