OLD | NEW |
1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
3 # | 3 # |
4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
7 # | 7 # |
8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 if not setting in ('source', 'target', 'user', 'group', 'ignore', 'posts
ync'): | 106 if not setting in ('source', 'target', 'user', 'group', 'ignore', 'posts
ync'): |
107 continue | 107 continue |
108 | 108 |
109 if not name in result: | 109 if not name in result: |
110 result[name] = { | 110 result[name] = { |
111 'source': None, | 111 'source': None, |
112 'target': None, | 112 'target': None, |
113 'user': None, | 113 'user': None, |
114 'group': None, | 114 'group': None, |
115 'postsync': None, | 115 'postsync': None, |
116 'ignore': [] | 116 'ignore': [], |
117 } | 117 } |
118 if isinstance(result[name][setting], list): | 118 if isinstance(result[name][setting], list): |
119 result[name][setting] = get_config().get('filesync', option).split('
') | 119 result[name][setting] = get_config().get('filesync', option).split('
') |
120 else: | 120 else: |
121 result[name][setting] = get_config().get('filesync', option) | 121 result[name][setting] = get_config().get('filesync', option) |
122 return result | 122 return result |
123 | 123 |
124 | 124 |
125 if __name__ == '__main__': | 125 if __name__ == '__main__': |
126 setupStderr() | 126 setupStderr() |
127 | 127 |
128 syncState = ConfigParser.SafeConfigParser() | 128 syncState = ConfigParser.SafeConfigParser() |
129 syncStateFile = get_config().get('filesync', 'syncData') | 129 syncStateFile = get_config().get('filesync', 'syncData') |
130 if os.path.exists(syncStateFile): | 130 if os.path.exists(syncStateFile): |
131 syncState.read(syncStateFile) | 131 syncState.read(syncStateFile) |
132 | 132 |
133 settings = readSyncSettings() | 133 settings = readSyncSettings() |
134 for name, value in settings.iteritems(): | 134 for name, value in settings.iteritems(): |
135 syncFiles(name, value, syncState) | 135 syncFiles(name, value, syncState) |
136 | 136 |
137 file = open(syncStateFile, 'wb') | 137 file = open(syncStateFile, 'wb') |
138 syncState.write(file) | 138 syncState.write(file) |
OLD | NEW |