From 0ce32b94d0b55763f0b474b586fdfe5716a758e8 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 13 Apr 2009 19:40:41 +0000 Subject: [PATCH] add XML templates, RSS file enclosure and RSS dir as options --- deefuzz.py | 34 +++-- example/deefuzz_test_mp3_station.xml | 26 ++++ example/test_mp3_8.xml | 211 +++++++++++++++++++++++++++ 3 files changed, 260 insertions(+), 11 deletions(-) create mode 100644 example/deefuzz_test_mp3_station.xml create mode 100644 example/test_mp3_8.xml diff --git a/deefuzz.py b/deefuzz.py index 47c4237..3ff61c0 100755 --- a/deefuzz.py +++ b/deefuzz.py @@ -188,13 +188,15 @@ class Station(Thread): self.ogg_quality = self.station['media']['ogg_quality'] self.samplerate = self.station['media']['samplerate'] self.voices = self.station['media']['voices'] + self.rss_dir = self.station['media']['rss_dir'] + self.rss_enclosure = self.station['media']['rss_enclosure'] # Infos self.short_name = self.station['infos']['short_name'] self.channel.name = self.station['infos']['name'] self.channel.genre = self.station['infos']['genre'] self.channel.description = self.station['infos']['description'] self.channel.url = self.station['infos']['url'] - self.rss_dir = os.sep + 'tmp' + os.sep + 'rss' + self.rss_current_file = self.rss_dir + os.sep + self.short_name + '_current.xml' self.rss_playlist_file = self.rss_dir + os.sep + self.short_name + '_playlist.xml' self.media_url_dir = '/media/' @@ -240,15 +242,24 @@ class Station(Thread): media_stats = os.stat(media.media) media_date = time.localtime(media_stats[8]) media_date = time.strftime("%a, %d %b %Y %H:%M:%S +0000", media_date) - - rss_item_list.append(PyRSS2Gen.RSSItem( - title = media.metadata['artist'] + ' : ' + media.metadata['title'], - link = media_link, - description = media_description, - enclosure = PyRSS2Gen.Enclosure(media_link, str(media.size), 'audio/mpeg'), - guid = PyRSS2Gen.Guid(media_link), - pubDate = media_date,) - ) + + if self.rss_enclosure == '1': + rss_item_list.append(PyRSS2Gen.RSSItem( + title = media.metadata['artist'] + ' : ' + media.metadata['title'], + link = media_link, + description = media_description, + enclosure = PyRSS2Gen.Enclosure(media_link, str(media.size), 'audio/mpeg'), + guid = PyRSS2Gen.Guid(media_link), + pubDate = media_date,) + ) + else: + rss_item_list.append(PyRSS2Gen.RSSItem( + title = media.metadata['artist'] + ' : ' + media.metadata['title'], + link = media_link, + description = media_description, + guid = PyRSS2Gen.Guid(media_link), + pubDate = media_date,) + ) rss = PyRSS2Gen.RSS2(title = self.channel.name + ' ' + sub_title, link = self.channel.url, @@ -372,7 +383,8 @@ class Station(Thread): it = q.get(1) self.current_media_obj = self.media_to_objs([media]) title = self.current_media_obj[0].metadata['title'] - self.channel.set_metadata({'song': str(title)}) + artist = self.current_media_obj[0].metadata['artist'] + self.channel.set_metadata({'song': str(artist) + ' : ' + str(title)}) self.update_rss(self.current_media_obj, self.rss_current_file) file_name, file_title, file_ext = self.get_file_info(media) self.logger.write('DeeFuzzing this file on %s : id = %s, name = %s' \ diff --git a/example/deefuzz_test_mp3_station.xml b/example/deefuzz_test_mp3_station.xml new file mode 100644 index 0000000..64d5513 --- /dev/null +++ b/example/deefuzz_test_mp3_station.xml @@ -0,0 +1,26 @@ + + + deefuzz$number + DeeFuzz by Cellar @ Parisson.com - 100% Mix Techno House Electronic Groove ! + DeeFuzz 100% Mix - The Best Techno House Electronic and Groove Mixes DeeFuzzed by Cellar from Paris 18 Chateau Rouge ! + http://studio.parisson.com + Techno House Dance Electronic Trance Mix Live + + + localhost + 8000 + source2parisson + 0 + + + /home/momo/music/music4/mp3/janob/80s + mp3 + 192 + 7 + 44100 + 2 + 1 + /tmp/rss/ + 0 + + diff --git a/example/test_mp3_8.xml b/example/test_mp3_8.xml new file mode 100644 index 0000000..cbfe601 --- /dev/null +++ b/example/test_mp3_8.xml @@ -0,0 +1,211 @@ + + /tmp/deefuzz.log + + + deefuzz_1 + DeeFuzz by Cellar @ Parisson.com - 100% Mix Techno House Electronic Groove ! + DeeFuzz 100% Mix - The Best Techno House Electronic and Groove Mixes DeeFuzzed by Cellar from Paris 18 Chateau Rouge ! + http://studio.parisson.com + Techno House Dance Electronic Trance Mix Live + + + localhost + 8000 + source2parisson + 0 + + + /home/momo/music/music4/mp3/janob/80s + mp3 + 192 + 7 + 44100 + 2 + 1 + /tmp/rss/ + 0 + + + + + deefuzz_2 + DeeFuzz by Cellar @ Parisson.com - 100% Mix Techno House Electronic Groove ! + DeeFuzz 100% Mix - The Best Techno House Electronic and Groove Mixes DeeFuzzed by Cellar from Paris 18 Chateau Rouge ! + http://studio.parisson.com + Techno House Dance Electronic Trance Mix Live + + + localhost + 8000 + source2parisson + 0 + + + /home/momo/music/music4/mp3/janob/80s + mp3 + 192 + 7 + 44100 + 2 + 1 + /tmp/rss/ + 0 + + + + + deefuzz_3 + DeeFuzz by Cellar @ Parisson.com - 100% Mix Techno House Electronic Groove ! + DeeFuzz 100% Mix - The Best Techno House Electronic and Groove Mixes DeeFuzzed by Cellar from Paris 18 Chateau Rouge ! + http://studio.parisson.com + Techno House Dance Electronic Trance Mix Live + + + localhost + 8000 + source2parisson + 0 + + + /home/momo/music/music4/mp3/janob/80s + mp3 + 192 + 7 + 44100 + 2 + 1 + /tmp/rss/ + 0 + + + + + deefuzz_4 + DeeFuzz by Cellar @ Parisson.com - 100% Mix Techno House Electronic Groove ! + DeeFuzz 100% Mix - The Best Techno House Electronic and Groove Mixes DeeFuzzed by Cellar from Paris 18 Chateau Rouge ! + http://studio.parisson.com + Techno House Dance Electronic Trance Mix Live + + + localhost + 8000 + source2parisson + 0 + + + /home/momo/music/music4/mp3/janob/80s + mp3 + 192 + 7 + 44100 + 2 + 1 + /tmp/rss/ + 0 + + + + + deefuzz_5 + DeeFuzz by Cellar @ Parisson.com - 100% Mix Techno House Electronic Groove ! + DeeFuzz 100% Mix - The Best Techno House Electronic and Groove Mixes DeeFuzzed by Cellar from Paris 18 Chateau Rouge ! + http://studio.parisson.com + Techno House Dance Electronic Trance Mix Live + + + localhost + 8000 + source2parisson + 0 + + + /home/momo/music/music4/mp3/janob/80s + mp3 + 192 + 7 + 44100 + 2 + 1 + /tmp/rss/ + 0 + + + + + deefuzz_6 + DeeFuzz by Cellar @ Parisson.com - 100% Mix Techno House Electronic Groove ! + DeeFuzz 100% Mix - The Best Techno House Electronic and Groove Mixes DeeFuzzed by Cellar from Paris 18 Chateau Rouge ! + http://studio.parisson.com + Techno House Dance Electronic Trance Mix Live + + + localhost + 8000 + source2parisson + 0 + + + /home/momo/music/music4/mp3/janob/80s + mp3 + 192 + 7 + 44100 + 2 + 1 + /tmp/rss/ + 0 + + + + + deefuzz_7 + DeeFuzz by Cellar @ Parisson.com - 100% Mix Techno House Electronic Groove ! + DeeFuzz 100% Mix - The Best Techno House Electronic and Groove Mixes DeeFuzzed by Cellar from Paris 18 Chateau Rouge ! + http://studio.parisson.com + Techno House Dance Electronic Trance Mix Live + + + localhost + 8000 + source2parisson + 0 + + + /home/momo/music/music4/mp3/janob/80s + mp3 + 192 + 7 + 44100 + 2 + 1 + /tmp/rss/ + 0 + + + + + deefuzz_8 + DeeFuzz by Cellar @ Parisson.com - 100% Mix Techno House Electronic Groove ! + DeeFuzz 100% Mix - The Best Techno House Electronic and Groove Mixes DeeFuzzed by Cellar from Paris 18 Chateau Rouge ! + http://studio.parisson.com + Techno House Dance Electronic Trance Mix Live + + + localhost + 8000 + source2parisson + 0 + + + /home/momo/music/music4/mp3/janob/80s + mp3 + 192 + 7 + 44100 + 2 + 1 + /tmp/rss/ + 0 + + + -- 2.39.5