aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorAndreas Frisch <andreas.frisch@multimedia-labs.de>2008-10-21 15:29:54 +0000
committerAndreas Frisch <andreas.frisch@multimedia-labs.de>2008-10-21 15:29:54 +0000
commitfc1c1768923a6ec3c3439a851b616095d60d81b3 (patch)
tree0f34ae5a1899e486fb7923c2e663ea715237d074 /lib/python
parent1428fa3eee06d2f0226c2080dff723e3fac1d16b (diff)
downloadenigma2-fc1c1768923a6ec3c3439a851b616095d60d81b3.tar.gz
enigma2-fc1c1768923a6ec3c3439a851b616095d60d81b3.zip
allow playing audio cds without mediascanner (choice in mediaplayer menu). offer playing dvd only if disc in drive actually is a
dvd
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/Harddisk.py2
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py4
-rw-r--r--lib/python/Plugins/Extensions/DVDPlayer/plugin.py25
-rw-r--r--lib/python/Plugins/Extensions/MediaPlayer/plugin.py49
4 files changed, 54 insertions, 26 deletions
diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py
index a5727cf7..f7c3a7cb 100644
--- a/lib/python/Components/Harddisk.py
+++ b/lib/python/Components/Harddisk.py
@@ -302,7 +302,7 @@ class HarddiskManager:
continue
partitions.append(partition)
else:
- self.cd = "/dev/"+blockdev
+ self.cd = blockdev
except IOError:
error = True
return error, blacklisted, removable, is_cdrom, partitions
diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
index e762f9ab..3ea48747 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
+++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
@@ -164,7 +164,7 @@ class DVDformatTask(Task):
self.toolbox = job.toolbox
self.postconditions.append(DVDformatTaskPostcondition())
self.setTool("/bin/dvd+rw-format")
- self.args += [ harddiskmanager.getCD() ]
+ self.args += [ "/dev/" + harddiskmanager.getCD() ]
self.end = 1100
def prepare(self):
@@ -208,7 +208,7 @@ class DVDinfoTask(Task):
self.toolbox = job.toolbox
self.postconditions.append(DVDinfoTaskPostcondition())
self.setTool("/bin/dvd+rw-mediainfo")
- self.args += [ harddiskmanager.getCD() ]
+ self.args += [ "/dev/" + harddiskmanager.getCD() ]
def prepare(self):
self.error = None
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
index b201d2c6..4298642c 100644
--- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
+++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
@@ -334,18 +334,25 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
})
self.onClose.append(self.__onClose)
-
+ self.physicalDVD = False
+ self.dvd_device = None
if dvd_device:
self.dvd_device = dvd_device
self.physicalDVD = True
else:
- if fileExists(harddiskmanager.getCD()):
- print "physical dvd found:", harddiskmanager.getCD()
- self.dvd_device = harddiskmanager.getCD()
- self.physicalDVD = True
- else:
- self.dvd_device = None
- self.physicalDVD = False
+ devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())
+ if pathExists(devicepath):
+ from Components.Scanner import scanDevice
+ res = scanDevice(devicepath)
+ list = [ (r.description, r, res[r], self.session) for r in res ]
+ if list:
+ (desc, scanner, files, session) = list[0]
+ for file in files:
+ print file
+ if file.mimetype == "video/x-dvd":
+ self.dvd_device = devicepath
+ print "physical dvd found:", self.dvd_device
+ self.physicalDVD = True
self.dvd_filelist = dvd_filelist
self.onFirstExecBegin.append(self.showFileBrowser)
@@ -542,7 +549,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
def showFileBrowser(self):
if self.physicalDVD and len(self.dvd_filelist) == 0:
- if self.dvd_device == harddiskmanager.getCD():
+ if self.dvd_device == harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()):
self.session.openWithCallback(self.DVDdriveCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 )
else:
self.DVDdriveCB(True)
diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py
index c751bb0d..7b5a4a09 100644
--- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py
+++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py
@@ -18,6 +18,8 @@ from Screens.InfoBarGenerics import InfoBarSeek, InfoBarAudioSelection, InfoBarC
from ServiceReference import ServiceReference
from Screens.ChoiceBox import ChoiceBox
from Screens.HelpMenu import HelpableScreen
+from Components.Harddisk import harddiskmanager
+from Tools.Directories import fileExists, pathExists
import random
class MyPlayList(PlayList):
@@ -283,7 +285,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
path = path[:-1]
pngname = path + "folder.png"
- if not os_path.exists(pngname):
+ if not fileExists(pngname):
pngname = self["coverArt"].default_pixmap
if self.coverArtFileName != pngname:
self.coverArtFileName = pngname
@@ -457,6 +459,19 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
menu.append((_("load playlist"), "loadplaylist"));
menu.append((_("delete saved playlist"), "deleteplaylist"));
menu.append((_("repeat playlist"), "repeat"));
+ self.cdAudioTrackFiles = []
+ drivepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())
+ if pathExists(drivepath):
+ from Components.Scanner import scanDevice
+ res = scanDevice(drivepath)
+ list = [ (r.description, r, res[r], self.session) for r in res ]
+ if list:
+ (desc, scanner, files, session) = list[0]
+ for file in files:
+ if file.mimetype == "audio/x-cda":
+ self.cdAudioTrackFiles.append(file.path)
+ if len(self.cdAudioTrackFiles):
+ menu.insert(0,(_("Play Audio-CD..."), "audiocd"))
self.session.openWithCallback(self.menuCallback, ChoiceBox, title="", list=menu)
def menuCallback(self, choice):
@@ -499,6 +514,22 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
else:
self.repeat = True
self["repeat"].setPixmapNum(1)
+ elif choice[1] == "audiocd":
+ self.playAudioCD()
+
+ def playAudioCD(self):
+ from enigma import eServiceReference
+ from Plugins.Extensions.CDInfo.plugin import Query
+ self.playlist.clear()
+ self.savePlaylistOnExit = False
+ self.isAudioCD = True
+ for file in self.cdAudioTrackFiles:
+ ref = eServiceReference(4097, 0, file)
+ self.playlist.addFile(ref)
+ cdinfo = Query(self)
+ cdinfo.scan()
+ self.changeEntry(0)
+ self.switchToPlayList()
def showEventInformation(self):
from Screens.EventView import EventViewSimple
@@ -823,20 +854,10 @@ def audioCD_open(list, session, **kwargs):
from enigma import eServiceReference
mp = session.open(MediaPlayer)
-
- mp.playlist.clear()
- mp.savePlaylistOnExit = False
- mp.isAudioCD = True
-
+ mp.cdAudioTrackFiles = []
for file in list:
- ref = eServiceReference(4097, 0, file.path)
- mp.playlist.addFile(ref)
- from Plugins.Extensions.CDInfo.plugin import Query
- cdinfo = Query(mp)
- cdinfo.scan()
-
- mp.changeEntry(0)
- mp.switchToPlayList()
+ mp.cdAudioTrackFiles.append(file.path)
+ mp.playAudioCD()
def filescan(**kwargs):
from Components.Scanner import Scanner, ScanPath