Tracks without track number get 0

Bug #530325 reported by Iakov Davydov on 2010-03-01
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fix Released
Thibault Saunier

Bug Description

In 0.3.1b tracks having no id3 track number automatically get number 0.

How to reproduce:
Load in collection mp3 file without id3 track number tag.

What happens:
0 is shown as track number.

What should happen:
Nothing should be shown as a track number.

reacocard (reacocard) wrote :

also applies to disc number.

Changed in exaile:
importance: Undecided → Low
milestone: none → 0.3.1
status: New → Confirmed
Changed in exaile:
assignee: nobody → Thibault Saunier (saunierthibault)

Corrects the bug, needs a review.

Iakov Davydov (iakov-davydov) wrote :

This fixes the bug for me.

Johannes Sasongko (sjohannes) wrote :

I haven't really looked at the patch thoroughly, but

- if track == -1:
+ if not track:
             cell.set_property('text', '')

Should this be "if track is None"?

Changed in exaile:
status: Confirmed → In Progress

@Johannes Sasongko, What is the difference between "if not track" and "if track is None"?

I haven't coded so much in Python and I actually don't reallyy no the good practices.

Thanks for the quick review ;)

reacocard (reacocard) wrote :

"if not track" could catch any case where track evaluates to False, so None, 0, False, any empty container, etc. would all match this case. "if track is not None" explicitly checks it against None, so 0, False, etc. won't match. While not a big deal for this situation, it's a good habit to use as it makes your code more robust. Additionally, it also hints to people reading your code that you _expect_ track to be None sometimes, which is useful information.

Thanks for your clear and neat explanations ;)

reacocard (reacocard) wrote :

patch committed trunk/2891, thanks!

Changed in exaile:
status: In Progress → Fix Committed
reacocard (reacocard) on 2010-03-16
Changed in exaile:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers