[GH-ISSUE #7] Date can be a list #5

Closed
opened 2026-05-22 22:02:29 +01:00 by JakeStanger · 6 comments
Owner

Originally created by @EgZvor on GitHub (Oct 5, 2018).
Original GitHub issue: https://github.com/JakeStanger/Rofi_MPD/issues/7

Traceback (most recent call last):
  File "main.py", line 123, in <module>
    'epoch': get_album_release_epoch(song_data=song),
  File "main.py", line 77, in get_album_release_epoch
    if date.isnumeric():
AttributeError: 'list' object has no attribute 'isnumeric'
Originally created by @EgZvor on GitHub (Oct 5, 2018). Original GitHub issue: https://github.com/JakeStanger/Rofi_MPD/issues/7 ``` Traceback (most recent call last): File "main.py", line 123, in <module> 'epoch': get_album_release_epoch(song_data=song), File "main.py", line 77, in get_album_release_epoch if date.isnumeric(): AttributeError: 'list' object has no attribute 'isnumeric' ```
JakeStanger 2026-05-22 22:02:29 +01:00
Author
Owner

@JakeStanger commented on GitHub (Oct 5, 2018):

Are you able to get me the track date causing this crash? Just a print(date) on the line above would be sufficient. I'd like to know why a date would be a list.

<!-- gh-comment-id:427414549 --> @JakeStanger commented on GitHub (Oct 5, 2018): Are you able to get me the track date causing this crash? Just a `print(date)` on the line above would be sufficient. I'd like to know why a date would be a list.
Author
Owner

@EgZvor commented on GitHub (Oct 5, 2018):

It looks like this in ncmpcpp
image

<!-- gh-comment-id:427425573 --> @EgZvor commented on GitHub (Oct 5, 2018): It looks like this in ncmpcpp ![image](https://user-images.githubusercontent.com/11237935/46547795-bd0af000-c8d5-11e8-92d7-3bdd99ba72c4.png)
Author
Owner

@EgZvor commented on GitHub (Oct 5, 2018):

import json

from mpd import MPDClient


client = MPDClient()
client.connect('localhost', '6600')

library = client.listallinfo()

print(json.dumps([
    song for song in library
    if isinstance(song.get('date'), list)][0], indent=2
))
(.env) ➜ ~/repos/Rofi_MPD (master) ✗ python showdoubledate.py
{
  "file": "Gorillaz - The Now Now/01 - Humility (feat. George Benson).mp3",
  "last-modified": "2018-07-25T18:41:25Z",
  "time": "198",
  "duration": "197.982",
  "artist": "Gorillaz",
  "albumartist": "Gorillaz",
  "title": "Humility (feat. George Benson)",
  "album": "The Now Now",
  "track": "1",
  "date": [
    "2018",
    "2018"
  ],
  "genre": "Alternative",
  "composer": "Gorillaz",
  "disc": "1"
}
<!-- gh-comment-id:427427915 --> @EgZvor commented on GitHub (Oct 5, 2018): ``` import json from mpd import MPDClient client = MPDClient() client.connect('localhost', '6600') library = client.listallinfo() print(json.dumps([ song for song in library if isinstance(song.get('date'), list)][0], indent=2 )) ``` ``` (.env) ➜ ~/repos/Rofi_MPD (master) ✗ python showdoubledate.py { "file": "Gorillaz - The Now Now/01 - Humility (feat. George Benson).mp3", "last-modified": "2018-07-25T18:41:25Z", "time": "198", "duration": "197.982", "artist": "Gorillaz", "albumartist": "Gorillaz", "title": "Humility (feat. George Benson)", "album": "The Now Now", "track": "1", "date": [ "2018", "2018" ], "genre": "Alternative", "composer": "Gorillaz", "disc": "1" } ```
Author
Owner

@EgZvor commented on GitHub (Oct 5, 2018):

I guess this is relevant
https://github.com/Mic92/python-mpd2/blob/master/examples/multitags.py

<!-- gh-comment-id:427432393 --> @EgZvor commented on GitHub (Oct 5, 2018): I guess this is relevant https://github.com/Mic92/python-mpd2/blob/master/examples/multitags.py
Author
Owner

@JakeStanger commented on GitHub (Oct 5, 2018):

This is all very helpful, thank you very much. Also your rice is very pretty.

ae9df0b should serve as a fix for now. Let me know if this works or if you want any different behavior.

<!-- gh-comment-id:427512369 --> @JakeStanger commented on GitHub (Oct 5, 2018): This is all very helpful, thank you very much. Also your rice is very pretty. ae9df0b should serve as a fix for now. Let me know if this works or if you want any different behavior.
Author
Owner

@EgZvor commented on GitHub (Oct 6, 2018):

That's fine (it's what I did too anyway). Knowing what this double date means would probably help to decide what to do with it in the future.

<!-- gh-comment-id:427591587 --> @EgZvor commented on GitHub (Oct 6, 2018): That's fine (it's what I did too anyway). Knowing what this double date means would probably help to decide what to do with it in the future.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/Rofi_MPD#5
No description provided.