View Single Post
Helmuth's Avatar
Posts: 1,259 | Thanked: 1,341 times | Joined on Oct 2009 @ Germany
#444
I'm currently trying to fix the "append a new Track" Bug. (with gPodder)

In my opinion, setting the track to the last in the playbacklist if a file is added should fix the problem.

I fiddled out that as soon as the dbus signal is triggered it calls the function append(self, item) from class Queue(list, ObservableService) in file playlist.py.

So I tried to fix it with: self.__current_item_position = len(self)

But it has no effect. Even if I set current_item_position to zero. Hmm... Why has it no effect?

In the functions remove and insert is the current_item_position altered, too. And it seems to work there.

Here is my current function. Could you please have a look and give me a advice where to look to move the current playlist position to the last one in the list?

Code:
    def append(self, item):
        if not self.__prep_item(item):
            return False

        item.duplicate_id = self.__count_dupe_items(self, item)
        item.load_bookmarks()

        self.__mapping_dict[str(item)] = item
        self.__current_item_position = len(self)
        print("Append File:")
        print(len(self))
        list.append(self, item)
        return True