[GH-ISSUE #3] Bug: albums without month-day in their epoch #2

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

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

Traceback (most recent call last):
  File "/usr/bin/rofi-mpd", line 120, in <module>
    'epoch': get_album_release_epoch(song_data=song),
  File "/usr/bin/rofi-mpd", line 86, in get_album_release_epoch
    year, month, day = date.split(split_char)
ValueError: not enough values to unpack (expected 3, got 2)

Apparently I have albums with only year and month in their date... :-)

Originally created by @rubdos on GitHub (Oct 5, 2018). Original GitHub issue: https://github.com/JakeStanger/Rofi_MPD/issues/3 ``` Traceback (most recent call last): File "/usr/bin/rofi-mpd", line 120, in <module> 'epoch': get_album_release_epoch(song_data=song), File "/usr/bin/rofi-mpd", line 86, in get_album_release_epoch year, month, day = date.split(split_char) ValueError: not enough values to unpack (expected 3, got 2) ``` Apparently I have albums with only year and month in their date... :-)
Author
Owner

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

Can you check if #5 fixes this? If not I'll look into it later.

<!-- gh-comment-id:427327604 --> @JakeStanger commented on GitHub (Oct 5, 2018): Can you check if #5 fixes this? If not I'll look into it later.
Author
Owner

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

Not sure, I get another one now (more relevant in #4 than here):

Traceback (most recent call last):
  File "/usr/bin/rofi-mpd", line 122, in <module>
    'epoch': get_album_release_epoch(song_data=song),
  File "/usr/bin/rofi-mpd", line 78, in get_album_release_epoch
    epoch = datetime.datetime(year, 1, 1)
ValueError: year 0 is out of range
<!-- gh-comment-id:427343064 --> @rubdos commented on GitHub (Oct 5, 2018): Not sure, I get another one now (more relevant in #4 than here): ``` Traceback (most recent call last): File "/usr/bin/rofi-mpd", line 122, in <module> 'epoch': get_album_release_epoch(song_data=song), File "/usr/bin/rofi-mpd", line 78, in get_album_release_epoch epoch = datetime.datetime(year, 1, 1) ValueError: year 0 is out of range ```
Author
Owner

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

Ok I'm hoping ff40f69905 and ff4561e fix this. I've implemented some basic date error correction that should stop the crashing at least.

<!-- gh-comment-id:427514924 --> @JakeStanger commented on GitHub (Oct 5, 2018): Ok I'm hoping ff40f6990503f6090d57638f9d6b21d4b682b1dc and ff4561e fix this. I've implemented some basic date error correction that should stop the crashing at least.
Author
Owner

@rubdos commented on GitHub (Oct 8, 2018):

I still have the invalid stuff with year 0. I'll try to fix it myself and submit a MR.

Traceback (most recent call last):
  File "./main.py", line 157, in <module>
    'epoch': get_album_release_epoch(song_data=song),
  File "./main.py", line 98, in get_album_release_epoch
    epoch = datetime.datetime(year, 1, 1)
ValueError: year 0 is out of range
<!-- gh-comment-id:427744824 --> @rubdos commented on GitHub (Oct 8, 2018): I still have the invalid stuff with year 0. I'll try to fix it myself and submit a MR. ``` Traceback (most recent call last): File "./main.py", line 157, in <module> 'epoch': get_album_release_epoch(song_data=song), File "./main.py", line 98, in get_album_release_epoch epoch = datetime.datetime(year, 1, 1) ValueError: year 0 is out of range ```
Author
Owner
<!-- gh-comment-id:427903480 --> @JakeStanger commented on GitHub (Oct 8, 2018): https://github.com/JakeStanger/Rofi_MPD/pull/11#issuecomment-427903150
Author
Owner

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

Ok I've looked into it further and done some testing; I was just missing a check for dates with years only.

Unix timestamps work (in python at least) backwards a long way so I'll keep it for now unless anything else pops up. The program works (for me at least) with any track dated from the year 1 to whatever the datetime limit is (9999 I think?).

<!-- gh-comment-id:427914683 --> @JakeStanger commented on GitHub (Oct 8, 2018): Ok I've looked into it further and done some testing; I was just missing a check for dates with years only. Unix timestamps work (in python at least) backwards a long way so I'll keep it for now unless anything else pops up. The program works (for me at least) with any track dated from the year 1 to whatever the datetime limit is (9999 I think?).
Author
Owner

@rubdos commented on GitHub (Oct 9, 2018):

Unix timestamps work (in python at least) backwards a long way so I'll keep it for now unless anything else pops up.

Is that on Windows? Because these timestamps are literally OS dependent, and on Unix, I cannot imagine them going back before 1905 (negative 1<<32 - 1 seconds before 1970).

<!-- gh-comment-id:428084819 --> @rubdos commented on GitHub (Oct 9, 2018): > Unix timestamps work (in python at least) backwards a long way so I'll keep it for now unless anything else pops up. Is that on Windows? Because these timestamps are literally OS dependent, and on Unix, I cannot imagine them going back before 1905 (negative 1<<32 - 1 seconds before 1970).
Author
Owner

@rubdos commented on GitHub (Oct 9, 2018):

Hmm, since your last commit, the thing actually starts. So clamping 1 -- 9999 seems to work here.

<!-- gh-comment-id:428085133 --> @rubdos commented on GitHub (Oct 9, 2018): Hmm, since your last commit, the thing actually starts. So clamping 1 -- 9999 seems to work here.
Author
Owner

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

I've only tested this on Linux. This is in Python don't forget, so the "Unix timestamp" is actually an arbitrarily long integer representing the number of seconds offset from 1970. Theoretically it should be able to go infinitely far forwards or back.

I don't know how OS dependent it is, but this works on Arch Linux for me at least.

<!-- gh-comment-id:428085639 --> @JakeStanger commented on GitHub (Oct 9, 2018): I've only tested this on Linux. This is in Python don't forget, so the "Unix timestamp" is actually an arbitrarily long integer representing the number of seconds offset from 1970. Theoretically it should be able to go infinitely far forwards or back. I don't know how OS dependent it is, but this works on Arch Linux for me at least.
Author
Owner

@rubdos commented on GitHub (Oct 9, 2018):

Yeh well, it seems fixed :-)

<!-- gh-comment-id:428086586 --> @rubdos commented on GitHub (Oct 9, 2018): Yeh well, it seems fixed :-)
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#2
No description provided.