Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listall() output is broken #64

Open
potors opened this issue Nov 11, 2023 · 0 comments
Open

listall() output is broken #64

potors opened this issue Nov 11, 2023 · 0 comments

Comments

@potors
Copy link

potors commented Nov 11, 2023

As the title says.

Let's say that you runned client.listall() and you have this folder structure:

Artist1
 └─ Album1
     └─ Single1
Artist2
 └─ Album2
     └─ Single2
Artist3
 └─ Album3
     ├─ Song1
     └─ Song2

When mpd's socket list they, it looks like this:

directory: Artist1;
directory: Artist1 / Album1;
file: Artist1 / Album1 / Single1;
directory: Artist2;
directory: Artist2 / Album2;
file: Artist2 / Album2 / Single2;
directory: Artist3;
directory: Artist3 / Album3;
file: Artist3 / Album3 / Song1;
file: Artist3 / Album3 / Song2;

As you call Client::listall, it does some parsing from that output.
But when you inspect the values, rust gives you this:

[
    Song {
        file: "Artist1/Album1/Single1",
        name: None,
        title: None,
        last_mod: None,
        artist: None,
        duration: None,
        place: None,
        range: None,
        tags: [
            ("directory", "Artist2"),
            ("directory", "Artist2/Album2")
        ],
    },
    Song {
        file: "Artist2/Album2/Single2",
        ...
        tags: [
            ("directory", "Artist3"),
            ("directory", "Artist3/Album3")
        ],
    },
    Song {
        file: "Artist3/Album3/Song1",
        ...
        tags: []
    },
    Song {
        file: "Artist3/Album3/Song2",
        ...
        tags: []
    }
]
  • Every field, except file, is missing
  • The tags are shifted up

I suppose that when parsing the output, it reads every row, then when it reaches a file label, read all to the next, and join everything together. Something like:

  • Discard: directory: Artist1
  • Discard: directory: Artist1/Album1
  • Take: file: Artist1/Album1/Single1
    • Tag: directory: Artist2
    • Tag: directory: Artist2/Album2
  • Take: file: Artist2/Album2/Single2
    • Tag: directory: Artist3
    • Tag: directory: Artist3/Album3
  • Take: file: Artist3/Album3/Song1
  • Take: file: Artist3/Album3/Song2

As shown above

  • Fields are missing, this part of the code is just... missing
  • Tags are shifted, and even if not, they are wrong (in sense that every other song from that album should have it)

Looks like this project is dead, I'm leaving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant