Ticket #3550: mythmusic-debug.patch

File mythmusic-debug.patch, 4.0 KB (added by Daniel Burr, 13 years ago)

Fix Duplicate Entry in All My Music

  • mythmusic/mythmusic/playbackbox.cpp

     
    17461746    // whether a node is selectable, how it can be ordered (normal, random,
    17471747    // intelligent, album), etc.
    17481748
    1749     all_playlists->writeTree(playlist_tree);
     1749    GenericTree *active_playlist_node = all_playlists->writeTree(playlist_tree);
    17501750    music_tree_list->assignTreeData(playlist_tree);
     1751    music_tree_list->setCurrentNode(active_playlist_node);
    17511752    tree_is_done = true;
    17521753}
    17531754
  • mythmusic/mythmusic/playlist.h

     
    172172    void            setActiveWidget(PlaylistTitle *widget);
    173173    PlaylistTitle*  getActiveWidget(void) { return active_widget; }
    174174
    175     void            writeTree(GenericTree *tree_to_write_to);
     175    GenericTree*    writeTree(GenericTree *tree_to_write_to);
    176176    void            clearCDList();
    177177    void            addCDTrack(int x);
    178178    void            removeCDTrack(int x);
  • mythmusic/mythmusic/metadata.cpp

     
    951951{
    952952    //
    953953    //  Given "paths" and loaded metadata,
    954     //  build a tree (nodes, leafs, and all)
     954    //  build a tree (nodes, leaves, and all)
    955955    //  that reflects the desired structure
    956956    //  of the metadata. This is a structure
    957957    //  that makes it easy (and QUICK) to
  • mythmusic/mythmusic/playlist.cpp

     
    582582
    583583    if (filter)
    584584    {
     585        all_available_music->clearTree();
    585586        all_available_music->buildTree();
    586587        all_available_music->sortTree();
    587588    }
     
    946947            {
    947948                // Normal track
    948949                Metadata *tmpdata = all_available_music->getMetadata(it->getValue());
    949                 if (tmpdata)
     950                if (tmpdata && tmpdata->isVisible())
    950951                {
    951952                    if (songs.at() == 0) { // first song
    952953                        playcountMin = playcountMax = tmpdata->PlayCount();
     
    984985            {
    985986                // Normal track
    986987                Metadata *tmpdata = all_available_music->getMetadata(it->getValue());
    987                 if (tmpdata)
     988                if (tmpdata && tmpdata->isVisible())
    988989                {
    989990                    QString a_string = QString("%1 ~ %2").arg(tmpdata->FormatArtist()).arg(tmpdata->FormatTitle());
    990991                    GenericTree *added_node = tree_to_write_to->addNode(a_string, it->getValue(), true);
     
    10711072    return a_counter;
    10721073}
    10731074
    1074 void PlaylistsContainer::writeTree(GenericTree *tree_to_write_to)
     1075GenericTree* PlaylistsContainer::writeTree(GenericTree *tree_to_write_to)
    10751076{
    10761077    all_available_music->writeTree(tree_to_write_to);
    10771078
     
    11271128        a_list->writeTree(new_node, 0);
    11281129        ++iterator;
    11291130    }
    1130    
     1131
     1132    GenericTree* active_playlist_node = subsub_node->findLeaf();
     1133    if(!active_playlist_node) active_playlist_node = subsub_node;
     1134    return active_playlist_node;
    11311135}
    11321136
    11331137void PlaylistsContainer::save()
  • mythmusic/mythmusic/metadata.h

     
    347347    void        buildTree();
    348348    void        printTree();    // debugging
    349349    void        sortTree();
     350    inline void clearTree() { m_root_node-> clear(); }
    350351    void        writeTree(GenericTree *tree_to_write_to);
    351352    void        setSorting(QString a_paths);
    352353    bool        putYourselfOnTheListView(TreeCheckItem *where);