Always create M3U playlists in download folder

This removes two configuration options :)
This commit is contained in:
Thomas Perl 2009-07-06 16:14:36 +02:00
parent 33e585dc12
commit 57f144ee36
3 changed files with 18 additions and 32 deletions

View File

@ -158,10 +158,6 @@ gPodderSettings = {
# Special settings (not in preferences)
'on_quit_systray': (bool, False,
_("When the 'X' button is clicked do not quit, send gPodder to the tray.")),
'create_m3u_playlists': (bool, False,
_("Create an m3u playlist for every channel.")),
'reverse_m3u_playlist_order': (bool, False,
_("Reverse the order of the gPodder-generated m3u playlists.")),
'max_episodes_per_feed': (int, 200,
_("The maximum number of episodes that gPodder will display in the episode "
"list. Note: Set this to a lower value on slower hardware to speed up "

View File

@ -1311,11 +1311,10 @@ class gPodder(BuilderWidget, dbus.service.Object):
item.set_sensitive( not self.updating_feed_cache )
menu.append( item)
if gl.config.create_m3u_playlists:
item = gtk.ImageMenuItem(_('Update M3U playlist'))
item.set_image(gtk.image_new_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU))
item.connect('activate', self.update_m3u_playlist_clicked)
menu.append(item)
item = gtk.ImageMenuItem(_('Update M3U playlist'))
item.set_image(gtk.image_new_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU))
item.connect('activate', self.update_m3u_playlist_clicked)
menu.append(item)
if self.active_channel.link:
item = gtk.ImageMenuItem(_('Visit website'))

View File

@ -444,32 +444,23 @@ class PodcastChannel(PodcastModelObject):
factory=self.episode_factory) if check_is_new(episode)]
def update_m3u_playlist(self):
if gl.config.create_m3u_playlists:
downloaded_episodes = self.get_downloaded_episodes()
fn = util.sanitize_filename(self.title)
if len(fn) == 0:
fn = os.path.basename(self.save_dir)
m3u_filename = os.path.join(gl.downloaddir, fn+'.m3u')
log('Writing playlist to %s', m3u_filename, sender=self)
f = open(m3u_filename, 'w')
f.write('#EXTM3U\n')
m3u_filename = os.path.join(gl.downloaddir, os.path.basename(self.save_dir)+'.m3u')
log('Writing playlist to %s', m3u_filename, sender=self)
# Check to see if we need to reverse the playlist order
if gl.config.reverse_m3u_playlist_order:
episodes_m3u = reversed(downloaded_episodes)
else:
episodes_m3u = downloaded_episodes
f = open(m3u_filename, 'w')
f.write('#EXTM3U\n')
for episode in episodes_m3u:
if episode.was_downloaded(and_exists=True):
filename = episode.local_filename(create=False)
assert filename is not None
for episode in self.get_downloaded_episodes():
if episode.was_downloaded(and_exists=True):
filename = episode.local_filename(create=False)
assert filename is not None
if os.path.dirname(filename).startswith(os.path.dirname(m3u_filename)):
filename = filename[len(os.path.dirname(m3u_filename)+os.sep):]
f.write('#EXTINF:0,'+self.title+' - '+episode.title+' ('+episode.cute_pubdate()+')\n')
f.write(filename+'\n')
f.close()
if os.path.dirname(filename).startswith(os.path.dirname(m3u_filename)):
filename = filename[len(os.path.dirname(m3u_filename)+os.sep):]
f.write('#EXTINF:0,'+self.title+' - '+episode.title+' ('+episode.cute_pubdate()+')\n')
f.write(filename+'\n')
f.close()
def addDownloadedItem(self, item):
log('addDownloadedItem(%s)', item.url)