From 9b29d3e3704bc683160e3a5fc9775675a0789763 Mon Sep 17 00:00:00 2001 From: achbed Date: Sun, 3 May 2015 12:07:03 -0500 Subject: [PATCH] Fix to detect a playlist that changed in content, but not length Signed-off-by: achbed --- deefuzzer/station.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/deefuzzer/station.py b/deefuzzer/station.py index c771b4b..50b0322 100644 --- a/deefuzzer/station.py +++ b/deefuzzer/station.py @@ -46,6 +46,7 @@ import shout import urllib import mimetypes import json +import hashlib from threading import Thread from player import * @@ -438,6 +439,9 @@ class Station(Thread): pass return file_list + + def get_array_hash(self, s): + return hashlib.md5(str(s)).hexdigest() def get_jingles(self): file_list = [] @@ -483,7 +487,10 @@ class Station(Thread): self._info('Generating new playlist (' + str(self.lp) + ' tracks)') - elif lp_new != self.lp: + # use a hash check instead to detect when a filename changes as well as playlist length + # Also, recompute the hash every time for the built-in playlist so we can catch when that + # changes as well + elif self.get_array_hash(new_playlist) != self.get_array_hash(self.playlist): self.id += 1 if self.id >= lp_new: self.id = 0 -- 2.47.3