Beispiel #1
0
 def playMetadataFile(self,mountpoint,subfile):
     dbPlugin=mpfd.getDBPlugin()
     toplevelDict=dbPlugin.getDB("filesMetadataArtists" if mountpoint.mpType[0]=='artist' else "filesMetadataAlbums")
     if not mpfd.path_separator in subfile:
         return False
     subfilePath=subfile.split(mpfd.path_separator)
     if len(subfilePath)!=len(mountpoint.mpType)+1:
         return False
     if not subfilePath[0] in toplevelDict:
         return []
     fileList=toplevelDict[subfilePath[0]]
     for i in xrange(1,len(mountpoint.mpType)):
         fileList=[x for x in fileList if x[mountpoint.mpType[i]]==subfilePath[i]]
     fpath=next((x['filepath'] for x in fileList if hashlib.md5(x['filepath']).hexdigest()==subfilePath[-1]),None)
     return mpfd.playLocalFile(fpath)
Beispiel #2
0
 def playMetadataFile(self, mountpoint, subfile):
     dbPlugin = mpfd.getDBPlugin()
     toplevelDict = dbPlugin.getDB(
         "filesMetadataArtists" if mountpoint.mpType[0] ==
         'artist' else "filesMetadataAlbums")
     if not mpfd.path_separator in subfile:
         return False
     subfilePath = subfile.split(mpfd.path_separator)
     if len(subfilePath) != len(mountpoint.mpType) + 1:
         return False
     if not subfilePath[0] in toplevelDict:
         return []
     fileList = toplevelDict[subfilePath[0]]
     for i in xrange(1, len(mountpoint.mpType)):
         fileList = [
             x for x in fileList
             if x[mountpoint.mpType[i]] == subfilePath[i]
         ]
     fpath = next(
         (x['filepath'] for x in fileList
          if hashlib.md5(x['filepath']).hexdigest() == subfilePath[-1]),
         None)
     return mpfd.playLocalFile(fpath)
Beispiel #3
0
 def playDirectoryFile(self,subfile):
     fpath=os.path.join(*([self.root]+subfile.split(mpfd.path_separator)))
     return mpfd.playLocalFile(fpath)
Beispiel #4
0
 def playDirectoryFile(self, subfile):
     fpath = os.path.join(*([self.root] +
                            subfile.split(mpfd.path_separator)))
     return mpfd.playLocalFile(fpath)