File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ namespace lbz
3131 " tracknumber" ,
3232 };
3333
34+ static const size_t min_playback_duration = 240U ;
35+
3436 class lbz_play_callback_static : public play_callback_static
3537 {
3638 public:
@@ -43,16 +45,20 @@ namespace lbz
4345 {
4446 m_counter = 0 ;
4547 const double length = handle->get_length ();
46- if (length >= 5.0 && prefs::check_enabled.get_value ())
48+ m_listened_at = 0 ;
49+ m_target = SIZE_MAX; // ignore this track unless it matches below
50+ if (prefs::check_enabled.get_value ())
4751 {
48- const size_t half = static_cast <size_t >(std::round (length / 2 ));
49- m_target = std::min<size_t >(half, 240U );
5052 m_listened_at = pfc::fileTimeWtoU (pfc::fileTimeNow ());
51- }
52- else
53- {
54- m_target = SIZE_MAX;
55- m_listened_at = 0 ;
53+ if (length >= 5.0 )
54+ {
55+ const size_t half = static_cast <size_t >(std::round (length / 2 ));
56+ m_target = std::min<size_t >(half, min_playback_duration);
57+ }
58+ else if (length == 0.0 )
59+ {
60+ m_target = min_playback_duration;
61+ }
5662 }
5763 }
5864
You can’t perform that action at this time.
0 commit comments