Device sync: Fix sync when playlists are disabled (bug 1769)

This commit is contained in:
Joseph Wickremasinghe 2013-02-18 22:54:42 -08:00 committed by Thomas Perl
parent 93668b636c
commit b7d23744e5
2 changed files with 25 additions and 17 deletions

View File

@ -178,7 +178,7 @@ class gPodderSyncUI(object):
self.commit_changes_to_database()
for current_channel in self.channels:
#only sync those channels marked for syncing
if current_channel.sync_to_mp3_player:
if (current_channel.sync_to_mp3_player and self._config.device_sync.playlists.create):
#get playlist object
playlist=gPodderDevicePlaylist(self._config,
@ -191,10 +191,11 @@ class gPodderSyncUI(object):
#enable updating of UI
self.enable_download_list_update()
title = _('Update successful')
message = _('The playlist on your MP3 player has been updated.')
self.notification(message, title, widget=self.preferences_widget)
if self._config.device_sync.playlists.create:
title = _('Update successful')
message = _('The playlist on your MP3 player has been updated.')
self.notification(message, title, widget=self.preferences_widget)
# Finally start the synchronization process
@util.run_in_background
@ -280,6 +281,10 @@ class gPodderSyncUI(object):
title = _('Error writing playlist files')
message = _(str(ioe))
self.notification(message, title, widget=self.preferences_widget)
else:
logger.info ('Not creating playlists - starting sync')
resume_sync([],[],None)
# This function is used to remove files from the device

View File

@ -213,18 +213,21 @@ class Device(services.ObservableService):
if does_not_exist or exclude_played or wrong_type:
logger.info('Excluding %s from sync', track.title)
tracklist.remove(track)
for track in sorted(tracklist, key=lambda e: e.pubdate_prop):
if self.cancelled:
return False
# XXX: need to check if track is added properly?
sync_task=SyncTask(track)
sync_task.status=sync_task.QUEUED
sync_task.device=self
self.download_status_model.register_task(sync_task)
self.download_queue_manager.add_task(sync_task)
if tracklist:
for track in sorted(tracklist, key=lambda e: e.pubdate_prop):
if self.cancelled:
return False
# XXX: need to check if track is added properly?
sync_task=SyncTask(track)
sync_task.status=sync_task.QUEUED
sync_task.device=self
self.download_status_model.register_task(sync_task)
self.download_queue_manager.add_task(sync_task)
else:
logger.warning("No episodes to sync")
return True