Exemple #1
0
    def get_file(self, path):

        parts = File.unpack_path(path)
        prefix = parts[0]

        f = None
        if (prefix == "/"):
            # root folder
            f = File(self)
            f.is_local = True
            f.path = "/"
            f.mimetype = f.DIRECTORY
            f.resource = ""
            f.name = self.get_name()
            f.info = "Browse your music library by album"
            f.icon = self.get_icon().get_path()
            f.folder_flags = f.ITEMS_ENQUEUEABLE | f.ITEMS_COMPACT

        elif (prefix == "/albums"):
            # album
            ffolder, album = parts[1:]
            f = self.__make_album(ffolder, album)

        elif (prefix == "/tracks"):
            # track
            artist, album, title, trackno, resource, mimetype = parts[1:]
            f = self.__make_track(artist, album, title, trackno, resource,
                                  mimetype)

        return f
Exemple #2
0
    def __make_folder(self, folder_name):

        f = File(self)
        f.is_local = True
        f.path = "/" + urlquote.quote(folder_name, "")
        f.mimetype = f.DIRECTORY
        f.resource = ""
        f.name = folder_name
        f.acoustic_name = "Folder: " + f.name
        f.icon = theme.mb_folder_audioclips.get_path()
        #f.info = "%d items" % len(self.__folders.get(folder_name, []))
        f.folder_flags = f.ITEMS_ENQUEUEABLE

        return f
Exemple #3
0
    def __make_folder(self, folder_name):

        f = File(self)
        f.is_local = True
        f.path = "/" + urlquote.quote(folder_name, "")
        f.mimetype = "application/x-image-folder"
        f.resource = ""
        f.name = folder_name
        f.acoustic_name = "Folder: " + f.name
        #f.info = "%d items" % len(self.__folders.get(folder_name, []))
        f.folder_flags = f.ITEMS_ENQUEUEABLE | \
                            f.ITEMS_COMPACT

        return f
Exemple #4
0
    def __make_folder(self, month, year):

        f = File(self)
        f.is_local = True
        f.path = File.pack_path("/months", str(month), str(year))
        f.mimetype = "application/x-image-folder"
        f.resource = ""
        f.name = "%s %d" % (_MONTHS[month - 1], year)
        f.acoustic_name = "Folder: " + f.name
        f.comparable = 0 - ((year * 100) + month)
        #f.info = "%d items" % len(self.__folders.get(folder_name, []))
        f.folder_flags = f.ITEMS_ENQUEUEABLE | \
                            f.ITEMS_COMPACT

        return f
Exemple #5
0
    def __make_album(self, ffolder, album):

        f = File(self)
        f.is_local = True
        f.path = File.pack_path("/albums", ffolder, album)
        f.name = album
        f.acoustic_name = f.name
        #f.info = artist
        f.mimetype = "application/x-music-folder"
        f.folder_flags = f.ITEMS_ENQUEUEABLE
        f.comparable = f.name

        if (album == "All Tracks"):
            f.icon = theme.mb_folder_audio.get_path()

        return f
Exemple #6
0
    def get_file(self, path):

        parts = [p for p in path.split("/") if p]
        len_parts = len(parts)

        f = None
        if (len_parts == 0):
            f = File(self)
            f.is_local = True
            f.path = "/"
            f.mimetype = f.DEVICE_ROOT
            f.resource = ""
            f.name = self.get_name()
            f.info = "Browse your video library"
            f.icon = self.get_icon().get_path()
            f.folder_flags = f.ITEMS_ENQUEUEABLE  #| f.ITEMS_COMPACT

        elif (len_parts == 1):
            folder_name = urlquote.unquote(parts[0])
            f = self.__make_folder(folder_name)

        return f
    def get_file(self, path):

        parts = File.unpack_path(path)
        prefix = parts[0]

        f = None
        if (prefix == "/"):
            # root folder
            f = File(self)
            f.is_local = True
            f.path = "/"
            f.mimetype = f.DEVICE_ROOT
            f.resource = ""
            f.name = self.get_name()
            f.icon = self.get_icon().get_path()
            f.info = "Browse your music library by genre"

        elif (prefix == "/genres"):
            # genre
            genre = parts[1]
            f = self.__make_genre(genre)

        return f
Exemple #8
0
    def __make_track(self, artist, album, title, trackno, resource, mimetype):

        #f = self.call_service(msgs.CORE_SVC_GET_FILE, resource)
        #if (not f): return None

        path = File.pack_path("/tracks", artist, album, title, trackno,
                              resource, mimetype)

        f = File(self)
        f.path = path
        f.is_local = True
        f.resource = resource
        f.name = title
        f.info = artist or "unknown"
        f.mimetype = mimetype
        f.acoustic_name = f.name + ", by " + f.info

        if (album == "All Tracks"):
            f.comparable = f.name.upper()
        else:
            f.comparable = trackno

        return f
    def get_file(self, path):

        parts = File.unpack_path(path)
        prefix = parts[0]

        f = None
        if (prefix == "/"):
            # root folder
            f = File(self)
            f.is_local = True
            f.path = "/"
            f.mimetype = f.DEVICE_ROOT
            f.resource = ""
            f.name = self.get_name()
            f.icon = self.get_icon().get_path()
            f.info = "Browse your music library by artist"
            #f.folder_flags = f.ITEMS_COMPACT
            
        elif (prefix == "/artists"):
            # artist
            artist = parts[1]
            f = self.__make_artist(artist)
    
        return f
Exemple #10
0
    def get_file(self, path):

        parts = File.unpack_path(path)
        prefix = parts[0]

        f = None
        if (prefix == "/"):
            f = File(self)
            f.is_local = True
            f.path = "/"
            f.mimetype = f.DEVICE_ROOT
            f.resource = ""
            f.name = self.get_name()
            f.info = "Browse your camera pictures"
            f.icon = self.get_icon().get_path()
            f.folder_flags = f.ITEMS_ENQUEUEABLE | f.ITEMS_COMPACT

        elif (prefix == "/months"):
            month, year = parts[1:]
            month = int(month)
            year = int(year)
            f = self.__make_folder(month, year)

        return f