Permalink
Browse files

+ added converting flag to database

  • Loading branch information...
1 parent 0058623 commit 1f4861cd76dc20ca25bc3d9c5fc660312336c9dc @erlehmann erlehmann committed Dec 3, 2012
Showing with 10 additions and 1 deletion.
  1. +1 −0 model.py
  2. +9 −1 oa-cache
View
1 model.py
@@ -49,6 +49,7 @@ class SupplementaryMaterial(Entity):
url = Field(UnicodeText, primary_key=True)
article = ManyToOne('Article')
downloaded = Field(Boolean, default=False)
+ converting = Field(Boolean, default=False)
converted = Field(Boolean, default=False)
uploaded = Field(Boolean, default=False)
View
10 oa-cache
@@ -113,6 +113,10 @@ if action == 'convert-media':
media_raw_path = path.join(media_raw_directory, filename)
media_refined_path = path.join(media_refined_directory, filename + '.ogv')
+ if material.converting:
+ stderr.write("Skipping conversion of “%s”, earlier attempt failed.\n")
+ continue
+
if path.isfile(media_refined_path):
stderr.write("Skipping conversion of “%s”, exists at “%s”.\n" %
(
@@ -124,13 +128,17 @@ if action == 'convert-media':
session.commit()
continue
+ material.converting = True
+ session.commit()
stderr.write("Converting “%s”, saving into “%s” … " % (
media_raw_path.encode('utf-8'),
media_refined_path.encode('utf-8')
)
)
+ material.converting = False
+ session.commit()
- loop = gobject.MainLoop()
+ #loop = gobject.MainLoop()
m = media.Media(media_raw_path)
try:
m.find_streams()

0 comments on commit 1f4861c

Please sign in to comment.