Ejemplo n.º 1
0
 def scan(self):
     import sys
     from qobuz.node.flag import Flag
     """Building tree when using Xbmc library scanning
     feature
     """
     from qobuz.gui.directory import Directory
     if not self.set_root_node():
         warn(self, "Cannot set root node ('%s')" % (str(
             self.node_type)))
         return False
     handle = qobuz.boot.handle
     Dir = Directory(self.root, self.nodes, withProgress=False)
     Dir.handle = int(sys.argv[1])
     Dir.asList = False
     Dir.asLocalURL = True
     if self.root.nt & Flag.TRACK:
         self.root.fetch(None, None, Flag.TRACK, Flag.NONE)
         Dir.add_node(self.root)
     else:
         self.root.populating(Dir, self.depth,
                              self.whiteFlag, self.blackFlag)
     Dir.set_content(self.root.content_type)
     Dir.end_of_directory()
     notifyH('Scanning results', str(Dir.total_put) +
             ' items where scanned', mstime=3000)
     return True
Ejemplo n.º 2
0
 def run(self):
     """Building our tree, creating root node based on our node_type
     """
     if not self.set_root_node():
         warn(self,
              ("Cannot set root node (%s, %s)") %
              (str(self.node_type), str(self.root.get_parameter('nid'))))
         return False
     if self.root.hasWidget:
         return self.root.displayWidget()
     if self.has_method_parameter():
         return self.execute_method_parameter()
     from qobuz.gui.directory import Directory
     Dir = Directory(self.root, self.nodes,
                     withProgress=self.enable_progress)
     Dir.asList = self.asList
     Dir.handle = config.app.handle
     if getSetting('contextmenu_replaceitems', asBool=True):
         Dir.replaceItems = True
     try:
         ret = self.root.populating(Dir, self.depth,
                                    self.whiteFlag, self.blackFlag)
     except Qerror as e:
         Dir.end_of_directory(False)
         Dir = None
         warn(self,
              "Error while populating our directory: %s" % (repr(e)))
         return False
     if not self.asList:
         import xbmcplugin  # @UnresolvedImport
         Dir.set_content(self.root.content_type)
         methods = [
             xbmcplugin.SORT_METHOD_UNSORTED,
             xbmcplugin.SORT_METHOD_LABEL,
             xbmcplugin.SORT_METHOD_DATE,
             xbmcplugin.SORT_METHOD_TITLE,
             xbmcplugin.SORT_METHOD_VIDEO_YEAR,
             xbmcplugin.SORT_METHOD_GENRE,
             xbmcplugin.SORT_METHOD_ARTIST,
             xbmcplugin.SORT_METHOD_ALBUM,
             xbmcplugin.SORT_METHOD_PLAYLIST_ORDER,
             xbmcplugin.SORT_METHOD_TRACKNUM, ]
         [xbmcplugin.addSortMethod(handle=config.app.handle,
                                   sortMethod=method) for method in methods]
     return Dir.end_of_directory()