Support syncing to FS-based MP3 players without subfolders

git-svn-id: svn://svn.berlios.de/gpodder/trunk@456 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
Thomas Perl 2007-11-08 11:12:06 +00:00
parent bb266f63e4
commit 22c8f31092
5 changed files with 100 additions and 48 deletions

View file

@ -1,3 +1,17 @@
Thu, 08 Nov 2007 12:07:30 +0100 <thp@perli.net>
Support syncing to FS-based MP3 players without subfolders
* data/gpodder.glade: Add checkbox "Create a subfolder for each
channel" to preferences dialog and rename some widgets
* src/gpodder/config.py: Add boolean "fssync_channel_subfolders"
option that defaults to True (create subfolder for each channel)
* src/gpodder/gui.py: Hook up config option fssync_channel_subfolders
to preferences dialog; do more intelligent widget hiding for the
"Player" tab in the preferences dialog (only show relevant widgets)
* src/gpodder/libipodsync.py: Only append channel name as subfolder to
destination folder name when the "fssync_channel_subfolders" option is
True
Thu, 08 Nov 2007 11:28:17 +0100 <thp@perli.net>
Fix offline cache behaviour when time is not set

View file

@ -2861,7 +2861,7 @@
<widget class="GtkTable" id="table5">
<property name="border_width">10</property>
<property name="visible">True</property>
<property name="n_rows">9</property>
<property name="n_rows">10</property>
<property name="n_columns">4</property>
<property name="homogeneous">False</property>
<property name="row_spacing">5</property>
@ -2972,27 +2972,6 @@
</packing>
</child>
<child>
<widget class="GtkImage" id="image2425">
<property name="visible">True</property>
<property name="icon_size">6</property>
<property name="icon_name">palm-pilot-sync</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">6</property>
<property name="bottom_attach">8</property>
<property name="x_padding">6</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="cbCustomSyncName">
<property name="visible">True</property>
@ -3038,7 +3017,7 @@
</child>
<child>
<widget class="GtkHSeparator" id="hseparator6">
<widget class="GtkHSeparator" id="separatorSyncOptions">
<property name="visible">True</property>
</widget>
<packing>
@ -3286,7 +3265,7 @@ Filesystem-based MP3 player</property>
</child>
<child>
<widget class="GtkLabel" id="label90">
<widget class="GtkLabel" id="labelSyncOptions">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Synchronization Options&lt;/b&gt;</property>
<property name="use_underline">False</property>
@ -3342,6 +3321,50 @@ Filesystem-based MP3 player</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkImage" id="imageSyncOptions">
<property name="visible">True</property>
<property name="icon_size">6</property>
<property name="icon_name">palm-pilot-sync</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">6</property>
<property name="bottom_attach">9</property>
<property name="x_padding">6</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="cbChannelSubfolder">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">If checked, a subfolder will be created for each channel synchronized. If not checked, all episodes will be copied directly to the folder specified by &quot;Sync to folder:&quot;.</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Create a subfolder for each channel</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">4</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>

View file

@ -56,6 +56,7 @@ gPodderSettings = {
'only_sync_not_played': ( bool, False ),
'proxy_use_environment': ( bool, True ),
'update_tags': ( bool, False ),
'fssync_channel_subfolders': ( bool, True ),
# Settings that are updated directly in code
'ipod_mount': ( str, '/media/ipod' ),

View file

@ -1318,6 +1318,7 @@ class gPodderProperties(GladeWidget):
gl.config.connect_gtk_togglebutton( 'use_gnome_bittorrent', self.radio_gnome_bittorrent)
gl.config.connect_gtk_togglebutton( 'update_on_startup', self.updateonstartup)
gl.config.connect_gtk_togglebutton( 'only_sync_not_played', self.only_sync_not_played)
gl.config.connect_gtk_togglebutton( 'fssync_channel_subfolders', self. cbChannelSubfolder)
gl.config.connect_gtk_spinbutton( 'max_downloads', self.spinMaxDownloads)
gl.config.connect_gtk_togglebutton( 'max_downloads_enabled', self.cbMaxDownloads)
gl.config.connect_gtk_spinbutton( 'limit_rate_value', self.spinLimitDownloads)
@ -1443,25 +1444,32 @@ class gPodderProperties(GladeWidget):
def on_comboboxDeviceType_changed(self, widget, *args):
active_item = self.comboboxDeviceType.get_active()
# None
sync_widgets = ( self.only_sync_not_played, self.labelSyncOptions,
self.imageSyncOptions, self. separatorSyncOptions )
for widget in sync_widgets:
if active_item == 0:
widget.hide_all()
else:
widget.show_all()
# iPod
if active_item == 1:
self.ipodLabel.show()
self.btn_iPodMountpoint.set_sensitive( True)
self.btn_iPodMountpoint.show_all()
else:
self.ipodLabel.hide()
self.btn_iPodMountpoint.set_sensitive( False)
self.btn_iPodMountpoint.hide()
ipod_widgets = ( self.ipodLabel, self.btn_iPodMountpoint )
for widget in ipod_widgets:
if active_item == 1:
widget.show_all()
else:
widget.hide_all()
# filesystem-based MP3 player
if active_item == 2:
self.filesystemLabel.show()
self.btn_filesystemMountpoint.set_sensitive( True)
self.btn_filesystemMountpoint.show_all()
else:
self.filesystemLabel.hide()
self.btn_filesystemMountpoint.set_sensitive( False)
self.btn_filesystemMountpoint.hide()
fs_widgets = ( self.filesystemLabel, self.btn_filesystemMountpoint,
self.cbChannelSubfolder, self.cbCustomSyncName,
self.entryCustomSyncName, self.btnCustomSyncNameHelp )
for widget in fs_widgets:
if active_item == 2:
widget.show_all()
else:
widget.hide_all()
def on_btn_iPodMountpoint_clicked(self, widget, *args):
fs = gtk.FileChooserDialog( title = _('Select iPod mountpoint'), action = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)

View file

@ -516,14 +516,20 @@ class gPodder_FSSync( gPodderSyncMethod):
gPodderSyncMethod.add_episode_from_channel( self, channel, episode)
folder_src = channel.title
folder = ''
for ch in folder_src:
if ch in allowed_chars:
folder = folder + ch
else:
folder = folder + '_'
folder = os.path.join( self.destination, folder)
gl = libgpodder.gPodderLib()
if gl.config.fssync_channel_subfolders:
# Add channel title as subfolder
folder_src = channel.title
folder = ''
for ch in folder_src:
if ch in allowed_chars:
folder = folder + ch
else:
folder = folder + '_'
folder = os.path.join( self.destination, folder)
else:
folder = self.destination
from_file = episode.local_filename()