Skip to content

Commit

Permalink
Changed ad detection logic slightly (fix for 1.7.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Demian committed Jan 10, 2015
1 parent 05d3ee2 commit 6a907bd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions blockify/blockify.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ def find_ad(self):
if not self.automute:
return False

if self.autodetect and self.current_song_is_ad():
if self.autodetect and self.current_song and self.current_song_is_ad():
if self.use_interlude_music and not self.player.temp_disable:
self.player.temp_disable = True
gtk.timeout_add(self.player.playback_delay, self.player.play_with_delay)
self.toggle_mute(1)
self.ad_found()
return True

# Check if the blockfile has changed.
Expand All @@ -167,7 +167,7 @@ def find_ad(self):

for i in self.blocklist:
if self.current_song.startswith(i):
self.toggle_mute(1)
self.ad_found()
return True

# Unmute with a certain delay to avoid the last second
Expand All @@ -176,6 +176,10 @@ def find_ad(self):

return False

def ad_found(self):
# log.debug("Ad found: {0}".format(self.current_song))
self.toggle_mute(1)

def current_song_is_ad(self):
"Compares the wnck song info to dbus song info."
try:
Expand Down

0 comments on commit 6a907bd

Please sign in to comment.