~ubuntu-branches/ubuntu/karmic/calibre/karmic

« back to all changes in this revision

Viewing changes to src/calibre/ebooks/metadata/odt.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-30 12:49:41 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730124941-qjdsmri25zt8zocn
Tags: 0.6.3+dfsg-0ubuntu1
* New upstream release. Please see http://calibre.kovidgoyal.net/new_in_6/
  for the list of new features and changes.
* remove_postinstall.patch: Update for new version.
* build_debug.patch: Does not apply any more, disable for now. Might not be
  necessary any more.
* debian/copyright: Fix reference to versionless GPL.
* debian/rules: Drop obsolete dh_desktop call.
* debian/rules: Add workaround for weird Python 2.6 setuptools behaviour of
  putting compiled .so files into src/calibre/plugins/calibre/plugins
  instead of src/calibre/plugins.
* debian/rules: Drop hal fdi moving, new upstream version does not use hal
  any more. Drop hal dependency, too.
* debian/rules: Install udev rules into /lib/udev/rules.d.
* Add debian/calibre.preinst: Remove unmodified
  /etc/udev/rules.d/95-calibre.rules on upgrade.
* debian/control: Bump Python dependencies to 2.6, since upstream needs
  it now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
    
165
165
    return mi
166
166
 
167
 
def main(args=sys.argv):
168
 
    if len(args) != 2:
169
 
        print 'Usage: %s file.odt'%args[0]
170
 
        return 1
171
 
    mi = get_metadata(open(args[1], 'rb'))
172
 
    print mi
173
 
    return 0
174
 
 
175
 
if __name__ == '__main__':
176
 
    sys.exit(main())
177
 
 
178
 
#now = time.localtime()[:6]
179
 
#outputfile = "-"
180
 
#writemeta = False   # Do we change any meta data?
181
 
#usenormalize = False
182
 
#
183
 
#try:
184
 
#    opts, args = getopt.getopt(sys.argv[1:], "cdlI:A:a:o:x:X:")
185
 
#except getopt.GetoptError:
186
 
#    exitwithusage()
187
 
#
188
 
#if len(opts) == 0:
189
 
#    opts = [ ('-l','') ]
190
 
#
191
 
#for o, a in opts:
192
 
#    if o in ('-a','-A','-I'):
193
 
#        writemeta = True
194
 
#        if a.find(":") >= 0:
195
 
#            k,v = a.split(":",1)
196
 
#        else:
197
 
#            k,v = (a, "")
198
 
#        if len(k) == 0:
199
 
#            exitwithusage()
200
 
#        k = fields.get(k,k)
201
 
#        addfields[k] = unicode(v,'utf-8')
202
 
#    if o == '-a':
203
 
#        yieldfields[k] = True
204
 
#    if o == '-I':
205
 
#        deletefields[k] = True
206
 
#    if o == '-d':
207
 
#        writemeta = True
208
 
#        addfields[(DCNS,u'date')] = "%04d-%02d-%02dT%02d:%02d:%02d" % now
209
 
#        deletefields[(DCNS,u'date')] = True
210
 
#    if o == '-c':
211
 
#        usenormalize = True
212
 
#    if o == '-l':
213
 
#        Xfields = fields.values()
214
 
#    if o == "-x":
215
 
#        xfields.append(fields.get(a,a))
216
 
#    if o == "-X":
217
 
#        Xfields.append(fields.get(a,a))
218
 
#    if o == "-o":
219
 
#        outputfile = a
220
 
#
221
 
## The specification says we should change the element to our own,
222
 
## and must not export the original identifier.
223
 
#if writemeta:
224
 
#    addfields[(METANS,u'generator')] = TOOLSVERSION
225
 
#    deletefields[(METANS,u'generator')] = True
226
 
#
227
 
#odfs = odfmetaparser()
228
 
#parser = xml.sax.make_parser()
229
 
#parser.setFeature(xml.sax.handler.feature_namespaces, 1)
230
 
#parser.setContentHandler(odfs)
231
 
#
232
 
#if len(args) == 0:
233
 
#    zin = zipfile.ZipFile(sys.stdin,'r')
234
 
#else:
235
 
#    if not zipfile.is_zipfile(args[0]):
236
 
#        exitwithusage()
237
 
#    zin = zipfile.ZipFile(args[0], 'r')
238
 
#
239
 
#content = zin.read('meta.xml')
240
 
#parser.parse(StringIO(content))
241
 
#
242
 
#if writemeta:
243
 
#    if outputfile == '-':
244
 
#        if sys.stdout.isatty():
245
 
#           sys.stderr.write("Won't write ODF file to terminal\n")
246
 
#           sys.exit(1)
247
 
#        zout = zipfile.ZipFile(sys.stdout,"w")
248
 
#    else:
249
 
#        zout = zipfile.ZipFile(outputfile,"w")
250
 
#
251
 
#
252
 
#
253
 
#    # Loop through the input zipfile and copy the content to the output until we
254
 
#    # get to the meta.xml. Then substitute.
255
 
#    for zinfo in zin.infolist():
256
 
#        if zinfo.filename == "meta.xml":
257
 
#            # Write meta
258
 
#            zi = zipfile.ZipInfo("meta.xml", now)
259
 
#            zi.compress_type = zipfile.ZIP_DEFLATED
260
 
#            zout.writestr(zi,odfs.meta() )
261
 
#        else:
262
 
#            payload = zin.read(zinfo.filename)
263
 
#            zout.writestr(zinfo, payload)
264
 
#
265
 
#    zout.close()
266
 
#zin.close()